GeSHi - Generic Syntax Highlighter

Hi! If you've found your way here and were looking for more information about GeSHi 1.2, you've come to the right place! Here you can find a demo form for trying out the latest "bleeding edge" version of GeSHi, and find out more about what's happening with development.

If you're looking for information about other/available versions of GeSHi, you should go to the GeSHi site. There you can get your hands on one of the 1.0.X versions.

Demo Form

This demo form is linked to the latest GeSHi 1.2 source, uploaded every chance I get. Therefore, every now and then it may not work or produce bizarre results. In these cases, e-mail me and tell me what happened so I can look at fixing the problem. Just as with any other bug report, make sure you include information about what happened, and what you expected to happen.

Source Code



If you use PHP, remember the <?php and ?> marks, else your code won't be highlighted as you expect. On the other hand, try highlighting some PHP source with embedded HTML :)


GeSHi released


See the main site for details.

GeSHi released


See the main site for details.

GeSHi released


See the main site for details.

GeSHi released


See the main site for details.

GeSHi released


See the main site for details.

GeSHi released


See the main site for details.

GeSHi released


See the main site for details.

GeSHi released


See the main site for details.

GeSHi released


See the main site for details.

GeSHi 1.1.2alpha3 released


GeSHi development rolls on with the release of this alpha. There are two major new "features": C support is now all but complete, thanks to the addition of support for line-continuations, and escape characters for strings can now be grouped with their characters to escape, which is necessary for languages such as SQL where ' can escape ' and can escape n, r, t... etc. depending on the dialect.

It seems that the CLC wiki is using the alpha version now, which is good to see. C support in 1.1.X is most definately better than in 1.0.X so if you need C highlighting and you don't mind the default 1.1.X style then I would suggest you try switching :)

There's also been some preliminary work around optimising GeSHi, of which there will be a lot more happening in 1.1.4. For now, there's only one reasonably small feature to add and a bit of work on PHP highlighting to go before 1.1.2 will be done, and work can begin on 1.1.3, which currently has caching support marked for doing then.

GeSHi released


See the main site for details.

GeSHi released


See the main site for details.

GeSHi 1.1.2alpha2 released


The second alpha of 1.1.2 has just been released. This release has fixed a few bugs in the PHP and C code parsers, and adds basic support for SQL.

Work will continue on PHP, C and SQL support over the next few weeks. I'm going on holiday in July, so there might be some time then to do a decent block of work.

GeSHi released


See the main site for details.

GeSHi 1.1.2alpha1 released


The first alpha of 1.1.2 has just been released. New features in this release include much improved support for PHP highlighting - constants, function names and calls, and PHPDoc highlighting have all been either added or improved. Also there is support in the C language for highlighting correctly even when backslash-newlines occur in the source. There are a couple of minor improvements to other languages as well.

I plan to add SQL highlighting support to this iteration of development as well as the other things planned. I imagine that there will be at least 5 alphas, but I'm getting into the routine of releasing one a week now so things should progress quickly :).

The next stable version of GeSHi is due out in 5 days time. There's not much change at this point except for one or two more languages.

GeSHi 1.1.1 released


The next step on the road to a stable 1.2.0 release is now complete, with the release of GeSHi version 1.1.1. This version is a quantum leap forward in the accuracy and customisability of highlighting, with major new features since 1.1.0 including:

Of course, as well as all of that there's been myriads of bug fixes and overall a speed increase, as well as language support improving for most languages and new support added for Java, VHDL and C.

Now again active development will resume heading towards a 1.1.2 release. 1.1.2 will include yet more improvements to highlighting, although no new major end-user features are planned. Basically it will be a release that hopefully brings highlighting support to the level it will be at in 1.2.0.

Future releases after that will concentrate on things like caching, performance, bug fixing and the like until 1.1.5. After that the focus will move to reimplementing the old API, moving languages to the new format, writing new themes and renderers and all the other details that will make 1.2.0 just so much better than 1.0.X :). Usability will definately take an upward turn after 1.1.5 :)

