Standalone Mediawiki parsers to render content

180 Views Asked by At

Is there a standalone mediawiki parsers that takes content in mediawiki syntax, and returns HTML, without depending on a running Mediawiki instance. The use case is to call the standalone parser by passing in Mediawiki syntaxed content, and rendering the returned HTML output on a browser.

My content use templates, a few extensions (such as Toggle display), magic words and parser functions ( such as #if, #titleparts) quite extensively. Hence, a basic mediawiki parser won't satisfy my use case.

I have already briefly gone through the alternate parsers list, but the only one marked as 'full support' (Parsoid) seems to require a Mediawiki instance running to work.

It will also be really helpful for me, if you can share information if you have tried doing something like this, and what issues you ran into.

1

There are 1 best solutions below

0
On

There are a few reasons why parsing wikicode is really hard:

  • Discovery of templates
  • No clear definition of wikicode (the MediaWiki parser is the de-facto reference for what is or isn't valid)
  • wikicode has changed over the years

I once tried my hands at writing a wikicode parser for a step by step tutorial on how to edit a wiki myself, but eventually settled with using the MediaWiki parse API of a running Mediawiki instance.