Page MenuHomePhabricator

A space should be included after list token when adding a new item to an existant list
Closed, DuplicatePublic

Description

  1. Edit a page containing a bullet list or numbered list (example)
  2. Place your cursor inside the list, any place.
  3. Press Enter to carriage return: this creates a new item in the list.
  4. Observe the created wikitext:
    1. actually: *new item
    2. expected: * new item

Related:

Event Timeline

ssastry added a subscriber: ssastry.

This is not a Parsoid bug per se right now.

VE seems to be copying over element ids to the new element (from the previous element) which causes Parsoid to think it is a "pre-existing" element that has been copied over and modified. To avoid bloating the output HTML, Parsoid does not track whitespace used in the original wikitext and relies on selective serialization, so it uses the simple heuristic: (a) if a new element, add whitespace after bullet markup (b) if not, don't add whitespace. Eventually we can add more logic for Parsoid to inspect whitespace style and match it ( T53654: Match whitespace style of other list items when adding a new list item ) but for now, we rely on the new / not-new heuristic that is determined by whether it has an element id that Parsoid had introduced in the original document.

VE might have its reasons for copying the element id from the previous list item. I will leave it to the VE folks to investigate that.

If we don't copy the original ID, then we'll have the opposite issue, right? New items will always be inserted with a space, which will look wrong if the existing list doesn't have spaces.

If we don't copy the original ID, then we'll have the opposite issue, right? New items will always be inserted with a space, which will look wrong if the existing list doesn't have spaces.

Good point! :-). I am going to merge this as a duplicate of T536454 then. That would be the ideal solution.

I'm not sure that duplicating the id is working out so well. See T245206#6208042