mirror of
https://github.com/markedjs/marked.git
synced 2026-11-30 16:48:05 +01:00
fix: fix blockquote after list (#3888)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user