Antun’s Blog

Notes on OpenLaszlo, LZX and Rich Internet Application Development

Antun’s Blog header image 3

Posting Code in Blog Comments

I use WordPress to power my blog. Because of the nature of its content, you may need to post LZX, HTML, XML or some other type of code into a comment. WordPress will not display this correctly if you simply paste XML into the comment.

To have the code in your comments appear correctly, follow these steps:

  1. XML-escape your code. That means that if you want to write <canvas>, you must escape it to &lt;canvas&gt;. Characters that should be escaped are < (which becomes &lt;), > (which becomes &gt;) and & (which becomes &amp;).
  2. Wrap your code in <pre> tags. Do not escape the brackets (< and >) in the pre tags.
  3. Submit your comment.

This will display your code correctly, along with white space.

As always when typing into browsers, save what you write before submitting it – e.g. by copying to the clipboard – so that if something goes wrong, you don’t have to retype it.

No Comments

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment

Need to post code in a comment? Read this first!