How to Setup Syntax Highlighting in MediaWiki
Steps for setting up GeSHi (Generic Syntax Highlighter) on MediaWiki:
- Download GeSHi (Generic Syntax Highlighter).
- Upload geshi.php and the geshi folder to your MediaWiki extensions folder.
- Create GeSHiHighlight.php using this source code.
- Copy the following line to your LocalSettings.php file.
include("extensions/GeSHiHighlight.php"); - Add code to a MediaWiki page using <pre> tags.
<php><?php echo "Hello World!"; ?></php>
More information about GeSHI can be found at http://qbnz.com/highlighter/.
Edit: Oops. I had posted the last step with <pre> tags instead of <php>. I’ve fixed it now. Thanks override!





June 27th, 2008 at 11:50 pm
No, its not like that..
To get the real syntax highlighting working should use:
The way you have posted will just preformat text.
June 27th, 2008 at 11:54 pm
ok , my comments got hidden:: as i said you should use the following code:
June 28th, 2008 at 12:41 am
ok, it happened again, it sucks i cannot see a preview before posting, anyway , instead of “” you have to use “” with its respective “” to close the block.
cheers
February 4th, 2009 at 3:26 pm
I still can’t believe how many people are using that chunk of php! :)
Heres a more up-to-date source for the highlight extension:
http://www.mediawiki.org/wiki/Extension:GeSHiHighlight
(The version on intel-research is quite old, has my old email address, and there are some bugs/features that have been worked out — mostly by other people — I’m really not a php programmer, so there were a number of improvements.)