You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2.7 KiB


Prism highlight is a syntax highlighting extension for Mediawiki which uses the Prism JavaScript syntax highlighter.


To install the extension clone the source into your extensions directory:

cd /path/to/wiki/extensions
git clone 

Alternatively you may download the source via zip.

To activate the extension open your LocalSettings.php file and add the following:



The following are the configuration options for the Localsettings.php file ( defaults shown ):

 * Theme to use
 * options: dark, funky, okaidia, tomoorrow, twilight, false ( default )
 * /
$wgPrismHighlightTheme = false;

 * Allow to highlight <source> tags
 * options: true / false
$wgPrismHighlightSource = true;

 * Plugins to use
 * options: autolinker, file-highlight, ie8, line-highlight, line-numbers,
 *   show-invisibles, wpd 
 * note: autolinker and show-invisibles do not appear to work for some reason
$wgPrismHighlightPlugins = array(

 * Languages to load
 * options: bash, c, clike, coffeescript, cpp, css, css-extras, groovy, 
 *   java, javascript, markup, php, python, scss, sql
$wgPrismHighlightLanguages = array(


To use the syntax highlighter in wiki markup create the following:


Place your code where //[...] is.

Now the following parameters may be passed to the <source> tag:

  • lang or language - language to use (none specified uses markup)
  • data-start - the starting line number for numbering or highlight
  • data-lines - the lines to highlight
  • line-numbers - used as a flag to specify line numbers should be used


<source lang=php data-start=29 line-numbers>
    foreach( $args as $key => $value ){
        switch ($key) {
            case 'lang':
            case 'language':
                $code_classes .= " language-$value";
            case 'class':
                $code_classes .= " $value";
            case 'line-numbers':
                $pre_args .= " class=$key";
            case 'data-start':
                $pre_args .= " data-line-offset=$value"; //should make sure this is set
                $pre_args .= " $key=$value";