Parsoid

From MediaWiki.org
Jump to navigation Jump to search
Artist's impression of the Parsoid HTML5 + RDFa wiki runtime

Parsoid allows an editor to use mediawiki extensions such as VisualEditor.

Technical details[edit]

Parsoid is an application which can translate back and forth, at runtime, between MediaWiki's wikitext syntax and an equivalent HTML/RDFa document model with enhanced support for automated processing and rich editing.

It has been under development by a team at the Wikimedia Foundation since 2012. It is currently used extensively by VisualEditor, Flow, Content Translation and other applications.

Parsoid is structured as a web service, and is written in JavaScript, making use of Node.js. It is intended to provide flawless back-and-forth conversion, i.e. to avoid information loss and also prevent "dirty diffs".

On Wikimedia wikis, for several applications, Parsoid is currently proxied behind RESTBase, which stores the HTML translated by Parsoid.

For more on the overall project, see this blog post from March 2013. To read about the HTML model being used, see MediaWiki DOM spec.

GitHub Repository: https://github.com/wikimedia/parsoid

Usage[edit]

Development[edit]

Development happens in the Parsoid service Git repository. Code review happens in Gerrit. See Gerrit/Getting started to set up an account for yourself.

If you use the MediaWiki-Vagrant development environment using a virtual machine, you can simply add the role visualeditor to it and it will set up a working Parsoid along with Extension:VisualEditor.

Running the tests[edit]

To run all parser tests and mocha tests:

npm test

parserTests has quite a few options now which can be listed using node parserTests --help.

Converting simple wikitext[edit]

You can convert simple wikitext snippets from the command line using the parse.js script in the bin/ directory:

echo 'Foo' | node parse

The parse script has a lot of options. node parse --help gives you information about this.

In Ubuntu 13 and 14, node has been renamed to nodejs. There, either type nodejs or create a symbolic link (or equivalent).

Debugging Parsoid (for developers)[edit]

See Parsoid/Debugging for debugging tips.

Technical documents[edit]

  • /Internals: documentation about Parsoid internals with links to other details.
  • Parsoid deployment agenda on Wikimedia cluster (code normally deployed every Monday and Wednesday between 1pm - 1:30pm PST)
  • /Round-trip testing: The round-trip testing setup we are using to test the wikitext -> HTML DOM -> wikitext round-trip on actual Wikipedia content.
  • /Visual Diffs Testing: Info about visual diff testing for comparing Parsoid's html rendering with php parser's html rendering + a testreduce setup for doing mass visual diff tests.
  • /limitations: Limitations in Parsoid, mainly contrived templating (ab)uses that don't matter in practice. Could be extended to be similar to the preprocessor upgrade notes (Might need updating)
  • /Bibliography: Bibliography of related literature

Links for Parsoid developers[edit]

Links for Parsoid deployers (to the Wikimedia cluster)[edit]

See also[edit]

Contact[edit]

If you need help or have questions/feedback, you can contact us in #mediawiki-parsoidconnect or the wikitext-l mailing list. If all that fails, you can also contact us by email at parsing-team at the wikimedia.org domain.