Marcus etc.

Syntax Highlighting on your wordpress posts

I’ve had the unpleasant experience of having to play and experiment with syntax highlighting plugins for any code I’d like to post on here and other blogs. Unfortunately, there’s a ton of options to choose from and many just aren’t up to scratch.

What’s worse is that some have funny syntaxes such as using <pre class=”language”> tags which are easily broken by the wordpress WYSIWYG editor and your code gets mangled. Not only that, but changing over to a better plugin becomes a tedious task if you have to change all those pre tags to shorttags.

I’d like to recommend a plugin which works very well, called SyntaxHighliter Plus by Fred Wu and other contributors. In my opinion, it’s one of the easier plugins to use and makes posting code a breeze.

What inspired this post is I just discovered today that an older post on here was broken because it was using syntax for an older plugin I used (although the plugin is still activated).

If I had used SyntaxHighlighter Plus instead, the worst that would have happened is this:

 /*Testing*/ #font { font-size:12px; } 

Turning into this (curly braces would actually be square brackets):

{css}

/*Testing*/ #font { font-size:12px; }

{/css}

If anyone has another great syntax highlighter please feel free to recommend it in the comments!