DokuWiki syntax highlighting

DokuWiki includes out-of-the-box functionality for syntax highlighting using a built-in GeSHi plugin.

The DokuWiki engine uses a single, shared stylesheet for all GeSHi languages. This reduces the amount of data that needs to be transferred from the server, but prevents language-specific highlighting. This can be uncomfortable if you're used to a specific highlighting syle (e.g. SSMS's highlighting conventions for TSQL).

The single stylesheet is enforced in the p_xhtml_cached_geshi() function in core DokuWiki code, using the line:

$geshi->enable_classes();

To disable this behaviour (i.e. to enable language-specific highlighting!), just comment it out:

// $geshi->enable_classes();

Because you're modifying core engine code, you need to reinstate this change any time you upgrade your install.

The line of code appears in different places for different wiki versions:

Version File Line number
Greebo inc/parserutils.php 766
Detritus
Elenor of Tsort
Frusterick Manners
inc/parserutils.php 764
Hrun inc/parserutils.php 720
Binky inc/parserutils.php 705
Weatherwax inc/parserutils.php 785
2005-02-18 inc/parser.php