-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tight lists are not correctly rendered in the editor #57
Comments
Have you tried adding styles to |
Appreciate the swift response, yes making the |
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? |
I've corrected the display with these lines of css: .ProseMirror ul li p:first-child {
margin-top: 0;
}
.ProseMirror ul li p:last-child {
margin-bottom: 0;
} See in my POC project: https://github.com/stephane-klein/poc-svelte-prosemirror-markdown/blob/6a27f64eb7bd23663021a945d180b29c88d073d6/src/routes/editor.css#L336 |
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.
The text was updated successfully, but these errors were encountered: