GeSHi

Generic Syntax Highlighter
Developer(s) Nigel McNie, Benny Baumann
Stable release 1.0.8.12 / November 3, 2014
Development status Active
Written in PHP
Operating system Cross-platform
Type Syntax highlighting
License GPL
Website http://qbnz.com/highlighter/

GeSHi or Generic Syntax Highlighter is a free software library that allows syntax highlighting of source code for several markup and programming languages. The program is written in PHP and is bundled or available as an add-on in popular web-based applications, such as Dokuwiki, Drupal, Mambo, MediaWiki (see extension), phpBB and WikkaWiki. Wikipedia uses GeSHi as its primary syntax highlighter.

Features

Among its notable features:

History

GeSHi was originally designed as a module to introduce syntax highlighting in the phpBB board system. Later, it was made to work without a phpBB as a stand-alone library.

After a long time of inactivity the project was handed over to Benny Baumann on March 15, 2008.

Example

Here is a Perl program, highlighted using GeSHi.

    use Time::HiRes qw(sleep time);
    use POSIX qw();
    use IO::Handle;
 
    my $delay = shift(@ARGV);
 
    STDOUT->autoflush(1);
    {
        my $start = time();
        my $end = $start + $delay;
 
        my $last_printed;
        while ((my $t = time()) < $end)
        {
            my $new_to_print = POSIX::floor($end - $t);
            if (!defined($last_printed) or $new_to_print != $last_printed)
            {
                $last_printed = $new_to_print;
                print "Remaining $new_to_print/$delay", ' ' x 40, "\r";
            }
            sleep(0.1);
        }
    }
    print "\n";

Software which utilises GeSHi to colour files

Free GeSHi WebService

External links