It's better when it's simple

User Tools

Site Tools


Translations of this page?:

Learn about DokuWiki

Advanced Use

Corporate Use

Our Community

Follow us on Facebook, Twitter and other social networks.

Our Privacy Policy


Syntax highlighting by Geshi

DokuWiki includes GeSHi - Generic Syntax Highlighter - for formatting <code> and <file> blocks. Please refer to the documentation at for more information about how to use its class.

Please refer to the GeSHi class documentation for implementation details.

Example usage

Example how DokuWiki applies the highlighter for its code and file blocks. It is embedded in a wrapper method p_xhtml_cached_geshi that caches the output to reduce the server load.

$code = '... syntax to higlight ...';
$geshi = new GeSHi($code, $language, DOKU_INC . 'inc/geshi');
// when you like to use your own wrapper, remove GeSHi's wrapper element
// we need to use a GeSHi wrapper to avoid <BR> throughout the highlighted text
$highlighted_code = trim(

See also

devel/geshi.txt · Last modified: 2013-12-10 12:31 by