Code Highlight
Module
Download module at SyntaxHighlight_GeSHi
tar -xzf SyntaxHighlight_GeSHi-REL1_23-4959271.tar.gz -C /var/www/mediawiki/extensions
Setup
Copy file into extensions folder Add the following code at the end of LocalSettings.php
require_once "$IP/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php"; $wgSyntaxHighlightDefaultLang = "php";
Sample code
<syntaxhighlight lang="php"> <?php $v = "string"; // sample initialization ?> html text <? echo $v; // end of php code ?> </syntaxhighlight>
Result
Supported Languages
These are the languages known by GeSHi that can be used in the lang parameter.
Note that installed GeSHi version (can be revealed by previewing e.g. <syntaxhighlight lang="-"></syntaxhighlight>
) might not be the most recent version; see bugzilla:10967 for Wikimedia sites.
The GeSHi sources for each language can be found in VCS on SourceForge. Remember to go and select the version that the MediaWiki installation uses.