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

  1. mod using Internet Explorer 7.0 on Windows Vista | January 6, 2007 at 5:25 am | Permalink

    Hey I was actually searching for a GeSHi-Langauge file to syntax-Highlight Linux-shel-scripts and could not believe that I didi not find any, not a single hint where to find on the whole thing called internet. And I'm actually a little upset. As I#m not and never was a bleeding edge GeSHi user, but just starting up to use that, I'm asking myself is there so little Linux-shell scripters or at least so many less that vb, oracle, sql and whatsover programmers, or do shellscriptes just not document their code on the net or do shellscripters just hate everything that has more than two colors (a shelscript;-). I don't know but would actually be gratefull for any assumtions on this.

  2. Aaron using Firefox 2.0.0.1 on Ubuntu | January 6, 2007 at 8:27 am | Permalink

    Mod-

    Well, first off, I'm confused with exactly what you are looking for. GeSHi is a solid syntax highlighter, and I would recommend it for anyone who hosts a web site, and posts code to the site.

    As for as the number of Linux shell scripters, I have no idea what you are talking about. Every programmer I have met, loves syntax highlighting, and chooses to use environments that use syntax highlighting. GeSHi highlights most Linux shell scripting languages.

Post a Comment

Your email is never published nor shared.

Switch to our mobile site