Previously, I complained about how I needed a syntax highlighter and have no recommendations… I hand tested and create a review on some of the popular choices I found on plugin directory. The plugins I listed are base on following requirements:
- Supported in WordPress 2.7.1
- Last updated in 2009
The criteria to the syntax highlighter I am looking for based on below 2 points:
- Code remains unchange after a post is been edited in either Visual mode or HTML mode
- Read to use out of the box. I should be able to use it with no or little configurations
SyntaxHighlighter Evolved
Last Updated: 2009-5-4 (Version 2.1.0)
Syntax: Visual. Eg/ [php], [javascript]
One of the feature of SyntaxHighlighter Evolved is its elegant toolbar on the corner of the code block, which allows you to choose between: View code in a pop up, copy code to clipboard or print code. For some reason Syntax highlighter Evolved likes to strip away my indents (spaces) in my code. If I tried to save in HTML mode, I will get PHP warning messages as well as have my code striped from my post. Overall, this plugin does not perform the way I wanted.
Syntax Highlighter Plus
Last Updated: 2009-2-11 (Version 1.0b2)
Syntax: Visual. Eg/ [sourcecode language='css']
Like other plugins of Syntax Highlighter family, it come with a toolbar, and like Syntax Highlighter Evolved it failed on the same way: Strips my indents and remove my code when I tried to save in HTML mocde.
Google Syntax Highlighter for WordPress
Last Updated: 2007-8-14 (Version 1.5.1)
Syntax: HTML. Eg/ <pre name=”code” class=”php”>
Despite it has not been updated for almost 2 years, Google Syntax Highlighter seems to be the popular choice by bloggers, so I decide to include this one in the test. Google Syntax Highlighter comes with a texture toolbar, not as fancy as Syntax Highlighter family but does its job. Appearently there is a styling issue when dealing with long line of code but that won’t matter much since the plugin fail siliently when I switch between Visual mode and HTML mode: loss indent and syntax color. Another disappointed candidate.
WP-Chili
Last Updated: 2008-7-24 (Version 1.1)
Syntax: HTML. Eg/ <code class=”php”>
WP-Chili is another special candidate, which has been recommanded in another WordPress syntax highlighter review, I will also give this one a try. Unlike all previous candidates, it required manual character escaping. I uses Elliot’s postable script (as recommanded) to do the job. Simplier styling that may requires few tweaks (such as fix long line wrapping and give it a background color or border to distinguish from normal paragraph). WP-Chili actually survived after test saving in both Visual mode and HTML mode, unfortunately my indents went missing after few saves… Does no one likes my space indents?!
Code Colorer
Last Updated: 2009-1-27 (Version 0.7.3)
Syntax: Both Visual or HTML. Eg/ <code lang=”php”>, [cc lang="php"]
Now a fairly new plugin I found in the directory. For some reason I can not get the code showing correctly despite I able to inspect the HTML code using firebug.
Dojox WordPress Syntax Highlighter
Last Updated: 2009-1-27 (Version 0.7.3)
Syntax: HTML. Eg/ <pre><code class=”php”>
Dojox is the first plugin that manage to survive the test: code remain the same after multiple saves in different mode. Dojox uses a double tagging syntax and requires manual character escaping. Background color may need a change to fit blogger’s theme but besides that, it is a working pluging (finally).
Syntax Highlighter and Code Colorizer for WordPress
Last Updated: 2009-5-5 (Version 2.0.296)
Syntax: HTML. Eg/ <pre class=”brush:php”>
Appearently it is also known as Code Prettifier. Code Colorizer does auto wrapping by default and has a toolbar on top right corner as it is another member of Syntax Highlighter family. One important different to its family is it actually works! No problem when saving post in Visual mode nor HTML mode, however you will require to manually escape your code.
WP-SynHighlight
Last Updated: 2009-1-27 (Version 0.91)
Syntax: Visual. Eg/ [codesyntax lang="php"]
This plugin is the only plugin I found that works and uses Visual syntax and won’t break if you switch between different modes. And since you pasting your code in Visual mode, there is no need to escape the characters, which is an advantage of posting in Visual mode. But somehow I got no coloring from WP-SynHighlighter even if I follow its example.
Conclusion
Syntax Highlighter and Code Colorizer for WordPress won my vote as it is easy, robust and actually works. The plug in is out of the box, which means I do not need to dig into CSS restyle its color schema to fit in my theme. I know I will enjoy making my switch!










Pingback: omg post formats-notlaura
Pingback: syntax highlighting with WordPress at blog.humaneguitarist.org
Pingback: WordPress代码高亮插件指南 « 呢喃的歌声