fix: fix setext heading interupts (#3210)
This commit is contained in:
parent
d61c266097
commit
d848445072
@ -12,8 +12,13 @@ const fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\
|
||||
const hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
|
||||
const heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
|
||||
const bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
||||
const lheading = edit(/^(?!bull )((?:.|\n(?!\s*?\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/)
|
||||
const lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/)
|
||||
.replace(/bull/g, bullet) // lists can interrupt
|
||||
.replace(/blockCode/g, / {4}/) // indented code blocks can interrupt
|
||||
.replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/) // fenced code blocks can interrupt
|
||||
.replace(/blockquote/g, / {0,3}>/) // blockquote can interrupt
|
||||
.replace(/heading/g, / {0,3}#{1,6}/) // ATX heading can interrupt
|
||||
.replace(/html/g, / {0,3}<[^\n>]+>\n/) // block html can interrupt
|
||||
.getRegex();
|
||||
const _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
|
||||
const blockText = /^[^\n]+/;
|
||||
|
12
test/specs/new/setext_no_blankline.html
Normal file
12
test/specs/new/setext_no_blankline.html
Normal file
@ -0,0 +1,12 @@
|
||||
<pre><code>indented code block
|
||||
</code></pre>
|
||||
<p>=</p>
|
||||
<p>fenced code block</p>
|
||||
<pre><code>=
|
||||
</code></pre>
|
||||
<blockquote><h1>blockquote</h1>
|
||||
</blockquote>
|
||||
<h3>heading</h3>
|
||||
<p>=</p>
|
||||
<html>
|
||||
=
|
16
test/specs/new/setext_no_blankline.md
Normal file
16
test/specs/new/setext_no_blankline.md
Normal file
@ -0,0 +1,16 @@
|
||||
indented code block
|
||||
=
|
||||
|
||||
fenced code block
|
||||
```
|
||||
=
|
||||
```
|
||||
|
||||
> blockquote
|
||||
=
|
||||
|
||||
### heading
|
||||
=
|
||||
|
||||
<html>
|
||||
=
|
Loading…
x
Reference in New Issue
Block a user