You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] Adding a paragraph to a list item keeps the list tight in the editor, but it reopens loose #5297
🪲 pri/lowSome low-priority bugs, such as styles, some bugs on non-primary features🦁 need discussthe issue or PR need to discuss🐛 bugSomething isn't working🔭 area/muya
When a list item gains a second paragraph while editing, the list keeps rendering tight, but the saved file reopens as a loose list — every item in the list suddenly gets paragraph spacing.
The list's meta.loose is decided when the list block is built (from the parser, or preferLooseListItem when the list is created in the editor), and the mu-tight-list class follows it (packages/muya/src/block/commonMark/bulletList/index.ts, same in orderList / gfm/taskList). Adding a block to an item changes neither, so .mu-tight-list > li > p { margin: 0; padding: 0 } keeps the list compact.
The saved Markdown needs a blank line between the two paragraphs of the item, and in CommonMark that makes the whole list loose, so reopening parses loose: true.
Both existing ways of adding a paragraph to a list item show it. Measured on develop by driving the engine (insertParagraph('after') as the context menu does, and enterHandler / backspaceHandler on the content blocks), then parsing the saved Markdown back:
Starting from - a / - c
list meta.loose in the editor
saved Markdown
meta.loose after reopening
Insert Paragraph After on a, type b
false
- a\n\n b\n- c\n
true
Enter at the end of a, Backspace, type b
false
- a\n\n b\n- c\n
true
Steps to Reproduce
In a new document, type a two-item list: a, c.
Put the caret at the end of a, right-click → Insert Paragraph After, type b.
The list still looks tight: b sits directly under a, and c directly under b.
Save, close and reopen the file.
Expected Behavior
The list's spacing in the editor matches what the saved file reopens as: once an item holds a second paragraph, the list renders loose.
Actual Behavior
The list stays tight in the editor and turns loose only after the file is reopened.
🪲 pri/lowSome low-priority bugs, such as styles, some bugs on non-primary features🦁 need discussthe issue or PR need to discuss🐛 bugSomething isn't working🔭 area/muya
Activity