Design Simply

Simplicity in design, photography & code.


How to Setup Syntax Highlighting in MediaWiki

Steps for setting up GeSHi (Generic Syntax Highlighter) on MediaWiki:

  1. Download GeSHi (Generic Syntax Highlighter).
  2. Upload geshi.php and the geshi folder to your MediaWiki extensions folder.
  3. Create GeSHiHighlight.php using this source code.
  4. Copy the following line to your LocalSettings.php file.
    include("extensions/GeSHiHighlight.php");
  5. 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!

Add to your del.icio.us Add to del.icio.us Digg this storyDigg this

4 Responses to “How to Setup Syntax Highlighting in MediaWiki”

  1. override Says:

    No, its not like that..
    To get the real syntax highlighting working should use:

    The way you have posted will just preformat text.

  2. override Says:

    ok , my comments got hidden:: as i said you should use the following code:

  3. override Says:

    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

  4. Rogan Creswick Says:

    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.)

Leave a Reply



Copyright © 2000-2010 Sheri Bigelow. Proudly powered by WordPress and hosted by bluehost.
Log in. Valid XHTML 1, CSS 2. Entries (RSS) and Comments (RSS).