Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Cover the rest of the markdown grammar
The changelog for 2.12.0 says a list split by a code block keeps
counting, and only the split by a blank line was checked.
| -rw-r--r-- | tests/extensions/test-about-render.lua | 53 |
1 file changed, 53 insertions, 0 deletions
diff --git a/tests/extensions/test-about-render.lua b/tests/extensions/test-about-render.lua index bdd4d84..d5d2d2e 100644 --- a/tests/extensions/test-about-render.lua +++ b/tests/extensions/test-about-render.lua @@ -384,9 +384,62 @@ h.contains("a change of marker splits the list", out, "</ul><ol>") out = render("README.md", "- a **bold** item") h.contains("list items parse their text", out, "<li>a <strong>bold</strong> item</li>") +out = render("README.md", "1. a\n```\nx\n```\n2. b") +h.contains("a list split by a code block keeps counting", out, + "<ol><li>a</li></ol><pre><code>x\n</code></pre><ol start='2'><li>b</li></ol>") + +out = render("README.md", "+ a\n+ b") +h.contains("plus signs render an unordered list", out, "<ul><li>a</li><li>b</li></ul>") + +out = render("README.md", "* a\n* b") +h.contains("stars render an unordered list", out, "<ul><li>a</li><li>b</li></ul>") + +out = render("README.md", "### c\n#### d\n##### e\n###### f\n####### g") +h.contains("headings go down to the sixth level and no further", out, + "<h3 id='c'>c</h3><h4 id='d'>d</h4><h5 id='e'>e</h5><h6 id='f'>f</h6><p>####### g</p>") + +out = render("x.mkd", "# M") +h.contains("the mkd extension dispatches too", out, "<h1 id='m'>M</h1>") + +out = render("x.mdown", "# M") +h.contains("and so does mdown", out, "<h1 id='m'>M</h1>") + +out = render("README.md", "a\rb") +h.contains("a bare carriage return ends a line", out, "<p>a\nb</p>") + +out = render("README.md", "a | b\n:--- | ---:\n1 | 2") +h.contains("a delimiter row needs no outer pipes and may carry colons", out, + "<table><thead><tr><th>a</th><th>b</th></tr></thead><tbody><tr><td>1</td><td>2</td></tr></tbody></table>") + +out = render("README.md", "| a | b |\n|:-:|--:|\n| 1 | 2 |") +h.contains("a centred or right aligned column still makes a table", out, + "<tbody><tr><td>1</td><td>2</td></tr></tbody>") + +out = render("README.md", "| a | b |\n|---|---|\n| 1 |\n| 1 | 2 | 3 |") +h.contains("a row shorter or longer than the head keeps every cell", out, + "<tbody><tr><td>1</td></tr><tr><td>1</td><td>2</td><td>3</td></tr></tbody>") + +out = render("README.md", "```\ncode\nmore") +h.contains("an unclosed fence runs to the end", out, + "<div class='markdown'><pre><code>code\nmore\n</code></pre></div>") + +out = render("README.md", '[a](x "t")') +h.contains("a link title is dropped", out, "<p><a href='x'>a</a></p>") + +out = render("README.md", "# a <b>\n\n- <b>\n\n> <b>\n\n[<b>](x)\n\n| <b> |\n|---|\n| <i> |") +h.contains("markup in a heading is escaped", out, "<h1 id='a-b'>a <b></h1>") +h.contains("markup in a list item is escaped", out, "<li><b></li>") +h.contains("markup in a quote is escaped", out, "<blockquote><p><b></p></blockquote>") +h.contains("markup in link text is escaped", out, "<a href='x'><b></a>") +h.contains("markup in a table head is escaped", out, "<th><b></th>") +h.contains("markup in a table cell is escaped", out, "<td><i></td>") + out = render("README.md", string.rep("a", 512 * 1024 + 1)) h.contains("an oversized readme renders as plain text", out, "<pre class='plaintext'>") +out = render("README.md", string.rep("a", 512 * 1024)) +h.equals("a readme of exactly the cap still renders as markup", out:sub(1, 25), "<div class='markdown'><p>") + -- Man pages. out = render("page.1", ".SH NAME") |
