fix: fix blockquote after list (#3888)

This commit is contained in:
Tony Brix
2026-02-11 09:38:30 -07:00
committed by GitHub
parent 1a5b124c0c
commit 2a475a1fb5
4 changed files with 55 additions and 0 deletions
+6
View File
@@ -296,6 +296,7 @@ export class _Tokenizer<ParserOutput = string, RendererOutput = string> {
const fencesBeginRegex = this.rules.other.fencesBeginRegex(indent);
const headingBeginRegex = this.rules.other.headingBeginRegex(indent);
const htmlBeginRegex = this.rules.other.htmlBeginRegex(indent);
const blockquoteBeginRegex = this.rules.other.blockquoteBeginRegex(indent);
// Check if following lines should be included in List Item
while (src) {
@@ -326,6 +327,11 @@ export class _Tokenizer<ParserOutput = string, RendererOutput = string> {
break;
}
// End list item if found start of blockquote
if (blockquoteBeginRegex.test(nextLine)) {
break;
}
// End list item if found start of new bullet
if (nextBulletRegex.test(nextLine)) {
break;
+1
View File
@@ -85,6 +85,7 @@ export const other = {
fencesBeginRegex: (indent: number) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`),
headingBeginRegex: (indent: number) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`),
htmlBeginRegex: (indent: number) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}<(?:[a-z].*>|!--)`, 'i'),
blockquoteBeginRegex: (indent: number) => new RegExp(`^ {0,${Math.min(3, indent - 1)}}>`),
};
/**
@@ -0,0 +1,34 @@
<h3>Child</h3>
<ul>
<li>list item
<ul>
<li>nested list item
<blockquote>
<p>quoteblock</p>
</blockquote>
</li>
</ul>
</li>
</ul>
<h3>Sibling</h3>
<ul>
<li>list item
<ul>
<li>nested list item</li>
</ul>
<blockquote>
<p>quoteblock</p>
</blockquote>
</li>
</ul>
<h3>Parent level</h3>
<ul>
<li>list item
<ul>
<li>nested list item</li>
</ul>
</li>
</ul>
<blockquote>
<p>quote block</p>
</blockquote>
@@ -0,0 +1,14 @@
### Child
- list item
- nested list item
> quoteblock
### Sibling
- list item
- nested list item
> quoteblock
### Parent level
- list item
- nested list item
> quote block