And the best part is, I don't think it will take too long to go through each of the 1.1.2 - 1.1.5 releases. They're broken into similar sized blocks and I'm having a good run of time available at the moment (see the recent spate of releases). Let's hope it continues!

GeSHi 1.1.1beta1 released


I've just released the first (and hopefully only) beta of version 1.1.1 of GeSHi. This release contains a couple of small bugfixes over the last alpha.

If nothing bad is found over the next week I'll release 1.1.1 "stable" next week and then development will continue on 1.1.2.

GeSHi 1.1.1alpha5 released


Finally I've managed to get a long awaited update to the GeSHi development branch out. This release is the next alpha on the way to 1.1.1, and hopefully the last.

New features include:

I'd like to thank all the people who have been helping me out over that time, whether by participating on the bug tracker, helping to write language files or simply e-mailing me with their thoughts. Please keep it coming! If you know a language well and want to help out, now is the time to get in touch with me, so that the new language file format can be put through its paces.

The next release after this in the development branch will probably be 1.1.1beta1. I don't anticipate too many issues, and after 1.1.1 development can continue on new features, like proper balancing of contexts, an improvement that will allow detection of keywords broken in to bits by newlines (like in C) and more. Caching will follow in 1.1.3, as well as the beginnings of attempts to optimise slow parts of the source. After 1.1.5 I will begin re-implementing the old API, and things will begin to get very interesting :)

Enjoy this release :). Please test if you're able to, I would be most thankful for any feedback.

GeSHi released


See the main site for details.

There's been quite a bit of 1.1.X development recently, with the language files having been converted to the new format and C support coming along nicely (thanks to Netocrat). I will be attempting to get out a new alpha release sometime soon, perhaps next weekend.

GeSHi released


See the main site for details.

GeSHi released


See the main site for details.

GeSHi released


See the main site for details.

GeSHi 1.1.1alpha4 released


New to this release is theming support (try it out on the demo form!) and improvements to Delphi and Java. A full changelog is available on the bug tracker.

The language file development tutorial is under construction now, and gives an idea of what you need to do to support language highlighting.

GeSHi released


See the main site for details.

A quick update on 1.2 progress: Theming support is in CVS, as well as other bug fixes and improvements. I hope to get out another alpha soon, after I have fixed some bugs related to theming support.

GeSHi 1.1.1alpha3 released


The third alpha on the way to 1.1.1 has been released. This one adds beginning support for VHDL, courtesy of Lingzi Xue and Java, thanks to Tim Wright.

Other significant changes in this build are support for "Code Parsers" - the mechanism I have mentioned before that would allow you to do cool things like highlight errors in the source code or keywords only under certain conditions (see improvements that Ben has made to Delphi to see why) - and "Renderers", which will allow support for highlighting in PDF and other formats as well as HTML. If you know anything about a format you'd like supported, you're welcome to contact me about adding support for it.

A wiki has been set up at that you can browse around. It will contain plenty of information about GeSHi and in particular language files, although it is a little bare at the moment.

That's all for now. Download from sourceforge .

GeSHi released


See the main GeSHi site for details.

GeSHi 1.1.1alpha2 released


A little overdue, but better late than never. The big change this release is preliminary support for balanced context endings, although it requires some improvements.

Also improved is the get-keywords script, which now should work in PHP 4.4/5.0.5+.

I don't know whether I will be able to keep the Monday release schedule up since I am starting a full-time job next Monday, but I will endeavour to continue releases as fast as I can. The next release should have more improvements to context balancing, and possibly the beginnings of theme support.

GeSHi released


See the main GeSHi site for details.

I have now set up the new bug tracker - please register and post any bugs you find in the development strand of GeSHi there.

GeSHi 1.1.1alpha1 released


