fix: match html block start conditions when ending a list item (#4072)

This commit is contained in:
Bao Nguyen
2026-09-12 14:19:35 -06:00
committed by GitHub
parent ef394f71df
commit c2facac8d4
7 changed files with 38 additions and 1 deletions
+3 -1
View File
@@ -96,7 +96,9 @@ export const other = {
hrRegex: cachedIndentRegex((indent: number) => new RegExp(`^ {0,${indent}}((?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\\*[ \t]*){3,})(?:\\n+|$)`)),
fencesBeginRegex: cachedIndentRegex((indent: number) => new RegExp(`^ {0,${indent}}(?:\`\`\`|~~~)`)),
headingBeginRegex: cachedIndentRegex((indent: number) => new RegExp(`^ {0,${indent}}#`)),
htmlBeginRegex: cachedIndentRegex((indent: number) => new RegExp(`^ {0,${indent}}<(?:[a-z].*>|!--)`, 'i')),
// a list item ends where a paragraph would be interrupted, so this mirrors the
// html start conditions in the paragraph rule below; type 7 is excluded there
htmlBeginRegex: cachedIndentRegex((indent: number) => new RegExp(`^ {0,${indent}}(?:</?(?:${_tag})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`, 'i')),
blockquoteBeginRegex: cachedIndentRegex((indent: number) => new RegExp(`^ {0,${indent}}>`)),
};
@@ -0,0 +1,6 @@
<div class="some-class">
<ul>
<li>list item 1</li>
<li>list item 2</li>
</ul>
</div>
@@ -0,0 +1,5 @@
<div class="some-class">
- list item 1
- list item 2
</div>
@@ -0,0 +1,6 @@
<ul>
<li>list item 1
<b>bold</b></li>
<li>list item 2
<span>span</span></li>
</ul>
@@ -0,0 +1,4 @@
- list item 1
<b>bold</b>
- list item 2
<span>span</span>
@@ -0,0 +1,8 @@
<ul>
<li>list item 1</li>
<li>list item 2</li>
</ul>
<div
class="some-class">
Content
</div>
@@ -0,0 +1,6 @@
- list item 1
- list item 2
<div
class="some-class">
Content
</div>