Jump to content

Help:Extension:ParserMigration

From mediawiki.org
PD Note: When you edit this page, you agree to release your contribution under the CC0. See Public Domain Help Pages for more info. PD

The ParserMigration extension allows users to compare the output of the legacy wikitext parser with the latest Parsoid wikitext parser. To report issues with the the Parsoid output, first read Parsoid/Parser Unification/Known Issues; after verifying that your issue is not already known, that page contains instructions to report a new issue.

Enabling via user preference

[edit]

This extension adds Enable parser migration tool and Use the new Parsoid wikitext parser to the list of Developer tools options at the bottom of the Editing preferences for a user. To opt-in to test Parsoid read views, select Always (opt-in) under Use the new Parsoid wikitext parser. You can also ensure Parsoid is never used by selecting Never (opt-out), or (the default) follow the default wiki settings for the use of the Parsoid wikitext parser by selecting According to the wiki configuration (default).

User preferences items added by the ParserMigration extension

Opting in to Parsoid read views on all wikis

[edit]

To opt in to Parsoid read views on all wikis, you will need to select Always under Use the new Parsoid wikitext parser in your global preferences. First, click the Set your global preferences button on the "User profile" page of your user preferences:

Global Preferences button in MediaWiki user preferences

After you have switched to global preferences, select Always (opt-in) under Use the new Parsoid wikitext parser at the bottom of your Editing preferences tab:

The two global preferences added by the ParserMigration extension

Switching between Parsoid and the legacy parser

[edit]

When the new Parsoid wikitext parser is used on a page a Use legacy parser link is added to the user tools sidebar. This allows a user to compare the output to the legacy parser, or to temporarily switch back to the legacy parser on the given page.

Link added to the Tools menu which allows switching back to legacy parser output

Comparing article rendering

[edit]

When Use parser migration tool is enabled, an Edit with migration tool link is added to the Tools menu in the sidebar for article pages.

Page tools menu item added by the ParserMigration extension

Clicking this on an article page will bring up a variant of the "preview edit" page which allows you to compare the legacy parser output against Parsoid output.

Parser output comparison page added by the ParserMigration extension

Selecting a parser using a URL query string

[edit]

The ParserMigration extension also allows the use of useparsoid in the URL query string to force the use of the legacy or Parsoid parser, overriding user or wiki preferences. Given a page URL like:

https://www.mediawiki.org/wiki/Parsoid

then the following URL will force the use of Parsoid:

https://www.mediawiki.org/wiki/Parsoid?useparsoid=1

And this URL will force the use of the legacy parser:

https://www.mediawiki.org/wiki/Parsoid?useparsoid=0

Action API

[edit]

This extension also adds action=parser-migration to the MediaWiki action API, which parses a page with two different parser configurations and returns one or both variants in the API response.

Action API added by the ParserMigration extension