Because the program code I’ll be posting on this blog is hard to read when in the form of long colourless unformatted lines, I’ve looked around at various plugins to help make my work more readable.
WordPress suggests using a port of the syntaxhighlighter Google Code proejct by Alex Gorbatchev (http://faq.wordpress.com/2007/09/03/how-do-i-post-source-code/) but I found this plug-in to be too robust.
For my purposes, I plan to demonstrate HTML, C#, C++ and some Java, so my goal was to have a very scaled-back method of posting code.
A Google search brought me to Sean Deasy’s blog (http://www.seandeasy.com/code-syntax-highlighting-in-wordpress/) which pushed me in the right direction.
The WP-dp.SyntaxHighlighter:source code syntax highlighting plugin supports a good breadth of languages and has a minimalistic look – perfect for my needs. It can be found at:
WP-dp.SyntaxHighlighter:source code syntax highlighting plugin
I recommend this plugin to anyone who, like me, needs a decent syntax highlighter without a lot of the bells and whistles found in other packages.
[Edit: The plugin file for this tool has 2 lines of whitespace at the end, after the “?>”. If you install this tool, you will want to remove these extra characters (you can do this from right inside WordPress’ editor page after uploading the file to your server).]
[Edit2-Feb8, 2008: I had problems getting the originally suggested Highlighter working the way I wanted. I eventually settled on this one from OpenSourceBrain: http://erik.range-it.de/wordpress/plugins/syntaxhighlighter/ … it’s the same idea but implemented much more cleanly]
Tags: Google, programming