diff --git a/src/rules.ts b/src/rules.ts index aeb880c5..72016895 100644 --- a/src/rules.ts +++ b/src/rules.ts @@ -155,8 +155,8 @@ const html = edit( + '|[^\\n]*\\n*|$)' // (4) + '|[^\\n]*\\n*|$)' // (5) + '|?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (6) -+ '|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (7) open tag -+ '|(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (7) closing tag ++ '|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (7) open tag ++ '|(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ \t]*)+\\n|$)' // (7) closing tag + ')', 'i') .replace('comment', _comment) .replace('tag', _tag) @@ -432,8 +432,8 @@ const autolink = edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/) const _inlineComment = edit(_comment).replace('(?:-->|$)', '-->').getRegex(); const tag = edit( '^comment' - + '|^[a-zA-Z][\\w:-]*\\s*>' // self-closing tag - + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag + + '|^[a-zA-Z][a-zA-Z0-9-]*\\s*>' // self-closing tag + + '|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>' // open tag + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. + '|^' // declaration, e.g. + '|^') // CDATA section diff --git a/test/specs/new/html_invalid_tag_name.html b/test/specs/new/html_invalid_tag_name.html new file mode 100644 index 00000000..75b28115 --- /dev/null +++ b/test/specs/new/html_invalid_tag_name.html @@ -0,0 +1,3 @@ +
foo <bar_baz> qux
+foo </a:b> qux
+<div_>
diff --git a/test/specs/new/html_invalid_tag_name.md b/test/specs/new/html_invalid_tag_name.md new file mode 100644 index 00000000..89380545 --- /dev/null +++ b/test/specs/new/html_invalid_tag_name.md @@ -0,0 +1,5 @@ +foo