Page MenuHomePhabricator

Spec for precisely positioned, localized error message in Parsoid
Open, MediumPublic


A number of legacy Parser behavior amount to embedding something like the following in the output wikitext:

<span class="error" style="font-color:red; font-weight: bold">Error of some kind</span>

This adheres to the social conventions on our wiki, in terms of making errors highly visible to readers in order to motivate them to become editors and fix the mistake.

Previously, we'd used typeof="mw:Error" in our Parsoid output and relied on Visual Editor to use this machine-readable information to provide appropriate UX for editors. But as we move towards Parsoid read views, we need to duplicate the reader experience as well.

We already have T266666: Localization html2html pass for Parsoid to cover the localization part, and typeof="mw:Error" provides coarse-grained positioning, identifying the specific extension or transclusion at fault.

But in many cases the legacy parser provides more specific positioning: a gallery might indicate an error *at the specific location in the gallery where it occurs*, a citation might indicate an error *at a specific location in the references list*, math markup might indicate an error *at a specific operator or LaTeX command*. We should develop a spec which allows the mw:Error to be specifically positioned in the result HTML, with a localized message *in read views* that matches as far as possible the existing experience with the legacy parser.

I suggest that we use the following three cases are pathfinders, and draft what we'd expect/like to see the output HTML look like for various errors in:

  • The Cite extension
  • The Gallery extension
  • The {{int}} parser function -- both normal output and exception output are interesting in this case, as they would both use the localization html2html pass of T266666 but perhaps in slightly different ways. See

Event Timeline

Change 638195 had a related patch set uploaded (by Arlolra; owner: Arlolra):
[mediawiki/services/parsoid@master] Add a localization html2html pass

ssastry triaged this task as Medium priority.Nov 16 2020, 9:47 PM
ssastry added a project: Parsoid-Rendering.
ssastry moved this task from Needs Triage to Current & Upcoming Work on the Parsoid board.

Change 638195 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Add a localization html2html pass

Change 641308 had a related patch set uploaded (by Subramanya Sastry; owner: Subramanya Sastry):
[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.13.0-a17

Change 641308 merged by jenkins-bot:
[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.13.0-a17