Skip to content

Commit 9e64a6a

Browse files
fix: end blockquote before a lazy line after a heading, hr or html block (#4115)
1 parent ec3a4e5 commit 9e64a6a

3 files changed

Lines changed: 37 additions & 2 deletions

File tree

‎src/Tokenizer.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ export class _Tokenizer<ParserOutput = string, RendererOutput = string> {
251251

252252
const lastToken = tokens.at(-1);
253253

254-
if (lastToken?.type === 'code') {
255-
// blockquote continuation cannot be preceded by a code block
254+
if (lastToken?.type === 'code' || lastToken?.type === 'heading' || lastToken?.type === 'hr' || lastToken?.type === 'html') {
255+
// blockquote continuation cannot be preceded by a code block, heading, hr or html block
256256
break;
257257
} else if (lastToken?.type === 'blockquote') {
258258
// include continuation in nested blockquote
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<blockquote>
2+
<h1>heading</h1>
3+
</blockquote>
4+
<p>not quoted</p>
5+
<blockquote>
6+
<h2>setext heading</h2>
7+
</blockquote>
8+
<p>not quoted</p>
9+
<blockquote>
10+
<hr />
11+
</blockquote>
12+
<p>not quoted</p>
13+
<blockquote>
14+
<div>
15+
</blockquote>
16+
<p>not quoted</p>
17+
<blockquote>
18+
<!-- comment -->
19+
</blockquote>
20+
<p>not quoted</p>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
> # heading
2+
not quoted
3+
4+
> setext heading
5+
> ---
6+
not quoted
7+
8+
> ***
9+
not quoted
10+
11+
> <div>
12+
not quoted
13+
14+
> <!-- comment -->
15+
not quoted

0 commit comments

Comments
 (0)