Extension:HighlightJS

From Organic Design wiki
Revision as of 20:43, 22 May 2015 by Nad (talk | contribs) (Changed to a client-side syntax highlighter)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Info.svg This code is in our Git repository here.

Note: If there is no information in this page about this code and it's a MediaWiki extension, there may be something at mediawiki.org.

We've been using GeSHi for our syntax highlighting for ten years now, and today I decided it was time to change to a client-side version instead. So I looked around on the net a bit and found a free open source one that I liked which was highlightjs.org, and made a quick wrapper for it which is this extension. It allows the same syntax to be used as normal, e.g. <source lang="LANG">.

The extension's installed the usual way and has just one option, $wgHighlightJsStyle 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).

I've included the languages that we use on this wiki, but you can download more from the main site, it supports over a hundred languages!

See also

  • highlightjs.org - Home page of the JS highlighter
  • CodeTidy - a utility to format code in accord with the MediaWiki code guidelines