mirror of
https://github.com/markedjs/marked.git
synced 2026-11-30 16:48:05 +01:00
fix: keep lazy setext underlines in list items as text (#4126)
This commit is contained in:
+9
-1
@@ -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();
|
||||
|
||||
@@ -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,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
|
||||
===
|
||||
@@ -0,0 +1,5 @@
|
||||
<ul>
|
||||
<li>
|
||||
<h1>foo</h1>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -0,0 +1,2 @@
|
||||
- foo
|
||||
===
|
||||
Reference in New Issue
Block a user