wp-syntax and code presentation

Just started experimenting with the WP-Syntax plugin for WordPress. Apart from leading me to discover that some (much) of what I though was a pretty good translation out of FlatPress pages into WordPress format was … crummy, it has caused me to reconsider a lot of what I originally believed about the most effective way to present code in weblogs and other media.

My basic philosophy when it comes to writing and especially the presentation of my own writing is generally “the simpler the better”. That’s how I wound up using the extremely minimalist Sandbox theme on both this and my personal blog. Apart from getting eyestrain from the usual teeny tiny default font sizes set by most themes, I’ve always preferred letting HTML markup work as originally intended, that is, in the words of css expert Andy Rutledge, to add meaning and context to the content.

But as someone who is interested in sharing what I learn, especially in the area of programming, I continue to be interested in anything that can help me improve the presentation of that material.

And so I find myself playing around with the basic syntax highlighting and other features provided by WP-Syntax. The plugin uses Generic Syntax Highlighter (GeSHi) supported syntax, and the latter’s project page is a good resource for getting beyond the basics.

The WordPress plugin page gives a good summary of how to use it and what to expect.

Basically what WP-Syntax does is provide a choice of styles for formatting code text. It is invoked by extending the <pre> tag with a “lang” element:

<pre lang="perl">
use strict;

print "Hello Worldn";


In the short time I’ve worked with the plugin I have seen some unexpected results, some of which have been… unpleasant. Some of this may be attributable to my habit of bracketing code in <code> and then <pre> tags, a carryover from the “good old days” when my blogs were hosted on Blogger (by definition the <code> tag should display in a monospaced font — but <pre> may be needed to allow for indenting and other code formatting elements that would be lost if rendered by standard HTML), and some on the general weirdness that seems to always accompany things technical. Not that I’m complaining. As Garrett Morris (doing his impression of Chico Escuela) once said, “Base-a-ball been berry berry good to me.”