Syntax Highlighting with GeSHi

Posted in PHP and Programming on Thursday, the 5th of February, 2009.


On this very site, I've recently started using GeSHi, to implement the rather nifty code syntax highlighting you see in posts like this and this.

I had previously been using PHP's built in highlight_string() function, but that function is only of use for highlighting PHP code! As I often seem to need to highlight other languages, it was time to turn to GeSHi.

Since I did, a couple of people have asked about ease of use, implementation and so forth, so this post is my attempt at answering those questions.


Posted by Russell on Friday, the 6th of February, 2009.

I have been putting off looking into syntax highlighting for a while as I thought it would be a pain to implement but GeSHi looks easy enough to get working. There is also a proposed Zend Framework component called Zend_Syntax which although yet to be released is worth keeping an eye on. Looking at the proposal for Zend_Syntax however it looks as though there has been no progress in the last few months.

Enter your comment: