From a8978a379c1a59e2fbc431d785d04f3922f5199f Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Thu, 29 Oct 2026 14:37:25 -1000 Subject: Render more of the markdown seen in readmes A line of equals signs or dashes under a paragraph now makes a heading of it, as on GitHub, instead of running into its text, and any other rule ends the paragraph. Four spaces or a tab start a code block, and an escaped pipe stays in its table cell. A link opening with two slashes or backslashes in any mix leads to another site, so it renders as text like the plain scheme relative one already did. --- tests/extensions/test-about-render.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'tests/extensions') diff --git a/tests/extensions/test-about-render.lua b/tests/extensions/test-about-render.lua index a493720..0571796 100644 --- a/tests/extensions/test-about-render.lua +++ b/tests/extensions/test-about-render.lua @@ -257,6 +257,26 @@ render("README.md", string.rep("# a\n", 50000)) render("README.md", "| a | b |\n|---|---|\n| x" .. string.rep(" ", 40000) .. "y | z |") h.check("a long run of spaces is trimmed quickly", os.clock() - started < 10) +out = render("README.md", "Title\n=====\n\nBody") +h.contains("equals signs under a line make a heading", out, "

Title

Body

") + +out = render("README.md", "Two\nlines\n---\nafter") +h.contains("dashes under a paragraph make a heading of it all", out, + "

Two lines

after

") + +out = render("README.md", "text\n***\nmore") +h.contains("a rule ends the paragraph above it", out, "

text


more

") + +out = render("README.md", "Para\n\n code line\n\tnext \n\nafter") +h.contains("an indented block renders as code", out, + "

Para

code line\nnext <line>\n

after

") + +out = render("README.md", "- item\n\n more about it") +h.excludes("an indented paragraph after a list stays prose", out, "
")
+
+out = render("README.md", "[a](\\\\evil.example/x) [b](\\/evil.example/x)")
+h.excludes("a scheme relative link spelt with backslashes renders no anchor", out, "ab")
 h.contains("a pipe table renders its body", out, "12")
@@ -267,6 +287,12 @@ h.contains("a table cuts a paragraph short", out, "

Pick one:

x | y") + +out = render("README.md", "| a | b |\n|---|---|\n| x \\\\| y |") +h.contains("an escaped backslash still lets the pipe divide", out, "") + out = render("README.md", "- first\n- second") h.contains("dashes render an unordered list", out, "
  • first
  • second
") -- cgit
p | qx \\y