This MediaWiki extension adds syntaxhighlight tag that is implemented using Google Code Prettify library.
- MediaWiki 1.17 or above.
Clone extension repository to extensions/GoogleCodePrettify directory.
cd $MEDIAWIKI_ROOT
git clone git://github.com/Undev/MediaWiki-GoogleCodePrettify.git extensions/GoogleCodePrettify
Add to LocalSettings.php before trailing ?> this code:
require_once( "$IP/extensions/GoogleCodePrettify/GoogleCodePrettify.php" );
That's all.
Google Code Prettify automatically recognizes language of source code. But you can set it using lang attribute.
You can add additional CSS class names to generated pre tags using class attribute. This is useful, for example, to add mw-collapsible class.
Handling of source tag disabled by default and is not recommended.
You can override this behavior by setting global $wgGoogleCodePrettifyAllowSourceTag variable to true.
Handling of shl tag disabled by default.
You can override this behavior by setting global $wgGoogleCodePrettifyAllowShlTag variable to true.
By default GoogleCodePrettify enables core languages plus css, sql and yaml.
You can add or remove supported languages by changing of global $wgGoogleCodePrettifyAdditionalLanguages array variable.
Licensed under MIT License.