Jump to content

Extension:Geshi

From mediawiki.org
Revision as of 22:16, 3 July 2011 by Royce (talk | contribs) (→‎Dependancy: spelling fix, standardize on plural for consistency)
MediaWiki extensions manual
geshi
Release status: stable
Implementation Tag
Description Syntax highlight text snippets, whole pages or whole files.
Author(s) Jean-Lou Dupont
Latest version 1.0.0
MediaWiki 1.10, 1.11
License No license specified
Download SVN
See SVN ($Id: geshi.doc.wikitext 491 2007-10-10 15:34:11Z jeanlou.dupont $)

See also: Extension:SyntaxHighlight GeSHi.

Purpose

Syntax highlight text snippets, whole pages or whole files. The extension also provides a new 'hook' for other extensions to leverage as well as providing syntax highlighting for text blocks, whole pages or whole files. Line numbers can optionally be included or omitted.

Usage

  • LINES parameter
    • 0 -> no line numbers
    • 1 -> include line numbers
  • LANG parameter: language
  • SOURCE parameter
    • source=page where page is a valid page
    • source=file where file is a valid file of the Mediawiki installation accessible through the root of the installation.

Example 1

<geshi lang=LANG lines=LINES source=SOURCE> code OR page title OR filename </geshi>

Example 2

<php lines=LINES source=SOURCE> php code OR page title OR filename </php>

This usage is especially useful to integrate with other extensions (such as Form Processor).

Extensibility

This extension provides a new hook SyntaxHighlight that can be leveraged by other extensions.

public function handler( &$text, $lang, $lines, &$result )

History

  • Added 'source' tag for aligning with some similar extensions.
  • Added 'js' tag for highlighting 'Javascript'
  • Added 'css' tag for highlighting 'CSS'
  • Added parser function '{{#source ...}}'

1.0.0

  • Moved to PEAR distribution channel

Dependencies

Template:Pear