Image of the glider from the Game of Life by John Conway
Skip to content

Using GeSHi

For those who are unaware, I am using GeSHi as my syntax highlighter for WordPress. It is a solid program, and well worth the look, if you are looking for something to highlight your code on your blog. It's licensed under the GPL, and I love it.

One of the strong features in GeSHi, is the ability to recognize keywords and functions built into the language, and provide a link to the official documentation about that keyword. You may have noticed this with my last post about optimizing searches in Perl. Clicking on one of the functions will take to the Perl documentation site about that function. Try 'print' or 'open' to see what I am talking about.

To get GeSHi into your WordPress blog, use this plugin. It's in beta, but it's just a wrapper around the initial GeSHi code. You can easily update your Geshi, by downloading the latest from here, unpacking the folder, and dropping it into the plugin folder. Works like a charm.

However, WordPress isn't without it's flaws, and as such, some of my code that I post on this site may appear a bit odd. For example, in my most recent post , you may have noticed that my file handles are in lowercase. Generally, it's considered good programming practice in Perl to put your file handles in uppercase, as harleypig mentioned in the comments. Well, I do uppercase when coding, but WordPress thinks that anything between < and > is HTML, so it lowercases the letters between the tags. Also, if I don't have a closing tag, it will provide one for me. So, as you may have also noticed, in the code, I have closing tags for the file handles just past a comment marker. This may look a bit odd, but it's for WordPress' sake. And yes, I have tried escaping the tags with &lt; and &gt;, but then it shows up as so. Of course, I am working on a plugin to stop this behavior.

So keep this in mind when looking over the code that I post to this site. The reason for the code is to illustrate a point rather than show syntax-perfect code (although all code I post to the site should compile without errors). If you have any questions about the code, of course, leave it in the comments or contact me directly.

Now, on with the show!

{ 2 } Comments