fix: keep lazy setext underlines in list items as text (#4126)

This commit is contained in:
vhinayindia
2026-10-25 23:51:09 -06:00
committed by GitHub
parent 6b63189546
commit 398234ccea
13 changed files with 60 additions and 1 deletions
+9 -1
View File
@@ -454,7 +454,15 @@ export class _Tokenizer<ParserOutput = string, RendererOutput = string> {
break;
}
itemContents += '\n' + nextLine;
// A lazy continuation can look like a setext underline after
// list indentation is removed. Keep it in the paragraph.
const setextContinuation = !this.options.pedantic
&& /^ {0,3}(?:=+|-+) *$/.test(nextLine)
&& this.rules.block.lheading.test(`${line}\n${nextLine}`);
const continuation = setextContinuation
? ` ${nextLineWithoutTabs.replace(/^ {0,3}/, '')}`
: nextLine;
itemContents += '\n' + continuation;
}
blankLine = !nextLine.trim();
+4
View File
@@ -0,0 +1,4 @@
<ul>
<li>foo
===</li>
</ul>
+2
View File
@@ -0,0 +1,2 @@
- foo
===
@@ -0,0 +1,5 @@
<ul>
<li>foo
bar
===</li>
</ul>
@@ -0,0 +1,3 @@
- foo
bar
===
@@ -0,0 +1,4 @@
<ul>
<li>foo
=</li>
</ul>
@@ -0,0 +1,2 @@
- foo
=
@@ -0,0 +1,5 @@
<ul>
<li>foo
bar
=</li>
</ul>
@@ -0,0 +1,3 @@
- foo
bar
=
@@ -0,0 +1,11 @@
<ul>
<li>outer
<ul>
<li>inner
===</li>
<li>
<h1>heading</h1>
</li>
</ul>
</li>
</ul>
@@ -0,0 +1,5 @@
- outer
- inner
===
- heading
===
+5
View File
@@ -0,0 +1,5 @@
<ul>
<li>
<h1>foo</h1>
</li>
</ul>
+2
View File
@@ -0,0 +1,2 @@
- foo
===