Tight lists are not correctly rendered in the editor #57
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I ran into a list-rendering-related inconsistency in ProseMirror. After digging around, I found #51 (TIL about "list tightness" in Markdown!), and the fix does seem to correctly detect the "hidden" attributes in Markdown-it's tokens and correctly attaches them on lists, but the then the (default) list rendering does not take these into account:
In the above screenshot, the left-hand side is plain Markdown-it, the right-hand side is ProseMirror. As evidenced by the
data-tight="true"in the list DOM, the tightness is correctly detected but ignored on render.This behavior can also be reproduced by the Friendly Markdown example on the website.
I tried looking into where this gets rendered (is it prosemirror-schema-list?) but arguably I'm still a bit new to ProseMirror's internals and couldn't quite get to it, would be happy to help to have this fixed.
Have you tried adding styles to
ul[data-tight=true] lithat remove the margins?Appreciate the swift response, yes making the
<p>insidedisplay: contentsis how I'm currently working around this, but I suspected that perhaps it was worthy to have a more clean solution of not rendering the paragraph elements in the first place?The schema puts a block node there, which makes sense (you can have nested lists and such in tight list items), and the editor view expects nodes in the document to have a DOM node equivalent, so I don't think not rendering the paragraph is a very practical approach.
I see! Thanks for elaborating! Maybe then including the above CSS snippet by default and documenting this behavior would be a better recourse?
Same subject here: https://discuss.prosemirror.net/t/lists-paragraph-inside-li-instead-of-new-list-item/455/8
I've corrected the display with these lines of css:
See in my POC project:
github.com/stephane-klein/poc-svelte-prosemirror-markdown@6a27f64eb7/src/routes/editor.css (L336)