mirror of
https://github.com/markedjs/marked.git
synced 2026-12-01 16:56:16 +01:00
fix: fix hr after list (#2809)
This commit is contained in:
+5
-1
@@ -26,7 +26,7 @@ export const block = {
|
||||
+ ')',
|
||||
def: /^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
|
||||
table: noopTest,
|
||||
lheading: /^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
||||
lheading: /^((?:(?!^bull ).|\n(?!\n|bull ))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
||||
// regex template, placeholders will be replaced according to different paragraph
|
||||
// interruption rules of commonmark and the original markdown spec:
|
||||
_paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
|
||||
@@ -64,6 +64,10 @@ block.html = edit(block.html, 'i')
|
||||
.replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/)
|
||||
.getRegex();
|
||||
|
||||
block.lheading = edit(block.lheading)
|
||||
.replace(/bull/g, block.bullet) // lists can interrupt
|
||||
.getRegex();
|
||||
|
||||
block.paragraph = edit(block._paragraph)
|
||||
.replace('hr', block.hr)
|
||||
.replace('heading', ' {0,3}#{1,6} ')
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<ul>
|
||||
<li>this is a list, not a heading</li>
|
||||
</ul>
|
||||
<hr />
|
||||
|
||||
<ol>
|
||||
<li>this is also a list</li>
|
||||
</ol>
|
||||
<ul>
|
||||
<li>it should be a list</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li>not heading</li>
|
||||
</ul>
|
||||
<hr />
|
||||
|
||||
<p><s>not heading</s></p>
|
||||
<ul>
|
||||
<li>this is also a list, not a multiline heading</li>
|
||||
</ul>
|
||||
<hr />
|
||||
|
||||
<p><a href="/index.jpg">click here</a></p>
|
||||
<ul>
|
||||
<li>this has to be a list</li>
|
||||
<li>true...</li>
|
||||
</ul>
|
||||
<hr />
|
||||
|
||||
<h2 id="heading--this-one-is-a-heading">
|
||||
<b>heading</b> -this one is a heading
|
||||
</h2>
|
||||
|
||||
<h2 id="heading---this-is-a-heading-too">
|
||||
<b>heading</b> - this is a heading too
|
||||
</h2>
|
||||
@@ -0,0 +1,23 @@
|
||||
- this is a list, not a heading
|
||||
-----
|
||||
|
||||
1) this is also a list
|
||||
* it should be a list
|
||||
- not heading
|
||||
-----
|
||||
|
||||
<s>not heading</s>
|
||||
- this is also a list, not a multiline heading
|
||||
*****
|
||||
|
||||
[click here](/index.jpg)
|
||||
- this has to be a list
|
||||
- true...
|
||||
_____
|
||||
|
||||
<b>heading</b>
|
||||
-this one is a heading
|
||||
-----
|
||||
|
||||
<b>heading</b> - this is a heading too
|
||||
-----
|
||||
Reference in New Issue
Block a user