VisualEditor/Parsoid hacks

From MediaWiki.org
Jump to: navigation, search

This page describes which hacks we have in ve.dm.Converter.js to work around (mostly newline-related) bugs in Parsoid. "Inbound" hacks are applied when receiving input from Parsoid (to work around issues in Parsoid's output), "outbound" hacks are applied when outputting HTML back to Parsoid (to work around issues in Parsoid's serializer).

Inbound[edit | edit source]

Bug description Workaround Still needed?
Trailing newline in each <li> Strip all trailing newlines (line 309) Yes, but should strip only one
Leading and trailing newlines in <p>s Strip newlines according to complex rules (lines 315-349) No?

Outbound[edit | edit source]

In this context, "heading" means h1,h2,h3,h4,h5,h6, "list item" means li,dd,dt, "list" means ul,ol,dl, and "sublist" means a list within a list item.

Bug description Workaround Still needed?
Leading and trailing newlines in paragraphs required to produce valid wikitext Add newlines according to complex rules (lines 412-443) No?
First paragraph in each list item is serialized to a <p> tag Unwrap first paragraph unless it has stx=html in the round-trip data No?
List items require trailing newlines to produce valid wikitext Add trailing newline to each list item whose last child is not a list No?
Newline before sublist required to produce valid wikitext Add a newline before each sublist unless it is the first child No?
Newline sometimes required after heading to produce valid wikitext Add a newline after each heading that is followed by something that is not a paragraph No?
Newline required between <pre> and heading Add a newline before each heading that is preceded by a <pre> No?