AlternateSyntaxParser Extension

From Jimbojw.com

Jump to: navigation, search

The AlternateSyntaxParser Extension is a MediaWiki extension which conditionally parses article text with an alternate syntax engine. This can be done either at the document level or site-wide.

It is released under The MIT License.

Contents

Compatibility

This extension requires:

  • MediaWiki 1.6.x, 1.9.x, 1.10.x or higher
  • PHP 4.x, 5.x or higer

Installation

  1. Create a folder in your $IP/extensions directory called AlternateSyntaxParser.
    Note: $IP is your MediaWiki install dir.
  2. Download AlternateSyntaxParser, and be sure to rename the downloaded file to AlternateSyntaxParser.php.
  3. Drop the downloaded script into $IP/extensions/AlternateSyntaxParser
  4. Enable the extension by adding this line to your LocalSettings.php:
    require_once('extensions/AlternateSyntaxParser/AlternateSyntaxParser.php');
  5. Download the required libraries for chosen alternate syntaxes as specified below
    Note: If you don't download the libraries, the extension won't work!

Markdown

To support Markdown syntax:

  1. Download Michel Fortin's PHP Markdown or PHP Markdown Extra library:
    http://www.michelf.com/projects/php-markdown/
  2. Extract the file 'markdown.php' from the zip archive.
  3. Drop markdown.php into $IP/extensions/AlternateSyntaxParser/

Textile

To support Textile Syntax:

  1. Download Jim Riggs' TextilePHP library:
    http://jimandlissa.com/project/textilephp
  2. Extract the file 'Textile.php' from the downloaded archive.
  3. Drop Textile.php into $IP/extensions/AlternateSyntaxParser/

Usage

To use an alternate syntax in a page, put the following at the top of the page:

#MARKUP language

Where 'language' is the markup language - examples include 'markdown' and 'textile'.

Alternatively, you may specify a site-wide default alternate language by setting the $wgAlternateSyntaxParserLanguage variable in your LocalSettings.php. For examlpe, to make Markdown the default parsing syntax, you'd add:

$wgAlternateSyntaxParserLanguage = 'markdown';

Comments

Got something to say?

Leave a comment
Sorry, comments are disabled.

or, read what others have said ...