From 2e2e94825dcf00d378b93e97ce3d43db91a28e0c Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Sat, 7 Sep 2024 00:42:16 -0600 Subject: [PATCH] fix: fix html following list --- src/Tokenizer.ts | 6 ++++++ test/specs/new/html_following_list.html | 7 +++++++ test/specs/new/html_following_list.md | 5 +++++ 3 files changed, 18 insertions(+) create mode 100644 test/specs/new/html_following_list.html create mode 100644 test/specs/new/html_following_list.md diff --git a/src/Tokenizer.ts b/src/Tokenizer.ts index 80fc59ec7a..f29795e704 100644 --- a/src/Tokenizer.ts +++ b/src/Tokenizer.ts @@ -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; diff --git a/test/specs/new/html_following_list.html b/test/specs/new/html_following_list.html new file mode 100644 index 0000000000..349d4136cb --- /dev/null +++ b/test/specs/new/html_following_list.html @@ -0,0 +1,7 @@ + +
+Content +
diff --git a/test/specs/new/html_following_list.md b/test/specs/new/html_following_list.md new file mode 100644 index 0000000000..52c2113123 --- /dev/null +++ b/test/specs/new/html_following_list.md @@ -0,0 +1,5 @@ +- list item 1 +- list item 2 +
+Content +