Extension:ASHighlight

This extension adds the '''

Note that this extension assumes PHP 5. It was tested using MediaWiki 1.9.3 on PHP 5.1.6, with highlight 2.4.5 on Ubuntu 6.10.


 * See Discussion Page for fix that works for MW 11.1.0

Installation on a Windows system: highlight installs by default in the folder C:\Program Files\WinHighlight Therefore the following changes are required in ashighlight.class.php

change define('ASHIGHLIGHT_LANG_ROOT',"/user/share/highlight/langDefs"); to define('ASHIGHLIGHT_LANG_ROOT',"C:\Program Files\WinHighlight\langDefs");

change function __construct($dir="/temp",$default_lang="py"){ to function __construct($dir="C:\\temp",$default_lang="py"){

change $cmd = "highlight --fragment" to $cmd = "C:\Progra~1\WinHighlight\highlight --fragment"

change $css = $this->dir. "/" . "highlight.css"; to $css = $this->dir. "\\" . "highlight.css";

Usage
Use a 'source' HTML-style tag in your wiki code, and give it a 'lang' attribute that matches the standard file extension for your source code, eg 'c' for C code, 'cpp' for C++ code, 'py' for Python, etc. For example:

Example
You can see this extension in action at


 * http://ascend4.org/ExtPy (Python highlighting)
 * http://ascend4.org/Calculation_of_sun_position (highlighting in the ASCEND language)

Aborts PdfBook export
Using this extension in combination with Extension:Pdf_Book may block the export of articles containing the tag, as well as subsequent articles in the generated PDF. This does not affect the intermediate HTML export. Unfortunately, the current workaround is to use Extension:SyntaxHighlight GeSHi instead of ASHighlight.

(Occurred with MediaWiki v1.12.0 / PdfBook v0.0.9)

ttttt