diff --git a/test/markdown/markdown_images_test.cc b/test/markdown/markdown_images_test.cc index 9be5406f17..ec9ab38007 100644 --- a/test/markdown/markdown_images_test.cc +++ b/test/markdown/markdown_images_test.cc @@ -83,3 +83,10 @@ TEST(image_title_with_escaped_quote) { EXPECT_EQ(result, "

\"logo\"

\n"); } + +TEST(image_description_spanning_a_soft_break) { + // The description becomes the alt attribute, which cannot hold a line break, + // so the break is flattened into a single space + const auto result{sourcemeta::core::markdown_to_html("![a\nb](/u)")}; + EXPECT_EQ(result, "

\"a

\n"); +} diff --git a/test/markdown/markdown_links_test.cc b/test/markdown/markdown_links_test.cc index e4879f0856..8a16705e39 100644 --- a/test/markdown/markdown_links_test.cc +++ b/test/markdown/markdown_links_test.cc @@ -655,3 +655,9 @@ TEST(link_inside_link_text_with_later_bracket_is_not_allowed) { sourcemeta::core::markdown_to_html("[a [b](/c) [d] e](/u)")}; EXPECT_EQ(result, "

[a b [d] e](/u)

\n"); } + +TEST(reference_link_label_with_a_space_before_a_non_ascii_character) { + const auto result{sourcemeta::core::markdown_to_html( + "[click][a \u00e9]\n\n[a \u00e9]: https://example.com")}; + EXPECT_EQ(result, "

click

\n"); +} diff --git a/test/markdown/markdown_unsafe_test.cc b/test/markdown/markdown_unsafe_test.cc index 6b091f3693..8b896fe291 100644 --- a/test/markdown/markdown_unsafe_test.cc +++ b/test/markdown/markdown_unsafe_test.cc @@ -388,3 +388,12 @@ TEST(tagfilter_vertical_tab_does_not_end_tag_name) { "a\n" "\n"); } + +TEST(tagfilter_tag_name_ended_by_a_tab) { + // The HTML tokenizer ends a tag name at a tab just as it does at a space, so + // the tag is still one of the disallowed ones and its opening angle bracket + // is escaped + const auto result{ + sourcemeta::core::markdown_to_html("x ", false)}; + EXPECT_EQ(result, "

x <script\tsrc=y>

\n"); +}