Sueetie Wall Messages Go Inline (Code)

Sueetie Wall Messages now support the display of inline code blocks.  This may seem like a simple feature to add, but converting the message to simple HTML and preserve multiple coding blocks made it interesting.  Message are normally first stripped of all HTML and line breaks replaced with </p><p> tags.  That wouldn’t work to preserve HTML and other code types, so the approach I used was to convert the message string to a StringReader and applying logic line-by-line.

All Code Types on Wall Messages are displayed with the same styling for a consistent look on the wall.  Inline Code is inserted using BBCode [code][/code] tags, which are converted to the following HTML when the message is saved.

<pre class="code">...</pre>

You can customize the icon used for inserting code, just as you can with attached images, files and other functions. Below is the icon used on Sueetie.com for inserting code in a wall message and the BBCode which is appended to the message. You then insert your code between the two "code" tags.

Image

Here is what is displayed when the message to saved to the wall. You can modify how your inline code appears by styling your wall.css "code" class.

Image

Article written by

A long time developer, I was an early adopter of Linux in the mid-90's for a few years until I entered corporate environments and worked with Microsoft technologies like ASP, then .NET. In 2008 I released Sueetie, an Online Community Platform built in .NET. In late 2012 I returned to my Linux roots and locked in on Java development. Much of my work is available on GitHub.