Skip to content

Commit af440df

Browse files
committed
fix: fix blockquote after list
1 parent bc7e185 commit af440df

File tree

4 files changed

+55
-0
lines changed

4 files changed

+55
-0
lines changed

src/Tokenizer.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ export class _Tokenizer<ParserOutput = string, RendererOutput = string> {
296296
const fencesBeginRegex = this.rules.other.fencesBeginRegex(indent);
297297
const headingBeginRegex = this.rules.other.headingBeginRegex(indent);
298298
const htmlBeginRegex = this.rules.other.htmlBeginRegex(indent);
299+
const blockquoteBeginRegex = this.rules.other.blockquoteBeginRegex(indent);
299300

300301
// Check if following lines should be included in List Item
301302
while (src) {
@@ -326,6 +327,11 @@ export class _Tokenizer<ParserOutput = string, RendererOutput = string> {
326327
break;
327328
}
328329

330+
// End list item if found start of blockquote
331+
if (blockquoteBeginRegex.test(nextLine)) {
332+
break;
333+
}
334+
329335
// End list item if found start of new bullet
330336
if (nextBulletRegex.test(nextLine)) {
331337
break;

src/rules.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export const other = {
8585
fencesBeginRegex: (indent: number) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`),
8686
headingBeginRegex: (indent: number) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`),
8787
htmlBeginRegex: (indent: number) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}<(?:[a-z].*>|!--)`, 'i'),
88+
blockquoteBeginRegex: (indent: number) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}>`),
8889
};
8990

9091
/**
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<h3>Child</h3>
2+
<ul>
3+
<li>list item
4+
<ul>
5+
<li>nested list item
6+
<blockquote>
7+
<p>quoteblock</p>
8+
</blockquote>
9+
</li>
10+
</ul>
11+
</li>
12+
</ul>
13+
<h3>Sibling</h3>
14+
<ul>
15+
<li>list item
16+
<ul>
17+
<li>nested list item</li>
18+
</ul>
19+
<blockquote>
20+
<p>quoteblock</p>
21+
</blockquote>
22+
</li>
23+
</ul>
24+
<h3>Parent level</h3>
25+
<ul>
26+
<li>list item
27+
<ul>
28+
<li>nested list item</li>
29+
</ul>
30+
</li>
31+
</ul>
32+
<blockquote>
33+
<p>quote block</p>
34+
</blockquote>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
### Child
2+
- list item
3+
- nested list item
4+
> quoteblock
5+
6+
### Sibling
7+
- list item
8+
- nested list item
9+
> quoteblock
10+
11+
### Parent level
12+
- list item
13+
- nested list item
14+
> quote block

0 commit comments

Comments
 (0)