Thursday, October 17, 2013

How to post code in Blogger

In my previous post, I wanted to post some XML code, but Blogger kept interpreting it as HTML and displaying it wrongly. Here's a solution I found. It converts characters that are interpreted as code into a format that is not, but which is displayed in a browser as the original character. NB the "friendly" text is posted in Compose not HTML in Blogger.

Postable.

Reading the explanation page for Postable, I realised that the Blogger friendly encoding will also solve a problem with the < and > characters I've had when posting in Blogger. To get them to display correctly, use the "safe" encoding:
&lt; and &gt;

No comments:

Post a Comment