Sunday, March 13, 2011

How to display HTML markup code in a Blogger or other blog post.

If you are writing articles about programming there will come a point where you need to be able to display HTML code as part of a blog post. If you have tried this before you will find that the code is not displayed as text, but run as part of the web page so <b>word</b> becomes word.

To stop this happening you need to convert the HTML entities to their equivalents:

'&' (ampersand) needs changed to '&amp;'
'"' (double quote) needs changed to '&quot'
''' (single quote) needs changed to '&#039;'
'<' (less than) needs changed to '&lt;'
'>' (greater than) needs changed to '&gt;'

I have made a tool which does the HTML entity conversion for you.

To access it click here: HTML to Blog Converter