mirror of
https://github.com/markedjs/marked.git
synced 2026-11-30 16:48:05 +01:00
fix: allow tabs in the thematic break that ends a list item (#4087)
CommonMark 0.31.2 says each -, _, or * of a thematic break may be followed by any number of spaces or tabs, but the hrRegex that closes a list item allowed spaces only, so a break written with tabs was taken as paragraph continuation instead. "- foo" followed by a line of underscores separated by tabs put the hr inside the list item, and "- foo" followed by "---" plus a tab turned foo into a setext heading. The block hr rule already allows tabs; this makes the list item check agree with it.
This commit is contained in:
+1
-1
@@ -93,7 +93,7 @@ export const other = {
|
||||
endingNewline: /\n$/,
|
||||
listItemRegex: (bull: string) => new RegExp(`^( {0,3}${bull})((?:[\t ][^\\n]*)?(?:\\n|$))`),
|
||||
nextBulletRegex: cachedIndentRegex((indent: number) => new RegExp(`^ {0,${indent}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`)),
|
||||
hrRegex: cachedIndentRegex((indent: number) => new RegExp(`^ {0,${indent}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),
|
||||
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')),
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<ul>
|
||||
<li>foo</li>
|
||||
</ul>
|
||||
<hr>
|
||||
<ul>
|
||||
<li>bar</li>
|
||||
</ul>
|
||||
<hr>
|
||||
<ul>
|
||||
<li>baz</li>
|
||||
</ul>
|
||||
<hr>
|
||||
@@ -0,0 +1,11 @@
|
||||
---
|
||||
gfm: false
|
||||
---
|
||||
- foo
|
||||
_ _ _
|
||||
|
||||
- bar
|
||||
***
|
||||
|
||||
- baz
|
||||
---
|
||||
Reference in New Issue
Block a user