diff --git a/markdown_it/rules_block/html_block.py b/markdown_it/rules_block/html_block.py index 3a130907..1ff23d76 100644 --- a/markdown_it/rules_block/html_block.py +++ b/markdown_it/rules_block/html_block.py @@ -14,16 +14,18 @@ # last argument defines whether it can terminate a paragraph or not HTML_SEQUENCES: list[tuple[re.Pattern[str], re.Pattern[str], bool]] = [ ( - re.compile(r"^<(script|pre|style|textarea)(?=(\s|>|$))", re.IGNORECASE), - re.compile(r"<\/(script|pre|style|textarea)>", re.IGNORECASE), + re.compile(r"^<(?a:(script|pre|style|textarea))(?=(\s|>|$))", re.IGNORECASE), + re.compile(r"<\/(?a:(script|pre|style|textarea))>", re.IGNORECASE), True, ), (re.compile(r"^"), True), (re.compile(r"^<\?"), re.compile(r"\?>"), True), - (re.compile(r"^"), True), + (re.compile(r"^"), True), (re.compile(r"^"), True), ( - re.compile("^|$))", re.IGNORECASE), + re.compile( + "^|$))", re.IGNORECASE + ), re.compile(r"^$"), True, ), diff --git a/tests/test_port/fixtures/commonmark_extras.md b/tests/test_port/fixtures/commonmark_extras.md index 0f835ae3..98ce1ad5 100644 --- a/tests/test_port/fixtures/commonmark_extras.md +++ b/tests/test_port/fixtures/commonmark_extras.md @@ -871,3 +871,12 @@ b

c

. + +HTML block type 4 (declaration) starts with ` +. +

foo

+ +. diff --git a/tests/test_port/fixtures/issue-fixes.md b/tests/test_port/fixtures/issue-fixes.md index 596c6cd3..fefef099 100644 --- a/tests/test_port/fixtures/issue-fixes.md +++ b/tests/test_port/fixtures/issue-fixes.md @@ -140,3 +140,107 @@ foo

foo -->

. + +#437 a lowercase declaration interrupts a paragraph, as an uppercase one does +. +para + + +para + +. +

para

+ +

para

+ +. + +#437 Unicode lookalikes that case-fold to ASCII (U+017F, U+0130, U+0131) do not start an HTML block +. +para +<ſcript> +text + +para +<ſtyle> +text + +para + +text + +para + +text +. +

para +<ſcript> +text

+

para +<ſtyle> +text

+

para +<dİv> +text

+

para +<dıv> +text

+. + +#437 a Unicode lookalike does not close a type 1 HTML block +. + +after +. +

para

+ +

after

+. + +#437 a no-break space (U+00A0) after a type 6 tag name still starts an HTML block +. +para + +text +. +

para

+ +text +. + +#437 a no-break space (U+00A0) after a type 1 tag name still starts an HTML block +. +para + + +*a* + +. +

para

+ + +*a* + +.