mirror of
https://github.com/markedjs/marked.git
synced 2026-11-30 16:48:05 +01:00
fix: do not continue a block quote paragraph from a whitespace-only line (#4134)
This commit is contained in:
+3
-1
@@ -190,7 +190,9 @@ const paragraph = createParagraph(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/);
|
||||
// paragraph, where an empty list cannot interrupt)
|
||||
const blockquoteParagraph = createParagraph(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/);
|
||||
|
||||
const blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/)
|
||||
// a line with only whitespace after the marker is blank, so it must not start a
|
||||
// paragraph that lazily continues onto the next line
|
||||
const blockquote = edit(/^( {0,3}> ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/)
|
||||
.replace('paragraph', blockquoteParagraph)
|
||||
.getRegex();
|
||||
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<blockquote>
|
||||
</blockquote>
|
||||
<p>b</p>
|
||||
@@ -0,0 +1,2 @@
|
||||
>
|
||||
b
|
||||
@@ -0,0 +1,8 @@
|
||||
<blockquote>
|
||||
<p>a</p>
|
||||
</blockquote>
|
||||
<p>b</p>
|
||||
<blockquote>
|
||||
<p>c</p>
|
||||
</blockquote>
|
||||
<p>d</p>
|
||||
@@ -0,0 +1,7 @@
|
||||
> a
|
||||
>
|
||||
b
|
||||
|
||||
> c
|
||||
>
|
||||
d
|
||||
Reference in New Issue
Block a user