Syntax Highlighting with Wordpress
at 7.43pmNo programming blog is complete without decent syntax highlighting so it seemed reasonable to expect there to already be a good plug-in available to provide the functionality I need. Sure enough, a quick search resulted in finding WP-Syntax. The plug-in is based on GeSHi which started as the syntax highlighter for phpBB and is now a fully independent project with support for most major languages.
As a demonstration (and a test) here’s some PHP:
public class Foo { public function __construct($bar) { echo 'Hello World!'; { }
and some CSS (with line numbers):
1 2 3 4 | .foo { color: #FFFFFF; height: 100px; } |
I think that’s enough of a demonstration and promotion of the previously mentioned projects but expect to see some code related posts in the not-to-distant future.
I use GeSHi too on my site - there’s a Drupal module too. Works like a treat, and you can customise your syntax highlighting via CSS to match your favourite IDE, too