fix: keep text after a nested list tight inside a list item #4269
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.40) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 302 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.342
Real PR Conversation Timeline
1 comments
"Review active on #4269"
general
weight: 0.35
UziTech
Marked version: 18.2.1 (master at 6c2a5ab4)
Markdown flavor: CommonMark|GitHub Flavored Markdown
Description
Expectation
Text that follows a nested list inside a tight list item is part of that tight item, so it shouldn't be wrapped in
<p>:should render
<li><ul><li></li></ul>foo</li>, andshould render
barwithout a<p>after the heading.Result
foo/barare rendered as<p>foo</p>/<p>bar</p>even though the outer list is tight (master, commonmark; master, commonmark).list()setslexer.state.top = falsebefore lexing each item, butblockTokens()setsstate.top = truewhen it returns. After a nested list is lexed, the rest of the enclosing item is lexed withtop === true, soparagraphis used instead oftext. The same thing happens after a nested list ended by a heading, thematic break, or fenced code block, and inside block quotes.What changed
list()saveslexer.state.topbefore lexing its items and restores it afterwards, likeblockquote()already does.test/specs/new/list_nested_list_then_text_tightcovers text after an empty nested item, after a heading, a thematic break and a fenced code block that end the nested list, and the same case inside a block quote. The expected output matches commonmark.js.Contributor
Committer
In most cases, this should be a different person than the contributor.