This extension is currently not actively maintained! Although it may still work, any bug reports or feature requests will more than likely be ignored.
Release status: unmaintained
|Description||A wrapper for the "highlight.js" client-side syntax highlighter|
|Author(s)||Aran Dunkley (Nadtalk)|
|Latest version||1.1.2 (2015-09-04)|
|License||GNU General Public License 2.0 or later|
- Download the code and place the file(s) in a directory called
- Add the following code at the bottom of your
wfLoadExtension( 'HighlightJS' );
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
To users running MediaWiki 1.24 or earlier:
The instructions above describe the new way of installing this extension using
If you need to install this extension on these earlier versions (MediaWiki 1.24 and earlier), instead of
wfLoadExtension( 'HighlightJS' );, you need to use:
Code-blocks are created in the same way as the existing SyntaxHighlight one where the code-block is surrounded by a source tag with a language attribute as shown in the following example.
The colour theme can be set using the $wgHighlightJsStyle global variable which by default is empty which means to use the Organic Design code colours. You can set this to any of the sixty or so styles that you can see in the highlight/styles directory (don't include the ".css" in the setting).
Some wikis including this one now use the syntaxhighlight tag instead, so if your wiki already has existing code-blocks that use a different tag, you can set the tag that the HighlightJS extension uses with the $wgHighlightJsMagic global variable.
Example configuration options:
wfLoadExtension( 'HighlightJS' ); $wgHighlightJsMagic = 'syntaxhighlight'; $wgHighlightJsStyle = 'tomorrow-night-bright';
- Related extensions:
- Highlightjs Integration – another MediaWiki extension for syntax highlighter.
- SyntaxHighlight – server-side syntax highlighter that uses Pygments.