Major features include a new infrastructure for support for multiple output formats (like PDF, DOC etc. Only HTML at this time), a huge memory usage reduction (I've successfully highlighted a 190K source file), and a new infrastructure to give languages access to the parsed source so they can modify it if needed. This infrastructure is quite neat - it allows languages to examine the results of their own parsing and change it for special cases. So for example, PHP is currently using it to look out for the keyword "class" and then making the next token into a class name (which is then highlighted anywhere else in the source that it is found).

There were also some minor bug fixes, including the zero-length string bug and a couple of minor fixes for Delphi.

In other news, I will be setting up a Wiki and a new bug tracker hopefully tomorrow here. This should make it easier for you to report bugs, and I will be putting lots of information about 1.1.X, especially on how to create language files, on the Wiki. I'll post news here when they are available.

GeSHi 1.1.0 released


Finally, GeSHi 1.1.0 has been released. 1.1.0 contains a regression fix for PHP heredoc highlighting.

It's good to finally get 1.1.0 out the door. I've released it just after I have finished university for the year, and I plan from now on to release 1.1.X dev builds weekly (every Monday where possible). Now I can begin again active development work, so CVS will soon be trashed with broken code, while theming support, memory usage improvements and more languages are checked in.

Note that the 1.1.0 release should still be considered unstable. Although the highlighting engine is largely in place (and highlighting for the supported languages is miles better than what 1.0.X gives you), almost none of the old API is in place, so you have near zero control over the output. Nevertheless, I would appreciate it if people were to download it and take it for a spin, to test support for the supported languages.

If you do find any bugs, there is a bug tracker set up especially for 1.1.X and beyond. And of course, the roadmap will tell you more about what is going to be in 1.1.1.

The download is at sourceforge as per usual. Enjoy!

GeSHi 1.1.0beta1 released


It's been a long time, but finally the first beta of GeSHi 1.1.0 has been released. This release features many improvements in highlighting, and support for Delphi and CodeWorker as new languages. The amount of outputted source has been slightly reduced, and improvements have been made to PHP double string highlighting and number highlighting.

Hopefully there will be just a short beta cycle before 1.1.0 "stable" is released. After that, work can begin on 1.1.1, which will hopefully see huge memory-usage reductions, theming and a plugin architecture both to provide advanced highlighting for languages that the current system cannot handle and for output formats such as PDF to be supported.

Release available at sourceforge. Delphi users in particular may be interested in this release.

GeSHi released


Details at the main site. This release has mainly been focused on adding new languages.

GeSHi 1.1.0alpha6 released


Version 1.1.0alpha6 of GeSHi has been released. New to this release is a couple of minor bugfixes, one targeted at number highlighting, and the other at path setting. Also, and an improvement for OO highlighting - if a method is actually a keyword, it can be highlighted as such if needed. In particular, javascript uses this.

The download is at sourceforge as normal.

Hopefully that will be the last alpha before 1.1.0 goes to beta. Check the roadmap for details.

GeSHi released


Version of GeSHi has just been released. Details at the main site.

Hopefully 1.1.0alpha6 will be released in the next few days also, which will contain better number support and support for "method names that are actually keywords".

Development Resuming


I am now back from my holiday and am in the process of catching up on the stuff I have missed while I was away. So shortly work will re-begin on all aspects of GeSHi.

There will be a release out hopefully in the next couple of weeks that will add a few language files, update old ones, and fix a few minor bugs reported since the 1.0.7 release.

There will also be a 1.1.0alpha6 build soon, which will test a new feature that allows methods in highlighted code to actually be keywords also, and should fix some number highlighting bugs.

And finally, I hope to re-begin work on the GeSHi phpBB mod, cleaning up code and fixing bugs for an 0.4 beta release.

GeSHi 1.0.7 released


The next stable version of GeSHi has been released. See the notes at the other site. I am going to England for a holiday tomorrow, and will not be back for five weeks. In that time I will not be answering my e-mail and will not otherwise be contactable, so by all means send your queries but don't expect a quick reply.

GeSHi 1.1.0alpha5 released


Now HTML, Javascript and PHP5 are supported languages. A bug in the support of case insensitive keywords was fixed. Now every element of parsed code should have the correct name (changes were made to make it both easier and more reliable to name contexts).

I played around with the idea of using the singleton design pattern for the contexts, but unfortunately as PHP4 does not support static member variables very well at all, the idea crumbled.

In other news, you can now access the roadmap page to see the plan for GeSHi 1.2 and into the future. That is the page where I will put information about how GeSHi is progressing.

GeSHi 1.1.0alpha4 released


New features to this release include auto-linkifying of e-mail addresses and URLs in highlighted source code, CSS support again greatly improved and a language file added for CSS (so you can try highlighting CSS files at the demo form), the get-keywords script has been improved with new options and now uses its own copy of the PEAR files it needs, and context naming support has been greatly improved, which will lead to an important optimisation in speed and RAM usage in the next build.

Get the build from sourceforge, and give it a thrashing :)

