Page MenuHomePhabricator

Parsoid incorrectly renders lines beginning with " :" (space colon)
Closed, ResolvedPublic

Description

The wikitext :foo (space colon f o o ) is rendered by the PHP parser as <pre>:foo</pre> (as you would expect), but is rendered by Parsoid as a paragraph starting with a (span-wrapped) space:

<p data-parsoid='{"dsr":[0,5,0,0]}'><span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true,"dsr":[0,1,0,0]}'> </span>:foo</p>

This doesn't happen with any other special-seeming characters that I could think of, only colons. Things like ;foo (space semicolon f o o) and *foo are correctly rendered as <pre>s.

I discovered this because, while working on T209120, I found an old Flow post that contains <pre>:-(</pre>, which does not round-trip html2html cleanly:

$ echo '<pre>:-(</pre>' | ./parse.js --html2html --body_only
<p data-parsoid='{"dsr":[0,4,0,0]}'><span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true,"dsr":[0,1,0,0]}'> </span>:-(</p>

For a demonstration of this, see https://www.mediawiki.org/wiki/User:Roan_Kattouw_(WMF)/space_colon . The second line displays as a <pre> in the MW rendering, but changes to a paragraph when you open VisualEditor.

Event Timeline

LGoto triaged this task as Medium priority.Apr 17 2020, 4:30 PM
LGoto moved this task from Backlog to Bugs & Crashers on the Parsoid board.

"isDisplayHack" is part of some totally broken code: T197879: Fix mw:DisplaySpace to match PHP "armorFrenchSpaces"

Dunno if that's relevant, but that code needs to be taken out back and shot anyway.

Change 589732 had a related patch set uploaded (by Arlolra; owner: Arlolra):
[mediawiki/services/parsoid@master] Don't apply display hack at sol

https://gerrit.wikimedia.org/r/589732

Change 589732 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Don't apply display hack at sol

https://gerrit.wikimedia.org/r/589732

Change 592663 had a related patch set uploaded (by Subramanya Sastry; owner: Subramanya Sastry):
[mediawiki/vendor@master] Bump Parsoid to 0.12.0-a11

https://gerrit.wikimedia.org/r/592663

Change 592663 merged by jenkins-bot:
[mediawiki/vendor@master] Bump Parsoid to 0.12.0-a11

https://gerrit.wikimedia.org/r/592663