Skip to content

Commit bcc3067

Browse files
authored
fix: fix unexpected setext heading (#2986)
1 parent 0743d4a commit bcc3067

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

src/rules.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export const block: Record<BlockRuleNames, Rule> & Record<BlockSubRuleNames, Rul
8787
+ ')',
8888
def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
8989
table: noopTest,
90-
lheading: /^((?:(?!^bull ).|\n(?!\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
90+
lheading: /^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
9191
// regex template, placeholders will be replaced according to different paragraph
9292
// interruption rules of commonmark and the original markdown spec:
9393
_paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,

test/specs/new/setext_blankline.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<p>a</p>
2+
<p>b</p>
3+
<p>=</p>
4+
5+
<p>a</p>
6+
<p>b</p>
7+
<ul>
8+
<li></li>
9+
</ul>

test/specs/new/setext_blankline.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
a
2+
3+
b
4+
5+
=
6+
7+
a
8+
9+
b
10+
11+
-

0 commit comments

Comments
 (0)