GeSHi 1.1.0alpha3 released


New to this build is a large saving in RAM usage and speed increase, brought about at the expense of namespace support that nobody would use anyway. In addition, the get-keywords script gets a whole extra bunch of keywords for CSS, and there have been other small changes.

As usual, you can get the build from sourceforge. Submit bugs to the bugtracker if you find any.

GeSHi 1.1.0alpha2 released


The second alpha of 1.1.0 has been released. In this build CSS support has been greatly improved, and bugs 2, 3 and 4 have been fixed.

Get the build from sourceforge as usual. If you find any bugs, please submit them to the bugtracker.

Bug Tracker opened


A bug tracker is now available at for everyone to submit bug reports about the dev releases. This bug tracker will also be where bugs for future stable versions of GeSHi will be managed. If you find a bug in the unstable release, please report it there so I can remember it.

First alpha build released


As promised, the first alpha build of 1.1.0 has been released. There is very little change in the build from the last build, as my time has gone into release infrastructure. You can download the build from sourceforge, and checkout the code from the cvs repository (the module name is geshi-src, not geshi, which is the old module).

Beware, of course, that the code is alpha and most likely won't work on a live site.

And I am looking for assistance for GeSHi still. As detailed in the last news item and on the current GeSHi site, if you have some spare time and want to help out on the project, please e-mail me.

Namespace support added, build releases soon


GeSHi 1.2 now supports namespaces. This feature means you can choose either to have a coarse or fine grained control over the styles of highlighted code. For example, you can choose to have PHP code embedded in CSS highlighted differently from PHP in Javascript, within the same source code.

Another change is that now caching of loaded context data files is performed so much less file retrieval from disk is performed. I'm not sure at this stage whether it is actually faster, but the plan is to allow the user to choose whether they want speed or less load on the system.

And finally, I'm preparing to start releasing builds of the source, as well as moving the CVS repository to sourceforge again. I've had some problems with CVS at sourceforge in the past but I'm confident that these will be fixed now. So hopefully soon builds of the source will be available at sourceforge. I will announce them here, and on the current GeSHi site when they become available.

And one last thing -- if anyone is interested, I am looking for a partner to help me with GeSHi, and when GeSHi 1.2 goes Beta I will be looking for several people to help with language support, so if you have a good knowledge of PHP, XML, PEAR and other PHP related technologies, or if you are willing to become a permanent maintainer of support for one or more languages in the future, feel free to e-mail me. Anyone who has experience in releasing software for Debian/Red Hat or similar I'd like to hear from also, if you're willing to become the GeSHi release technician.

Code update


Some internal changes have been made to the code, mainly related to regular expression handling. One of the new features of GeSHi is the ability to specify a regular expression to match and group many parts of it by brackets, and the changes made allow nested brackets. Also changed was the implementation of "infectious contexts" - contexts that are passed to a context tree and told to add themselves everywhere. For example, HTML is "infected" with PHP to create the PHP language file. Try it out by posting source that jumps in and out of HTML a lot!

There are other improvements to the highlighting - notably HTML supports comments, doctypes and entities, and javascript highlighting has been improved.

GeSHi 1.2 Opened to Public Testing


A demo of GeSHi 1.2 is now available at for playtesting. A form is available for you to input PHP scripts to highlight. is the place to go for updates on 1.2 development progress. More languages and information will be available in the future.

Planned Features for 1.2

Listed here is the features that are planned for 1.2, as well as whether they have been completed.

More will be added if I think of them, and some will be taken off if I decide that they're not worthy. Feel free to mail me and suggest features for 1.2!