[Bug][preset-commonmark
] Unable to use non-paragraph elements as the first element inside a list item
#1276
Closed
2 tasks done
Labels
bug
Something isn't working
Initial checklist
Affected packages and versions
@milkdown/preset-commonmark@^7.3.0
Link to runnable example
No response
Steps to reproduce
Open Milkdown playground.
From Markdown
Try Example 293 in the CommonMark Spec:
Observe that an empty paragraph is automatically inserted upon modification.
From Milkdown Editor
Focus the editor and type in the following:
Observe that one cannot use codeblocks as the first element inside a list item.
Expected behavior
One should be able to use non-paragraph elements as the first element inside a list item, since the Commonmark spec does not pose a limit on it if I understand correctly.
Actually, after applying a simple patch to
preset-commonmark
, the widget still seems to work fine. Are there other considerations behind this restriction?Actual behavior
As seems to be specified here:
milkdown/packages/preset-commonmark/src/node/list-item.ts
Line 21 in 2a99183
Milkdown requires the first element inside a list item to be a paragraph.
Runtime
Firefox
OS
Linux
Build and bundle tools
Vite
The text was updated successfully, but these errors were encountered: