mirror of
https://github.com/markedjs/marked
synced 2024-11-21 15:54:33 +00:00
fix: fix html following list (#3444)
This commit is contained in:
parent
2fe4136b5b
commit
9d7b728749
@ -305,6 +305,7 @@ export class _Tokenizer {
|
||||
const hrRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
|
||||
const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`);
|
||||
const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`);
|
||||
const htmlBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}<[a-z].*>`, 'i');
|
||||
|
||||
// Check if following lines should be included in List Item
|
||||
while (src) {
|
||||
@ -330,6 +331,11 @@ export class _Tokenizer {
|
||||
break;
|
||||
}
|
||||
|
||||
// End list item if found start of html block
|
||||
if (htmlBeginRegex.test(nextLine)) {
|
||||
break;
|
||||
}
|
||||
|
||||
// End list item if found start of new bullet
|
||||
if (nextBulletRegex.test(nextLine)) {
|
||||
break;
|
||||
|
7
test/specs/new/html_following_list.html
Normal file
7
test/specs/new/html_following_list.html
Normal file
@ -0,0 +1,7 @@
|
||||
<ul>
|
||||
<li>list item 1</li>
|
||||
<li>list item 2</li>
|
||||
</ul>
|
||||
<div class="some-class">
|
||||
Content
|
||||
</div>
|
5
test/specs/new/html_following_list.md
Normal file
5
test/specs/new/html_following_list.md
Normal file
@ -0,0 +1,5 @@
|
||||
- list item 1
|
||||
- list item 2
|
||||
<div class="some-class">
|
||||
Content
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user