Comparing Code Syntax Highlighters for Wordpress
March 17th, 2008 | Published in Web Development | 5 Comments
One of the main uses of this blog is for me to post some of the neat things I’m working on at Well.ca or on my own time. To do this, I need to have a decent syntax highlighter to make all the code I post nice and pretty. I searched the web and came down to 4 syntax highlights that work with Wordpress, this article is a basic attempt at comparing them.
The major differences between these are how they handle the syntax highlighting and the look. To help compare these I’ve taken screenshots of all the plugins highlighting a piece of code and written up a quick blurb about them.
iG:Syntax Hiliter
URL: http://blog.igeek.info/still-fresh/category/wp-plugins/igsyntax-hiliter/
Description:
iG:Syntax Hiliter uses GeSHi, a common code highlighter, and as such supports a good amount of languages. The code appears to be last updated in February of 2006 and uses version 1.0.7.6 of GeSHi which is about 14 versions behind the current release of GeSHi.Most of the changes to GeSHi are adding of more language definitions and not a lot of feature changes. GeSHi generates the code on the server side.
Code is defined in the Wordpress editor by the language name surrounded by square brackets, e.g.: [php]…[/php].
Some of the more notable features of iG:Syntax Hiliter are:
- It can highlight code in comments
- Can show plain text version of the code
- Has an option for fancy line numbers

SyntaxHighlighter Plus
URL: http://wordpress.org/extend/plugins/syntaxhighlighter-plus/
Description:
This is an enhanced version of another plugin called SyntaxHighlighter. It supports a smaller subset of languages then some other plugins but is capable of handling the major ones (PHP, Python, Java, JavaScript, etc). To handle the syntax highlighting it uses SyntaxHighlighter a JavaScript library to highlight code. The library argues that by making it JavaScript there are no dependencies on the server. I don’t know if this is a major issue with most Wordpress installs, and does add dependencies on the client side that they must have JavaScript.
You define the code by using one of the following tags:
- [css]…[/css]
- [code lang="css"]...[/code]
- [source lang="css"]…[/source]
- And some other variations…>

WP-Syntax
URL: http://wordpress.org/extend/plugins/wp-syntax/
Description:
WP-Syntax is another plugin that uses the GeSHi library to handle syntax highlighting. The GeSHi is 1.0.7.20 which is the latest version and supports a very large set of languages. The formating used by WP-Syntax can be defined through CSS (Cascading Style Sheets) or by defining the GeSHi initialization settings to match the design of your blog. It supposedly does not conflict with any other plugins by pulling out the code early and then placing it back in after other plugins have finished processing the blog text.
The code to be highlighted is specified by surrounding it with <pre lang=”php”>…</pre>

WP-CODEBOX
URL: http://wordpress.org/extend/plugins/wp-codebox/
Description:
WP-CODEBOX is a relatively new plugin that uses GeSHi to handle the highlighting. It comes with an administration interface that you can edit the defaults.
You specify the code by using: <pre lang=”php”>…</pre>
Some of the major features are:
- You can specify a file containing the code that a reader can download.
- If no file is specified it will have a “View in Plain Text” option.
- Can collapse a block of code.

Conclusion
As of the writing of this, I’m going to try out WP-Syntax. I’m a big fan of the simplicity and believe it will fit in with the overall design of my blog. I played around with all 4 plugins a little bit, but I need to try some real world examples before I come to a final decision. I’ll update this post or write a new one with what I think after trying out WP-Syntax for a few posts.

May 9th, 2008 at 6:40 pm (#)
how do you get the code snippets to indent? Mine do not do that.
May 26th, 2008 at 4:12 pm (#)
I had them already indented in my editor when I posted them.
July 9th, 2008 at 8:38 am (#)
[...] JavaScript, some others do it server side, and some one let Google do it :°D. I’ve found a comparison [...]
August 9th, 2008 at 8:25 am (#)
I agree with you that WP-syntax is the best. I use it too in my blog. GeShi really does the job well.
I can’t get WP-CODEBOX to display the “Copy to Clipboard” function. I install the latest version. If not, I would have change from WP-syntax to WP-CODEBOX.
SyntaxHighlighter Plus is has the clipboard function, but, lack of supported languages, such as LaTeX.
September 29th, 2008 at 10:21 am (#)
[...] On my blog, there is a lot of various code. Standard representation is very frustrating for me, and I expect this plugin to solve all of my problems. Very good review of available plugins can be found here. [...]