Extension:GoogleCodePrettify

Category:Unmaintained extensions#GoogleCodePrettify Category:Extensions without an imageCategory:Extensions without a compatibility policyCategory:MIT licensed extensions
MediaWiki extensions manual
GoogleCodePrettify
Release status: unmaintainedCategory:Unmaintained extensions
Implementation MyWiki Category:Personalization extensions
Description Adds syntaxhighlight tag using Google Code Prettify library.
Author(s) Akzhantalk
Latest version 0.4 (2012-06-09)
MediaWiki 1.17+Category:Extensions with manual MediaWiki version
License MIT License
Download Category:Extensions in GitHub version control
Category:All extensionsCategory:Extensions not in ExtensionJson

The GoogleCodePrettify extension adds a syntaxhighlight tag using using the Google Code Prettify library.

Installation

  • Clone repository of the extension into your extensions/GoogleCodePrettify directory.
cd "$MEDIAWIKI_ROOT"
git clone git://github.com/Undev/MediaWiki-GoogleCodePrettify.git extensions/GoogleCodePrettify
  • Add the following line to the bottom of LocalSettings.php
require_once "$IP/extensions/GoogleCodePrettify/GoogleCodePrettify.php";

syntaxhighlight tag

Google Code Prettify automatically recognizes language of source code. But you can set it using lang attribute.

class 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.

Configuration

Enable handling of source tag

Handling of source tag disabled by default and is not recommended.

You can override this behavior by setting in LocalSettings.php:

$wgGoogleCodePrettifyAllowSourceTag = true;

Enable handling of shl tag

Handling of shl tag disabled by default.

You can override this behavior by setting in LocalSettings.php:

$wgGoogleCodePrettifyAllowShlTag = true;

Additional languages

By default GoogleCodePrettify enables these languages:

  • C and friends.
  • Java.
  • Python.
  • Bash.
  • SQL.
  • HTML.
  • XML.
  • CSS.
  • JavaScript.
  • Makefiles.
  • Ruby.
  • PHP.
  • Awk.
  • Perl.
  • YAML.

You can add or remove supported languages by changing of global $wgGoogleCodePrettifyAdditionalLanguages array variable.

See also

Category:Syntax highlighting extensions
Category:All extensions Category:BeforePageDisplay extensions Category:Extensions in GitHub version control Category:Extensions not in ExtensionJson Category:Extensions with manual MediaWiki version Category:Extensions without a compatibility policy Category:Extensions without an image Category:MIT licensed extensions Category:ParserFirstCallInit extensions Category:Personalization extensions Category:Syntax highlighting extensions Category:Unmaintained extensions