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.
Andrew Senetar 03dbc1f963 Update
Add language to code blocks for highlighting
10 years ago
prism First Version ( v0.1 ) 11 years ago
.gitattributes First Version ( v0.1 ) 11 years ago
.gitignore First Version ( v0.1 ) 11 years ago First Version ( v0.1 ) 11 years ago
PrismHighlight.base.php Update PrismHighlight.base.php 10 years ago
PrismHighlight.i18n.php First Version ( v0.1 ) 11 years ago
PrismHighlight.php First Version ( v0.1 ) 11 years ago Update 10 years ago
init.js First Version ( v0.1 ) 11 years ago
overrides.css First Version ( v0.1 ) 11 years ago


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";