fix: allow a tab or end of input after a type 6 html block tag name

the type 6 html block start only accepted spaces, a newline, > or /> after the tag name. commonmark 0.31.2 also allows a tab and the end of the line, which includes the end of the input.
This commit is contained in:
dualfroz committed 2026-10-07 20:14:16 +02:00
1 parent 4e18e54fdb
commit d97a3ce360
5 files changed
+37 -1

No files matched your search

+1 -1
View File
@@ -162,7 +162,7 @@ const html = edit(
+ '|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)' // (3)
+ '|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)' // (4)
+ '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)' // (5)
+ '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (6)
+ '|</?(tag)(?:[ \\t]+|\\n|/?>|$)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (6)
+ '|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (7) open tag
+ '|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (7) closing tag
+ ')', 'i')
@@ -0,0 +1,15 @@
<div class="x">
*stays raw*
</div>
<TABLE class="x"><tr><td>
*stays raw*
</td></tr></TABLE>
<div
class="x">
*stays raw*
</div>
<blockquote>
<div class="x">
*stays raw*
</div>
</blockquote>
@@ -0,0 +1,16 @@
<div class="x">
*stays raw*
</div>
<TABLE class="x"><tr><td>
*stays raw*
</td></tr></TABLE>
<div
class="x">
*stays raw*
</div>
> <div class="x">
> *stays raw*
> </div>
@@ -0,0 +1,2 @@
<p>Paragraph</p>
<div
@@ -0,0 +1,3 @@
Paragraph
<div