Page MenuHomePhabricator

Parsoid eats paragraph breaks in lists and other single-line constructs - consider inserting <br><br> instead
Open, NormalPublic

Description

(probably a Parsoid problem, not a Flow problem, but you'll know that better than me)

Steps to reproduce:

  1. start editing a new thread in mw:Talk:Sandbox in WYSIWYG mode
  2. copy the rich text from the "about this board" section of mw:Talk:Flow
  3. put a paragraph break inside a list item (by pressing shift-enter)
  4. save

Expected result:
Not sure, actually. Wikitext does not provide a nice way to represent block content in a list item, and transforming lists into HTML would probably create more problems than it would solve,
Inserting <br/><br/> would be close enough, or just prevent putting paragraph breaks in list items in the first place.

Actual result:
The break gets transformed into two spaces and your nicely paragraphed text becomes a mess.

I tried to reproduce it here but while the bug did occur, the comment is only visible for a split second on load, then disappears. Not sure if that is caused by the bug or is an unrelated bug or a feature that I do not understand. When I originally encountered the bug, the disappearing did not happen.

Event Timeline

Tgr created this task.Sep 1 2015, 3:17 AM
Tgr raised the priority of this task from to Needs Triage.
Tgr updated the task description. (Show Details)
Tgr added a project: StructuredDiscussions.
Tgr added a subscriber: Tgr.
Restricted Application added a project: Collaboration-Team-Triage. · View Herald TranscriptSep 1 2015, 3:17 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Catrope set Security to None.
Catrope added a subscriber: Catrope.

Maybe a Parsoid bug, but if not that, this is a VE bug.

Elitre added a subscriber: Elitre.Mar 7 2016, 11:35 AM
Jdforrester-WMF renamed this task from Flow eats paragraph breaks in lists to Parsoid/VE in Flow eats paragraph breaks in lists.Mar 7 2016, 9:44 PM
Jdforrester-WMF added a project: Parsoid.

Parsoid has a notion of 'single-line-context' constraints for some wikitext constructs. When that constraint is violated, Parsoid strips tags as necessary. See snippets below.

[subbu@earth bin] echo "<ul><li>foo<p>bar</p></li></ul>" | parse.js --html2wt
* foo bar
[subbu@earth bin] echo "<ul><li>foo<br><br>bar</li></ul>" | parse.js --html2wt
* foo<br><br>bar

So, maybe we could insert <br> tags instead of completely stripping the p-tags.

ssastry renamed this task from Parsoid/VE in Flow eats paragraph breaks in lists to Parsoid eats paragraph breaks in lists and other single-line constructs - consider inserting <br><br> instead.May 23 2016, 4:39 PM
ssastry triaged this task as Normal priority.
ssastry removed a project: VisualEditor.

Hi - I may have access to developer resources to fix this bug, including possibly trying to create a fix myself. Is there anyone I can talk to about this? Is there at least a consensus that the current behavior should be changed?

@Arlolra - thanks, those links to the code look quite helpful. It could be that getting agreement that the change should be made will be much harder than actually making the change...

@Arlolra - thanks, those links to the code look quite helpful. It could be that getting agreement that the change should be made will be much harder than actually making the change...

I think @Arlolra is expressing a statement of fact that we haven't thought about this and so there is no consensus ... I don't expect arriving at an agreement to be difficult. It hasn't happened yet mostly because this issue has not been prioritized to be that important. But, if you are willing to tackle it, here are some initial thoughts to kick this off.

I think there are two possible approaches:

There are pros/cons to both approaches and needs some thinking / discussion. https://www.mediawiki.org/wiki/Parsoid/Normalizations lists current normalizations (and needs an update for another one we deployed y'day).

tosfos assigned this task to Vedmaka.Mar 20 2019, 8:58 PM
tosfos added a subscriber: tosfos.

Change 500667 had a related patch set uploaded (by Vedmaka Wakalaka; owner: Vedmaka Wakalaka):
[mediawiki/services/parsoid@master] Allow paragraph breaks in lists

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