Extension:AlternateSyntaxParser

The ext-AlternateSyntaxParser>Special:MyLanguage/Extension:AlternateSyntaxParser|AlternateSyntaxParser Extension provides the ability to use alternate syntax engines (such as [http://daringfireball.net/projects/markdown/ Markdown] and [http://www.textism.com/tools/textile/ Textile]) instead of the standard wikitext parser.

This can be done on a page-by-page basis, or by setting a site-wide default.


 * Project Homepage: [http://jimbojw.com/wiki/index.php?title=AlternateSyntaxParser_Extension AlternateSyntaxParser Extension - Jimbojw.com]
 * Source Code: [http://jimbojw.com/wiki/index.php?title=AlternateSyntaxParser AlternateSyntaxParser.php]
 * Licensing: AlternateSyntaxParser is released under [http://www.opensource.org/licenses/mit-license.php The MIT License].

Installation
require_once('extensions/AlternateSyntaxParser/AlternateSyntaxParser.php'); $wgEnableParserCache = false;
 * 1) Create a folder in your   directory called.
 * Note:  is your MediaWiki install dir.
 * 1) Download [http://jimbojw.com/wiki/index.php?title=AlternateSyntaxParser AlternateSyntaxParser], and be sure to rename the downloaded file to.
 * 2) Drop this script in
 * 3) Enable the extension by adding this line to your  :
 * 1) Download the required libraries for chosen alternate syntaxes as specified below
 * ''Note: If you don't download the libraries, the extension won't work!

Configuration (optional)

If you'd like to specify a site-wide default alternate syntax, set the  global variable to the chosen language in your LocalSettings.php file. For example, to set Markdown as the site-wide default, you'd put: $wgAlternateSyntaxParserLanguage = 'markdown';

Markdown
To support [http://daringfireball.net/projects/markdown/ Markdown] syntax you must:
 * 1) Download Michel Fortin's PHP Markdown or PHP Markdown Extra library (either one):
 * http://www.michelf.com/projects/php-markdown/</>
 * 1) Extract the file 'markdown.php' from the zip archive.
 * 2) Drop markdown.php into

Textile
To support [<tvar|textile>http://www.textism.com/tools/textile/</> Textile] syntax you must:
 * 1) Download Textpattern's TextilePHP library:
 * <tvar|class-textile>https://code.google.com/p/textpattern/source/browse/releases/4.3.0/source/textpattern/lib/classTextile.php</>
 * 1) Drop classTextile.php into

Usage
To use an alternate syntax in a page, if you haven't set a site-wide default, put the following at the top of the page:


 * 1) MARKUP language

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

Below that, add any desired page content in the markup language specified. That's it!

Implementation notes
The inspiration for this extension was born out of Simon Dorfman's work on ext-MarkdownSyntax>Special:MyLanguage/Extension:MarkdownSyntax</>|Extension:MarkdownSyntax, which takes a different approach to rendering the content. AlternateSyntaxParser bypasses nearly all of the MediaWiki Parser's steps in order to preserve the alternate language's output, while MarkdownSyntax renders the markup according to Markdown rules prior to MediaWiki's wikitext parsing.

This means that MarkdownSyntax will still be able to use the category, namespace and template systems (among other MediaWiki features), while AlternateSyntaxParser will not. On the other hand, AlternateSyntaxParser does not suffer from syntactical conflicts such as header/section mapping (as described on the MarkdownSyntax extension page).

It is left as an exercise for the user to decide which method is more appropriate for their particular use case.

--Jimbojw 20:33, 3 June 2007 (UTC)