Providing code examples

In order to display code on this blog, I’ve installed the WP-GeSHi-Highlight plug-in.

Whilst this works well, it does mean that posts need to be edited via the text editor, otherwise the code is interpreted. An alternative would be to escape all of the HTML and then highlight…

Example code

  1. <p class="element-invisible">Here is a paragraph</p>
  2. <div>A block element</div>
  3. <img src="/img/test.png" alt="foobar">