Repository navigation
Conversation
|
@lprnmns is attempting to deploy a commit to the MarkedJS Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
yxshee
left a comment
There was a problem hiding this comment.
This no longer merges with master, but only because of the fixture name: #4179 added test/specs/new/list_lazy_after_nested_block.md/.html, the same names this PR uses. The Tokenizer.ts and rules.ts changes merge cleanly; with this PR's fixture renamed, master plus this branch passes all spec tests, and the renamed fixture still fails on master without the change. So renaming the fixture should be all the rebase needs.
0d79e61 to
5f0f603
Compare
|
Rebased onto master and renamed the fixture to |
Marked version: 18.1.2 (master)
Markdown flavor: CommonMark|GitHub Flavored Markdown
Description
A line that is not indented enough only stays in a list item when it is paragraph continuation text (CommonMark 5.2).
Tokenizer.listdecides this by looking at the previous line, but when that line is the item's first line it can itself open a nested list item or block quote. The checks then see-or>instead of the block inside, so the lazy line is pulled into the outer item even when the nested block is empty or is a heading, fence, thematic break or indented code.This change looks past nested list and block quote markers on the item's first line before running the existing checks, and ends the item when nothing is left (an empty nested item or block quote). It only does this for the first line, which always starts a block, and not for lines with tabs, whose width depends on their column. This is the list counterpart of #4178, which handles
> -\nfoo.Expectation
- -\nnot in the listgives<ul><li><ul><li></li></ul></li></ul><p>not in the list</p>, matching commonmark.js.Result
<ul><li><ul><li></li></ul><p>not in the list</p></li></ul>. The same happens with1. -,- 1.,- >,- - # heading,- - ```,- - ***and- - codefollowed by an unindented line.- - item\nfoostill continues the nested paragraph.What was attempted
The new
test/specs/new/list_lazy_after_nested_blockspec fails without the change and passes with it; its expected HTML matches commonmark.js.npm testpasses. I also compared old and new output against commonmark.js on 600,000 random inputs built from list markers, block quote markers, indentation and block starts: no input that matched before differs now.Contributor
Committer
In most cases, this should be a different person than the contributor.