diff options
Diffstat (limited to 'tests')
40 files changed, 1371 insertions, 1289 deletions
diff --git a/tests/attention.rs b/tests/attention.rs index c7d7454..93c3a50 100644 --- a/tests/attention.rs +++ b/tests/attention.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn attention() { +fn attention() -> Result<(), String> { let danger = Options { allow_dangerous_html: true, allow_dangerous_protocol: true, @@ -765,25 +765,25 @@ fn attention() { ); assert_eq!( - micromark_with_options("*<img src=\"foo\" title=\"*\"/>", &danger), + micromark_with_options("*<img src=\"foo\" title=\"*\"/>", &danger)?, "<p>*<img src=\"foo\" title=\"*\"/></p>", "should not end inside HTML" ); assert_eq!( - micromark_with_options("*<img src=\"foo\" title=\"*\"/>", &danger), + micromark_with_options("*<img src=\"foo\" title=\"*\"/>", &danger)?, "<p>*<img src=\"foo\" title=\"*\"/></p>", "should not end emphasis inside HTML" ); assert_eq!( - micromark_with_options("**<a href=\"**\">", &danger), + micromark_with_options("**<a href=\"**\">", &danger)?, "<p>**<a href=\"**\"></p>", "should not end strong inside HTML (1)" ); assert_eq!( - micromark_with_options("__<a href=\"__\">", &danger), + micromark_with_options("__<a href=\"__\">", &danger)?, "<p>__<a href=\"__\"></p>", "should not end strong inside HTML (2)" ); @@ -822,8 +822,10 @@ fn attention() { }, ..Options::default() } - ), + )?, "<p>*a*</p>", "should support turning off attention" ); + + Ok(()) } diff --git a/tests/autolink.rs b/tests/autolink.rs index b851583..4cf357a 100644 --- a/tests/autolink.rs +++ b/tests/autolink.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn autolink() { +fn autolink() -> Result<(), String> { let danger = Options { allow_dangerous_html: true, allow_dangerous_protocol: true, @@ -41,7 +41,7 @@ fn autolink() { ); assert_eq!( - micromark_with_options("<a+b+c:d>", &danger), + micromark_with_options("<a+b+c:d>", &danger)?, "<p><a href=\"a+b+c:d\">a+b+c:d</a></p>", "should support protocol autolinks w/ incorrect URIs (1, danger)" ); @@ -53,7 +53,7 @@ fn autolink() { ); assert_eq!( - micromark_with_options("<made-up-scheme://foo,bar>", &danger), + micromark_with_options("<made-up-scheme://foo,bar>", &danger)?, "<p><a href=\"made-up-scheme://foo,bar\">made-up-scheme://foo,bar</a></p>", "should support protocol autolinks w/ incorrect URIs (2, danger)" ); @@ -65,7 +65,7 @@ fn autolink() { ); assert_eq!( - micromark_with_options("<localhost:5001/foo>", &danger), + micromark_with_options("<localhost:5001/foo>", &danger)?, "<p><a href=\"localhost:5001/foo\">localhost:5001/foo</a></p>", "should support protocol autolinks w/ incorrect URIs (4)" ); @@ -182,12 +182,11 @@ fn autolink() { ); assert_eq!( - micromark( - "<asd@012345678901234567890123456789012345678901234567890123456789012>" - ), - "<p><a href=\"mailto:asd@012345678901234567890123456789012345678901234567890123456789012\">asd@012345678901234567890123456789012345678901234567890123456789012</a></p>", - "should support 63 character in email autolinks domains" - ); + micromark( + "<asd@012345678901234567890123456789012345678901234567890123456789012>"), + "<p><a href=\"mailto:asd@012345678901234567890123456789012345678901234567890123456789012\">asd@012345678901234567890123456789012345678901234567890123456789012</a></p>", + "should support 63 character in email autolinks domains" + ); assert_eq!( micromark("<asd@0123456789012345678901234567890123456789012345678901234567890123>"), @@ -196,12 +195,11 @@ fn autolink() { ); assert_eq!( - micromark( - "<asd@012345678901234567890123456789012345678901234567890123456789012.a>" - ), - "<p><a href=\"mailto:asd@012345678901234567890123456789012345678901234567890123456789012.a\">asd@012345678901234567890123456789012345678901234567890123456789012.a</a></p>", - "should support a TLD after a 63 character domain in email autolinks" - ); + micromark( + "<asd@012345678901234567890123456789012345678901234567890123456789012.a>"), + "<p><a href=\"mailto:asd@012345678901234567890123456789012345678901234567890123456789012.a\">asd@012345678901234567890123456789012345678901234567890123456789012.a</a></p>", + "should support a TLD after a 63 character domain in email autolinks" + ); assert_eq!( micromark("<asd@0123456789012345678901234567890123456789012345678901234567890123.a>"), @@ -210,12 +208,11 @@ fn autolink() { ); assert_eq!( - micromark( - "<asd@a.012345678901234567890123456789012345678901234567890123456789012>" - ), - "<p><a href=\"mailto:asd@a.012345678901234567890123456789012345678901234567890123456789012\">asd@a.012345678901234567890123456789012345678901234567890123456789012</a></p>", - "should support a 63 character TLD in email autolinks" - ); + micromark( + "<asd@a.012345678901234567890123456789012345678901234567890123456789012>"), + "<p><a href=\"mailto:asd@a.012345678901234567890123456789012345678901234567890123456789012\">asd@a.012345678901234567890123456789012345678901234567890123456789012</a></p>", + "should support a 63 character TLD in email autolinks" + ); assert_eq!( micromark("<asd@a.0123456789012345678901234567890123456789012345678901234567890123>"), @@ -257,8 +254,10 @@ fn autolink() { }, ..Options::default() } - ), + )?, "<p><a@b.co></p>", "should support turning off autolinks" ); + + Ok(()) } diff --git a/tests/block_quote.rs b/tests/block_quote.rs index be9da40..6947ef3 100644 --- a/tests/block_quote.rs +++ b/tests/block_quote.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn block_quote() { +fn block_quote() -> Result<(), String> { assert_eq!( micromark("> # a\n> b\n> c"), "<blockquote>\n<h1>a</h1>\n<p>b\nc</p>\n</blockquote>", @@ -206,8 +206,10 @@ fn block_quote() { }, ..Options::default() } - ), + )?, "<p>> # a\n> b\n> c</p>", "should support turning off block quotes" ); + + Ok(()) } diff --git a/tests/character_escape.rs b/tests/character_escape.rs index 2ecaa5f..e76e3e9 100644 --- a/tests/character_escape.rs +++ b/tests/character_escape.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn character_escape() { +fn character_escape() -> Result<(), String> { let danger = Options { allow_dangerous_html: true, allow_dangerous_protocol: true, @@ -12,8 +12,7 @@ fn character_escape() { assert_eq!( micromark( - "\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\-\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\_\\`\\{\\|\\}\\~" - ), + "\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\-\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\_\\`\\{\\|\\}\\~"), "<p>!"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~</p>", "should support escaped ascii punctuation" ); @@ -26,8 +25,7 @@ fn character_escape() { assert_eq!( micromark( - "\\*not emphasized*\n\\<br/> not a tag\n\\[not a link](/foo)\n\\`not code`\n1\\. not a list\n\\* not a list\n\\# not a heading\n\\[foo]: /url \"not a reference\"\n\\ö not a character entity" - ), + "\\*not emphasized*\n\\<br/> not a tag\n\\[not a link](/foo)\n\\`not code`\n1\\. not a list\n\\* not a list\n\\# not a heading\n\\[foo]: /url \"not a reference\"\n\\ö not a character entity"), "<p>*not emphasized*\n<br/> not a tag\n[not a link](/foo)\n`not code`\n1. not a list\n* not a list\n# not a heading\n[foo]: /url "not a reference"\n&ouml; not a character entity</p>", "should escape other constructs" ); @@ -57,7 +55,7 @@ fn character_escape() { ); assert_eq!( - micromark_with_options("<a href=\"/bar\\/)\">", &danger), + micromark_with_options("<a href=\"/bar\\/)\">", &danger)?, "<a href=\"/bar\\/)\">", "should not escape in flow html" ); @@ -90,8 +88,10 @@ fn character_escape() { }, ..Options::default() } - ), + )?, "<p>\\> a</p>", "should support turning off character escapes" ); + + Ok(()) } diff --git a/tests/character_reference.rs b/tests/character_reference.rs index c388514..a08c3f9 100644 --- a/tests/character_reference.rs +++ b/tests/character_reference.rs @@ -3,11 +3,10 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn character_reference() { +fn character_reference() -> Result<(), String> { assert_eq!( micromark( - " & © Æ Ď\n¾ ℋ ⅆ\n∲ ≧̸" - ), + " & © Æ Ď\n¾ ℋ ⅆ\n∲ ≧̸"), "<p>\u{a0} & © Æ Ď\n¾ ℋ ⅆ\n∲ ≧̸</p>", "should support named character references" ); @@ -26,8 +25,7 @@ fn character_reference() { assert_eq!( micromark( - "  &x; &#; &#x;\n�\n&#abcdef0;\n&ThisIsNotDefined; &hi?;" - ), + "  &x; &#; &#x;\n�\n&#abcdef0;\n&ThisIsNotDefined; &hi?;"), "<p>&nbsp &x; &#; &#x;\n&#987654321;\n&#abcdef0;\n&ThisIsNotDefined; &hi?;</p>", "should not support other things that look like character references" ); @@ -51,7 +49,7 @@ fn character_reference() { allow_dangerous_html: true, ..Options::default() } - ), + )?, "<a href=\"öö.html\">", "should not care about character references in html" ); @@ -199,8 +197,10 @@ fn character_reference() { }, ..Options::default() } - ), + )?, "<p>&amp;</p>", "should support turning off character references" ); + + Ok(()) } diff --git a/tests/code_fenced.rs b/tests/code_fenced.rs index fd35eb8..850bd1b 100644 --- a/tests/code_fenced.rs +++ b/tests/code_fenced.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn code_fenced() { +fn code_fenced() -> Result<(), String> { assert_eq!( micromark("```\n<\n >\n```"), "<pre><code><\n >\n</code></pre>", @@ -267,8 +267,10 @@ fn code_fenced() { }, ..Options::default() } - ), + )?, "<p>```</p>", "should support turning off code (fenced)" ); + + Ok(()) } diff --git a/tests/code_indented.rs b/tests/code_indented.rs index cd27953..29d8909 100644 --- a/tests/code_indented.rs +++ b/tests/code_indented.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn code_indented() { +fn code_indented() -> Result<(), String> { assert_eq!( micromark(" a simple\n indented code block"), "<pre><code>a simple\n indented code block\n</code></pre>", @@ -127,37 +127,37 @@ fn code_indented() { }; assert_eq!( - micromark_with_options(" a", &off), + micromark_with_options(" a", &off)?, "<p>a</p>", "should support turning off code (indented, 1)" ); assert_eq!( - micromark_with_options("> a\n b", &off), + micromark_with_options("> a\n b", &off)?, "<blockquote>\n<p>a\nb</p>\n</blockquote>", "should support turning off code (indented, 2)" ); assert_eq!( - micromark_with_options("- a\n b", &off), + micromark_with_options("- a\n b", &off)?, "<ul>\n<li>a\nb</li>\n</ul>", "should support turning off code (indented, 3)" ); assert_eq!( - micromark_with_options("- a\n - b", &off), + micromark_with_options("- a\n - b", &off)?, "<ul>\n<li>a\n<ul>\n<li>b</li>\n</ul>\n</li>\n</ul>", "should support turning off code (indented, 4)" ); assert_eq!( - micromark_with_options("- a\n - b", &off), + micromark_with_options("- a\n - b", &off)?, "<ul>\n<li>a\n<ul>\n<li>b</li>\n</ul>\n</li>\n</ul>", "should support turning off code (indented, 5)" ); assert_eq!( - micromark_with_options("```\na\n ```", &off), + micromark_with_options("```\na\n ```", &off)?, "<pre><code>a\n</code></pre>", "should support turning off code (indented, 6)" ); @@ -169,20 +169,22 @@ fn code_indented() { allow_dangerous_html: true, ..off.clone() } - ), + )?, "<p>a <?\n?></p>", "should support turning off code (indented, 7)" ); assert_eq!( - micromark_with_options("- Foo\n---", &off), + micromark_with_options("- Foo\n---", &off)?, "<ul>\n<li>Foo</li>\n</ul>\n<hr />", "should support turning off code (indented, 8)" ); assert_eq!( - micromark_with_options("- Foo\n ---", &off), + micromark_with_options("- Foo\n ---", &off)?, "<ul>\n<li>\n<h2>Foo</h2>\n</li>\n</ul>", "should support turning off code (indented, 9)" ); + + Ok(()) } diff --git a/tests/code_text.rs b/tests/code_text.rs index 5199e7e..a0ed13e 100644 --- a/tests/code_text.rs +++ b/tests/code_text.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn code_text() { +fn code_text() -> Result<(), String> { let danger = Options { allow_dangerous_html: true, allow_dangerous_protocol: true, @@ -107,7 +107,7 @@ fn code_text() { ); assert_eq!( - micromark_with_options("<a href=\"`\">`", &danger), + micromark_with_options("<a href=\"`\">`", &danger)?, "<p><a href=\"`\">`</p>", "should have same precedence as HTML (2)" ); @@ -165,8 +165,10 @@ fn code_text() { }, ..Options::default() } - ), + )?, "<p>`a`</p>", "should support turning off code (text)" ); + + Ok(()) } diff --git a/tests/commonmark.rs b/tests/commonmark.rs index 889bbf3..b5bb40e 100644 --- a/tests/commonmark.rs +++ b/tests/commonmark.rs @@ -9,7 +9,7 @@ use pretty_assertions::assert_eq; #[rustfmt::skip] #[test] -fn commonmark() { +fn commonmark() -> Result<(), String> { let danger = Options { allow_dangerous_html: true, allow_dangerous_protocol: true, @@ -21,7 +21,7 @@ fn commonmark() { r###" foo baz bim "###, &danger - ), + )?, r###"<pre><code>foo baz bim </code></pre> "###, @@ -33,7 +33,7 @@ fn commonmark() { r###" foo baz bim "###, &danger - ), + )?, r###"<pre><code>foo baz bim </code></pre> "###, @@ -46,7 +46,7 @@ fn commonmark() { ὐ a "###, &danger - ), + )?, r###"<pre><code>a a ὐ a </code></pre> @@ -61,7 +61,7 @@ fn commonmark() { bar "###, &danger - ), + )?, r###"<ul> <li> <p>foo</p> @@ -79,7 +79,7 @@ fn commonmark() { bar "###, &danger - ), + )?, r###"<ul> <li> <p>foo</p> @@ -96,7 +96,7 @@ fn commonmark() { r###"> foo "###, &danger - ), + )?, r###"<blockquote> <pre><code> foo </code></pre> @@ -110,7 +110,7 @@ fn commonmark() { r###"- foo "###, &danger - ), + )?, r###"<ul> <li> <pre><code> foo @@ -127,7 +127,7 @@ fn commonmark() { bar "###, &danger - ), + )?, r###"<pre><code>foo bar </code></pre> @@ -142,7 +142,7 @@ bar - baz "###, &danger - ), + )?, r###"<ul> <li>foo <ul> @@ -163,7 +163,7 @@ bar r###"# Foo "###, &danger - ), + )?, r###"<h1>Foo</h1> "###, r###"Tabs (10)"### @@ -174,7 +174,7 @@ bar r###"* * * "###, &danger - ), + )?, r###"<hr /> "###, r###"Tabs (11)"### @@ -185,7 +185,7 @@ bar r###"\!\"\#\$\%\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\\\]\^\_\`\{\|\}\~ "###, &danger - ), + )?, r###"<p>!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~</p> "###, r###"Backslash escapes (12)"### @@ -196,7 +196,7 @@ bar r###"\ \A\a\ \3\φ\« "###, &danger - ), + )?, r###"<p>\ \A\a\ \3\φ\«</p> "###, r###"Backslash escapes (13)"### @@ -215,7 +215,7 @@ bar \ö not a character entity "###, &danger - ), + )?, r###"<p>*not emphasized* <br/> not a tag [not a link](/foo) @@ -234,7 +234,7 @@ bar r###"\\*emphasis* "###, &danger - ), + )?, r###"<p>\<em>emphasis</em></p> "###, r###"Backslash escapes (15)"### @@ -246,7 +246,7 @@ bar bar "###, &danger - ), + )?, r###"<p>foo<br /> bar</p> "###, @@ -258,7 +258,7 @@ bar</p> r###"`` \[\` `` "###, &danger - ), + )?, r###"<p><code>\[\`</code></p> "###, r###"Backslash escapes (17)"### @@ -269,7 +269,7 @@ bar</p> r###" \[\] "###, &danger - ), + )?, r###"<pre><code>\[\] </code></pre> "###, @@ -283,7 +283,7 @@ bar</p> ~~~ "###, &danger - ), + )?, r###"<pre><code>\[\] </code></pre> "###, @@ -295,7 +295,7 @@ bar</p> r###"<http://example.com?find=\*> "###, &danger - ), + )?, r###"<p><a href="http://example.com?find=%5C*">http://example.com?find=\*</a></p> "###, r###"Backslash escapes (20)"### @@ -306,7 +306,7 @@ bar</p> r###"<a href="/bar\/)"> "###, &danger - ), + )?, r###"<a href="/bar\/)"> "###, r###"Backslash escapes (21)"### @@ -317,7 +317,7 @@ bar</p> r###"[foo](/bar\* "ti\*tle") "###, &danger - ), + )?, r###"<p><a href="/bar*" title="ti*tle">foo</a></p> "###, r###"Backslash escapes (22)"### @@ -330,7 +330,7 @@ bar</p> [foo]: /bar\* "ti\*tle" "###, &danger - ), + )?, r###"<p><a href="/bar*" title="ti*tle">foo</a></p> "###, r###"Backslash escapes (23)"### @@ -343,7 +343,7 @@ foo ``` "###, &danger - ), + )?, r###"<pre><code class="language-foo+bar">foo </code></pre> "###, @@ -357,7 +357,7 @@ foo ∲ ≧̸ "###, &danger - ), + )?, r###"<p> & © Æ Ď ¾ ℋ ⅆ ∲ ≧̸</p> @@ -370,7 +370,7 @@ foo r###"# Ӓ Ϡ � "###, &danger - ), + )?, r###"<p># Ӓ Ϡ �</p> "###, r###"Entity and numeric character references (26)"### @@ -381,7 +381,7 @@ foo r###"" ആ ಫ "###, &danger - ), + )?, r###"<p>" ആ ಫ</p> "###, r###"Entity and numeric character references (27)"### @@ -395,7 +395,7 @@ foo &ThisIsNotDefined; &hi?; "###, &danger - ), + )?, r###"<p>&nbsp &x; &#; &#x; &#87654321; &#abcdef0; @@ -409,7 +409,7 @@ foo r###"© "###, &danger - ), + )?, r###"<p>&copy</p> "###, r###"Entity and numeric character references (29)"### @@ -420,7 +420,7 @@ foo r###"&MadeUpEntity; "###, &danger - ), + )?, r###"<p>&MadeUpEntity;</p> "###, r###"Entity and numeric character references (30)"### @@ -431,7 +431,7 @@ foo r###"<a href="öö.html"> "###, &danger - ), + )?, r###"<a href="öö.html"> "###, r###"Entity and numeric character references (31)"### @@ -442,7 +442,7 @@ foo r###"[foo](/föö "föö") "###, &danger - ), + )?, r###"<p><a href="/f%C3%B6%C3%B6" title="föö">foo</a></p> "###, r###"Entity and numeric character references (32)"### @@ -455,7 +455,7 @@ foo [foo]: /föö "föö" "###, &danger - ), + )?, r###"<p><a href="/f%C3%B6%C3%B6" title="föö">foo</a></p> "###, r###"Entity and numeric character references (33)"### @@ -468,7 +468,7 @@ foo ``` "###, &danger - ), + )?, r###"<pre><code class="language-föö">foo </code></pre> "###, @@ -480,7 +480,7 @@ foo r###"`föö` "###, &danger - ), + )?, r###"<p><code>f&ouml;&ouml;</code></p> "###, r###"Entity and numeric character references (35)"### @@ -491,7 +491,7 @@ foo r###" föfö "###, &danger - ), + )?, r###"<pre><code>f&ouml;f&ouml; </code></pre> "###, @@ -504,7 +504,7 @@ foo *foo* "###, &danger - ), + )?, r###"<p>*foo* <em>foo</em></p> "###, @@ -518,7 +518,7 @@ foo * foo "###, &danger - ), + )?, r###"<p>* foo</p> <ul> <li>foo</li> @@ -532,7 +532,7 @@ foo r###"foo bar "###, &danger - ), + )?, r###"<p>foo bar</p> @@ -545,7 +545,7 @@ bar</p> r###"	foo "###, &danger - ), + )?, r###"<p> foo</p> "###, r###"Entity and numeric character references (40)"### @@ -556,7 +556,7 @@ bar</p> r###"[a](url "tit") "###, &danger - ), + )?, r###"<p>[a](url "tit")</p> "###, r###"Entity and numeric character references (41)"### @@ -568,7 +568,7 @@ bar</p> - two` "###, &danger - ), + )?, r###"<ul> <li>`one</li> <li>two`</li> @@ -584,7 +584,7 @@ bar</p> ___ "###, &danger - ), + )?, r###"<hr /> <hr /> <hr /> @@ -597,7 +597,7 @@ ___ r###"+++ "###, &danger - ), + )?, r###"<p>+++</p> "###, r###"Thematic breaks (44)"### @@ -608,7 +608,7 @@ ___ r###"=== "###, &danger - ), + )?, r###"<p>===</p> "###, r###"Thematic breaks (45)"### @@ -621,7 +621,7 @@ ___ __ "###, &danger - ), + )?, r###"<p>-- ** __</p> @@ -636,7 +636,7 @@ __</p> *** "###, &danger - ), + )?, r###"<hr /> <hr /> <hr /> @@ -649,7 +649,7 @@ __</p> r###" *** "###, &danger - ), + )?, r###"<pre><code>*** </code></pre> "###, @@ -662,7 +662,7 @@ __</p> *** "###, &danger - ), + )?, r###"<p>Foo ***</p> "###, @@ -674,7 +674,7 @@ __</p> r###"_____________________________________ "###, &danger - ), + )?, r###"<hr /> "###, r###"Thematic breaks (50)"### @@ -685,7 +685,7 @@ __</p> r###" - - - "###, &danger - ), + )?, r###"<hr /> "###, r###"Thematic breaks (51)"### @@ -696,7 +696,7 @@ __</p> r###" ** * ** * ** * ** "###, &danger - ), + )?, r###"<hr /> "###, r###"Thematic breaks (52)"### @@ -707,7 +707,7 @@ __</p> r###"- - - - "###, &danger - ), + )?, r###"<hr /> "###, r###"Thematic breaks (53)"### @@ -718,7 +718,7 @@ __</p> r###"- - - - "###, &danger - ), + )?, r###"<hr /> "###, r###"Thematic breaks (54)"### @@ -733,7 +733,7 @@ a------ ---a--- "###, &danger - ), + )?, r###"<p>_ _ _ _ a</p> <p>a------</p> <p>---a---</p> @@ -746,7 +746,7 @@ a------ r###" *-* "###, &danger - ), + )?, r###"<p><em>-</em></p> "###, r###"Thematic breaks (56)"### @@ -759,7 +759,7 @@ a------ - bar "###, &danger - ), + )?, r###"<ul> <li>foo</li> </ul> @@ -778,7 +778,7 @@ a------ bar "###, &danger - ), + )?, r###"<p>Foo</p> <hr /> <p>bar</p> @@ -793,7 +793,7 @@ bar bar "###, &danger - ), + )?, r###"<h2>Foo</h2> <p>bar</p> "###, @@ -807,7 +807,7 @@ bar * Bar "###, &danger - ), + )?, r###"<ul> <li>Foo</li> </ul> @@ -825,7 +825,7 @@ bar - * * * "###, &danger - ), + )?, r###"<ul> <li>Foo</li> <li> @@ -846,7 +846,7 @@ bar ###### foo "###, &danger - ), + )?, r###"<h1>foo</h1> <h2>foo</h2> <h3>foo</h3> @@ -862,7 +862,7 @@ bar r###"####### foo "###, &danger - ), + )?, r###"<p>####### foo</p> "###, r###"ATX headings (63)"### @@ -875,7 +875,7 @@ bar #hashtag "###, &danger - ), + )?, r###"<p>#5 bolt</p> <p>#hashtag</p> "###, @@ -887,7 +887,7 @@ bar r###"\## foo "###, &danger - ), + )?, r###"<p>## foo</p> "###, r###"ATX headings (65)"### @@ -898,7 +898,7 @@ bar r###"# foo *bar* \*baz\* "###, &danger - ), + )?, r###"<h1>foo <em>bar</em> *baz*</h1> "###, r###"ATX headings (66)"### @@ -909,7 +909,7 @@ bar r###"# foo "###, &danger - ), + )?, r###"<h1>foo</h1> "###, r###"ATX headings (67)"### @@ -922,7 +922,7 @@ bar # foo "###, &danger - ), + )?, r###"<h3>foo</h3> <h2>foo</h2> <h1>foo</h1> @@ -935,7 +935,7 @@ bar r###" # foo "###, &danger - ), + )?, r###"<pre><code># foo </code></pre> "###, @@ -948,7 +948,7 @@ bar # bar "###, &danger - ), + )?, r###"<p>foo # bar</p> "###, @@ -961,7 +961,7 @@ bar ### bar ### "###, &danger - ), + )?, r###"<h2>foo</h2> <h3>bar</h3> "###, @@ -974,7 +974,7 @@ bar ##### foo ## "###, &danger - ), + )?, r###"<h1>foo</h1> <h5>foo</h5> "###, @@ -986,7 +986,7 @@ bar r###"### foo ### "###, &danger - ), + )?, r###"<h3>foo</h3> "###, r###"ATX headings (73)"### @@ -997,7 +997,7 @@ bar r###"### foo ### b "###, &danger - ), + )?, r###"<h3>foo ### b</h3> "###, r###"ATX headings (74)"### @@ -1008,7 +1008,7 @@ bar r###"# foo# "###, &danger - ), + )?, r###"<h1>foo#</h1> "###, r###"ATX headings (75)"### @@ -1021,7 +1021,7 @@ bar # foo \# "###, &danger - ), + )?, r###"<h3>foo ###</h3> <h2>foo ###</h2> <h1>foo #</h1> @@ -1036,7 +1036,7 @@ bar **** "###, &danger - ), + )?, r###"<hr /> <h2>foo</h2> <hr /> @@ -1051,7 +1051,7 @@ bar Bar foo "###, &danger - ), + )?, r###"<p>Foo bar</p> <h1>baz</h1> <p>Bar foo</p> @@ -1066,7 +1066,7 @@ Bar foo ### ### "###, &danger - ), + )?, r###"<h2></h2> <h1></h1> <h3></h3> @@ -1083,7 +1083,7 @@ Foo *bar* --------- "###, &danger - ), + )?, r###"<h1>Foo <em>bar</em></h1> <h2>Foo <em>bar</em></h2> "###, @@ -1097,7 +1097,7 @@ baz* ==== "###, &danger - ), + )?, r###"<h1>Foo <em>bar baz</em></h1> "###, @@ -1111,7 +1111,7 @@ baz* ==== "###, &danger - ), + )?, r###"<h1>Foo <em>bar baz</em></h1> "###, @@ -1127,7 +1127,7 @@ Foo = "###, &danger - ), + )?, r###"<h2>Foo</h2> <h1>Foo</h1> "###, @@ -1146,7 +1146,7 @@ Foo === "###, &danger - ), + )?, r###"<h2>Foo</h2> <h2>Foo</h2> <h1>Foo</h1> @@ -1163,7 +1163,7 @@ Foo --- "###, &danger - ), + )?, r###"<pre><code>Foo --- @@ -1180,7 +1180,7 @@ Foo ---- "###, &danger - ), + )?, r###"<h2>Foo</h2> "###, r###"Setext headings (86)"### @@ -1192,7 +1192,7 @@ Foo --- "###, &danger - ), + )?, r###"<p>Foo ---</p> "###, @@ -1208,7 +1208,7 @@ Foo --- - "###, &danger - ), + )?, r###"<p>Foo = =</p> <p>Foo</p> @@ -1223,7 +1223,7 @@ Foo ----- "###, &danger - ), + )?, r###"<h2>Foo</h2> "###, r###"Setext headings (89)"### @@ -1235,7 +1235,7 @@ Foo ---- "###, &danger - ), + )?, r###"<h2>Foo\</h2> "###, r###"Setext headings (90)"### @@ -1252,7 +1252,7 @@ Foo of dashes"/> "###, &danger - ), + )?, r###"<h2>`Foo</h2> <p>`</p> <h2><a title="a lot</h2> @@ -1267,7 +1267,7 @@ of dashes"/> --- "###, &danger - ), + )?, r###"<blockquote> <p>Foo</p> </blockquote> @@ -1283,7 +1283,7 @@ bar === "###, &danger - ), + )?, r###"<blockquote> <p>foo bar @@ -1299,7 +1299,7 @@ bar --- "###, &danger - ), + )?, r###"<ul> <li>Foo</li> </ul> @@ -1315,7 +1315,7 @@ Bar --- "###, &danger - ), + )?, r###"<h2>Foo Bar</h2> "###, @@ -1332,7 +1332,7 @@ Bar Baz "###, &danger - ), + )?, r###"<hr /> <h2>Foo</h2> <h2>Bar</h2> @@ -1347,7 +1347,7 @@ Baz ==== "###, &danger - ), + )?, r###"<p>====</p> "###, r###"Setext headings (97)"### @@ -1359,7 +1359,7 @@ Baz --- "###, &danger - ), + )?, r###"<hr /> <hr /> "###, @@ -1372,7 +1372,7 @@ Baz ----- "###, &danger - ), + )?, r###"<ul> <li>foo</li> </ul> @@ -1387,7 +1387,7 @@ Baz --- "###, &danger - ), + )?, r###"<pre><code>foo </code></pre> <hr /> @@ -1401,7 +1401,7 @@ Baz ----- "###, &danger - ), + )?, r###"<blockquote> <p>foo</p> </blockquote> @@ -1416,7 +1416,7 @@ Baz ------ "###, &danger - ), + )?, r###"<h2>> foo</h2> "###, r###"Setext headings (102)"### @@ -1431,7 +1431,7 @@ bar baz "###, &danger - ), + )?, r###"<p>Foo</p> <h2>bar</h2> <p>baz</p> @@ -1449,7 +1449,7 @@ bar baz "###, &danger - ), + )?, r###"<p>Foo bar</p> <hr /> @@ -1466,7 +1466,7 @@ bar baz "###, &danger - ), + )?, r###"<p>Foo bar</p> <hr /> @@ -1483,7 +1483,7 @@ bar baz "###, &danger - ), + )?, r###"<p>Foo bar --- @@ -1498,7 +1498,7 @@ baz</p> indented code block "###, &danger - ), + )?, r###"<pre><code>a simple indented code block </code></pre> @@ -1513,7 +1513,7 @@ baz</p> bar "###, &danger - ), + )?, r###"<ul> <li> <p>foo</p> @@ -1531,7 +1531,7 @@ baz</p> - bar "###, &danger - ), + )?, r###"<ol> <li> <p>foo</p> @@ -1552,7 +1552,7 @@ baz</p> - one "###, &danger - ), + )?, r###"<pre><code><a/> *hi* @@ -1573,7 +1573,7 @@ baz</p> chunk3 "###, &danger - ), + )?, r###"<pre><code>chunk1 chunk2 @@ -1593,7 +1593,7 @@ chunk3 chunk2 "###, &danger - ), + )?, r###"<pre><code>chunk1 chunk2 @@ -1609,7 +1609,7 @@ chunk3 "###, &danger - ), + )?, r###"<p>Foo bar</p> "###, @@ -1622,7 +1622,7 @@ bar</p> bar "###, &danger - ), + )?, r###"<pre><code>foo </code></pre> <p>bar</p> @@ -1640,7 +1640,7 @@ Heading ---- "###, &danger - ), + )?, r###"<h1>Heading</h1> <pre><code>foo </code></pre> @@ -1658,7 +1658,7 @@ Heading bar "###, &danger - ), + )?, r###"<pre><code> foo bar </code></pre> @@ -1675,7 +1675,7 @@ bar "###, &danger - ), + )?, r###"<pre><code>foo </code></pre> "###, @@ -1687,7 +1687,7 @@ bar r###" foo "###, &danger - ), + )?, r###"<pre><code>foo </code></pre> "###, @@ -1702,7 +1702,7 @@ bar ``` "###, &danger - ), + )?, r###"<pre><code>< > </code></pre> @@ -1718,7 +1718,7 @@ bar ~~~ "###, &danger - ), + )?, r###"<pre><code>< > </code></pre> @@ -1733,7 +1733,7 @@ foo `` "###, &danger - ), + )?, r###"<p><code>foo</code></p> "###, r###"Fenced code blocks (121)"### @@ -1747,7 +1747,7 @@ aaa ``` "###, &danger - ), + )?, r###"<pre><code>aaa ~~~ </code></pre> @@ -1763,7 +1763,7 @@ aaa ~~~ "###, &danger - ), + )?, r###"<pre><code>aaa ``` </code></pre> @@ -1779,7 +1779,7 @@ aaa `````` "###, &danger - ), + )?, r###"<pre><code>aaa ``` </code></pre> @@ -1795,7 +1795,7 @@ aaa ~~~~ "###, &danger - ), + )?, r###"<pre><code>aaa ~~~ </code></pre> @@ -1808,7 +1808,7 @@ aaa r###"``` "###, &danger - ), + )?, r###"<pre><code></code></pre> "###, r###"Fenced code blocks (126)"### @@ -1822,7 +1822,7 @@ aaa aaa "###, &danger - ), + )?, r###"<pre><code> ``` aaa @@ -1839,7 +1839,7 @@ aaa bbb "###, &danger - ), + )?, r###"<blockquote> <pre><code>aaa </code></pre> @@ -1857,7 +1857,7 @@ bbb ``` "###, &danger - ), + )?, r###"<pre><code> </code></pre> @@ -1871,7 +1871,7 @@ bbb ``` "###, &danger - ), + )?, r###"<pre><code></code></pre> "###, r###"Fenced code blocks (130)"### @@ -1885,7 +1885,7 @@ aaa ``` "###, &danger - ), + )?, r###"<pre><code>aaa aaa </code></pre> @@ -1902,7 +1902,7 @@ aaa ``` "###, &danger - ), + )?, r###"<pre><code>aaa aaa aaa @@ -1920,7 +1920,7 @@ aaa ``` "###, &danger - ), + )?, r###"<pre><code>aaa aaa aaa @@ -1936,7 +1936,7 @@ aaa ``` "###, &danger - ), + )?, r###"<pre><code>``` aaa ``` @@ -1952,7 +1952,7 @@ aaa ``` "###, &danger - ), + )?, r###"<pre><code>aaa </code></pre> "###, @@ -1966,7 +1966,7 @@ aaa ``` "###, &danger - ), + )?, r###"<pre><code>aaa </code></pre> "###, @@ -1980,7 +1980,7 @@ aaa ``` "###, &danger - ), + )?, r###"<pre><code>aaa ``` </code></pre> @@ -1994,7 +1994,7 @@ aaa aaa "###, &danger - ), + )?, r###"<p><code> </code> aaa</p> "###, @@ -2008,7 +2008,7 @@ aaa ~~~ ~~ "###, &danger - ), + )?, r###"<pre><code>aaa ~~~ ~~ </code></pre> @@ -2025,7 +2025,7 @@ bar baz "###, &danger - ), + )?, r###"<p>foo</p> <pre><code>bar </code></pre> @@ -2044,7 +2044,7 @@ bar # baz "###, &danger - ), + )?, r###"<h2>foo</h2> <pre><code>bar </code></pre> @@ -2062,7 +2062,7 @@ end ``` "###, &danger - ), + )?, r###"<pre><code class="language-ruby">def foo(x) return 3 end @@ -2080,7 +2080,7 @@ end ~~~~~~~ "###, &danger - ), + )?, r###"<pre><code class="language-ruby">def foo(x) return 3 end @@ -2095,7 +2095,7 @@ end ```` "###, &danger - ), + )?, r###"<pre><code class="language-;"></code></pre> "###, r###"Fenced code blocks (144)"### @@ -2107,7 +2107,7 @@ end foo "###, &danger - ), + )?, r###"<p><code>aa</code> foo</p> "###, @@ -2121,7 +2121,7 @@ foo ~~~ "###, &danger - ), + )?, r###"<pre><code class="language-aa">foo </code></pre> "###, @@ -2135,7 +2135,7 @@ foo ``` "###, &danger - ), + )?, r###"<pre><code>``` aaa </code></pre> "###, @@ -2153,7 +2153,7 @@ _world_. </td></tr></table> "###, &danger - ), + )?, r###"<table><tr><td> <pre> **Hello**, @@ -2177,7 +2177,7 @@ _world_. okay. "###, &danger - ), + )?, r###"<table> <tr> <td> @@ -2197,7 +2197,7 @@ okay. <foo><a> "###, &danger - ), + )?, r###" <div> *hello* <foo><a> @@ -2211,7 +2211,7 @@ okay. *foo* "###, &danger - ), + )?, r###"</div> *foo* "###, @@ -2227,7 +2227,7 @@ okay. </DIV> "###, &danger - ), + )?, r###"<DIV CLASS="foo"> <p><em>Markdown</em></p> </DIV> @@ -2242,7 +2242,7 @@ okay. </div> "###, &danger - ), + )?, r###"<div id="foo" class="bar"> </div> @@ -2257,7 +2257,7 @@ okay. </div> "###, &danger - ), + )?, r###"<div id="foo" class="bar baz"> </div> @@ -2273,7 +2273,7 @@ okay. *bar* "###, &danger - ), + )?, r###"<div> *foo* <p><em>bar</em></p> @@ -2287,7 +2287,7 @@ okay. *hi* "###, &danger - ), + )?, r###"<div id="foo" *hi* "###, @@ -2300,7 +2300,7 @@ okay. foo "###, &danger - ), + )?, r###"<div class foo "###, @@ -2313,7 +2313,7 @@ foo *foo* "###, &danger - ), + )?, r###"<div *???-&&&-<--- *foo* "###, @@ -2325,7 +2325,7 @@ foo r###"<div><a href="bar">*foo*</a></div> "###, &danger - ), + )?, r###"<div><a href="bar">*foo*</a></div> "###, r###"HTML blocks (159)"### @@ -2338,7 +2338,7 @@ foo </td></tr></table> "###, &danger - ), + )?, r###"<table><tr><td> foo </td></tr></table> @@ -2354,7 +2354,7 @@ int x = 33; ``` "###, &danger - ), + )?, r###"<div></div> ``` c int x = 33; @@ -2370,7 +2370,7 @@ int x = 33; </a> "###, &danger - ), + )?, r###"<a href="foo"> *bar* </a> @@ -2385,7 +2385,7 @@ int x = 33; </Warning> "###, &danger - ), + )?, r###"<Warning> *bar* </Warning> @@ -2400,7 +2400,7 @@ int x = 33; </i> "###, &danger - ), + )?, r###"<i class="foo"> *bar* </i> @@ -2414,7 +2414,7 @@ int x = 33; *bar* "###, &danger - ), + )?, r###"</ins> *bar* "###, @@ -2428,7 +2428,7 @@ int x = 33; </del> "###, &danger - ), + )?, r###"<del> *foo* </del> @@ -2445,7 +2445,7 @@ int x = 33; </del> "###, &danger - ), + )?, r###"<del> <p><em>foo</em></p> </del> @@ -2458,7 +2458,7 @@ int x = 33; r###"<del>*foo*</del> "###, &danger - ), + )?, r###"<p><del><em>foo</em></del></p> "###, r###"HTML blocks (168)"### @@ -2475,7 +2475,7 @@ main = print $ parseTags tags okay "###, &danger - ), + )?, r###"<pre language="haskell"><code> import Text.HTML.TagSoup @@ -2497,7 +2497,7 @@ document.getElementById("demo").innerHTML = "Hello JavaScript!"; okay "###, &danger - ), + )?, r###"<script type="text/javascript"> // JavaScript example @@ -2519,7 +2519,7 @@ _bar_ </textarea> "###, &danger - ), + )?, r###"<textarea> *foo* @@ -2542,7 +2542,7 @@ p {color:blue;} okay "###, &danger - ), + )?, r###"<style type="text/css"> h1 {color:red;} @@ -2562,7 +2562,7 @@ p {color:blue;} foo "###, &danger - ), + )?, r###"<style type="text/css"> @@ -2579,7 +2579,7 @@ foo bar "###, &danger - ), + )?, r###"<blockquote> <div> foo @@ -2595,7 +2595,7 @@ foo - foo "###, &danger - ), + )?, r###"<ul> <li> <div> @@ -2612,7 +2612,7 @@ foo *foo* "###, &danger - ), + )?, r###"<style>p{color:red;}</style> <p><em>foo</em></p> "###, @@ -2625,7 +2625,7 @@ foo *baz* "###, &danger - ), + )?, r###"<!-- foo -->*bar* <p><em>baz</em></p> "###, @@ -2639,7 +2639,7 @@ foo </script>1. *bar* "###, &danger - ), + )?, r###"<script> foo </script>1. *bar* @@ -2656,7 +2656,7 @@ bar okay "###, &danger - ), + )?, r###"<!-- Foo bar @@ -2676,7 +2676,7 @@ bar okay "###, &danger - ), + )?, r###"<?php echo '>'; @@ -2692,7 +2692,7 @@ okay r###"<!DOCTYPE html> "###, &danger - ), + )?, r###"<!DOCTYPE html> "###, r###"HTML blocks (181)"### @@ -2715,7 +2715,7 @@ function matchwo(a,b) okay "###, &danger - ), + )?, r###"<![CDATA[ function matchwo(a,b) { @@ -2740,7 +2740,7 @@ function matchwo(a,b) <!-- foo --> "###, &danger - ), + )?, r###" <!-- foo --> <pre><code><!-- foo --> </code></pre> @@ -2755,7 +2755,7 @@ function matchwo(a,b) <div> "###, &danger - ), + )?, r###" <div> <pre><code><div> </code></pre> @@ -2771,7 +2771,7 @@ bar </div> "###, &danger - ), + )?, r###"<p>Foo</p> <div> bar @@ -2788,7 +2788,7 @@ bar *foo* "###, &danger - ), + )?, r###"<div> bar </div> @@ -2804,7 +2804,7 @@ bar baz "###, &danger - ), + )?, r###"<p>Foo <a href="bar"> baz</p> @@ -2821,7 +2821,7 @@ baz</p> </div> "###, &danger - ), + )?, r###"<div> <p><em>Emphasized</em> text.</p> </div> @@ -2836,7 +2836,7 @@ baz</p> </div> "###, &danger - ), + )?, r###"<div> *Emphasized* text. </div> @@ -2859,7 +2859,7 @@ Hi </table> "###, &danger - ), + )?, r###"<table> <tr> <td> @@ -2886,7 +2886,7 @@ Hi </table> "###, &danger - ), + )?, r###"<table> <tr> <pre><code><td> @@ -2906,7 +2906,7 @@ Hi [foo] "###, &danger - ), + )?, r###"<p><a href="/url" title="title">foo</a></p> "###, r###"Link reference definitions (192)"### @@ -2921,7 +2921,7 @@ Hi [foo] "###, &danger - ), + )?, r###"<p><a href="/url" title="the title">foo</a></p> "###, r###"Link reference definitions (193)"### @@ -2934,7 +2934,7 @@ Hi [Foo*bar\]] "###, &danger - ), + )?, r###"<p><a href="my_(url)" title="title (with parens)">Foo*bar]</a></p> "###, r###"Link reference definitions (194)"### @@ -2949,7 +2949,7 @@ Hi [Foo bar] "###, &danger - ), + )?, r###"<p><a href="my%20url" title="title">Foo bar</a></p> "###, r###"Link reference definitions (195)"### @@ -2966,7 +2966,7 @@ line2 [foo] "###, &danger - ), + )?, r###"<p><a href="/url" title=" title line1 @@ -2985,7 +2985,7 @@ with blank line' [foo] "###, &danger - ), + )?, r###"<p>[foo]: /url 'title</p> <p>with blank line'</p> <p>[foo]</p> @@ -3001,7 +3001,7 @@ with blank line' [foo] "###, &danger - ), + )?, r###"<p><a href="/url">foo</a></p> "###, r###"Link reference definitions (198)"### @@ -3014,7 +3014,7 @@ with blank line' [foo] "###, &danger - ), + )?, r###"<p>[foo]:</p> <p>[foo]</p> "###, @@ -3028,7 +3028,7 @@ with blank line' [foo] "###, &danger - ), + )?, r###"<p><a href="">foo</a></p> "###, r###"Link reference definitions (200)"### @@ -3041,7 +3041,7 @@ with blank line' [foo] "###, &danger - ), + )?, r###"<p>[foo]: <bar>(baz)</p> <p>[foo]</p> "###, @@ -3055,7 +3055,7 @@ with blank line' [foo] "###, &danger - ), + )?, r###"<p><a href="/url%5Cbar*baz" title="foo"bar\baz">foo</a></p> "###, r###"Link reference definitions (202)"### @@ -3068,7 +3068,7 @@ with blank line' [foo]: url "###, &danger - ), + )?, r###"<p><a href="url">foo</a></p> "###, r###"Link reference definitions (203)"### @@ -3082,7 +3082,7 @@ with blank line' [foo]: second "###, &danger - ), + )?, r###"<p><a href="first">foo</a></p> "###, r###"Link reference definitions (204)"### @@ -3095,7 +3095,7 @@ with blank line' [Foo] "###, &danger - ), + )?, r###"<p><a href="/url">Foo</a></p> "###, r###"Link reference definitions (205)"### @@ -3108,7 +3108,7 @@ with blank line' [αγω] "###, &danger - ), + )?, r###"<p><a href="/%CF%86%CE%BF%CF%85">αγω</a></p> "###, r###"Link reference definitions (206)"### @@ -3119,7 +3119,7 @@ with blank line' r###"[foo]: /url "###, &danger - ), + )?, r###""###, r###"Link reference definitions (207)"### ); @@ -3132,7 +3132,7 @@ foo bar "###, &danger - ), + )?, r###"<p>bar</p> "###, r###"Link reference definitions (208)"### @@ -3143,7 +3143,7 @@ bar r###"[foo]: /url "title" ok "###, &danger - ), + )?, r###"<p>[foo]: /url "title" ok</p> "###, r###"Link reference definitions (209)"### @@ -3155,7 +3155,7 @@ bar "title" ok "###, &danger - ), + )?, r###"<p>"title" ok</p> "###, r###"Link reference definitions (210)"### @@ -3168,7 +3168,7 @@ bar [foo] "###, &danger - ), + )?, r###"<pre><code>[foo]: /url "title" </code></pre> <p>[foo]</p> @@ -3185,7 +3185,7 @@ bar [foo] "###, &danger - ), + )?, r###"<pre><code>[foo]: /url </code></pre> <p>[foo]</p> @@ -3201,7 +3201,7 @@ bar [bar] "###, &danger - ), + )?, r###"<p>Foo [bar]: /baz</p> <p>[bar]</p> @@ -3216,7 +3216,7 @@ bar > bar "###, &danger - ), + )?, r###"<h1><a href="/url">Foo</a></h1> <blockquote> <p>bar</p> @@ -3233,7 +3233,7 @@ bar [foo] "###, &danger - ), + )?, r###"<h1>bar</h1> <p><a href="/url">foo</a></p> "###, @@ -3247,7 +3247,7 @@ bar [foo] "###, &danger - ), + )?, r###"<p>=== <a href="/url">foo</a></p> "###, @@ -3266,7 +3266,7 @@ bar [baz] "###, &danger - ), + )?, r###"<p><a href="/foo-url" title="foo">foo</a>, <a href="/bar-url" title="bar">bar</a>, <a href="/baz-url">baz</a></p> @@ -3281,7 +3281,7 @@ bar > [foo]: /url "###, &danger - ), + )?, r###"<p><a href="/url">foo</a></p> <blockquote> </blockquote> @@ -3296,7 +3296,7 @@ bar bbb "###, &danger - ), + )?, r###"<p>aaa</p> <p>bbb</p> "###, @@ -3312,7 +3312,7 @@ ccc ddd "###, &danger - ), + )?, r###"<p>aaa bbb</p> <p>ccc @@ -3329,7 +3329,7 @@ ddd</p> bbb "###, &danger - ), + )?, r###"<p>aaa</p> <p>bbb</p> "###, @@ -3342,7 +3342,7 @@ bbb bbb "###, &danger - ), + )?, r###"<p>aaa bbb</p> "###, @@ -3356,7 +3356,7 @@ bbb</p> ccc "###, &danger - ), + )?, r###"<p>aaa bbb ccc</p> @@ -3370,7 +3370,7 @@ ccc</p> bbb "###, &danger - ), + )?, r###"<p>aaa bbb</p> "###, @@ -3383,7 +3383,7 @@ bbb</p> bbb "###, &danger - ), + )?, r###"<pre><code>aaa </code></pre> <p>bbb</p> @@ -3397,7 +3397,7 @@ bbb bbb "###, &danger - ), + )?, r###"<p>aaa<br /> bbb</p> "###, @@ -3416,7 +3416,7 @@ aaa "###, &danger - ), + )?, r###"<p>aaa</p> <h1>aaa</h1> "###, @@ -3430,7 +3430,7 @@ aaa > baz "###, &danger - ), + )?, r###"<blockquote> <h1>Foo</h1> <p>bar @@ -3447,7 +3447,7 @@ baz</p> > baz "###, &danger - ), + )?, r###"<blockquote> <h1>Foo</h1> <p>bar @@ -3464,7 +3464,7 @@ baz</p> > baz "###, &danger - ), + )?, r###"<blockquote> <h1>Foo</h1> <p>bar @@ -3481,7 +3481,7 @@ baz</p> > baz "###, &danger - ), + )?, r###"<pre><code>> # Foo > bar > baz @@ -3497,7 +3497,7 @@ baz</p> baz "###, &danger - ), + )?, r###"<blockquote> <h1>Foo</h1> <p>bar @@ -3514,7 +3514,7 @@ baz > foo "###, &danger - ), + )?, r###"<blockquote> <p>bar baz @@ -3530,7 +3530,7 @@ foo</p> --- "###, &danger - ), + )?, r###"<blockquote> <p>foo</p> </blockquote> @@ -3545,7 +3545,7 @@ foo</p> - bar "###, &danger - ), + )?, r###"<blockquote> <ul> <li>foo</li> @@ -3564,7 +3564,7 @@ foo</p> bar "###, &danger - ), + )?, r###"<blockquote> <pre><code>foo </code></pre> @@ -3582,7 +3582,7 @@ foo ``` "###, &danger - ), + )?, r###"<blockquote> <pre><code></code></pre> </blockquote> @@ -3598,7 +3598,7 @@ foo - bar "###, &danger - ), + )?, r###"<blockquote> <p>foo - bar</p> @@ -3612,7 +3612,7 @@ foo r###"> "###, &danger - ), + )?, r###"<blockquote> </blockquote> "###, @@ -3626,7 +3626,7 @@ foo > "###, &danger - ), + )?, r###"<blockquote> </blockquote> "###, @@ -3640,7 +3640,7 @@ foo > "###, &danger - ), + )?, r###"<blockquote> <p>foo</p> </blockquote> @@ -3655,7 +3655,7 @@ foo > bar "###, &danger - ), + )?, r###"<blockquote> <p>foo</p> </blockquote> @@ -3672,7 +3672,7 @@ foo > bar "###, &danger - ), + )?, r###"<blockquote> <p>foo bar</p> @@ -3688,7 +3688,7 @@ bar</p> > bar "###, &danger - ), + )?, r###"<blockquote> <p>foo</p> <p>bar</p> @@ -3703,7 +3703,7 @@ bar</p> > bar "###, &danger - ), + )?, r###"<p>foo</p> <blockquote> <p>bar</p> @@ -3719,7 +3719,7 @@ bar</p> > bbb "###, &danger - ), + )?, r###"<blockquote> <p>aaa</p> </blockquote> @@ -3737,7 +3737,7 @@ bar</p> baz "###, &danger - ), + )?, r###"<blockquote> <p>bar baz</p> @@ -3753,7 +3753,7 @@ baz</p> baz "###, &danger - ), + )?, r###"<blockquote> <p>bar</p> </blockquote> @@ -3769,7 +3769,7 @@ baz baz "###, &danger - ), + )?, r###"<blockquote> <p>bar</p> </blockquote> @@ -3784,7 +3784,7 @@ baz bar "###, &danger - ), + )?, r###"<blockquote> <blockquote> <blockquote> @@ -3804,7 +3804,7 @@ bar</p> >>baz "###, &danger - ), + )?, r###"<blockquote> <blockquote> <blockquote> @@ -3825,7 +3825,7 @@ baz</p> > not code "###, &danger - ), + )?, r###"<blockquote> <pre><code>code </code></pre> @@ -3847,7 +3847,7 @@ with two lines. > A block quote. "###, &danger - ), + )?, r###"<p>A paragraph with two lines.</p> <pre><code>indented code @@ -3869,7 +3869,7 @@ with two lines.</p> > A block quote. "###, &danger - ), + )?, r###"<ol> <li> <p>A paragraph @@ -3892,7 +3892,7 @@ with two lines.</p> two "###, &danger - ), + )?, r###"<ul> <li>one</li> </ul> @@ -3908,7 +3908,7 @@ with two lines.</p> two "###, &danger - ), + )?, r###"<ul> <li> <p>one</p> @@ -3926,7 +3926,7 @@ with two lines.</p> two "###, &danger - ), + )?, r###"<ul> <li>one</li> </ul> @@ -3943,7 +3943,7 @@ with two lines.</p> two "###, &danger - ), + )?, r###"<ul> <li> <p>one</p> @@ -3961,7 +3961,7 @@ with two lines.</p> >> two "###, &danger - ), + )?, r###"<blockquote> <blockquote> <ol> @@ -3983,7 +3983,7 @@ with two lines.</p> > > two "###, &danger - ), + )?, r###"<blockquote> <blockquote> <ul> @@ -4003,7 +4003,7 @@ with two lines.</p> 2.two "###, &danger - ), + )?, r###"<p>-one</p> <p>2.two</p> "###, @@ -4018,7 +4018,7 @@ with two lines.</p> bar "###, &danger - ), + )?, r###"<ul> <li> <p>foo</p> @@ -4042,7 +4042,7 @@ with two lines.</p> > bam "###, &danger - ), + )?, r###"<ol> <li> <p>foo</p> @@ -4068,7 +4068,7 @@ with two lines.</p> baz "###, &danger - ), + )?, r###"<ul> <li> <p>Foo</p> @@ -4088,7 +4088,7 @@ baz r###"123456789. ok "###, &danger - ), + )?, r###"<ol start="123456789"> <li>ok</li> </ol> @@ -4101,7 +4101,7 @@ baz r###"1234567890. not ok "###, &danger - ), + )?, r###"<p>1234567890. not ok</p> "###, r###"List items (266)"### @@ -4112,7 +4112,7 @@ baz r###"0. ok "###, &danger - ), + )?, r###"<ol start="0"> <li>ok</li> </ol> @@ -4125,7 +4125,7 @@ baz r###"003. ok "###, &danger - ), + )?, r###"<ol start="3"> <li>ok</li> </ol> @@ -4138,7 +4138,7 @@ baz r###"-1. not ok "###, &danger - ), + )?, r###"<p>-1. not ok</p> "###, r###"List items (269)"### @@ -4151,7 +4151,7 @@ baz bar "###, &danger - ), + )?, r###"<ul> <li> <p>foo</p> @@ -4170,7 +4170,7 @@ baz bar "###, &danger - ), + )?, r###"<ol start="10"> <li> <p>foo</p> @@ -4191,7 +4191,7 @@ paragraph more code "###, &danger - ), + )?, r###"<pre><code>indented code </code></pre> <p>paragraph</p> @@ -4210,7 +4210,7 @@ paragraph more code "###, &danger - ), + )?, r###"<ol> <li> <pre><code>indented code @@ -4233,7 +4233,7 @@ paragraph more code "###, &danger - ), + )?, r###"<ol> <li> <pre><code> indented code @@ -4254,7 +4254,7 @@ paragraph bar "###, &danger - ), + )?, r###"<p>foo</p> <p>bar</p> "###, @@ -4268,7 +4268,7 @@ bar bar "###, &danger - ), + )?, r###"<ul> <li>foo</li> </ul> @@ -4284,7 +4284,7 @@ bar bar "###, &danger - ), + )?, r###"<ul> <li> <p>foo</p> @@ -4307,7 +4307,7 @@ bar baz "###, &danger - ), + )?, r###"<ul> <li>foo</li> <li> @@ -4329,7 +4329,7 @@ bar foo "###, &danger - ), + )?, r###"<ul> <li>foo</li> </ul> @@ -4344,7 +4344,7 @@ bar foo "###, &danger - ), + )?, r###"<ul> <li></li> </ul> @@ -4360,7 +4360,7 @@ bar - bar "###, &danger - ), + )?, r###"<ul> <li>foo</li> <li></li> @@ -4377,7 +4377,7 @@ bar - bar "###, &danger - ), + )?, r###"<ul> <li>foo</li> <li></li> @@ -4394,7 +4394,7 @@ bar 3. bar "###, &danger - ), + )?, r###"<ol> <li>foo</li> <li></li> @@ -4409,7 +4409,7 @@ bar r###"* "###, &danger - ), + )?, r###"<ul> <li></li> </ul> @@ -4426,7 +4426,7 @@ foo 1. "###, &danger - ), + )?, r###"<p>foo *</p> <p>foo @@ -4445,7 +4445,7 @@ foo > A block quote. "###, &danger - ), + )?, r###"<ol> <li> <p>A paragraph @@ -4471,7 +4471,7 @@ with two lines.</p> > A block quote. "###, &danger - ), + )?, r###"<ol> <li> <p>A paragraph @@ -4497,7 +4497,7 @@ with two lines.</p> > A block quote. "###, &danger - ), + )?, r###"<ol> <li> <p>A paragraph @@ -4523,7 +4523,7 @@ with two lines.</p> > A block quote. "###, &danger - ), + )?, r###"<pre><code>1. A paragraph with two lines. @@ -4545,7 +4545,7 @@ with two lines. > A block quote. "###, &danger - ), + )?, r###"<ol> <li> <p>A paragraph @@ -4567,7 +4567,7 @@ with two lines.</p> with two lines. "###, &danger - ), + )?, r###"<ol> <li>A paragraph with two lines.</li> @@ -4582,7 +4582,7 @@ with two lines.</li> continued here. "###, &danger - ), + )?, r###"<blockquote> <ol> <li> @@ -4603,7 +4603,7 @@ continued here.</p> > continued here. "###, &danger - ), + )?, r###"<blockquote> <ol> <li> @@ -4626,7 +4626,7 @@ continued here.</p> - boo "###, &danger - ), + )?, r###"<ul> <li>foo <ul> @@ -4654,7 +4654,7 @@ continued here.</p> - boo "###, &danger - ), + )?, r###"<ul> <li>foo</li> <li>bar</li> @@ -4671,7 +4671,7 @@ continued here.</p> - bar "###, &danger - ), + )?, r###"<ol start="10"> <li>foo <ul> @@ -4689,7 +4689,7 @@ continued here.</p> - bar "###, &danger - ), + )?, r###"<ol start="10"> <li>foo</li> </ol> @@ -4705,7 +4705,7 @@ continued here.</p> r###"- - foo "###, &danger - ), + )?, r###"<ul> <li> <ul> @@ -4722,7 +4722,7 @@ continued here.</p> r###"1. - 2. foo "###, &danger - ), + )?, r###"<ol> <li> <ul> @@ -4746,7 +4746,7 @@ continued here.</p> baz "###, &danger - ), + )?, r###"<ul> <li> <h1>Foo</h1> @@ -4766,7 +4766,7 @@ baz</li> + baz "###, &danger - ), + )?, r###"<ul> <li>foo</li> <li>bar</li> @@ -4785,7 +4785,7 @@ baz</li> 3) baz "###, &danger - ), + )?, r###"<ol> <li>foo</li> <li>bar</li> @@ -4804,7 +4804,7 @@ baz</li> - baz "###, &danger - ), + )?, r###"<p>Foo</p> <ul> <li>bar</li> @@ -4820,7 +4820,7 @@ baz</li> 14. The number of doors is 6. "###, &danger - ), + )?, r###"<p>The number of windows in my house is 14. The number of doors is 6.</p> "###, @@ -4833,7 +4833,7 @@ baz</li> 1. The number of doors is 6. "###, &danger - ), + )?, r###"<p>The number of windows in my house is</p> <ol> <li>The number of doors is 6.</li> @@ -4852,7 +4852,7 @@ baz</li> - baz "###, &danger - ), + )?, r###"<ul> <li> <p>foo</p> @@ -4878,7 +4878,7 @@ baz</li> bim "###, &danger - ), + )?, r###"<ul> <li>foo <ul> @@ -4908,7 +4908,7 @@ baz</li> - bim "###, &danger - ), + )?, r###"<ul> <li>foo</li> <li>bar</li> @@ -4935,7 +4935,7 @@ baz</li> code "###, &danger - ), + )?, r###"<ul> <li> <p>foo</p> @@ -4963,7 +4963,7 @@ baz</li> - g "###, &danger - ), + )?, r###"<ul> <li>a</li> <li>b</li> @@ -4986,7 +4986,7 @@ baz</li> 3. c "###, &danger - ), + )?, r###"<ol> <li> <p>a</p> @@ -5011,7 +5011,7 @@ baz</li> - e "###, &danger - ), + )?, r###"<ul> <li>a</li> <li>b</li> @@ -5032,7 +5032,7 @@ baz</li> 3. c "###, &danger - ), + )?, r###"<ol> <li> <p>a</p> @@ -5055,7 +5055,7 @@ baz</li> - c "###, &danger - ), + )?, r###"<ul> <li> <p>a</p> @@ -5079,7 +5079,7 @@ baz</li> * c "###, &danger - ), + )?, r###"<ul> <li> <p>a</p> @@ -5102,7 +5102,7 @@ baz</li> - d "###, &danger - ), + )?, r###"<ul> <li> <p>a</p> @@ -5128,7 +5128,7 @@ baz</li> - d "###, &danger - ), + )?, r###"<ul> <li> <p>a</p> @@ -5155,7 +5155,7 @@ baz</li> - c "###, &danger - ), + )?, r###"<ul> <li>a</li> <li> @@ -5179,7 +5179,7 @@ baz</li> - d "###, &danger - ), + )?, r###"<ul> <li>a <ul> @@ -5203,7 +5203,7 @@ baz</li> * c "###, &danger - ), + )?, r###"<ul> <li>a <blockquote> @@ -5226,7 +5226,7 @@ baz</li> - d "###, &danger - ), + )?, r###"<ul> <li>a <blockquote> @@ -5246,7 +5246,7 @@ baz</li> r###"- a "###, &danger - ), + )?, r###"<ul> <li>a</li> </ul> @@ -5260,7 +5260,7 @@ baz</li> - b "###, &danger - ), + )?, r###"<ul> <li>a <ul> @@ -5281,7 +5281,7 @@ baz</li> bar "###, &danger - ), + )?, r###"<ol> <li> <pre><code>foo @@ -5301,7 +5301,7 @@ baz</li> baz "###, &danger - ), + )?, r###"<ul> <li> <p>foo</p> @@ -5326,7 +5326,7 @@ baz</li> - f "###, &danger - ), + )?, r###"<ul> <li> <p>a</p> @@ -5352,7 +5352,7 @@ baz</li> r###"`hi`lo` "###, &danger - ), + )?, r###"<p><code>hi</code>lo`</p> "###, r###"Inlines (327)"### @@ -5363,7 +5363,7 @@ baz</li> r###"`foo` "###, &danger - ), + )?, r###"<p><code>foo</code></p> "###, r###"Code spans (328)"### @@ -5374,7 +5374,7 @@ baz</li> r###"`` foo ` bar `` "###, &danger - ), + )?, r###"<p><code>foo ` bar</code></p> "###, r###"Code spans (329)"### @@ -5385,7 +5385,7 @@ baz</li> r###"` `` ` "###, &danger - ), + )?, r###"<p><code>``</code></p> "###, r###"Code spans (330)"### @@ -5396,7 +5396,7 @@ baz</li> r###"` `` ` "###, &danger - ), + )?, r###"<p><code> `` </code></p> "###, r###"Code spans (331)"### @@ -5407,7 +5407,7 @@ baz</li> r###"` a` "###, &danger - ), + )?, r###"<p><code> a</code></p> "###, r###"Code spans (332)"### @@ -5418,7 +5418,7 @@ baz</li> r###"` b ` "###, &danger - ), + )?, r###"<p><code> b </code></p> "###, r###"Code spans (333)"### @@ -5430,7 +5430,7 @@ baz</li> ` ` "###, &danger - ), + )?, r###"<p><code> </code> <code> </code></p> "###, @@ -5446,7 +5446,7 @@ baz `` "###, &danger - ), + )?, r###"<p><code>foo bar baz</code></p> "###, r###"Code spans (335)"### @@ -5459,7 +5459,7 @@ foo `` "###, &danger - ), + )?, r###"<p><code>foo </code></p> "###, r###"Code spans (336)"### @@ -5471,7 +5471,7 @@ foo baz` "###, &danger - ), + )?, r###"<p><code>foo bar baz</code></p> "###, r###"Code spans (337)"### @@ -5482,7 +5482,7 @@ baz` r###"`foo\`bar` "###, &danger - ), + )?, r###"<p><code>foo\</code>bar`</p> "###, r###"Code spans (338)"### @@ -5493,7 +5493,7 @@ baz` r###"``foo`bar`` "###, &danger - ), + )?, r###"<p><code>foo`bar</code></p> "###, r###"Code spans (339)"### @@ -5504,7 +5504,7 @@ baz` r###"` foo `` bar ` "###, &danger - ), + )?, r###"<p><code>foo `` bar</code></p> "###, r###"Code spans (340)"### @@ -5515,7 +5515,7 @@ baz` r###"*foo`*` "###, &danger - ), + )?, r###"<p>*foo<code>*</code></p> "###, r###"Code spans (341)"### @@ -5526,7 +5526,7 @@ baz` r###"[not a `link](/foo`) "###, &danger - ), + )?, r###"<p>[not a <code>link](/foo</code>)</p> "###, r###"Code spans (342)"### @@ -5537,7 +5537,7 @@ baz` r###"`<a href="`">` "###, &danger - ), + )?, r###"<p><code><a href="</code>">`</p> "###, r###"Code spans (343)"### @@ -5548,7 +5548,7 @@ baz` r###"<a href="`">` "###, &danger - ), + )?, r###"<p><a href="`">`</p> "###, r###"Code spans (344)"### @@ -5559,7 +5559,7 @@ baz` r###"`<http://foo.bar.`baz>` "###, &danger - ), + )?, r###"<p><code><http://foo.bar.</code>baz>`</p> "###, r###"Code spans (345)"### @@ -5570,7 +5570,7 @@ baz` r###"<http://foo.bar.`baz>` "###, &danger - ), + )?, r###"<p><a href="http://foo.bar.%60baz">http://foo.bar.`baz</a>`</p> "###, r###"Code spans (346)"### @@ -5581,7 +5581,7 @@ baz` r###"```foo`` "###, &danger - ), + )?, r###"<p>```foo``</p> "###, r###"Code spans (347)"### @@ -5592,7 +5592,7 @@ baz` r###"`foo "###, &danger - ), + )?, r###"<p>`foo</p> "###, r###"Code spans (348)"### @@ -5603,7 +5603,7 @@ baz` r###"`foo``bar`` "###, &danger - ), + )?, r###"<p>`foo<code>bar</code></p> "###, r###"Code spans (349)"### @@ -5614,7 +5614,7 @@ baz` r###"*foo bar* "###, &danger - ), + )?, r###"<p><em>foo bar</em></p> "###, r###"Emphasis and strong emphasis (350)"### @@ -5625,7 +5625,7 @@ baz` r###"a * foo bar* "###, &danger - ), + )?, r###"<p>a * foo bar*</p> "###, r###"Emphasis and strong emphasis (351)"### @@ -5636,7 +5636,7 @@ baz` r###"a*"foo"* "###, &danger - ), + )?, r###"<p>a*"foo"*</p> "###, r###"Emphasis and strong emphasis (352)"### @@ -5647,7 +5647,7 @@ baz` r###"* a * "###, &danger - ), + )?, r###"<p>* a *</p> "###, r###"Emphasis and strong emphasis (353)"### @@ -5658,7 +5658,7 @@ baz` r###"foo*bar* "###, &danger - ), + )?, r###"<p>foo<em>bar</em></p> "###, r###"Emphasis and strong emphasis (354)"### @@ -5669,7 +5669,7 @@ baz` r###"5*6*78 "###, &danger - ), + )?, r###"<p>5<em>6</em>78</p> "###, r###"Emphasis and strong emphasis (355)"### @@ -5680,7 +5680,7 @@ baz` r###"_foo bar_ "###, &danger - ), + )?, r###"<p><em>foo bar</em></p> "###, r###"Emphasis and strong emphasis (356)"### @@ -5691,7 +5691,7 @@ baz` r###"_ foo bar_ "###, &danger - ), + )?, r###"<p>_ foo bar_</p> "###, r###"Emphasis and strong emphasis (357)"### @@ -5702,7 +5702,7 @@ baz` r###"a_"foo"_ "###, &danger - ), + )?, r###"<p>a_"foo"_</p> "###, r###"Emphasis and strong emphasis (358)"### @@ -5713,7 +5713,7 @@ baz` r###"foo_bar_ "###, &danger - ), + )?, r###"<p>foo_bar_</p> "###, r###"Emphasis and strong emphasis (359)"### @@ -5724,7 +5724,7 @@ baz` r###"5_6_78 "###, &danger - ), + )?, r###"<p>5_6_78</p> "###, r###"Emphasis and strong emphasis (360)"### @@ -5735,7 +5735,7 @@ baz` r###"пристаням_стремятся_ "###, &danger - ), + )?, r###"<p>пристаням_стремятся_</p> "###, r###"Emphasis and strong emphasis (361)"### @@ -5746,7 +5746,7 @@ baz` r###"aa_"bb"_cc "###, &danger - ), + )?, r###"<p>aa_"bb"_cc</p> "###, r###"Emphasis and strong emphasis (362)"### @@ -5757,7 +5757,7 @@ baz` r###"foo-_(bar)_ "###, &danger - ), + )?, r###"<p>foo-<em>(bar)</em></p> "###, r###"Emphasis and strong emphasis (363)"### @@ -5768,7 +5768,7 @@ baz` r###"_foo* "###, &danger - ), + )?, r###"<p>_foo*</p> "###, r###"Emphasis and strong emphasis (364)"### @@ -5779,7 +5779,7 @@ baz` r###"*foo bar * "###, &danger - ), + )?, r###"<p>*foo bar *</p> "###, r###"Emphasis and strong emphasis (365)"### @@ -5791,7 +5791,7 @@ baz` * "###, &danger - ), + )?, r###"<p>*foo bar *</p> "###, @@ -5803,7 +5803,7 @@ baz` r###"*(*foo) "###, &danger - ), + )?, r###"<p>*(*foo)</p> "###, r###"Emphasis and strong emphasis (367)"### @@ -5814,7 +5814,7 @@ baz` r###"*(*foo*)* "###, &danger - ), + )?, r###"<p><em>(<em>foo</em>)</em></p> "###, r###"Emphasis and strong emphasis (368)"### @@ -5825,7 +5825,7 @@ baz` r###"*foo*bar "###, &danger - ), + )?, r###"<p><em>foo</em>bar</p> "###, r###"Emphasis and strong emphasis (369)"### @@ -5836,7 +5836,7 @@ baz` r###"_foo bar _ "###, &danger - ), + )?, r###"<p>_foo bar _</p> "###, r###"Emphasis and strong emphasis (370)"### @@ -5847,7 +5847,7 @@ baz` r###"_(_foo) "###, &danger - ), + )?, r###"<p>_(_foo)</p> "###, r###"Emphasis and strong emphasis (371)"### @@ -5858,7 +5858,7 @@ baz` r###"_(_foo_)_ "###, &danger - ), + )?, r###"<p><em>(<em>foo</em>)</em></p> "###, r###"Emphasis and strong emphasis (372)"### @@ -5869,7 +5869,7 @@ baz` r###"_foo_bar "###, &danger - ), + )?, r###"<p>_foo_bar</p> "###, r###"Emphasis and strong emphasis (373)"### @@ -5880,7 +5880,7 @@ baz` r###"_пристаням_стремятся "###, &danger - ), + )?, r###"<p>_пристаням_стремятся</p> "###, r###"Emphasis and strong emphasis (374)"### @@ -5891,7 +5891,7 @@ baz` r###"_foo_bar_baz_ "###, &danger - ), + )?, r###"<p><em>foo_bar_baz</em></p> "###, r###"Emphasis and strong emphasis (375)"### @@ -5902,7 +5902,7 @@ baz` r###"_(bar)_. "###, &danger - ), + )?, r###"<p><em>(bar)</em>.</p> "###, r###"Emphasis and strong emphasis (376)"### @@ -5913,7 +5913,7 @@ baz` r###"**foo bar** "###, &danger - ), + )?, r###"<p><strong>foo bar</strong></p> "###, r###"Emphasis and strong emphasis (377)"### @@ -5924,7 +5924,7 @@ baz` r###"** foo bar** "###, &danger - ), + )?, r###"<p>** foo bar**</p> "###, r###"Emphasis and strong emphasis (378)"### @@ -5935,7 +5935,7 @@ baz` r###"a**"foo"** "###, &danger - ), + )?, r###"<p>a**"foo"**</p> "###, r###"Emphasis and strong emphasis (379)"### @@ -5946,7 +5946,7 @@ baz` r###"foo**bar** "###, &danger - ), + )?, r###"<p>foo<strong>bar</strong></p> "###, r###"Emphasis and strong emphasis (380)"### @@ -5957,7 +5957,7 @@ baz` r###"__foo bar__ "###, &danger - ), + )?, r###"<p><strong>foo bar</strong></p> "###, r###"Emphasis and strong emphasis (381)"### @@ -5968,7 +5968,7 @@ baz` r###"__ foo bar__ "###, &danger - ), + )?, r###"<p>__ foo bar__</p> "###, r###"Emphasis and strong emphasis (382)"### @@ -5980,7 +5980,7 @@ baz` foo bar__ "###, &danger - ), + )?, r###"<p>__ foo bar__</p> "###, @@ -5992,7 +5992,7 @@ foo bar__</p> r###"a__"foo"__ "###, &danger - ), + )?, r###"<p>a__"foo"__</p> "###, r###"Emphasis and strong emphasis (384)"### @@ -6003,7 +6003,7 @@ foo bar__</p> r###"foo__bar__ "###, &danger - ), + )?, r###"<p>foo__bar__</p> "###, r###"Emphasis and strong emphasis (385)"### @@ -6014,7 +6014,7 @@ foo bar__</p> r###"5__6__78 "###, &danger - ), + )?, r###"<p>5__6__78</p> "###, r###"Emphasis and strong emphasis (386)"### @@ -6025,7 +6025,7 @@ foo bar__</p> r###"пристаням__стремятся__ "###, &danger - ), + )?, r###"<p>пристаням__стремятся__</p> "###, r###"Emphasis and strong emphasis (387)"### @@ -6036,7 +6036,7 @@ foo bar__</p> r###"__foo, __bar__, baz__ "###, &danger - ), + )?, r###"<p><strong>foo, <strong>bar</strong>, baz</strong></p> "###, r###"Emphasis and strong emphasis (388)"### @@ -6047,7 +6047,7 @@ foo bar__</p> r###"foo-__(bar)__ "###, &danger - ), + )?, r###"<p>foo-<strong>(bar)</strong></p> "###, r###"Emphasis and strong emphasis (389)"### @@ -6058,7 +6058,7 @@ foo bar__</p> r###"**foo bar ** "###, &danger - ), + )?, r###"<p>**foo bar **</p> "###, r###"Emphasis and strong emphasis (390)"### @@ -6069,7 +6069,7 @@ foo bar__</p> r###"**(**foo) "###, &danger - ), + )?, r###"<p>**(**foo)</p> "###, r###"Emphasis and strong emphasis (391)"### @@ -6080,7 +6080,7 @@ foo bar__</p> r###"*(**foo**)* "###, &danger - ), + )?, r###"<p><em>(<strong>foo</strong>)</em></p> "###, r###"Emphasis and strong emphasis (392)"### @@ -6092,7 +6092,7 @@ foo bar__</p> *Asclepias physocarpa*)** "###, &danger - ), + )?, r###"<p><strong>Gomphocarpus (<em>Gomphocarpus physocarpus</em>, syn. <em>Asclepias physocarpa</em>)</strong></p> "###, @@ -6104,7 +6104,7 @@ foo bar__</p> r###"**foo "*bar*" foo** "###, &danger - ), + )?, r###"<p><strong>foo "<em>bar</em>" foo</strong></p> "###, r###"Emphasis and strong emphasis (394)"### @@ -6115,7 +6115,7 @@ foo bar__</p> r###"**foo**bar "###, &danger - ), + )?, r###"<p><strong>foo</strong>bar</p> "###, r###"Emphasis and strong emphasis (395)"### @@ -6126,7 +6126,7 @@ foo bar__</p> r###"__foo bar __ "###, &danger - ), + )?, r###"<p>__foo bar __</p> "###, r###"Emphasis and strong emphasis (396)"### @@ -6137,7 +6137,7 @@ foo bar__</p> r###"__(__foo) "###, &danger - ), + )?, r###"<p>__(__foo)</p> "###, r###"Emphasis and strong emphasis (397)"### @@ -6148,7 +6148,7 @@ foo bar__</p> r###"_(__foo__)_ "###, &danger - ), + )?, r###"<p><em>(<strong>foo</strong>)</em></p> "###, r###"Emphasis and strong emphasis (398)"### @@ -6159,7 +6159,7 @@ foo bar__</p> r###"__foo__bar "###, &danger - ), + )?, r###"<p>__foo__bar</p> "###, r###"Emphasis and strong emphasis (399)"### @@ -6170,7 +6170,7 @@ foo bar__</p> r###"__пристаням__стремятся "###, &danger - ), + )?, r###"<p>__пристаням__стремятся</p> "###, r###"Emphasis and strong emphasis (400)"### @@ -6181,7 +6181,7 @@ foo bar__</p> r###"__foo__bar__baz__ "###, &danger - ), + )?, r###"<p><strong>foo__bar__baz</strong></p> "###, r###"Emphasis and strong emphasis (401)"### @@ -6192,7 +6192,7 @@ foo bar__</p> r###"__(bar)__. "###, &danger - ), + )?, r###"<p><strong>(bar)</strong>.</p> "###, r###"Emphasis and strong emphasis (402)"### @@ -6203,7 +6203,7 @@ foo bar__</p> r###"*foo [bar](/url)* "###, &danger - ), + )?, r###"<p><em>foo <a href="/url">bar</a></em></p> "###, r###"Emphasis and strong emphasis (403)"### @@ -6215,7 +6215,7 @@ foo bar__</p> bar* "###, &danger - ), + )?, r###"<p><em>foo bar</em></p> "###, @@ -6227,7 +6227,7 @@ bar</em></p> r###"_foo __bar__ baz_ "###, &danger - ), + )?, r###"<p><em>foo <strong>bar</strong> baz</em></p> "###, r###"Emphasis and strong emphasis (405)"### @@ -6238,7 +6238,7 @@ bar</em></p> r###"_foo _bar_ baz_ "###, &danger - ), + )?, r###"<p><em>foo <em>bar</em> baz</em></p> "###, r###"Emphasis and strong emphasis (406)"### @@ -6249,7 +6249,7 @@ bar</em></p> r###"__foo_ bar_ "###, &danger - ), + )?, r###"<p><em><em>foo</em> bar</em></p> "###, r###"Emphasis and strong emphasis (407)"### @@ -6260,7 +6260,7 @@ bar</em></p> r###"*foo *bar** "###, &danger - ), + )?, r###"<p><em>foo <em>bar</em></em></p> "###, r###"Emphasis and strong emphasis (408)"### @@ -6271,7 +6271,7 @@ bar</em></p> r###"*foo **bar** baz* "###, &danger - ), + )?, r###"<p><em>foo <strong>bar</strong> baz</em></p> "###, r###"Emphasis and strong emphasis (409)"### @@ -6282,7 +6282,7 @@ bar</em></p> r###"*foo**bar**baz* "###, &danger - ), + )?, r###"<p><em>foo<strong>bar</strong>baz</em></p> "###, r###"Emphasis and strong emphasis (410)"### @@ -6293,7 +6293,7 @@ bar</em></p> r###"*foo**bar* "###, &danger - ), + )?, r###"<p><em>foo**bar</em></p> "###, r###"Emphasis and strong emphasis (411)"### @@ -6304,7 +6304,7 @@ bar</em></p> r###"***foo** bar* "###, &danger - ), + )?, r###"<p><em><strong>foo</strong> bar</em></p> "###, r###"Emphasis and strong emphasis (412)"### @@ -6315,7 +6315,7 @@ bar</em></p> r###"*foo **bar*** "###, &danger - ), + )?, r###"<p><em>foo <strong>bar</strong></em></p> "###, r###"Emphasis and strong emphasis (413)"### @@ -6326,7 +6326,7 @@ bar</em></p> r###"*foo**bar*** "###, &danger - ), + )?, r###"<p><em>foo<strong>bar</strong></em></p> "###, r###"Emphasis and strong emphasis (414)"### @@ -6337,7 +6337,7 @@ bar</em></p> r###"foo***bar***baz "###, &danger - ), + )?, r###"<p>foo<em><strong>bar</strong></em>baz</p> "###, r###"Emphasis and strong emphasis (415)"### @@ -6348,7 +6348,7 @@ bar</em></p> r###"foo******bar*********baz "###, &danger - ), + )?, r###"<p>foo<strong><strong><strong>bar</strong></strong></strong>***baz</p> "###, r###"Emphasis and strong emphasis (416)"### @@ -6359,7 +6359,7 @@ bar</em></p> r###"*foo **bar *baz* bim** bop* "###, &danger - ), + )?, r###"<p><em>foo <strong>bar <em>baz</em> bim</strong> bop</em></p> "###, r###"Emphasis and strong emphasis (417)"### @@ -6370,7 +6370,7 @@ bar</em></p> r###"*foo [*bar*](/url)* "###, &danger - ), + )?, r###"<p><em>foo <a href="/url"><em>bar</em></a></em></p> "###, r###"Emphasis and strong emphasis (418)"### @@ -6381,7 +6381,7 @@ bar</em></p> r###"** is not an empty emphasis "###, &danger - ), + )?, r###"<p>** is not an empty emphasis</p> "###, r###"Emphasis and strong emphasis (419)"### @@ -6392,7 +6392,7 @@ bar</em></p> r###"**** is not an empty strong emphasis "###, &danger - ), + )?, r###"<p>**** is not an empty strong emphasis</p> "###, r###"Emphasis and strong emphasis (420)"### @@ -6403,7 +6403,7 @@ bar</em></p> r###"**foo [bar](/url)** "###, &danger - ), + )?, r###"<p><strong>foo <a href="/url">bar</a></strong></p> "###, r###"Emphasis and strong emphasis (421)"### @@ -6415,7 +6415,7 @@ bar</em></p> bar** "###, &danger - ), + )?, r###"<p><strong>foo bar</strong></p> "###, @@ -6427,7 +6427,7 @@ bar</strong></p> r###"__foo _bar_ baz__ "###, &danger - ), + )?, r###"<p><strong>foo <em>bar</em> baz</strong></p> "###, r###"Emphasis and strong emphasis (423)"### @@ -6438,7 +6438,7 @@ bar</strong></p> r###"__foo __bar__ baz__ "###, &danger - ), + )?, r###"<p><strong>foo <strong>bar</strong> baz</strong></p> "###, r###"Emphasis and strong emphasis (424)"### @@ -6449,7 +6449,7 @@ bar</strong></p> r###"____foo__ bar__ "###, &danger - ), + )?, r###"<p><strong><strong>foo</strong> bar</strong></p> "###, r###"Emphasis and strong emphasis (425)"### @@ -6460,7 +6460,7 @@ bar</strong></p> r###"**foo **bar**** "###, &danger - ), + )?, r###"<p><strong>foo <strong>bar</strong></strong></p> "###, r###"Emphasis and strong emphasis (426)"### @@ -6471,7 +6471,7 @@ bar</strong></p> r###"**foo *bar* baz** "###, &danger - ), + )?, r###"<p><strong>foo <em>bar</em> baz</strong></p> "###, r###"Emphasis and strong emphasis (427)"### @@ -6482,7 +6482,7 @@ bar</strong></p> r###"**foo*bar*baz** "###, &danger - ), + )?, r###"<p><strong>foo<em>bar</em>baz</strong></p> "###, r###"Emphasis and strong emphasis (428)"### @@ -6493,7 +6493,7 @@ bar</strong></p> r###"***foo* bar** "###, &danger - ), + )?, r###"<p><strong><em>foo</em> bar</strong></p> "###, r###"Emphasis and strong emphasis (429)"### @@ -6504,7 +6504,7 @@ bar</strong></p> r###"**foo *bar*** "###, &danger - ), + )?, r###"<p><strong>foo <em>bar</em></strong></p> "###, r###"Emphasis and strong emphasis (430)"### @@ -6516,7 +6516,7 @@ bar</strong></p> bim* bop** "###, &danger - ), + )?, r###"<p><strong>foo <em>bar <strong>baz</strong> bim</em> bop</strong></p> "###, @@ -6528,7 +6528,7 @@ bim</em> bop</strong></p> r###"**foo [*bar*](/url)** "###, &danger - ), + )?, r###"<p><strong>foo <a href="/url"><em>bar</em></a></strong></p> "###, r###"Emphasis and strong emphasis (432)"### @@ -6539,7 +6539,7 @@ bim</em> bop</strong></p> r###"__ is not an empty emphasis "###, &danger - ), + )?, r###"<p>__ is not an empty emphasis</p> "###, r###"Emphasis and strong emphasis (433)"### @@ -6550,7 +6550,7 @@ bim</em> bop</strong></p> r###"____ is not an empty strong emphasis "###, &danger - ), + )?, r###"<p>____ is not an empty strong emphasis</p> "###, r###"Emphasis and strong emphasis (434)"### @@ -6561,7 +6561,7 @@ bim</em> bop</strong></p> r###"foo *** "###, &danger - ), + )?, r###"<p>foo ***</p> "###, r###"Emphasis and strong emphasis (435)"### @@ -6572,7 +6572,7 @@ bim</em> bop</strong></p> r###"foo *\** "###, &danger - ), + )?, r###"<p>foo <em>*</em></p> "###, r###"Emphasis and strong emphasis (436)"### @@ -6583,7 +6583,7 @@ bim</em> bop</strong></p> r###"foo *_* "###, &danger - ), + )?, r###"<p>foo <em>_</em></p> "###, r###"Emphasis and strong emphasis (437)"### @@ -6594,7 +6594,7 @@ bim</em> bop</strong></p> r###"foo ***** "###, &danger - ), + )?, r###"<p>foo *****</p> "###, r###"Emphasis and strong emphasis (438)"### @@ -6605,7 +6605,7 @@ bim</em> bop</strong></p> r###"foo **\*** "###, &danger - ), + )?, r###"<p>foo <strong>*</strong></p> "###, r###"Emphasis and strong emphasis (439)"### @@ -6616,7 +6616,7 @@ bim</em> bop</strong></p> r###"foo **_** "###, &danger - ), + )?, r###"<p>foo <strong>_</strong></p> "###, r###"Emphasis and strong emphasis (440)"### @@ -6627,7 +6627,7 @@ bim</em> bop</strong></p> r###"**foo* "###, &danger - ), + )?, r###"<p>*<em>foo</em></p> "###, r###"Emphasis and strong emphasis (441)"### @@ -6638,7 +6638,7 @@ bim</em> bop</strong></p> r###"*foo** "###, &danger - ), + )?, r###"<p><em>foo</em>*</p> "###, r###"Emphasis and strong emphasis (442)"### @@ -6649,7 +6649,7 @@ bim</em> bop</strong></p> r###"***foo** "###, &danger - ), + )?, r###"<p>*<strong>foo</strong></p> "###, r###"Emphasis and strong emphasis (443)"### @@ -6660,7 +6660,7 @@ bim</em> bop</strong></p> r###"****foo* "###, &danger - ), + )?, r###"<p>***<em>foo</em></p> "###, r###"Emphasis and strong emphasis (444)"### @@ -6671,7 +6671,7 @@ bim</em> bop</strong></p> r###"**foo*** "###, &danger - ), + )?, r###"<p><strong>foo</strong>*</p> "###, r###"Emphasis and strong emphasis (445)"### @@ -6682,7 +6682,7 @@ bim</em> bop</strong></p> r###"*foo**** "###, &danger - ), + )?, r###"<p><em>foo</em>***</p> "###, r###"Emphasis and strong emphasis (446)"### @@ -6693,7 +6693,7 @@ bim</em> bop</strong></p> r###"foo ___ "###, &danger - ), + )?, r###"<p>foo ___</p> "###, r###"Emphasis and strong emphasis (447)"### @@ -6704,7 +6704,7 @@ bim</em> bop</strong></p> r###"foo _\__ "###, &danger - ), + )?, r###"<p>foo <em>_</em></p> "###, r###"Emphasis and strong emphasis (448)"### @@ -6715,7 +6715,7 @@ bim</em> bop</strong></p> r###"foo _*_ "###, &danger - ), + )?, r###"<p>foo <em>*</em></p> "###, r###"Emphasis and strong emphasis (449)"### @@ -6726,7 +6726,7 @@ bim</em> bop</strong></p> r###"foo _____ "###, &danger - ), + )?, r###"<p>foo _____</p> "###, r###"Emphasis and strong emphasis (450)"### @@ -6737,7 +6737,7 @@ bim</em> bop</strong></p> r###"foo __\___ "###, &danger - ), + )?, r###"<p>foo <strong>_</strong></p> "###, r###"Emphasis and strong emphasis (451)"### @@ -6748,7 +6748,7 @@ bim</em> bop</strong></p> r###"foo __*__ "###, &danger - ), + )?, r###"<p>foo <strong>*</strong></p> "###, r###"Emphasis and strong emphasis (452)"### @@ -6759,7 +6759,7 @@ bim</em> bop</strong></p> r###"__foo_ "###, &danger - ), + )?, r###"<p>_<em>foo</em></p> "###, r###"Emphasis and strong emphasis (453)"### @@ -6770,7 +6770,7 @@ bim</em> bop</strong></p> r###"_foo__ "###, &danger - ), + )?, r###"<p><em>foo</em>_</p> "###, r###"Emphasis and strong emphasis (454)"### @@ -6781,7 +6781,7 @@ bim</em> bop</strong></p> r###"___foo__ "###, &danger - ), + )?, r###"<p>_<strong>foo</strong></p> "###, r###"Emphasis and strong emphasis (455)"### @@ -6792,7 +6792,7 @@ bim</em> bop</strong></p> r###"____foo_ "###, &danger - ), + )?, r###"<p>___<em>foo</em></p> "###, r###"Emphasis and strong emphasis (456)"### @@ -6803,7 +6803,7 @@ bim</em> bop</strong></p> r###"__foo___ "###, &danger - ), + )?, r###"<p><strong>foo</strong>_</p> "###, r###"Emphasis and strong emphasis (457)"### @@ -6814,7 +6814,7 @@ bim</em> bop</strong></p> r###"_foo____ "###, &danger - ), + )?, r###"<p><em>foo</em>___</p> "###, r###"Emphasis and strong emphasis (458)"### @@ -6825,7 +6825,7 @@ bim</em> bop</strong></p> r###"**foo** "###, &danger - ), + )?, r###"<p><strong>foo</strong></p> "###, r###"Emphasis and strong emphasis (459)"### @@ -6836,7 +6836,7 @@ bim</em> bop</strong></p> r###"*_foo_* "###, &danger - ), + )?, r###"<p><em><em>foo</em></em></p> "###, r###"Emphasis and strong emphasis (460)"### @@ -6847,7 +6847,7 @@ bim</em> bop</strong></p> r###"__foo__ "###, &danger - ), + )?, r###"<p><strong>foo</strong></p> "###, r###"Emphasis and strong emphasis (461)"### @@ -6858,7 +6858,7 @@ bim</em> bop</strong></p> r###"_*foo*_ "###, &danger - ), + )?, r###"<p><em><em>foo</em></em></p> "###, r###"Emphasis and strong emphasis (462)"### @@ -6869,7 +6869,7 @@ bim</em> bop</strong></p> r###"****foo**** "###, &danger - ), + )?, r###"<p><strong><strong>foo</strong></strong></p> "###, r###"Emphasis and strong emphasis (463)"### @@ -6880,7 +6880,7 @@ bim</em> bop</strong></p> r###"____foo____ "###, &danger - ), + )?, r###"<p><strong><strong>foo</strong></strong></p> "###, r###"Emphasis and strong emphasis (464)"### @@ -6891,7 +6891,7 @@ bim</em> bop</strong></p> r###"******foo****** "###, &danger - ), + )?, r###"<p><strong><strong><strong>foo</strong></strong></strong></p> "###, r###"Emphasis and strong emphasis (465)"### @@ -6902,7 +6902,7 @@ bim</em> bop</strong></p> r###"***foo*** "###, &danger - ), + )?, r###"<p><em><strong>foo</strong></em></p> "###, r###"Emphasis and strong emphasis (466)"### @@ -6913,7 +6913,7 @@ bim</em> bop</strong></p> r###"_____foo_____ "###, &danger - ), + )?, r###"<p><em><strong><strong>foo</strong></strong></em></p> "###, r###"Emphasis and strong emphasis (467)"### @@ -6924,7 +6924,7 @@ bim</em> bop</strong></p> r###"*foo _bar* baz_ "###, &danger - ), + )?, r###"<p><em>foo _bar</em> baz_</p> "###, r###"Emphasis and strong emphasis (468)"### @@ -6935,7 +6935,7 @@ bim</em> bop</strong></p> r###"*foo __bar *baz bim__ bam* "###, &danger - ), + )?, r###"<p><em>foo <strong>bar *baz bim</strong> bam</em></p> "###, r###"Emphasis and strong emphasis (469)"### @@ -6946,7 +6946,7 @@ bim</em> bop</strong></p> r###"**foo **bar baz** "###, &danger - ), + )?, r###"<p>**foo <strong>bar baz</strong></p> "###, r###"Emphasis and strong emphasis (470)"### @@ -6957,7 +6957,7 @@ bim</em> bop</strong></p> r###"*foo *bar baz* "###, &danger - ), + )?, r###"<p>*foo <em>bar baz</em></p> "###, r###"Emphasis and strong emphasis (471)"### @@ -6968,7 +6968,7 @@ bim</em> bop</strong></p> r###"*[bar*](/url) "###, &danger - ), + )?, r###"<p>*<a href="/url">bar*</a></p> "###, r###"Emphasis and strong emphasis (472)"### @@ -6979,7 +6979,7 @@ bim</em> bop</strong></p> r###"_foo [bar_](/url) "###, &danger - ), + )?, r###"<p>_foo <a href="/url">bar_</a></p> "###, r###"Emphasis and strong emphasis (473)"### @@ -6990,7 +6990,7 @@ bim</em> bop</strong></p> r###"*<img src="foo" title="*"/> "###, &danger - ), + )?, r###"<p>*<img src="foo" title="*"/></p> "###, r###"Emphasis and strong emphasis (474)"### @@ -7001,7 +7001,7 @@ bim</em> bop</strong></p> r###"**<a href="**"> "###, &danger - ), + )?, r###"<p>**<a href="**"></p> "###, r###"Emphasis and strong emphasis (475)"### @@ -7012,7 +7012,7 @@ bim</em> bop</strong></p> r###"__<a href="__"> "###, &danger - ), + )?, r###"<p>__<a href="__"></p> "###, r###"Emphasis and strong emphasis (476)"### @@ -7023,7 +7023,7 @@ bim</em> bop</strong></p> r###"*a `*`* "###, &danger - ), + )?, r###"<p><em>a <code>*</code></em></p> "###, r###"Emphasis and strong emphasis (477)"### @@ -7034,7 +7034,7 @@ bim</em> bop</strong></p> r###"_a `_`_ "###, &danger - ), + )?, r###"<p><em>a <code>_</code></em></p> "###, r###"Emphasis and strong emphasis (478)"### @@ -7045,7 +7045,7 @@ bim</em> bop</strong></p> r###"**a<http://foo.bar/?q=**> "###, &danger - ), + )?, r###"<p>**a<a href="http://foo.bar/?q=**">http://foo.bar/?q=**</a></p> "###, r###"Emphasis and strong emphasis (479)"### @@ -7056,7 +7056,7 @@ bim</em> bop</strong></p> r###"__a<http://foo.bar/?q=__> "###, &danger - ), + )?, r###"<p>__a<a href="http://foo.bar/?q=__">http://foo.bar/?q=__</a></p> "###, r###"Emphasis and strong emphasis (480)"### @@ -7067,7 +7067,7 @@ bim</em> bop</strong></p> r###"[link](/uri "title") "###, &danger - ), + )?, r###"<p><a href="/uri" title="title">link</a></p> "###, r###"Links (481)"### @@ -7078,7 +7078,7 @@ bim</em> bop</strong></p> r###"[link](/uri) "###, &danger - ), + )?, r###"<p><a href="/uri">link</a></p> "###, r###"Links (482)"### @@ -7089,7 +7089,7 @@ bim</em> bop</strong></p> r###"[](./target.md) "###, &danger - ), + )?, r###"<p><a href="./target.md"></a></p> "###, r###"Links (483)"### @@ -7100,7 +7100,7 @@ bim</em> bop</strong></p> r###"[link]() "###, &danger - ), + )?, r###"<p><a href="">link</a></p> "###, r###"Links (484)"### @@ -7111,7 +7111,7 @@ bim</em> bop</strong></p> r###"[link](<>) "###, &danger - ), + )?, r###"<p><a href="">link</a></p> "###, r###"Links (485)"### @@ -7122,7 +7122,7 @@ bim</em> bop</strong></p> r###"[]() "###, &danger - ), + )?, r###"<p><a href=""></a></p> "###, r###"Links (486)"### @@ -7133,7 +7133,7 @@ bim</em> bop</strong></p> r###"[link](/my uri) "###, &danger - ), + )?, r###"<p>[link](/my uri)</p> "###, r###"Links (487)"### @@ -7144,7 +7144,7 @@ bim</em> bop</strong></p> r###"[link](</my uri>) "###, &danger - ), + )?, r###"<p><a href="/my%20uri">link</a></p> "###, r###"Links (488)"### @@ -7156,7 +7156,7 @@ bim</em> bop</strong></p> bar) "###, &danger - ), + )?, r###"<p>[link](foo bar)</p> "###, @@ -7169,7 +7169,7 @@ bar)</p> bar>) "###, &danger - ), + )?, r###"<p>[link](<foo bar>)</p> "###, @@ -7181,7 +7181,7 @@ bar>)</p> r###"[a](<b)c>) "###, &danger - ), + )?, r###"<p><a href="b)c">a</a></p> "###, r###"Links (491)"### @@ -7192,7 +7192,7 @@ bar>)</p> r###"[link](<foo\>) "###, &danger - ), + )?, r###"<p>[link](<foo>)</p> "###, r###"Links (492)"### @@ -7205,7 +7205,7 @@ bar>)</p> [a](<b>c) "###, &danger - ), + )?, r###"<p>[a](<b)c [a](<b)c> [a](<b>c)</p> @@ -7218,7 +7218,7 @@ bar>)</p> r###"[link](\(foo\)) "###, &danger - ), + )?, r###"<p><a href="(foo)">link</a></p> "###, r###"Links (494)"### @@ -7229,7 +7229,7 @@ bar>)</p> r###"[link](foo(and(bar))) "###, &danger - ), + )?, r###"<p><a href="foo(and(bar))">link</a></p> "###, r###"Links (495)"### @@ -7240,7 +7240,7 @@ bar>)</p> r###"[link](foo(and(bar)) "###, &danger - ), + )?, r###"<p>[link](foo(and(bar))</p> "###, r###"Links (496)"### @@ -7251,7 +7251,7 @@ bar>)</p> r###"[link](foo\(and\(bar\)) "###, &danger - ), + )?, r###"<p><a href="foo(and(bar)">link</a></p> "###, r###"Links (497)"### @@ -7262,7 +7262,7 @@ bar>)</p> r###"[link](<foo(and(bar)>) "###, &danger - ), + )?, r###"<p><a href="foo(and(bar)">link</a></p> "###, r###"Links (498)"### @@ -7273,7 +7273,7 @@ bar>)</p> r###"[link](foo\)\:) "###, &danger - ), + )?, r###"<p><a href="foo):">link</a></p> "###, r###"Links (499)"### @@ -7288,7 +7288,7 @@ bar>)</p> [link](http://example.com?foo=3#frag) "###, &danger - ), + )?, r###"<p><a href="#fragment">link</a></p> <p><a href="http://example.com#fragment">link</a></p> <p><a href="http://example.com?foo=3#frag">link</a></p> @@ -7301,7 +7301,7 @@ bar>)</p> r###"[link](foo\bar) "###, &danger - ), + )?, r###"<p><a href="foo%5Cbar">link</a></p> "###, r###"Links (501)"### @@ -7312,7 +7312,7 @@ bar>)</p> r###"[link](foo%20bä) "###, &danger - ), + )?, r###"<p><a href="foo%20b%C3%A4">link</a></p> "###, r###"Links (502)"### @@ -7323,7 +7323,7 @@ bar>)</p> r###"[link]("title") "###, &danger - ), + )?, r###"<p><a href="%22title%22">link</a></p> "###, r###"Links (503)"### @@ -7336,7 +7336,7 @@ bar>)</p> [link](/url (title)) "###, &danger - ), + )?, r###"<p><a href="/url" title="title">link</a> <a href="/url" title="title">link</a> <a href="/url" title="title">link</a></p> @@ -7349,7 +7349,7 @@ bar>)</p> r###"[link](/url "title \""") "###, &danger - ), + )?, r###"<p><a href="/url" title="title """>link</a></p> "###, r###"Links (505)"### @@ -7360,7 +7360,7 @@ bar>)</p> r###"[link](/url "title") "###, &danger - ), + )?, r###"<p><a href="/url%C2%A0%22title%22">link</a></p> "###, r###"Links (506)"### @@ -7371,7 +7371,7 @@ bar>)</p> r###"[link](/url "title "and" title") "###, &danger - ), + )?, r###"<p>[link](/url "title "and" title")</p> "###, r###"Links (507)"### @@ -7382,7 +7382,7 @@ bar>)</p> r###"[link](/url 'title "and" title') "###, &danger - ), + )?, r###"<p><a href="/url" title="title "and" title">link</a></p> "###, r###"Links (508)"### @@ -7394,7 +7394,7 @@ bar>)</p> "title" ) "###, &danger - ), + )?, r###"<p><a href="/uri" title="title">link</a></p> "###, r###"Links (509)"### @@ -7405,7 +7405,7 @@ bar>)</p> r###"[link] (/uri) "###, &danger - ), + )?, r###"<p>[link] (/uri)</p> "###, r###"Links (510)"### @@ -7416,7 +7416,7 @@ bar>)</p> r###"[link [foo [bar]]](/uri) "###, &danger - ), + )?, r###"<p><a href="/uri">link [foo [bar]]</a></p> "###, r###"Links (511)"### @@ -7427,7 +7427,7 @@ bar>)</p> r###"[link] bar](/uri) "###, &danger - ), + )?, r###"<p>[link] bar](/uri)</p> "###, r###"Links (512)"### @@ -7438,7 +7438,7 @@ bar>)</p> r###"[link [bar](/uri) "###, &danger - ), + )?, r###"<p>[link <a href="/uri">bar</a></p> "###, r###"Links (513)"### @@ -7449,7 +7449,7 @@ bar>)</p> r###"[link \[bar](/uri) "###, &danger - ), + )?, r###"<p><a href="/uri">link [bar</a></p> "###, r###"Links (514)"### @@ -7460,7 +7460,7 @@ bar>)</p> r###"[link *foo **bar** `#`*](/uri) "###, &danger - ), + )?, r###"<p><a href="/uri">link <em>foo <strong>bar</strong> <code>#</code></em></a></p> "###, r###"Links (515)"### @@ -7471,7 +7471,7 @@ bar>)</p> r###"[![moon](moon.jpg)](/uri) "###, &danger - ), + )?, r###"<p><a href="/uri"><img src="moon.jpg" alt="moon" /></a></p> "###, r###"Links (516)"### @@ -7482,7 +7482,7 @@ bar>)</p> r###"[foo [bar](/uri)](/uri) "###, &danger - ), + )?, r###"<p>[foo <a href="/uri">bar</a>](/uri)</p> "###, r###"Links (517)"### @@ -7493,7 +7493,7 @@ bar>)</p> r###"[foo *[bar [baz](/uri)](/uri)*](/uri) "###, &danger - ), + )?, r###"<p>[foo <em>[bar <a href="/uri">baz</a>](/uri)</em>](/uri)</p> "###, r###"Links (518)"### @@ -7504,7 +7504,7 @@ bar>)</p> r###"![[[foo](uri1)](uri2)](uri3) "###, &danger - ), + )?, r###"<p><img src="uri3" alt="[foo](uri2)" /></p> "###, r###"Links (519)"### @@ -7515,7 +7515,7 @@ bar>)</p> r###"*[foo*](/uri) "###, &danger - ), + )?, r###"<p>*<a href="/uri">foo*</a></p> "###, r###"Links (520)"### @@ -7526,7 +7526,7 @@ bar>)</p> r###"[foo *bar](baz*) "###, &danger - ), + )?, r###"<p><a href="baz*">foo *bar</a></p> "###, r###"Links (521)"### @@ -7537,7 +7537,7 @@ bar>)</p> r###"*foo [bar* baz] "###, &danger - ), + )?, r###"<p><em>foo [bar</em> baz]</p> "###, r###"Links (522)"### @@ -7548,7 +7548,7 @@ bar>)</p> r###"[foo <bar attr="](baz)"> "###, &danger - ), + )?, r###"<p>[foo <bar attr="](baz)"></p> "###, r###"Links (523)"### @@ -7559,7 +7559,7 @@ bar>)</p> r###"[foo`](/uri)` "###, &danger - ), + )?, r###"<p>[foo<code>](/uri)</code></p> "###, r###"Links (524)"### @@ -7570,7 +7570,7 @@ bar>)</p> r###"[foo<http://example.com/?search=](uri)> "###, &danger - ), + )?, r###"<p>[foo<a href="http://example.com/?search=%5D(uri)">http://example.com/?search=](uri)</a></p> "###, r###"Links (525)"### @@ -7583,7 +7583,7 @@ bar>)</p> [bar]: /url "title" "###, &danger - ), + )?, r###"<p><a href="/url" title="title">foo</a></p> "###, r###"Links (526)"### @@ -7596,7 +7596,7 @@ bar>)</p> [ref]: /uri "###, &danger - ), + )?, r###"<p><a href="/uri">link [foo [bar]]</a></p> "###, r###"Links (527)"### @@ -7609,7 +7609,7 @@ bar>)</p> [ref]: /uri "###, &danger - ), + )?, r###"<p><a href="/uri">link [bar</a></p> "###, r###"Links (528)"### @@ -7622,7 +7622,7 @@ bar>)</p> [ref]: /uri "###, &danger - ), + )?, r###"<p><a href="/uri">link <em>foo <strong>bar</strong> <code>#</code></em></a></p> "###, r###"Links (529)"### @@ -7635,7 +7635,7 @@ bar>)</p> [ref]: /uri "###, &danger - ), + )?, r###"<p><a href="/uri"><img src="moon.jpg" alt="moon" /></a></p> "###, r###"Links (530)"### @@ -7648,7 +7648,7 @@ bar>)</p> [ref]: /uri "###, &danger - ), + )?, r###"<p>[foo <a href="/uri">bar</a>]<a href="/uri">ref</a></p> "###, r###"Links (531)"### @@ -7661,7 +7661,7 @@ bar>)</p> [ref]: /uri "###, &danger - ), + )?, r###"<p>[foo <em>bar <a href="/uri">baz</a></em>]<a href="/uri">ref</a></p> "###, r###"Links (532)"### @@ -7674,7 +7674,7 @@ bar>)</p> [ref]: /uri "###, &danger - ), + )?, r###"<p>*<a href="/uri">foo*</a></p> "###, r###"Links (533)"### @@ -7687,7 +7687,7 @@ bar>)</p> [ref]: /uri "###, &danger - ), + )?, r###"<p><a href="/uri">foo *bar</a>*</p> "###, r###"Links (534)"### @@ -7700,7 +7700,7 @@ bar>)</p> [ref]: /uri "###, &danger - ), + )?, r###"<p>[foo <bar attr="][ref]"></p> "###, r###"Links (535)"### @@ -7713,7 +7713,7 @@ bar>)</p> [ref]: /uri "###, &danger - ), + )?, r###"<p>[foo<code>][ref]</code></p> "###, r###"Links (536)"### @@ -7726,7 +7726,7 @@ bar>)</p> [ref]: /uri "###, &danger - ), + )?, r###"<p>[foo<a href="http://example.com/?search=%5D%5Bref%5D">http://example.com/?search=][ref]</a></p> "###, r###"Links (537)"### @@ -7739,7 +7739,7 @@ bar>)</p> [bar]: /url "title" "###, &danger - ), + )?, r###"<p><a href="/url" title="title">foo</a></p> "###, r###"Links (538)"### @@ -7752,7 +7752,7 @@ bar>)</p> [SS]: /url "###, &danger - ), + )?, r###"<p><a href="/url">ẞ</a></p> "###, r###"Links (539)"### @@ -7766,7 +7766,7 @@ bar>)</p> [Baz][Foo bar] "###, &danger - ), + )?, r###"<p><a href="/url">Baz</a></p> "###, r###"Links (540)"### @@ -7779,7 +7779,7 @@ bar>)</p> [bar]: /url "title" "###, &danger - ), + )?, r###"<p>[foo] <a href="/url" title="title">bar</a></p> "###, r###"Links (541)"### @@ -7793,7 +7793,7 @@ bar>)</p> [bar]: /url "title" "###, &danger - ), + )?, r###"<p>[foo] <a href="/url" title="title">bar</a></p> "###, @@ -7809,7 +7809,7 @@ bar>)</p> [bar][foo] "###, &danger - ), + )?, r###"<p><a href="/url1">bar</a></p> "###, r###"Links (543)"### @@ -7822,7 +7822,7 @@ bar>)</p> [foo!]: /url "###, &danger - ), + )?, r###"<p>[bar][foo!]</p> "###, r###"Links (544)"### @@ -7835,7 +7835,7 @@ bar>)</p> [ref[]: /uri "###, &danger - ), + )?, r###"<p>[foo][ref[]</p> <p>[ref[]: /uri</p> "###, @@ -7849,7 +7849,7 @@ bar>)</p> [ref[bar]]: /uri "###, &danger - ), + )?, r###"<p>[foo][ref[bar]]</p> <p>[ref[bar]]: /uri</p> "###, @@ -7863,7 +7863,7 @@ bar>)</p> [[[foo]]]: /url "###, &danger - ), + )?, r###"<p>[[[foo]]]</p> <p>[[[foo]]]: /url</p> "###, @@ -7877,7 +7877,7 @@ bar>)</p> [ref\[]: /uri "###, &danger - ), + )?, r###"<p><a href="/uri">foo</a></p> "###, r###"Links (548)"### @@ -7890,7 +7890,7 @@ bar>)</p> [bar\\] "###, &danger - ), + )?, r###"<p><a href="/uri">bar\</a></p> "###, r###"Links (549)"### @@ -7903,7 +7903,7 @@ bar>)</p> []: /uri "###, &danger - ), + )?, r###"<p>[]</p> <p>[]: /uri</p> "###, @@ -7919,7 +7919,7 @@ bar>)</p> ]: /uri "###, &danger - ), + )?, r###"<p>[ ]</p> <p>[ @@ -7935,7 +7935,7 @@ bar>)</p> [foo]: /url "title" "###, &danger - ), + )?, r###"<p><a href="/url" title="title">foo</a></p> "###, r###"Links (552)"### @@ -7948,7 +7948,7 @@ bar>)</p> [*foo* bar]: /url "title" "###, &danger - ), + )?, r###"<p><a href="/url" title="title"><em>foo</em> bar</a></p> "###, r###"Links (553)"### @@ -7961,7 +7961,7 @@ bar>)</p> [foo]: /url "title" "###, &danger - ), + )?, r###"<p><a href="/url" title="title">Foo</a></p> "###, r###"Links (554)"### @@ -7975,7 +7975,7 @@ bar>)</p> [foo]: /url "title" "###, &danger - ), + )?, r###"<p><a href="/url" title="title">foo</a> []</p> "###, @@ -7989,7 +7989,7 @@ bar>)</p> [foo]: /url "title" "###, &danger - ), + )?, r###"<p><a href="/url" title="title">foo</a></p> "###, r###"Links (556)"### @@ -8002,7 +8002,7 @@ bar>)</p> [*foo* bar]: /url "title" "###, &danger - ), + )?, r###"<p><a href="/url" title="title"><em>foo</em> bar</a></p> "###, r###"Links (557)"### @@ -8015,7 +8015,7 @@ bar>)</p> [*foo* bar]: /url "title" "###, &danger - ), + )?, r###"<p>[<a href="/url" title="title"><em>foo</em> bar</a>]</p> "###, r###"Links (558)"### @@ -8028,7 +8028,7 @@ bar>)</p> [foo]: /url "###, &danger - ), + )?, r###"<p>[[bar <a href="/url">foo</a></p> "###, r###"Links (559)"### @@ -8041,7 +8041,7 @@ bar>)</p> [foo]: /url "title" "###, &danger - ), + )?, r###"<p><a href="/url" title="title">Foo</a></p> "###, r###"Links (560)"### @@ -8054,7 +8054,7 @@ bar>)</p> [foo]: /url "###, &danger - ), + )?, r###"<p><a href="/url">foo</a> bar</p> "###, r###"Links (561)"### @@ -8067,7 +8067,7 @@ bar>)</p> [foo]: /url "title" "###, &danger - ), + )?, r###"<p>[foo]</p> "###, r###"Links (562)"### @@ -8080,7 +8080,7 @@ bar>)</p> *[foo*] "###, &danger - ), + )?, r###"<p>*<a href="/url">foo*</a></p> "###, r###"Links (563)"### @@ -8094,7 +8094,7 @@ bar>)</p> [bar]: /url2 "###, &danger - ), + )?, r###"<p><a href="/url2">foo</a></p> "###, r###"Links (564)"### @@ -8107,7 +8107,7 @@ bar>)</p> [foo]: /url1 "###, &danger - ), + )?, r###"<p><a href="/url1">foo</a></p> "###, r###"Links (565)"### @@ -8120,7 +8120,7 @@ bar>)</p> [foo]: /url1 "###, &danger - ), + )?, r###"<p><a href="">foo</a></p> "###, r###"Links (566)"### @@ -8133,7 +8133,7 @@ bar>)</p> [foo]: /url1 "###, &danger - ), + )?, r###"<p><a href="/url1">foo</a>(not a link)</p> "###, r###"Links (567)"### @@ -8146,7 +8146,7 @@ bar>)</p> [baz]: /url "###, &danger - ), + )?, r###"<p>[foo]<a href="/url">bar</a></p> "###, r###"Links (568)"### @@ -8160,7 +8160,7 @@ bar>)</p> [bar]: /url2 "###, &danger - ), + )?, r###"<p><a href="/url2">foo</a><a href="/url1">baz</a></p> "###, r###"Links (569)"### @@ -8174,7 +8174,7 @@ bar>)</p> [foo]: /url2 "###, &danger - ), + )?, r###"<p>[foo]<a href="/url1">bar</a></p> "###, r###"Links (570)"### @@ -8185,7 +8185,7 @@ bar>)</p> r###"![foo](/url "title") "###, &danger - ), + )?, r###"<p><img src="/url" alt="foo" title="title" /></p> "###, r###"Images (571)"### @@ -8198,7 +8198,7 @@ bar>)</p> [foo *bar*]: train.jpg "train & tracks" "###, &danger - ), + )?, r###"<p><img src="train.jpg" alt="foo bar" title="train & tracks" /></p> "###, r###"Images (572)"### @@ -8209,7 +8209,7 @@ bar>)</p> r###"![foo ![bar](/url)](/url2) "###, &danger - ), + )?, r###"<p><img src="/url2" alt="foo bar" /></p> "###, r###"Images (573)"### @@ -8220,7 +8220,7 @@ bar>)</p> r###"![foo [bar](/url)](/url2) "###, &danger - ), + )?, r###"<p><img src="/url2" alt="foo bar" /></p> "###, r###"Images (574)"### @@ -8233,7 +8233,7 @@ bar>)</p> [foo *bar*]: train.jpg "train & tracks" "###, &danger - ), + )?, r###"<p><img src="train.jpg" alt="foo bar" title="train & tracks" /></p> "###, r###"Images (575)"### @@ -8246,7 +8246,7 @@ bar>)</p> [FOOBAR]: train.jpg "train & tracks" "###, &danger - ), + )?, r###"<p><img src="train.jpg" alt="foo bar" title="train & tracks" /></p> "###, r###"Images (576)"### @@ -8257,7 +8257,7 @@ bar>)</p> r###"![foo](train.jpg) "###, &danger - ), + )?, r###"<p><img src="train.jpg" alt="foo" /></p> "###, r###"Images (577)"### @@ -8268,7 +8268,7 @@ bar>)</p> r###"My ![foo bar](/path/to/train.jpg "title" ) "###, &danger - ), + )?, r###"<p>My <img src="/path/to/train.jpg" alt="foo bar" title="title" /></p> "###, r###"Images (578)"### @@ -8279,7 +8279,7 @@ bar>)</p> r###"![foo](<url>) "###, &danger - ), + )?, r###"<p><img src="url" alt="foo" /></p> "###, r###"Images (579)"### @@ -8290,7 +8290,7 @@ bar>)</p> r###"![](/url) "###, &danger - ), + )?, r###"<p><img src="/url" alt="" /></p> "###, r###"Images (580)"### @@ -8303,7 +8303,7 @@ bar>)</p> [bar]: /url "###, &danger - ), + )?, r###"<p><img src="/url" alt="foo" /></p> "###, r###"Images (581)"### @@ -8316,7 +8316,7 @@ bar>)</p> [BAR]: /url "###, &danger - ), + )?, r###"<p><img src="/url" alt="foo" /></p> "###, r###"Images (582)"### @@ -8329,7 +8329,7 @@ bar>)</p> [foo]: /url "title" "###, &danger - ), + )?, r###"<p><img src="/url" alt="foo" title="title" /></p> "###, r###"Images (583)"### @@ -8342,7 +8342,7 @@ bar>)</p> [*foo* bar]: /url "title" "###, &danger - ), + )?, r###"<p><img src="/url" alt="foo bar" title="title" /></p> "###, r###"Images (584)"### @@ -8355,7 +8355,7 @@ bar>)</p> [foo]: /url "title" "###, &danger - ), + )?, r###"<p><img src="/url" alt="Foo" title="title" /></p> "###, r###"Images (585)"### @@ -8369,7 +8369,7 @@ bar>)</p> [foo]: /url "title" "###, &danger - ), + )?, r###"<p><img src="/url" alt="foo" title="title" /> []</p> "###, @@ -8383,7 +8383,7 @@ bar>)</p> [foo]: /url "title" "###, &danger - ), + )?, r###"<p><img src="/url" alt="foo" title="title" /></p> "###, r###"Images (587)"### @@ -8396,7 +8396,7 @@ bar>)</p> [*foo* bar]: /url "title" "###, &danger - ), + )?, r###"<p><img src="/url" alt="foo bar" title="title" /></p> "###, r###"Images (588)"### @@ -8409,7 +8409,7 @@ bar>)</p> [[foo]]: /url "title" "###, &danger - ), + )?, r###"<p>![[foo]]</p> <p>[[foo]]: /url "title"</p> "###, @@ -8423,7 +8423,7 @@ bar>)</p> [foo]: /url "title" "###, &danger - ), + )?, r###"<p><img src="/url" alt="Foo" title="title" /></p> "###, r###"Images (590)"### @@ -8436,7 +8436,7 @@ bar>)</p> [foo]: /url "title" "###, &danger - ), + )?, r###"<p>![foo]</p> "###, r###"Images (591)"### @@ -8449,7 +8449,7 @@ bar>)</p> [foo]: /url "title" "###, &danger - ), + )?, r###"<p>!<a href="/url" title="title">foo</a></p> "###, r###"Images (592)"### @@ -8460,7 +8460,7 @@ bar>)</p> r###"<http://foo.bar.baz> "###, &danger - ), + )?, r###"<p><a href="http://foo.bar.baz">http://foo.bar.baz</a></p> "###, r###"Autolinks (593)"### @@ -8471,7 +8471,7 @@ bar>)</p> r###"<http://foo.bar.baz/test?q=hello&id=22&boolean> "###, &danger - ), + )?, r###"<p><a href="http://foo.bar.baz/test?q=hello&id=22&boolean">http://foo.bar.baz/test?q=hello&id=22&boolean</a></p> "###, r###"Autolinks (594)"### @@ -8482,7 +8482,7 @@ bar>)</p> r###"<irc://foo.bar:2233/baz> "###, &danger - ), + )?, r###"<p><a href="irc://foo.bar:2233/baz">irc://foo.bar:2233/baz</a></p> "###, r###"Autolinks (595)"### @@ -8493,7 +8493,7 @@ bar>)</p> r###"<MAILTO:FOO@BAR.BAZ> "###, &danger - ), + )?, r###"<p><a href="MAILTO:FOO@BAR.BAZ">MAILTO:FOO@BAR.BAZ</a></p> "###, r###"Autolinks (596)"### @@ -8504,7 +8504,7 @@ bar>)</p> r###"<a+b+c:d> "###, &danger - ), + )?, r###"<p><a href="a+b+c:d">a+b+c:d</a></p> "###, r###"Autolinks (597)"### @@ -8515,7 +8515,7 @@ bar>)</p> r###"<made-up-scheme://foo,bar> "###, &danger - ), + )?, r###"<p><a href="made-up-scheme://foo,bar">made-up-scheme://foo,bar</a></p> "###, r###"Autolinks (598)"### @@ -8526,7 +8526,7 @@ bar>)</p> r###"<http://../> "###, &danger - ), + )?, r###"<p><a href="http://../">http://../</a></p> "###, r###"Autolinks (599)"### @@ -8537,7 +8537,7 @@ bar>)</p> r###"<localhost:5001/foo> "###, &danger - ), + )?, r###"<p><a href="localhost:5001/foo">localhost:5001/foo</a></p> "###, r###"Autolinks (600)"### @@ -8548,7 +8548,7 @@ bar>)</p> r###"<http://foo.bar/baz bim> "###, &danger - ), + )?, r###"<p><http://foo.bar/baz bim></p> "###, r###"Autolinks (601)"### @@ -8559,7 +8559,7 @@ bar>)</p> r###"<http://example.com/\[\> "###, &danger - ), + )?, r###"<p><a href="http://example.com/%5C%5B%5C">http://example.com/\[\</a></p> "###, r###"Autolinks (602)"### @@ -8570,7 +8570,7 @@ bar>)</p> r###"<foo@bar.example.com> "###, &danger - ), + )?, r###"<p><a href="mailto:foo@bar.example.com">foo@bar.example.com</a></p> "###, r###"Autolinks (603)"### @@ -8581,7 +8581,7 @@ bar>)</p> r###"<foo+special@Bar.baz-bar0.com> "###, &danger - ), + )?, r###"<p><a href="mailto:foo+special@Bar.baz-bar0.com">foo+special@Bar.baz-bar0.com</a></p> "###, r###"Autolinks (604)"### @@ -8592,7 +8592,7 @@ bar>)</p> r###"<foo\+@bar.example.com> "###, &danger - ), + )?, r###"<p><foo+@bar.example.com></p> "###, r###"Autolinks (605)"### @@ -8603,7 +8603,7 @@ bar>)</p> r###"<> "###, &danger - ), + )?, r###"<p><></p> "###, r###"Autolinks (606)"### @@ -8614,7 +8614,7 @@ bar>)</p> r###"< http://foo.bar > "###, &danger - ), + )?, r###"<p>< http://foo.bar ></p> "###, r###"Autolinks (607)"### @@ -8625,7 +8625,7 @@ bar>)</p> r###"<m:abc> "###, &danger - ), + )?, r###"<p><m:abc></p> "###, r###"Autolinks (608)"### @@ -8636,7 +8636,7 @@ bar>)</p> r###"<foo.bar.baz> "###, &danger - ), + )?, r###"<p><foo.bar.baz></p> "###, r###"Autolinks (609)"### @@ -8647,7 +8647,7 @@ bar>)</p> r###"http://example.com "###, &danger - ), + )?, r###"<p>http://example.com</p> "###, r###"Autolinks (610)"### @@ -8658,7 +8658,7 @@ bar>)</p> r###"foo@bar.example.com "###, &danger - ), + )?, r###"<p>foo@bar.example.com</p> "###, r###"Autolinks (611)"### @@ -8669,7 +8669,7 @@ bar>)</p> r###"<a><bab><c2c> "###, &danger - ), + )?, r###"<p><a><bab><c2c></p> "###, r###"Raw HTML (612)"### @@ -8680,7 +8680,7 @@ bar>)</p> r###"<a/><b2/> "###, &danger - ), + )?, r###"<p><a/><b2/></p> "###, r###"Raw HTML (613)"### @@ -8692,7 +8692,7 @@ bar>)</p> data="foo" > "###, &danger - ), + )?, r###"<p><a /><b2 data="foo" ></p> "###, @@ -8705,7 +8705,7 @@ data="foo" ></p> _boolean zoop:33=zoop:33 /> "###, &danger - ), + )?, r###"<p><a foo="bar" bam = 'baz <em>"</em>' _boolean zoop:33=zoop:33 /></p> "###, @@ -8717,7 +8717,7 @@ _boolean zoop:33=zoop:33 /></p> r###"Foo <responsive-image src="foo.jpg" /> "###, &danger - ), + )?, r###"<p>Foo <responsive-image src="foo.jpg" /></p> "###, r###"Raw HTML (616)"### @@ -8728,7 +8728,7 @@ _boolean zoop:33=zoop:33 /></p> r###"<33> <__> "###, &danger - ), + )?, r###"<p><33> <__></p> "###, r###"Raw HTML (617)"### @@ -8739,7 +8739,7 @@ _boolean zoop:33=zoop:33 /></p> r###"<a h*#ref="hi"> "###, &danger - ), + )?, r###"<p><a h*#ref="hi"></p> "###, r###"Raw HTML (618)"### @@ -8750,7 +8750,7 @@ _boolean zoop:33=zoop:33 /></p> r###"<a href="hi'> <a href=hi'> "###, &danger - ), + )?, r###"<p><a href="hi'> <a href=hi'></p> "###, r###"Raw HTML (619)"### @@ -8764,7 +8764,7 @@ foo><bar/ > bim!bop /> "###, &danger - ), + )?, r###"<p>< a>< foo><bar/ > <foo bar=baz @@ -8778,7 +8778,7 @@ bim!bop /></p> r###"<a href='bar'title=title> "###, &danger - ), + )?, r###"<p><a href='bar'title=title></p> "###, r###"Raw HTML (621)"### @@ -8789,7 +8789,7 @@ bim!bop /></p> r###"</a></foo > "###, &danger - ), + )?, r###"<p></a></foo ></p> "###, r###"Raw HTML (622)"### @@ -8800,7 +8800,7 @@ bim!bop /></p> r###"</a href="foo"> "###, &danger - ), + )?, r###"<p></a href="foo"></p> "###, r###"Raw HTML (623)"### @@ -8812,7 +8812,7 @@ bim!bop /></p> comment - with hyphen --> "###, &danger - ), + )?, r###"<p>foo <!-- this is a comment - with hyphen --></p> "###, @@ -8824,7 +8824,7 @@ comment - with hyphen --></p> r###"foo <!-- not a comment -- two hyphens --> "###, &danger - ), + )?, r###"<p>foo <!-- not a comment -- two hyphens --></p> "###, r###"Raw HTML (625)"### @@ -8837,7 +8837,7 @@ comment - with hyphen --></p> foo <!-- foo---> "###, &danger - ), + )?, r###"<p>foo <!--> foo --></p> <p>foo <!-- foo---></p> "###, @@ -8849,7 +8849,7 @@ foo <!-- foo---> r###"foo <?php echo $a; ?> "###, &danger - ), + )?, r###"<p>foo <?php echo $a; ?></p> "###, r###"Raw HTML (627)"### @@ -8860,7 +8860,7 @@ foo <!-- foo---> r###"foo <!ELEMENT br EMPTY> "###, &danger - ), + )?, r###"<p>foo <!ELEMENT br EMPTY></p> "###, r###"Raw HTML (628)"### @@ -8871,7 +8871,7 @@ foo <!-- foo---> r###"foo <![CDATA[>&<]]> "###, &danger - ), + )?, r###"<p>foo <![CDATA[>&<]]></p> "###, r###"Raw HTML (629)"### @@ -8882,7 +8882,7 @@ foo <!-- foo---> r###"foo <a href="ö"> "###, &danger - ), + )?, r###"<p>foo <a href="ö"></p> "###, r###"Raw HTML (630)"### @@ -8893,7 +8893,7 @@ foo <!-- foo---> r###"foo <a href="\*"> "###, &danger - ), + )?, r###"<p>foo <a href="\*"></p> "###, r###"Raw HTML (631)"### @@ -8904,7 +8904,7 @@ foo <!-- foo---> r###"<a href="\""> "###, &danger - ), + )?, r###"<p><a href="""></p> "###, r###"Raw HTML (632)"### @@ -8916,7 +8916,7 @@ foo <!-- foo---> baz "###, &danger - ), + )?, r###"<p>foo<br /> baz</p> "###, @@ -8929,7 +8929,7 @@ baz</p> baz "###, &danger - ), + )?, r###"<p>foo<br /> baz</p> "###, @@ -8942,7 +8942,7 @@ baz</p> baz "###, &danger - ), + )?, r###"<p>foo<br /> baz</p> "###, @@ -8955,7 +8955,7 @@ baz</p> bar "###, &danger - ), + )?, r###"<p>foo<br /> bar</p> "###, @@ -8968,7 +8968,7 @@ bar</p> bar "###, &danger - ), + )?, r###"<p>foo<br /> bar</p> "###, @@ -8981,7 +8981,7 @@ bar</p> bar* "###, &danger - ), + )?, r###"<p><em>foo<br /> bar</em></p> "###, @@ -8994,7 +8994,7 @@ bar</em></p> bar* "###, &danger - ), + )?, r###"<p><em>foo<br /> bar</em></p> "###, @@ -9007,7 +9007,7 @@ bar</em></p> span` "###, &danger - ), + )?, r###"<p><code>code span</code></p> "###, r###"Hard line breaks (640)"### @@ -9019,7 +9019,7 @@ span` span` "###, &danger - ), + )?, r###"<p><code>code\ span</code></p> "###, r###"Hard line breaks (641)"### @@ -9031,7 +9031,7 @@ span` bar"> "###, &danger - ), + )?, r###"<p><a href="foo bar"></p> "###, @@ -9044,7 +9044,7 @@ bar"></p> bar"> "###, &danger - ), + )?, r###"<p><a href="foo\ bar"></p> "###, @@ -9056,7 +9056,7 @@ bar"></p> r###"foo\ "###, &danger - ), + )?, r###"<p>foo\</p> "###, r###"Hard line breaks (644)"### @@ -9067,7 +9067,7 @@ bar"></p> r###"foo "###, &danger - ), + )?, r###"<p>foo</p> "###, r###"Hard line breaks (645)"### @@ -9078,7 +9078,7 @@ bar"></p> r###"### foo\ "###, &danger - ), + )?, r###"<h3>foo\</h3> "###, r###"Hard line breaks (646)"### @@ -9089,7 +9089,7 @@ bar"></p> r###"### foo "###, &danger - ), + )?, r###"<h3>foo</h3> "###, r###"Hard line breaks (647)"### @@ -9101,7 +9101,7 @@ bar"></p> baz "###, &danger - ), + )?, r###"<p>foo baz</p> "###, @@ -9114,7 +9114,7 @@ baz</p> baz "###, &danger - ), + )?, r###"<p>foo baz</p> "###, @@ -9126,7 +9126,7 @@ baz</p> r###"hello $.;'there "###, &danger - ), + )?, r###"<p>hello $.;'there</p> "###, r###"Textual content (650)"### @@ -9137,7 +9137,7 @@ baz</p> r###"Foo χρῆν "###, &danger - ), + )?, r###"<p>Foo χρῆν</p> "###, r###"Textual content (651)"### @@ -9148,9 +9148,11 @@ baz</p> r###"Multiple spaces "###, &danger - ), + )?, r###"<p>Multiple spaces</p> "###, r###"Textual content (652)"### ); + + Ok(()) } diff --git a/tests/definition.rs b/tests/definition.rs index 589994d..11f783d 100644 --- a/tests/definition.rs +++ b/tests/definition.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn definition() { +fn definition() -> Result<(), String> { let danger = Options { allow_dangerous_html: true, allow_dangerous_protocol: true, @@ -77,7 +77,7 @@ fn definition() { ); assert_eq!( - micromark_with_options("[foo]: <bar>(baz)\n\n[foo]", &danger), + micromark_with_options("[foo]: <bar>(baz)\n\n[foo]", &danger)?, "<p>[foo]: <bar>(baz)</p>\n<p>[foo]</p>", "should not support definitions w/ no whitespace between destination and title" ); @@ -211,8 +211,7 @@ fn definition() { assert_eq!( micromark( - "[foo]: /foo-url \"foo\"\n[bar]: /bar-url\n \"bar\"\n[baz]: /baz-url\n\n[foo],\n[bar],\n[baz]" - ), + "[foo]: /foo-url \"foo\"\n[bar]: /bar-url\n \"bar\"\n[baz]: /baz-url\n\n[foo],\n[bar],\n[baz]"), "<p><a href=\"/foo-url\" title=\"foo\">foo</a>,\n<a href=\"/bar-url\" title=\"bar\">bar</a>,\n<a href=\"/baz-url\">baz</a></p>", "should support definitions after definitions" ); @@ -370,7 +369,7 @@ fn definition() { ); assert_eq!( - micromark_with_options("[a]\n\n[a]: <b<c>", &danger), + micromark_with_options("[a]\n\n[a]: <b<c>", &danger)?, "<p>[a]</p>\n<p>[a]: <b<c></p>", "should not support a less than in an enclosed destination" ); @@ -451,8 +450,10 @@ fn definition() { }, ..Options::default() } - ), + )?, "<p>[foo]: /url "title"</p>", "should support turning off definitions" ); + + Ok(()) } diff --git a/tests/frontmatter.rs b/tests/frontmatter.rs index 012eb9a..6195a5a 100644 --- a/tests/frontmatter.rs +++ b/tests/frontmatter.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn frontmatter() { +fn frontmatter() -> Result<(), String> { let frontmatter = Options { constructs: Constructs { frontmatter: true, @@ -19,50 +19,52 @@ fn frontmatter() { ); assert_eq!( - micromark_with_options("---\ntitle: Jupyter\n---", &frontmatter), + micromark_with_options("---\ntitle: Jupyter\n---", &frontmatter)?, "", "should support frontmatter (yaml)" ); assert_eq!( - micromark_with_options("+++\ntitle = \"Jupyter\"\n+++", &frontmatter), + micromark_with_options("+++\ntitle = \"Jupyter\"\n+++", &frontmatter)?, "", "should support frontmatter (toml)" ); assert_eq!( - micromark_with_options("---\n---", &frontmatter), + micromark_with_options("---\n---", &frontmatter)?, "", "should support empty frontmatter" ); assert_eq!( - micromark_with_options("---\n---\n## Neptune", &frontmatter), + micromark_with_options("---\n---\n## Neptune", &frontmatter)?, "<h2>Neptune</h2>", "should support content after frontmatter" ); assert_eq!( - micromark_with_options("## Neptune\n---\n---", &frontmatter), + micromark_with_options("## Neptune\n---\n---", &frontmatter)?, "<h2>Neptune</h2>\n<hr />\n<hr />", "should not support frontmatter after content" ); assert_eq!( - micromark_with_options("> ---\n> ---\n> ## Neptune", &frontmatter), + micromark_with_options("> ---\n> ---\n> ## Neptune", &frontmatter)?, "<blockquote>\n<hr />\n<hr />\n<h2>Neptune</h2>\n</blockquote>", "should not support frontmatter in a container" ); assert_eq!( - micromark_with_options("---", &frontmatter), + micromark_with_options("---", &frontmatter)?, "<hr />", "should not support just an opening fence" ); assert_eq!( - micromark_with_options("---\ntitle: Neptune", &frontmatter), + micromark_with_options("---\ntitle: Neptune", &frontmatter)?, "<hr />\n<p>title: Neptune</p>", "should not support a missing closing fence" ); + + Ok(()) } diff --git a/tests/gfm_autolink_literal.rs b/tests/gfm_autolink_literal.rs index 0c646b6..bcb0797 100644 --- a/tests/gfm_autolink_literal.rs +++ b/tests/gfm_autolink_literal.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn gfm_autolink_literal() { +fn gfm_autolink_literal() -> Result<(), String> { let gfm = Options { constructs: Constructs::gfm(), ..Options::default() @@ -26,165 +26,165 @@ fn gfm_autolink_literal() { ); assert_eq!( - micromark_with_options("https://example.com", &gfm), + micromark_with_options("https://example.com", &gfm)?, "<p><a href=\"https://example.com\">https://example.com</a></p>", "should support protocol urls if enabled" ); assert_eq!( - micromark_with_options("www.example.com", &gfm), + micromark_with_options("www.example.com", &gfm)?, "<p><a href=\"http://www.example.com\">www.example.com</a></p>", "should support www urls if enabled" ); assert_eq!( - micromark_with_options("user@example.com", &gfm), + micromark_with_options("user@example.com", &gfm)?, "<p><a href=\"mailto:user@example.com\">user@example.com</a></p>", "should support email urls if enabled" ); assert_eq!( - micromark_with_options("[https://example.com](xxx)", &gfm), + micromark_with_options("[https://example.com](xxx)", &gfm)?, "<p><a href=\"xxx\">https://example.com</a></p>", "should not link protocol urls in links" ); assert_eq!( - micromark_with_options("[www.example.com](xxx)", &gfm), + micromark_with_options("[www.example.com](xxx)", &gfm)?, "<p><a href=\"xxx\">www.example.com</a></p>", "should not link www urls in links" ); assert_eq!( - micromark_with_options("[user@example.com](xxx)", &gfm), + micromark_with_options("[user@example.com](xxx)", &gfm)?, "<p><a href=\"xxx\">user@example.com</a></p>", "should not link email urls in links" ); assert_eq!( - micromark_with_options("user@example.com", &gfm), + micromark_with_options("user@example.com", &gfm)?, "<p><a href=\"mailto:user@example.com\">user@example.com</a></p>", "should support a closing paren at TLD (email)" ); assert_eq!( - micromark_with_options("www.a.)", &gfm), + micromark_with_options("www.a.)", &gfm)?, "<p><a href=\"http://www.a\">www.a</a>.)</p>", "should support a closing paren at TLD (www)" ); assert_eq!( - micromark_with_options("www.a b", &gfm), + micromark_with_options("www.a b", &gfm)?, "<p><a href=\"http://www.a\">www.a</a> b</p>", "should support no TLD" ); assert_eq!( - micromark_with_options("www.a/b c", &gfm), + micromark_with_options("www.a/b c", &gfm)?, "<p><a href=\"http://www.a/b\">www.a/b</a> c</p>", "should support a path instead of TLD" ); assert_eq!( - micromark_with_options("www.�a", &gfm), + micromark_with_options("www.�a", &gfm)?, "<p><a href=\"http://www.%EF%BF%BDa\">www.�a</a></p>", "should support a replacement character in a domain" ); assert_eq!( - micromark_with_options("http://點看.com", &gfm), + micromark_with_options("http://點看.com", &gfm)?, "<p><a href=\"http://%E9%BB%9E%E7%9C%8B.com\">http://點看.com</a></p>", "should support non-ascii characters in a domain (http)" ); assert_eq!( - micromark_with_options("www.點看.com", &gfm), + micromark_with_options("www.點看.com", &gfm)?, "<p><a href=\"http://www.%E9%BB%9E%E7%9C%8B.com\">www.點看.com</a></p>", "should support non-ascii characters in a domain (www)" ); assert_eq!( - micromark_with_options("點看@example.com", &gfm), + micromark_with_options("點看@example.com", &gfm)?, "<p>點看@example.com</p>", "should *not* support non-ascii characters in atext (email)" ); assert_eq!( - micromark_with_options("example@點看.com", &gfm), + micromark_with_options("example@點看.com", &gfm)?, "<p>example@點看.com</p>", "should *not* support non-ascii characters in a domain (email)" ); assert_eq!( - micromark_with_options("www.a.com/點看", &gfm), + micromark_with_options("www.a.com/點看", &gfm)?, "<p><a href=\"http://www.a.com/%E9%BB%9E%E7%9C%8B\">www.a.com/點看</a></p>", "should support non-ascii characters in a path" ); assert_eq!( - micromark_with_options("www.-a.b", &gfm), + micromark_with_options("www.-a.b", &gfm)?, "<p><a href=\"http://www.-a.b\">www.-a.b</a></p>", "should support a dash to start a domain" ); assert_eq!( - micromark_with_options("www.$", &gfm), + micromark_with_options("www.$", &gfm)?, "<p><a href=\"http://www.$\">www.$</a></p>", "should support a dollar as a domain name" ); assert_eq!( - micromark_with_options("www.a..b.c", &gfm), + micromark_with_options("www.a..b.c", &gfm)?, "<p><a href=\"http://www.a..b.c\">www.a..b.c</a></p>", "should support adjacent dots in a domain name" ); assert_eq!( - micromark_with_options("www.a&a;", &gfm), + micromark_with_options("www.a&a;", &gfm)?, "<p><a href=\"http://www.a\">www.a</a>&a;</p>", "should support named character references in domains" ); assert_eq!( - micromark_with_options("https://a.bc/d/e/).", &gfm), + micromark_with_options("https://a.bc/d/e/).", &gfm)?, "<p><a href=\"https://a.bc/d/e/\">https://a.bc/d/e/</a>).</p>", "should support a closing paren and period after a path" ); assert_eq!( - micromark_with_options("https://a.bc/d/e/.)", &gfm), + micromark_with_options("https://a.bc/d/e/.)", &gfm)?, "<p><a href=\"https://a.bc/d/e/\">https://a.bc/d/e/</a>.)</p>", "should support a period and closing paren after a path" ); assert_eq!( - micromark_with_options("https://a.bc).", &gfm), + micromark_with_options("https://a.bc).", &gfm)?, "<p><a href=\"https://a.bc\">https://a.bc</a>).</p>", "should support a closing paren and period after a domain" ); assert_eq!( - micromark_with_options("https://a.bc.)", &gfm), + micromark_with_options("https://a.bc.)", &gfm)?, "<p><a href=\"https://a.bc\">https://a.bc</a>.)</p>", "should support a period and closing paren after a domain" ); assert_eq!( - micromark_with_options("https://a.bc).d", &gfm), + micromark_with_options("https://a.bc).d", &gfm)?, "<p><a href=\"https://a.bc).d\">https://a.bc).d</a></p>", "should support a closing paren and period in a path" ); assert_eq!( - micromark_with_options("https://a.bc.)d", &gfm), + micromark_with_options("https://a.bc.)d", &gfm)?, "<p><a href=\"https://a.bc.)d\">https://a.bc.)d</a></p>", "should support a period and closing paren in a path" ); assert_eq!( - micromark_with_options("https://a.bc/))d", &gfm), + micromark_with_options("https://a.bc/))d", &gfm)?, "<p><a href=\"https://a.bc/))d\">https://a.bc/))d</a></p>", "should support two closing parens in a path" ); assert_eq!( - micromark_with_options("ftp://a/b/c.txt", &gfm), + micromark_with_options("ftp://a/b/c.txt", &gfm)?, "<p>ftp://a/b/c.txt</p>", "should not support ftp links" ); @@ -193,19 +193,19 @@ fn gfm_autolink_literal() { // Fixing it would mean deviating from `cmark-gfm`: // Source: <https://github.com/github/cmark-gfm/blob/ef1cfcb/extensions/autolink.c#L156>. // assert_eq!( - // micromark_with_options(",www.example.com", &gfm), + // micromark_with_options(",www.example.com", &gfm)?, // "<p>,<a href=\"http://www.example.com\">www.example.com</a></p>", // "should support www links after Unicode punctuation", // ); assert_eq!( - micromark_with_options(",https://example.com", &gfm), + micromark_with_options(",https://example.com", &gfm)?, "<p>,<a href=\"https://example.com\">https://example.com</a></p>", "should support http links after Unicode punctuation" ); assert_eq!( - micromark_with_options(",example@example.com", &gfm), + micromark_with_options(",example@example.com", &gfm)?, "<p>,<a href=\"mailto:example@example.com\">example@example.com</a></p>", "should support email links after Unicode punctuation" ); @@ -214,13 +214,13 @@ fn gfm_autolink_literal() { micromark_with_options( "http://user:password@host:port/path?key=value#fragment", &gfm - ), + )?, "<p>http://user:password@host:port/path?key=value#fragment</p>", "should not link character reference for `:`" ); assert_eq!( - micromark_with_options("http://example.com/ab<cd", &gfm), + micromark_with_options("http://example.com/ab<cd", &gfm)?, "<p><a href=\"http://example.com/ab\">http://example.com/ab</a><cd</p>", "should stop domains/paths at `<`" ); @@ -252,7 +252,7 @@ xmpp:scyther@pokemon.com/message. Email me at:scyther@pokemon.com"###, &gfm - ), + )?, r###"<p><a href="mailto:scyther@pokemon.com">mailto:scyther@pokemon.com</a></p> <p>This is a <a href="mailto:scyther@pokemon.com">mailto:scyther@pokemon.com</a></p> <p><a href="mailto:scyther@pokemon.com">mailto:scyther@pokemon.com</a>.</p> @@ -298,7 +298,7 @@ a www.example.com&. b a www.example.com& b "###, &gfm - ), + )?, r###"<p>a <a href="http://www.example.com&xxx;b">www.example.com&xxx;b</a> c</p> <p>a <a href="http://www.example.com">www.example.com</a>&xxx;. b</p> <p>a <a href="http://www.example.com">www.example.com</a>&xxxxxxxxx;. b</p> @@ -345,7 +345,7 @@ a www.example.com& b ![ contact@example.com ](#) "###, &gfm - ), + )?, r###"<p>[ <a href="http://www.example.com">www.example.com</a></p> <p>[ <a href="https://example.com">https://example.com</a></p> <p>[ <a href="mailto:contact@example.com">contact@example.com</a></p> @@ -392,7 +392,7 @@ www.example.com/?q=a(business))) (www.example.com/?q=a(business)". "###, &gfm - ), + )?, r###"<p><a href="http://www.example.com/?=a(b)cccccc">www.example.com/?=a(b)cccccc</a></p> <p><a href="http://www.example.com/?=a(b(c)ccccc">www.example.com/?=a(b(c)ccccc</a></p> <p><a href="http://www.example.com/?=a(b(c)c)cccc">www.example.com/?=a(b(c)c)cccc</a></p> @@ -537,7 +537,7 @@ Can contain an underscore followed by a period: aaa@a.b_.c [link]() <http://autolink> should still be expanded. "###, &gfm - ), + )?, r###"<h1>Literal autolinks</h1> <h2>WWW autolinks</h2> <p>w.commonmark.org</p> @@ -641,7 +641,7 @@ H5. [[]]www.a.com©b "###, &gfm - ), + )?, r###"<p>H0.</p> <p>[<a href="https://a.com&copy;b">https://a.com&copy;b</a></p> <p>[<a href="http://www.a.com&copy;b">www.a.com&copy;b</a></p> @@ -716,7 +716,7 @@ Autolink literal after image. ![a]() www.a.com ![a]() a@b.c -"###, &gfm), +"###, &gfm)?, r###"<p>Image start.</p> <p>![<a href="https://a.com">https://a.com</a></p> <p>![<a href="http://a.com">http://a.com</a></p> @@ -858,7 +858,7 @@ Autolink literal after link. [a]() www.a.com [a]() a@b.c -"###, &gfm), +"###, &gfm)?, r###"<p>Link start.</p> <p>[<a href="https://a.com">https://a.com</a></p> <p>[<a href="http://a.com">http://a.com</a></p> @@ -991,7 +991,7 @@ www.a&b} www.a&b~ "###, &gfm - ), + )?, r###"<h1>“character reference”</h1> <p><a href="http://www.a&b">www.a&b</a> (space)</p> <p><a href="http://www.a&b">www.a&b</a>!</p> @@ -1101,7 +1101,7 @@ www.a#| www.a#} www.a#~ -"###, &gfm), +"###, &gfm)?, r###"<h1>“character reference”</h1> <p><a href="http://www.a&#35">www.a&#35</a> (space)</p> <p><a href="http://www.a&#35">www.a&#35</a>!</p> @@ -1174,7 +1174,7 @@ react@0.0.0-experimental-aae83a4b9 [ react@0.0.0-experimental-aae83a4b9 "###, &gfm - ), + )?, r###"<p>a@0.0</p> <p><a href="mailto:a@0.b">a@0.b</a></p> <p>a@a.29</p> @@ -1267,7 +1267,7 @@ http://a} http://a~ "###, &gfm - ), + )?, r###"<h1>httpshhh? (2)</h1> <p><a href="http://a">http://a</a> (space)</p> <p><a href="http://a">http://a</a>!</p> @@ -1380,7 +1380,7 @@ http://} http://~ "###, &gfm - ), + )?, r###"<h1>httpshhh? (1)</h1> <p>http:// (space)</p> <p>http://!</p> @@ -1493,7 +1493,7 @@ http://a/b} http://a/b~ "###, &gfm - ), + )?, r###"<h1>httpshhh? (4)</h1> <p><a href="http://a/b">http://a/b</a> (space)</p> <p><a href="http://a/b">http://a/b</a>!</p> @@ -1606,7 +1606,7 @@ http://a/} http://a/~ "###, &gfm - ), + )?, r###"<h1>httpshhh? (3)</h1> <p><a href="http://a/">http://a/</a> (space)</p> <p><a href="http://a/">http://a/</a>!</p> @@ -1661,7 +1661,7 @@ www.example.com/a&bogus; www.example.com/a\. "###, &gfm - ), + )?, r###"<p><a href="#">www.example.com/a©</a></p> <p><a href="http://www.example.com/a">www.example.com/a</a>©</p> <p><a href="#">www.example.com/a&bogus;</a></p> @@ -1745,7 +1745,7 @@ www.a/b&c} www.a/b&c~ "###, &gfm - ), + )?, r###"<h1>“character reference”</h1> <p><a href="http://www.a/b&c">www.a/b&c</a> (space)</p> <p><a href="http://www.a/b&c">www.a/b&c</a>!</p> @@ -1858,7 +1858,7 @@ www.a/b#} www.a/b#~ "###, &gfm - ), + )?, r###"<h1>“character reference”</h1> <p><a href="http://www.a/b&#35">www.a/b&#35</a> (space)</p> <p><a href="http://www.a/b&#35">www.a/b&#35</a>!</p> @@ -1943,7 +1943,7 @@ http://a.com#d]() www.a.com#d]() "###, &gfm - ), + )?, r###"<p>In autolink literal path or link end?</p> <p><a href="">https://a.com/d</a></p> <p><a href="">http://a.com/d</a></p> @@ -2016,7 +2016,7 @@ Some non-ascii: 中noreply@example.com, 中http://example.com, 中https://exampl Some more non-ascii: 🤷noreply@example.com, 🤷http://example.com, 🤷https://example.com, 🤷www.example.com "###, &gfm - ), + )?, r###"<p>Last non-markdown ASCII whitespace (FF): <a href="mailto:noreply@example.com">noreply@example.com</a>, <a href="http://example.com">http://example.com</a>, <a href="https://example.com">https://example.com</a>, www.example.com</p> <p>Last non-whitespace ASCII control (US): <a href="mailto:noreply@example.com">noreply@example.com</a>, <a href="http://example.com">http://example.com</a>, <a href="https://example.com">https://example.com</a>, www.example.com</p> <p>First punctuation after controls: !<a href="mailto:noreply@example.com">noreply@example.com</a>, !<a href="http://example.com">http://example.com</a>, !<a href="https://example.com">https://example.com</a>, !www.example.com</p> @@ -2123,7 +2123,7 @@ See `https://github.com/remarkjs/remark/discussions/678`. [asd] ,https://github.com "###, &gfm - ), + )?, r###"<h1>HTTP</h1> <p><a href="https://a.b">https://a.b</a> can start after EOF</p> <p>Can start after EOL: @@ -2243,7 +2243,7 @@ www.a} www.a~ "###, &gfm - ), + )?, r###"<h1>wwwtf 2?</h1> <p><a href="http://www.a">www.a</a> (space)</p> <p><a href="http://www.a">www.a</a>!</p> @@ -2356,7 +2356,7 @@ www.a.} www.a.~ "###, &gfm - ), + )?, r###"<h1>wwwtf 5?</h1> <p><a href="http://www.a">www.a</a>. (space)</p> <p><a href="http://www.a">www.a</a>.!</p> @@ -2469,7 +2469,7 @@ www.} www.~ "###, &gfm - ), + )?, r###"<h1>wwwtf?</h1> <p><a href="http://www">www</a>. (space)</p> <p><a href="http://www">www</a>.!</p> @@ -2582,7 +2582,7 @@ www.a/b} www.a/b~ "###, &gfm - ), + )?, r###"<h1>wwwtf? (4)</h1> <p><a href="http://www.a/b">www.a/b</a> (space)</p> <p><a href="http://www.a/b">www.a/b</a>!</p> @@ -2695,7 +2695,7 @@ www.a/} www.a/~ "###, &gfm - ), + )?, r###"<h1>wwwtf? (3)</h1> <p><a href="http://www.a/">www.a/</a> (space)</p> <p><a href="http://www.a/">www.a/</a>!</p> @@ -2734,4 +2734,6 @@ www.a/~ "###, "should match www (path start) like GitHub does (except for the bracket bug)" ); + + Ok(()) } diff --git a/tests/gfm_footnote.rs b/tests/gfm_footnote.rs index 8c6cc54..d371455 100644 --- a/tests/gfm_footnote.rs +++ b/tests/gfm_footnote.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn gfm_footnote() { +fn gfm_footnote() -> Result<(), String> { let gfm = Options { constructs: Constructs::gfm(), ..Options::default() @@ -16,7 +16,7 @@ fn gfm_footnote() { ); assert_eq!( - micromark_with_options("A call.[^a]\n\n[^a]: whatevs", &gfm), + micromark_with_options("A call.[^a]\n\n[^a]: whatevs", &gfm)?, "<p>A call.<sup><a href=\"#user-content-fn-a\" id=\"user-content-fnref-a\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup></p> <section data-footnotes=\"\" class=\"footnotes\"><h2 id=\"footnote-label\" class=\"sr-only\">Footnotes</h2> <ol> @@ -28,6 +28,7 @@ fn gfm_footnote() { ", "should support footnotes" ); + assert_eq!( micromark_with_options( "Noot.[^a]\n\n[^a]: dingen", @@ -37,7 +38,7 @@ fn gfm_footnote() { gfm_footnote_back_label: Some("Terug naar de inhoud".to_string()), ..Options::default() } - ), + )?, "<p>Noot.<sup><a href=\"#user-content-fn-a\" id=\"user-content-fnref-a\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup></p> <section data-footnotes=\"\" class=\"footnotes\"><h2 id=\"footnote-label\" class=\"sr-only\">Voetnoten</h2> <ol> @@ -58,7 +59,7 @@ fn gfm_footnote() { gfm_footnote_label_tag_name: Some("h1".to_string()), ..Options::default() } - ), + )?, "<p><sup><a href=\"#user-content-fn-a\" id=\"user-content-fnref-a\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup></p> <section data-footnotes=\"\" class=\"footnotes\"><h1 id=\"footnote-label\" class=\"sr-only\">Footnotes</h1> <ol> @@ -79,7 +80,7 @@ fn gfm_footnote() { gfm_footnote_label_attributes: Some("class=\"footnote-heading\"".to_string()), ..Options::default() } - ), + )?, "<p><sup><a href=\"#user-content-fn-a\" id=\"user-content-fnref-a\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup></p> <section data-footnotes=\"\" class=\"footnotes\"><h2 id=\"footnote-label\" class=\"footnote-heading\">Footnotes</h2> <ol> @@ -100,7 +101,7 @@ fn gfm_footnote() { gfm_footnote_clobber_prefix: Some("".to_string()), ..Options::default() } - ), + )?, "<p><sup><a href=\"#fn-a\" id=\"fnref-a\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup></p> <section data-footnotes=\"\" class=\"footnotes\"><h2 id=\"footnote-label\" class=\"sr-only\">Footnotes</h2> <ol> @@ -114,19 +115,19 @@ fn gfm_footnote() { ); assert_eq!( - micromark_with_options("A paragraph.\n\n[^a]: whatevs", &gfm), + micromark_with_options("A paragraph.\n\n[^a]: whatevs", &gfm)?, "<p>A paragraph.</p>\n", "should ignore definitions w/o calls" ); assert_eq!( - micromark_with_options("a[^b]", &gfm), + micromark_with_options("a[^b]", &gfm)?, "<p>a[^b]</p>", "should ignore calls w/o definitions" ); assert_eq!( - micromark_with_options("a[^b]\n\n[^b]: c\n[^b]: d", &gfm), + micromark_with_options("a[^b]\n\n[^b]: c\n[^b]: d", &gfm)?, "<p>a<sup><a href=\"#user-content-fn-b\" id=\"user-content-fnref-b\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup></p> <section data-footnotes=\"\" class=\"footnotes\"><h2 id=\"footnote-label\" class=\"sr-only\">Footnotes</h2> <ol> @@ -140,7 +141,7 @@ fn gfm_footnote() { ); assert_eq!( - micromark_with_options("a[^b], c[^b]\n\n[^b]: d", &gfm), + micromark_with_options("a[^b], c[^b]\n\n[^b]: d", &gfm)?, "<p>a<sup><a href=\"#user-content-fn-b\" id=\"user-content-fnref-b\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup>, c<sup><a href=\"#user-content-fn-b\" id=\"user-content-fnref-b-2\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup></p> <section data-footnotes=\"\" class=\"footnotes\"><h2 id=\"footnote-label\" class=\"sr-only\">Footnotes</h2> <ol> @@ -154,32 +155,32 @@ fn gfm_footnote() { ); assert_eq!( - micromark_with_options("![^a](b)", &gfm), + micromark_with_options("![^a](b)", &gfm)?, "<p>!<a href=\"b\">^a</a></p>", "should not support images starting w/ `^` (but see it as a link?!, 1)" ); assert_eq!( - micromark_with_options("![^a][b]\n\n[b]: c", &gfm), + micromark_with_options("![^a][b]\n\n[b]: c", &gfm)?, "<p>!<a href=\"c\">^a</a></p>\n", "should not support images starting w/ `^` (but see it as a link?!, 2)" ); assert_eq!( - micromark_with_options("[^]()", &gfm), + micromark_with_options("[^]()", &gfm)?, "<p><a href=\"\">^</a></p>", "should support an empty link with caret" ); assert_eq!( - micromark_with_options("![^]()", &gfm), + micromark_with_options("![^]()", &gfm)?, "<p>!<a href=\"\">^</a></p>", "should support an empty image with caret (as link)" ); // <https://github.com/github/cmark-gfm/issues/239> assert_eq!( - micromark_with_options("Call.[^a\\+b].\n\n[^a\\+b]: y", &gfm), + micromark_with_options("Call.[^a\\+b].\n\n[^a\\+b]: y", &gfm)?, "<p>Call.<sup><a href=\"#user-content-fn-a%5C+b\" id=\"user-content-fnref-a%5C+b\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup>.</p> <section data-footnotes=\"\" class=\"footnotes\"><h2 id=\"footnote-label\" class=\"sr-only\">Footnotes</h2> <ol> @@ -193,7 +194,7 @@ fn gfm_footnote() { ); assert_eq!( - micromark_with_options("Call.[^a©b].\n\n[^a©b]: y", &gfm), + micromark_with_options("Call.[^a©b].\n\n[^a©b]: y", &gfm)?, "<p>Call.<sup><a href=\"#user-content-fn-a&copy;b\" id=\"user-content-fnref-a&copy;b\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup>.</p> <section data-footnotes=\"\" class=\"footnotes\"><h2 id=\"footnote-label\" class=\"sr-only\">Footnotes</h2> <ol> @@ -209,7 +210,7 @@ fn gfm_footnote() { // <https://github.com/github/cmark-gfm/issues/239> // <https://github.com/github/cmark-gfm/issues/240> assert_eq!( - micromark_with_options("Call.[^a\\]b].\n\n[^a\\]b]: y", &gfm), + micromark_with_options("Call.[^a\\]b].\n\n[^a\\]b]: y", &gfm)?, "<p>Call.<sup><a href=\"#user-content-fn-a%5C%5Db\" id=\"user-content-fnref-a%5C%5Db\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup>.</p> <section data-footnotes=\"\" class=\"footnotes\"><h2 id=\"footnote-label\" class=\"sr-only\">Footnotes</h2> <ol> @@ -223,7 +224,7 @@ fn gfm_footnote() { ); assert_eq!( - micromark_with_options("Call.[^a[b].\n\n[^a[b]: y", &gfm), + micromark_with_options("Call.[^a[b].\n\n[^a[b]: y", &gfm)?, "<p>Call.<sup><a href=\"#user-content-fn-a&#91;b\" id=\"user-content-fnref-a&#91;b\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup>.</p> <section data-footnotes=\"\" class=\"footnotes\"><h2 id=\"footnote-label\" class=\"sr-only\">Footnotes</h2> <ol> @@ -237,19 +238,19 @@ fn gfm_footnote() { ); assert_eq!( - micromark_with_options("Call.[^a\\+b].\n\n[^a+b]: y", &gfm), + micromark_with_options("Call.[^a\\+b].\n\n[^a+b]: y", &gfm)?, "<p>Call.[^a+b].</p>\n", "should match calls to definitions on the source of the label, not on resolved escapes" ); assert_eq!( - micromark_with_options("Call.[^a[b].\n\n[^a\\[b]: y", &gfm), + micromark_with_options("Call.[^a[b].\n\n[^a\\[b]: y", &gfm)?, "<p>Call.[^a[b].</p>\n", "should match calls to definitions on the source of the label, not on resolved references" ); assert_eq!( - micromark_with_options("[^1].\n\n[^1]: a\nb", &gfm), + micromark_with_options("[^1].\n\n[^1]: a\nb", &gfm)?, "<p><sup><a href=\"#user-content-fn-1\" id=\"user-content-fnref-1\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup>.</p> <section data-footnotes=\"\" class=\"footnotes\"><h2 id=\"footnote-label\" class=\"sr-only\">Footnotes</h2> <ol> @@ -264,7 +265,7 @@ b <a href=\"#user-content-fnref-1\" data-footnote-backref=\"\" class=\"data-foot ); assert_eq!( - micromark_with_options("[^1].\n\n> [^1]: a\nb", &gfm), + micromark_with_options("[^1].\n\n> [^1]: a\nb", &gfm)?, "<p><sup><a href=\"#user-content-fn-1\" id=\"user-content-fnref-1\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup>.</p> <blockquote> </blockquote> @@ -281,7 +282,7 @@ b <a href=\"#user-content-fnref-1\" data-footnote-backref=\"\" class=\"data-foot ); assert_eq!( - micromark_with_options("[^1].\n\n> [^1]: a\n> b", &gfm), + micromark_with_options("[^1].\n\n> [^1]: a\n> b", &gfm)?, "<p><sup><a href=\"#user-content-fn-1\" id=\"user-content-fnref-1\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup>.</p> <blockquote> </blockquote> @@ -298,7 +299,7 @@ b <a href=\"#user-content-fnref-1\" data-footnote-backref=\"\" class=\"data-foot ); assert_eq!( - micromark_with_options("[^1].\n\n[^1]: a\n\n > b", &gfm), + micromark_with_options("[^1].\n\n[^1]: a\n\n > b", &gfm)?, "<p><sup><a href=\"#user-content-fn-1\" id=\"user-content-fnref-1\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup>.</p> <section data-footnotes=\"\" class=\"footnotes\"><h2 id=\"footnote-label\" class=\"sr-only\">Footnotes</h2> <ol> @@ -319,7 +320,7 @@ b <a href=\"#user-content-fnref-1\" data-footnote-backref=\"\" class=\"data-foot let max = "x".repeat(999); assert_eq!( - micromark_with_options(format!("Call.[^{}].\n\n[^{}]: y", max, max).as_str(), &gfm), + micromark_with_options(format!("Call.[^{}].\n\n[^{}]: y", max, max).as_str(), &gfm)?, format!("<p>Call.<sup><a href=\"#user-content-fn-{}\" id=\"user-content-fnref-{}\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup>.</p> <section data-footnotes=\"\" class=\"footnotes\"><h2 id=\"footnote-label\" class=\"sr-only\">Footnotes</h2> <ol> @@ -336,7 +337,7 @@ b <a href=\"#user-content-fnref-1\" data-footnote-backref=\"\" class=\"data-foot micromark_with_options( format!("Call.[^a{}].\n\n[^a{}]: y", max, max).as_str(), &gfm - ), + )?, format!("<p>Call.[^a{}].</p>\n<p>[^a{}]: y</p>", max, max), "should not support 1000 characters in a call / definition" ); @@ -354,7 +355,7 @@ a![^1] [i]: c"###, &gfm - ), + )?, r###"<p>a<img src="#" alt="i" /> a!<a href="#">i</a> a<img src="c" alt="i" /> @@ -373,7 +374,7 @@ a!<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref= ); assert_eq!( - micromark_with_options("a![^1]", &gfm), + micromark_with_options("a![^1]", &gfm)?, "<p>a![^1]</p>", "should match bang/caret interplay (undefined) like GitHub" ); @@ -385,7 +386,7 @@ a!<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref= [^1]: b "###, &gfm - ), + )?, r###"<p>a!<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></p> <section data-footnotes="" class="footnotes"><h2 id="footnote-label" class="sr-only">Footnotes</h2> <ol> @@ -424,7 +425,7 @@ even another caret. [^^]: caret "###, &gfm - ), + )?, r###"<p>Calls may not be empty: <a href="empty">^</a>.</p> <p>Calls cannot contain whitespace only: <a href="empty">^ </a>.</p> <p>Calls cannot contain whitespace at all: <a href="empty">^ </a>, <a href="empty">^ </a>, <a href="empty">^ @@ -482,7 +483,7 @@ even another caret.</p> [^![image](#)]: a "###, &gfm - ), + )?, // Note: // * GH does not support colons. // See: <https://github.com/github/cmark-gfm/issues/250> @@ -541,7 +542,7 @@ even another caret.</p> [^4]: Directly after a list item. "###, &gfm - ), + )?, r###"<p>Call<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup><sup><a href="#user-content-fn-2" id="user-content-fnref-2" data-footnote-ref="" aria-describedby="footnote-label">2</a></sup><sup><a href="#user-content-fn-3" id="user-content-fnref-3" data-footnote-ref="" aria-describedby="footnote-label">3</a></sup><sup><a href="#user-content-fn-4" id="user-content-fnref-4" data-footnote-ref="" aria-describedby="footnote-label">4</a></sup></p> <blockquote> <p>More.</p> @@ -598,7 +599,7 @@ even another caret.</p> - list "###, &gfm - ), + )?, r###"<p><sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup><sup><a href="#user-content-fn-2" id="user-content-fnref-2" data-footnote-ref="" aria-describedby="footnote-label">2</a></sup><sup><a href="#user-content-fn-3" id="user-content-fnref-3" data-footnote-ref="" aria-describedby="footnote-label">3</a></sup><sup><a href="#user-content-fn-4" id="user-content-fnref-4" data-footnote-ref="" aria-describedby="footnote-label">4</a></sup></p> <h1>Heading</h1> <blockquote> @@ -655,7 +656,7 @@ Lazy? Lazy! "###, &gfm - ), + )?, r###"<p>Call<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup><sup><a href="#user-content-fn-2" id="user-content-fnref-2" data-footnote-ref="" aria-describedby="footnote-label">2</a></sup><sup><a href="#user-content-fn-3" id="user-content-fnref-3" data-footnote-ref="" aria-describedby="footnote-label">3</a></sup><sup><a href="#user-content-fn-4" id="user-content-fnref-4" data-footnote-ref="" aria-describedby="footnote-label">4</a></sup><sup><a href="#user-content-fn-5" id="user-content-fnref-5" data-footnote-ref="" aria-describedby="footnote-label">5</a></sup>.</p> <p>Lazy?</p> <p>Lazy!</p> @@ -711,7 +712,7 @@ Lazy! [^10]:- - - kilo "###, &gfm - ), + )?, r###"<p>Note!<sup><a href="#user-content-fn-0" id="user-content-fnref-0" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup><sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref="" aria-describedby="footnote-label">2</a></sup><sup><a href="#user-content-fn-2" id="user-content-fnref-2" data-footnote-ref="" aria-describedby="footnote-label">3</a></sup><sup><a href="#user-content-fn-3" id="user-content-fnref-3" data-footnote-ref="" aria-describedby="footnote-label">4</a></sup><sup><a href="#user-content-fn-4" id="user-content-fnref-4" data-footnote-ref="" aria-describedby="footnote-label">5</a></sup><sup><a href="#user-content-fn-5" id="user-content-fnref-5" data-footnote-ref="" aria-describedby="footnote-label">6</a></sup><sup><a href="#user-content-fn-6" id="user-content-fnref-6" data-footnote-ref="" aria-describedby="footnote-label">7</a></sup><sup><a href="#user-content-fn-7" id="user-content-fnref-7" data-footnote-ref="" aria-describedby="footnote-label">8</a></sup><sup><a href="#user-content-fn-8" id="user-content-fnref-8" data-footnote-ref="" aria-describedby="footnote-label">9</a></sup><sup><a href="#user-content-fn-9" id="user-content-fnref-9" data-footnote-ref="" aria-describedby="footnote-label">10</a></sup><sup><a href="#user-content-fn-10" id="user-content-fnref-10" data-footnote-ref="" aria-describedby="footnote-label">11</a></sup></p> <section data-footnotes="" class="footnotes"><h2 id="footnote-label" class="sr-only">Footnotes</h2> <ol> @@ -784,7 +785,7 @@ indented delta <a href="#user-content-fnref-2" data-footnote-backref="" class="d [^1]: Recursion[^1][^1] "###, &gfm - ), + )?, r###"<p>Call<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup><sup><a href="#user-content-fn-1" id="user-content-fnref-1-2" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></p> <section data-footnotes="" class="footnotes"><h2 id="footnote-label" class="sr-only">Footnotes</h2> <ol> @@ -806,7 +807,7 @@ indented delta <a href="#user-content-fnref-2" data-footnote-backref="" class="d [^1]: b "###, &gfm - ), + )?, r###"<p>Call<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></p> <section data-footnotes="" class="footnotes"><h2 id="footnote-label" class="sr-only">Footnotes</h2> <ol> @@ -848,7 +849,7 @@ indented delta <a href="#user-content-fnref-2" data-footnote-backref="" class="d [^5]: e "###, &gfm - ), + )?, r###"<p><em>emphasis<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup></em></p> <p><strong>strong<sup><a href="#user-content-fn-2" id="user-content-fnref-2" data-footnote-ref="" aria-describedby="footnote-label">2</a></sup></strong></p> <p><code>code[^3]</code></p> @@ -885,7 +886,7 @@ indented delta <a href="#user-content-fnref-2" data-footnote-backref="" class="d [^3]: c "###, &gfm - ), + )?, r###"<p>What are these!<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup>, !<sup><a href="#user-content-fn-2" id="user-content-fnref-2" data-footnote-ref="" aria-describedby="footnote-label">2</a></sup>[], and ![this]<sup><a href="#user-content-fn-3" id="user-content-fnref-3" data-footnote-ref="" aria-describedby="footnote-label">3</a></sup>.</p> <section data-footnotes="" class="footnotes"><h2 id="footnote-label" class="sr-only">Footnotes</h2> <ol> @@ -927,7 +928,7 @@ indented delta <a href="#user-content-fnref-2" data-footnote-backref="" class="d * list "###, &gfm - ), + )?, r###"<p><sup><a href="#user-content-fn-0" id="user-content-fnref-0" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup><sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref="" aria-describedby="footnote-label">2</a></sup><sup><a href="#user-content-fn-2" id="user-content-fnref-2" data-footnote-ref="" aria-describedby="footnote-label">3</a></sup><sup><a href="#user-content-fn-3" id="user-content-fnref-3" data-footnote-ref="" aria-describedby="footnote-label">4</a></sup><sup><a href="#user-content-fn-4" id="user-content-fnref-4" data-footnote-ref="" aria-describedby="footnote-label">5</a></sup><sup><a href="#user-content-fn-5" id="user-content-fnref-5" data-footnote-ref="" aria-describedby="footnote-label">6</a></sup></p> <h1>Heading</h1> <blockquote> @@ -980,7 +981,7 @@ indented delta <a href="#user-content-fnref-2" data-footnote-backref="" class="d [^3]: c "###, &gfm - ), + )?, r###"<p>What are these<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup>, <sup><a href="#user-content-fn-2" id="user-content-fnref-2" data-footnote-ref="" aria-describedby="footnote-label">2</a></sup>[], and [this]<sup><a href="#user-content-fn-3" id="user-content-fnref-3" data-footnote-ref="" aria-describedby="footnote-label">3</a></sup>.</p> <section data-footnotes="" class="footnotes"><h2 id="footnote-label" class="sr-only">Footnotes</h2> <ol> @@ -1030,7 +1031,7 @@ indented delta <a href="#user-content-fnref-2" data-footnote-backref="" class="d - list "###, &gfm - ), + )?, r###"<p><sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup><sup><a href="#user-content-fn-2" id="user-content-fnref-2" data-footnote-ref="" aria-describedby="footnote-label">2</a></sup><sup><a href="#user-content-fn-3" id="user-content-fnref-3" data-footnote-ref="" aria-describedby="footnote-label">3</a></sup><sup><a href="#user-content-fn-4" id="user-content-fnref-4" data-footnote-ref="" aria-describedby="footnote-label">4</a></sup></p> <h1>Heading</h1> <blockquote> @@ -1092,7 +1093,7 @@ indented delta <a href="#user-content-fnref-2" data-footnote-backref="" class="d - list "###, &gfm - ), + )?, r###"<p><sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup><sup><a href="#user-content-fn-2" id="user-content-fnref-2" data-footnote-ref="" aria-describedby="footnote-label">2</a></sup><sup><a href="#user-content-fn-3" id="user-content-fnref-3" data-footnote-ref="" aria-describedby="footnote-label">3</a></sup><sup><a href="#user-content-fn-4" id="user-content-fnref-4" data-footnote-ref="" aria-describedby="footnote-label">4</a></sup></p> <section data-footnotes="" class="footnotes"><h2 id="footnote-label" class="sr-only">Footnotes</h2> <ol> @@ -1141,7 +1142,7 @@ more code [^3]: [^4]: Paragraph "###, &gfm - ), + )?, r###"<p>Note!<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup><sup><a href="#user-content-fn-2" id="user-content-fnref-2" data-footnote-ref="" aria-describedby="footnote-label">2</a></sup><sup><a href="#user-content-fn-3" id="user-content-fnref-3" data-footnote-ref="" aria-describedby="footnote-label">3</a></sup><sup><a href="#user-content-fn-4" id="user-content-fnref-4" data-footnote-ref="" aria-describedby="footnote-label">4</a></sup></p> <ul> <li></li> @@ -1191,7 +1192,7 @@ more code - list "###, &gfm - ), + )?, r###"<p><sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup><sup><a href="#user-content-fn-2" id="user-content-fnref-2" data-footnote-ref="" aria-describedby="footnote-label">2</a></sup><sup><a href="#user-content-fn-3" id="user-content-fnref-3" data-footnote-ref="" aria-describedby="footnote-label">3</a></sup><sup><a href="#user-content-fn-4" id="user-content-fnref-4" data-footnote-ref="" aria-describedby="footnote-label">4</a></sup></p> <h1>Heading</h1> <blockquote> @@ -1245,7 +1246,7 @@ more code - list "###, &gfm - ), + )?, r###"<p><sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup><sup><a href="#user-content-fn-2" id="user-content-fnref-2" data-footnote-ref="" aria-describedby="footnote-label">2</a></sup><sup><a href="#user-content-fn-3" id="user-content-fnref-3" data-footnote-ref="" aria-describedby="footnote-label">3</a></sup><sup><a href="#user-content-fn-4" id="user-content-fnref-4" data-footnote-ref="" aria-describedby="footnote-label">4</a></sup></p> <section data-footnotes="" class="footnotes"><h2 id="footnote-label" class="sr-only">Footnotes</h2> <ol> @@ -1303,7 +1304,7 @@ This paragraph won’t be part of the note, because it isn’t indented. "###, &gfm - ), + )?, r###"<p>Here is a footnote reference,<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup> and another.<sup><a href="#user-content-fn-longnote" id="user-content-fnref-longnote" data-footnote-ref="" aria-describedby="footnote-label">2</a></sup></p> <p>This paragraph won’t be part of the note, because it isn’t indented.</p> @@ -1371,7 +1372,7 @@ multi-paragraph list items. <a href="#user-content-fnref-longnote" data-footnote 3 "###, &gfm - ), + )?, r###"<p>Call[^1][^2]<sup><a href="#user-content-fn-3" id="user-content-fnref-3" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup><sup><a href="#user-content-fn-4" id="user-content-fnref-4" data-footnote-ref="" aria-describedby="footnote-label">2</a></sup><sup><a href="#user-content-fn-5" id="user-content-fnref-5" data-footnote-ref="" aria-describedby="footnote-label">3</a></sup><sup><a href="#user-content-fn-6" id="user-content-fnref-6" data-footnote-ref="" aria-describedby="footnote-label">4</a></sup><sup><a href="#user-content-fn-7" id="user-content-fnref-7" data-footnote-ref="" aria-describedby="footnote-label">5</a></sup><sup><a href="#user-content-fn-8" id="user-content-fnref-8" data-footnote-ref="" aria-describedby="footnote-label">6</a></sup><sup><a href="#user-content-fn-9" id="user-content-fnref-9" data-footnote-ref="" aria-describedby="footnote-label">7</a></sup><sup><a href="#user-content-fn-10" id="user-content-fnref-10" data-footnote-ref="" aria-describedby="footnote-label">8</a></sup><sup><a href="#user-content-fn-11" id="user-content-fnref-11" data-footnote-ref="" aria-describedby="footnote-label">9</a></sup><sup><a href="#user-content-fn-12" id="user-content-fnref-12" data-footnote-ref="" aria-describedby="footnote-label">10</a></sup>.</p> <pre><code> [^1]: 5 @@ -1463,7 +1464,7 @@ multi-paragraph list items. <a href="#user-content-fnref-longnote" data-footnote 0 "###, &gfm - ), + )?, r###"<p>Call<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref="" aria-describedby="footnote-label">1</a></sup><sup><a href="#user-content-fn-2" id="user-content-fnref-2" data-footnote-ref="" aria-describedby="footnote-label">2</a></sup><sup><a href="#user-content-fn-3" id="user-content-fnref-3" data-footnote-ref="" aria-describedby="footnote-label">3</a></sup><sup><a href="#user-content-fn-4" id="user-content-fnref-4" data-footnote-ref="" aria-describedby="footnote-label">4</a></sup><sup><a href="#user-content-fn-5" id="user-content-fnref-5" data-footnote-ref="" aria-describedby="footnote-label">5</a></sup><sup><a href="#user-content-fn-6" id="user-content-fnref-6" data-footnote-ref="" aria-describedby="footnote-label">6</a></sup><sup><a href="#user-content-fn-7" id="user-content-fnref-7" data-footnote-ref="" aria-describedby="footnote-label">7</a></sup><sup><a href="#user-content-fn-8" id="user-content-fnref-8" data-footnote-ref="" aria-describedby="footnote-label">8</a></sup><sup><a href="#user-content-fn-9" id="user-content-fnref-9" data-footnote-ref="" aria-describedby="footnote-label">9</a></sup>.</p> <p>3</p> <p>2</p> @@ -1522,9 +1523,11 @@ multi-paragraph list items. <a href="#user-content-fnref-longnote" data-footnote [3]: c "###, &gfm - ), + )?, r###"<p>Here is a short reference,<a href="a">1</a>, a collapsed one,<a href="b">2</a>, and a full <a href="c">one</a>.</p> "###, "should match references and definitions like GitHub" ); + + Ok(()) } diff --git a/tests/gfm_strikethrough.rs b/tests/gfm_strikethrough.rs index f39be07..b8c3e1f 100644 --- a/tests/gfm_strikethrough.rs +++ b/tests/gfm_strikethrough.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn gfm_strikethrough() { +fn gfm_strikethrough() -> Result<(), String> { let gfm = Options { constructs: Constructs::gfm(), ..Options::default() @@ -16,49 +16,49 @@ fn gfm_strikethrough() { ); assert_eq!( - micromark_with_options("a ~b~", &gfm), + micromark_with_options("a ~b~", &gfm)?, "<p>a <del>b</del></p>", "should support strikethrough w/ one tilde" ); assert_eq!( - micromark_with_options("a ~~b~~", &gfm), + micromark_with_options("a ~~b~~", &gfm)?, "<p>a <del>b</del></p>", "should support strikethrough w/ two tildes" ); assert_eq!( - micromark_with_options("a ~~~b~~~", &gfm), + micromark_with_options("a ~~~b~~~", &gfm)?, "<p>a ~~~b~~~</p>", "should not support strikethrough w/ three tildes" ); assert_eq!( - micromark_with_options("a \\~~~b~~ c", &gfm), + micromark_with_options("a \\~~~b~~ c", &gfm)?, "<p>a ~<del>b</del> c</p>", "should support strikethrough after an escaped tilde" ); assert_eq!( - micromark_with_options("a ~~b ~~c~~ d~~ e", &gfm), + micromark_with_options("a ~~b ~~c~~ d~~ e", &gfm)?, "<p>a <del>b <del>c</del> d</del> e</p>", "should support nested strikethrough" ); assert_eq!( - micromark_with_options("a ~-1~ b", &gfm), + micromark_with_options("a ~-1~ b", &gfm)?, "<p>a <del>-1</del> b</p>", "should open if preceded by whitespace and followed by punctuation" ); assert_eq!( - micromark_with_options("a ~b.~ c", &gfm), + micromark_with_options("a ~b.~ c", &gfm)?, "<p>a <del>b.</del> c</p>", "should close if preceded by punctuation and followed by whitespace" ); assert_eq!( - micromark_with_options("~b.~.", &gfm), + micromark_with_options("~b.~.", &gfm)?, "<p><del>b.</del>.</p>", "should close if preceded and followed by punctuation" ); @@ -123,7 +123,7 @@ a ~~two b one~ c two~~ d a ~~two b two~~ c one~ d "###, &gfm - ), + )?, r###"<h1>Balanced</h1> <p>a <del>one</del> b</p> <p>a <del>two</del> b</p> @@ -192,7 +192,7 @@ a ~~twoLeft b ~~twoLeft c twoRight~~ d a ~~twoLeft b ~~twoLeft c ~~twoLeft d "###, &gfm - ), + )?, r###"<h1>Flank</h1> <p>a oneRight~ b oneRight~ c oneRight~ d</p> <p>a oneRight~ b oneRight~ c ~oneLeft d</p> @@ -309,7 +309,7 @@ t ~~**xxx**~~ zzz u ~**xxx**~ zzz "###, &gfm - ), + )?, r###"<h1>Interlpay</h1> <h2>Interleave with attention</h2> <p>a <del>two <em>emphasis</em> two</del> b</p> @@ -367,7 +367,7 @@ u ~**xxx**~ zzz gfm_strikethrough_single_tilde: false, ..Options::default() } - ), + )?, "<p>a ~b~ <del>c</del> d</p>", "should not support strikethrough w/ one tilde if `singleTilde: false`" ); @@ -380,8 +380,10 @@ u ~**xxx**~ zzz gfm_strikethrough_single_tilde: true, ..Options::default() } - ), + )?, "<p>a <del>b</del> <del>c</del> d</p>", "should support strikethrough w/ one tilde if `singleTilde: true`" ); + + Ok(()) } diff --git a/tests/gfm_table.rs b/tests/gfm_table.rs index a265549..619bf2a 100644 --- a/tests/gfm_table.rs +++ b/tests/gfm_table.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn gfm_table() { +fn gfm_table() -> Result<(), String> { let gfm = Options { constructs: Constructs::gfm(), ..Options::default() @@ -16,181 +16,181 @@ fn gfm_table() { ); assert_eq!( - micromark_with_options("| a |\n| - |\n| b |", &gfm), + micromark_with_options("| a |\n| - |\n| b |", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>b</td>\n</tr>\n</tbody>\n</table>", "should support tables" ); assert_eq!( - micromark_with_options("| a |", &gfm), + micromark_with_options("| a |", &gfm)?, "<p>| a |</p>", "should not support a table w/ the head row ending in an eof (1)" ); assert_eq!( - micromark_with_options("| a", &gfm), + micromark_with_options("| a", &gfm)?, "<p>| a</p>", "should not support a table w/ the head row ending in an eof (2)" ); assert_eq!( - micromark_with_options("a |", &gfm), + micromark_with_options("a |", &gfm)?, "<p>a |</p>", "should not support a table w/ the head row ending in an eof (3)" ); assert_eq!( - micromark_with_options("| a |\n| - |", &gfm), + micromark_with_options("| a |\n| - |", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>", "should support a table w/ a delimiter row ending in an eof (1)" ); assert_eq!( - micromark_with_options("| a\n| -", &gfm), + micromark_with_options("| a\n| -", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>", "should support a table w/ a delimiter row ending in an eof (2)" ); assert_eq!( - micromark_with_options("| a |\n| - |\n| b |", &gfm), + micromark_with_options("| a |\n| - |\n| b |", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>b</td>\n</tr>\n</tbody>\n</table>", "should support a table w/ a body row ending in an eof (1)" ); assert_eq!( - micromark_with_options("| a\n| -\n| b", &gfm), + micromark_with_options("| a\n| -\n| b", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>b</td>\n</tr>\n</tbody>\n</table>", "should support a table w/ a body row ending in an eof (2)" ); assert_eq!( - micromark_with_options("a|b\n-|-\nc|d", &gfm), + micromark_with_options("a|b\n-|-\nc|d", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n<th>b</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>c</td>\n<td>d</td>\n</tr>\n</tbody>\n</table>", "should support a table w/ a body row ending in an eof (3)" ); assert_eq!( - micromark_with_options("| a \n| -\t\n| b | ", &gfm), + micromark_with_options("| a \n| -\t\n| b | ", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>b</td>\n</tr>\n</tbody>\n</table>", "should support rows w/ trailing whitespace (1)" ); assert_eq!( - micromark_with_options("| a | \n| - |", &gfm), + micromark_with_options("| a | \n| - |", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>", "should support rows w/ trailing whitespace (2)" ); assert_eq!( - micromark_with_options("| a |\n| - | ", &gfm), + micromark_with_options("| a |\n| - | ", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>", "should support rows w/ trailing whitespace (3)" ); assert_eq!( - micromark_with_options("| a |\n| - |\n| b | ", &gfm), + micromark_with_options("| a |\n| - |\n| b | ", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>b</td>\n</tr>\n</tbody>\n</table>", "should support rows w/ trailing whitespace (4)" ); assert_eq!( - micromark_with_options("||a|\n|-|-|", &gfm), + micromark_with_options("||a|\n|-|-|", &gfm)?, "<table>\n<thead>\n<tr>\n<th></th>\n<th>a</th>\n</tr>\n</thead>\n</table>", "should support empty first header cells" ); assert_eq!( - micromark_with_options("|a||\n|-|-|", &gfm), + micromark_with_options("|a||\n|-|-|", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n<th></th>\n</tr>\n</thead>\n</table>", "should support empty last header cells" ); assert_eq!( - micromark_with_options("a||b\n-|-|-", &gfm), + micromark_with_options("a||b\n-|-|-", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n<th></th>\n<th>b</th>\n</tr>\n</thead>\n</table>", "should support empty header cells" ); assert_eq!( - micromark_with_options("|a|b|\n|-|-|\n||c|", &gfm), + micromark_with_options("|a|b|\n|-|-|\n||c|", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n<th>b</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td></td>\n<td>c</td>\n</tr>\n</tbody>\n</table>", "should support empty first body cells" ); assert_eq!( - micromark_with_options("|a|b|\n|-|-|\n|c||", &gfm), + micromark_with_options("|a|b|\n|-|-|\n|c||", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n<th>b</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>c</td>\n<td></td>\n</tr>\n</tbody>\n</table>", "should support empty last body cells" ); assert_eq!( - micromark_with_options("a|b|c\n-|-|-\nd||e", &gfm), + micromark_with_options("a|b|c\n-|-|-\nd||e", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n<th>b</th>\n<th>c</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>d</td>\n<td></td>\n<td>e</td>\n</tr>\n</tbody>\n</table>", "should support empty body cells" ); assert_eq!( - micromark_with_options("| a |\n| - |\n- b", &gfm), + micromark_with_options("| a |\n| - |\n- b", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>\n<ul>\n<li>b</li>\n</ul>", "should support a list after a table" ); assert_eq!( - micromark_with_options("> | a |\n| - |", &gfm), + micromark_with_options("> | a |\n| - |", &gfm)?, "<blockquote>\n<p>| a |\n| - |</p>\n</blockquote>", "should not support a lazy delimiter row (1)" ); assert_eq!( - micromark_with_options("> a\n> | b |\n| - |", &gfm), + micromark_with_options("> a\n> | b |\n| - |", &gfm)?, "<blockquote>\n<p>a\n| b |\n| - |</p>\n</blockquote>", "should not support a lazy delimiter row (2)" ); assert_eq!( - micromark_with_options("| a |\n> | - |", &gfm), + micromark_with_options("| a |\n> | - |", &gfm)?, "<p>| a |</p>\n<blockquote>\n<p>| - |</p>\n</blockquote>", "should not support a piercing delimiter row" ); assert_eq!( - micromark_with_options("> a\n> | b |\n|-", &gfm), + micromark_with_options("> a\n> | b |\n|-", &gfm)?, "<blockquote>\n<p>a\n| b |\n|-</p>\n</blockquote>", "should not support a lazy body row (2)" ); assert_eq!( - micromark_with_options("> | a |\n> | - |\n| b |", &gfm), + micromark_with_options("> | a |\n> | - |\n| b |", &gfm)?, "<blockquote>\n<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>\n</blockquote>\n<p>| b |</p>", "should not support a lazy body row (1)" ); assert_eq!( - micromark_with_options("> a\n> | b |\n> | - |\n| c |", &gfm), + micromark_with_options("> a\n> | b |\n> | - |\n| c |", &gfm)?, "<blockquote>\n<p>a</p>\n<table>\n<thead>\n<tr>\n<th>b</th>\n</tr>\n</thead>\n</table>\n</blockquote>\n<p>| c |</p>", "should not support a lazy body row (2)" ); assert_eq!( - micromark_with_options("> | A |\n> | - |\n> | 1 |\n| 2 |", &gfm), + micromark_with_options("> | A |\n> | - |\n> | 1 |\n| 2 |", &gfm)?, "<blockquote>\n<table>\n<thead>\n<tr>\n<th>A</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>1</td>\n</tr>\n</tbody>\n</table>\n</blockquote>\n<p>| 2 |</p>", "should not support a lazy body row (3)" ); assert_eq!( - micromark_with_options(" - d\n - e", &gfm), + micromark_with_options(" - d\n - e", &gfm)?, micromark(" - d\n - e"), "should not change how lists and lazyness work" ); assert_eq!( - micromark_with_options("| a |\n | - |", &gfm), + micromark_with_options("| a |\n | - |", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>", "should form a table if the delimiter row is indented w/ 3 spaces" ); assert_eq!( - micromark_with_options("| a |\n | - |", &gfm), + micromark_with_options("| a |\n | - |", &gfm)?, "<p>| a |\n| - |</p>", "should not form a table if the delimiter row is indented w/ 4 spaces" ); @@ -202,31 +202,31 @@ fn gfm_table() { ..Constructs::gfm() }, ..Options::default() - }), + })?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>", "should form a table if the delimiter row is indented w/ 4 spaces and indented code is turned off" ); assert_eq!( - micromark_with_options("| a |\n| - |\n> block quote?", &gfm), + micromark_with_options("| a |\n| - |\n> block quote?", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>\n<blockquote>\n<p>block quote?</p>\n</blockquote>", "should be interrupted by a block quote" ); assert_eq!( - micromark_with_options("| a |\n| - |\n>", &gfm), + micromark_with_options("| a |\n| - |\n>", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>\n<blockquote>\n</blockquote>", "should be interrupted by a block quote (empty)" ); assert_eq!( - micromark_with_options("| a |\n| - |\n- list?", &gfm), + micromark_with_options("| a |\n| - |\n- list?", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>\n<ul>\n<li>list?</li>\n</ul>", "should be interrupted by a list" ); assert_eq!( - micromark_with_options("| a |\n| - |\n-", &gfm), + micromark_with_options("| a |\n| - |\n-", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>\n<ul>\n<li></li>\n</ul>", "should be interrupted by a list (empty)" ); @@ -239,7 +239,7 @@ fn gfm_table() { constructs: Constructs::gfm(), ..Options::default() } - ), + )?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>\n<!-- HTML? -->", "should be interrupted by HTML (flow)" ); @@ -249,7 +249,7 @@ fn gfm_table() { allow_dangerous_html: true, constructs: Constructs::gfm(), ..Options::default() - }), + })?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>\n<pre><code>code?\n</code></pre>", "should be interrupted by code (indented)" ); @@ -259,7 +259,7 @@ fn gfm_table() { allow_dangerous_html: true, constructs: Constructs::gfm(), ..Options::default() - }), + })?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>\n<pre><code class=\"language-js\">code?\n</code></pre>\n", "should be interrupted by code (fenced)" ); @@ -272,75 +272,71 @@ fn gfm_table() { constructs: Constructs::gfm(), ..Options::default() } - ), + )?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>\n<hr />", "should be interrupted by a thematic break" ); assert_eq!( - micromark_with_options("| a |\n| - |\n# heading?", &gfm), + micromark_with_options("| a |\n| - |\n# heading?", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>\n<h1>heading?</h1>", "should be interrupted by a heading (ATX)" ); assert_eq!( - micromark_with_options("| a |\n| - |\nheading\n=", &gfm), + micromark_with_options("| a |\n| - |\nheading\n=", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>heading</td>\n</tr>\n<tr>\n<td>=</td>\n</tr>\n</tbody>\n</table>", "should *not* be interrupted by a heading (setext)" ); assert_eq!( - micromark_with_options("| a |\n| - |\nheading\n---", &gfm), + micromark_with_options("| a |\n| - |\nheading\n---", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>heading</td>\n</tr>\n</tbody>\n</table>\n<hr />", "should *not* be interrupted by a heading (setext), but interrupt if the underline is also a thematic break" ); assert_eq!( - micromark_with_options("| a |\n| - |\nheading\n-", &gfm), + micromark_with_options("| a |\n| - |\nheading\n-", &gfm)?, "<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>heading</td>\n</tr>\n</tbody>\n</table>\n<ul>\n<li></li>\n</ul>", "should *not* be interrupted by a heading (setext), but interrupt if the underline is also an empty list item bullet" ); assert_eq!( - micromark_with_options("a\nb\n-:", &gfm), + micromark_with_options("a\nb\n-:", &gfm)?, "<p>a</p>\n<table>\n<thead>\n<tr>\n<th align=\"right\">b</th>\n</tr>\n</thead>\n</table>", "should support a single head row" ); assert_eq!( - micromark_with_options("> | a |\n> | - |", &gfm), + micromark_with_options("> | a |\n> | - |", &gfm)?, "<blockquote>\n<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>\n</blockquote>", "should support a table in a container" ); assert_eq!( - micromark_with_options("> | a |\n| - |", &gfm), + micromark_with_options("> | a |\n| - |", &gfm)?, "<blockquote>\n<p>| a |\n| - |</p>\n</blockquote>", "should not support a lazy delimiter row if the head row is in a container" ); assert_eq!( - micromark_with_options("| a |\n> | - |", &gfm), + micromark_with_options("| a |\n> | - |", &gfm)?, "<p>| a |</p>\n<blockquote>\n<p>| - |</p>\n</blockquote>", "should not support a “piercing” container for the delimiter row, if the head row was not in that container" ); assert_eq!( - micromark_with_options("> | a |\n> | - |\n| c |", &gfm), + micromark_with_options("> | a |\n> | - |\n| c |", &gfm)?, "<blockquote>\n<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>\n</blockquote>\n<p>| c |</p>", "should not support a lazy body row if the head row and delimiter row are in a container" ); assert_eq!( - micromark_with_options("> | a |\n| - |\n> | c |", &gfm), + micromark_with_options("> | a |\n| - |\n> | c |", &gfm)?, "<blockquote>\n<p>| a |\n| - |\n| c |</p>\n</blockquote>", "should not support a lazy delimiter row if the head row and a further body row are in a container" ); - assert_eq!(micromark_with_options("", &gfm), "", "should support"); - - assert_eq!(micromark_with_options("", &gfm), "", "should support"); - assert_eq!( micromark_with_options( r###"# Align @@ -422,7 +418,7 @@ a | f | "###, &gfm - ), + )?, r###"<h1>Align</h1> <h2>An empty initial cell</h2> <table> @@ -551,7 +547,7 @@ a | b | "###, &gfm - ), + )?, r###"<h1>Tables</h1> <table> <thead> @@ -653,7 +649,7 @@ a |- "###, &gfm - ), + )?, r###"<h1>Tables in things</h1> <h2>In lists</h2> <ul> @@ -798,7 +794,7 @@ a | 1 | "###, &gfm - ), + )?, r###"<table> <thead> <tr> @@ -876,7 +872,7 @@ bar | --- | --- | "###, &gfm - ), + )?, r###"<h1>Examples from GFM</h1> <h2>A</h2> <table> @@ -1037,7 +1033,7 @@ bar allow_dangerous_html: true, ..gfm.clone() } - ), + )?, r###"<h1>Grave accents</h1> <h2>Grave accent in cell</h2> <table> @@ -1148,7 +1144,7 @@ a | E | "###, &gfm - ), + )?, r###"<h1>Code</h1> <h2>Indented delimiter row</h2> <table> @@ -1345,7 +1341,7 @@ b allow_dangerous_html: true, ..gfm.clone() } - ), + )?, r###"<h2>Blank line</h2> <table> <thead> @@ -1696,7 +1692,7 @@ a | - | "###, &gfm - ), + )?, r###"<h1>Loose</h1> <h2>Loose</h2> <table> @@ -1748,7 +1744,7 @@ Note: GH has a bug where in case C and E, the escaped escape is treated as a normal escape: <https://github.com/github/cmark-gfm/issues/277>. "###, &gfm - ), + )?, r###"<h1>Some more escapes</h1> <table> <thead> @@ -1779,4 +1775,6 @@ normal escape: <a href="https://github.com/github/cmark-gfm/issues/277">https:// "###, "should match loose escapes like GitHub" ); + + Ok(()) } diff --git a/tests/gfm_tagfilter.rs b/tests/gfm_tagfilter.rs index 54c56ae..68246bd 100644 --- a/tests/gfm_tagfilter.rs +++ b/tests/gfm_tagfilter.rs @@ -3,7 +3,7 @@ use micromark::{micromark_with_options, Options}; use pretty_assertions::assert_eq; #[test] -fn gfm_tagfilter() { +fn gfm_tagfilter() -> Result<(), String> { assert_eq!( micromark_with_options( "<iframe>", @@ -11,7 +11,7 @@ fn gfm_tagfilter() { allow_dangerous_html: true, ..Options::default() } - ), + )?, "<iframe>", "should not filter by default" ); @@ -23,7 +23,7 @@ fn gfm_tagfilter() { gfm_tagfilter: true, ..Options::default() } - ), + )?, "<p>a <i></p>\n<script>", "should not turn `allow_dangerous_html` on" ); @@ -36,7 +36,7 @@ fn gfm_tagfilter() { allow_dangerous_html: true, ..Options::default() } - ), + )?, "<iframe>", "should filter" ); @@ -91,7 +91,7 @@ javascript:/*--></title></style></textarea></script></xmp><svg/onload='+/"/+/onm allow_dangerous_html: true, ..Options::default() } - ), + )?, r###"<title> <div title="<title>"></div> <p><span title="<title>"></span></p> @@ -118,4 +118,6 @@ javascript:/*--></title></style></textarea></script></xmp><svg/onload='+/"/+/onm "###, "should handle things like GitHub" ); + + Ok(()) } diff --git a/tests/gfm_task_list_item.rs b/tests/gfm_task_list_item.rs index 66b646f..b824730 100644 --- a/tests/gfm_task_list_item.rs +++ b/tests/gfm_task_list_item.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn gfm_task_list_item() { +fn gfm_task_list_item() -> Result<(), String> { let gfm = Options { constructs: Constructs::gfm(), ..Options::default() @@ -16,25 +16,25 @@ fn gfm_task_list_item() { ); assert_eq!( - micromark_with_options("* [x] y.", &gfm), + micromark_with_options("* [x] y.", &gfm)?, "<ul>\n<li><input type=\"checkbox\" disabled=\"\" checked=\"\" /> y.</li>\n</ul>", "should support task list item checks" ); assert_eq!( - micromark_with_options("* [ ] z.", &gfm), + micromark_with_options("* [ ] z.", &gfm)?, "<ul>\n<li><input type=\"checkbox\" disabled=\"\" /> z.</li>\n</ul>", "should support unchecked task list item checks" ); assert_eq!( - micromark_with_options("*\n [x]", &gfm), + micromark_with_options("*\n [x]", &gfm)?, "<ul>\n<li>[x]</li>\n</ul>", "should not support laziness (1)" ); assert_eq!( - micromark_with_options("*\n[x]", &gfm), + micromark_with_options("*\n[x]", &gfm)?, "<ul>\n<li></li>\n</ul>\n<p>[x]</p>", "should not support laziness (2)" ); @@ -122,7 +122,7 @@ EOL after: .replace('␠', " ") .replace('␉', "\t"), &gfm - ), + )?, r###"<ul> <li><input type="checkbox" disabled="" /> foo</li> <li><input type="checkbox" disabled="" checked="" /> bar</li> @@ -239,4 +239,6 @@ Text.</li> "###, "should handle things like GitHub" ); + + Ok(()) } diff --git a/tests/hard_break_escape.rs b/tests/hard_break_escape.rs index 70fbf64..2510860 100644 --- a/tests/hard_break_escape.rs +++ b/tests/hard_break_escape.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn hard_break_escape() { +fn hard_break_escape() -> Result<(), String> { assert_eq!( micromark("foo\\\nbaz"), "<p>foo<br />\nbaz</p>", @@ -50,8 +50,10 @@ fn hard_break_escape() { }, ..Options::default() } - ), + )?, "<p>a\\\nb</p>", "should support turning off hard break (escape)" ); + + Ok(()) } diff --git a/tests/hard_break_trailing.rs b/tests/hard_break_trailing.rs index f977657..b5577fd 100644 --- a/tests/hard_break_trailing.rs +++ b/tests/hard_break_trailing.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn hard_break_trailing() { +fn hard_break_trailing() -> Result<(), String> { assert_eq!( micromark("foo \nbaz"), "<p>foo<br />\nbaz</p>", @@ -116,8 +116,10 @@ fn hard_break_trailing() { }, ..Options::default() } - ), + )?, "<p>a\nb</p>", "should support turning off hard break (trailing)" ); + + Ok(()) } diff --git a/tests/heading_atx.rs b/tests/heading_atx.rs index 715b17a..1bd437c 100644 --- a/tests/heading_atx.rs +++ b/tests/heading_atx.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn heading_atx() { +fn heading_atx() -> Result<(), String> { assert_eq!( micromark("# foo"), "<h1>foo</h1>", @@ -212,8 +212,10 @@ fn heading_atx() { }, ..Options::default() } - ), + )?, "<p># a</p>", "should support turning off heading (atx)" ); + + Ok(()) } diff --git a/tests/heading_setext.rs b/tests/heading_setext.rs index fa979be..b2889f5 100644 --- a/tests/heading_setext.rs +++ b/tests/heading_setext.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn heading_setext() { +fn heading_setext() -> Result<(), String> { assert_eq!( micromark("Foo *bar*\n========="), "<h1>Foo <em>bar</em></h1>", @@ -279,8 +279,10 @@ fn heading_setext() { }, ..Options::default() } - ), + )?, "<p>a\n-</p>", "should support turning off setext underlines" ); + + Ok(()) } diff --git a/tests/html_flow.rs b/tests/html_flow.rs index 7013657..c411036 100644 --- a/tests/html_flow.rs +++ b/tests/html_flow.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn html_flow() { +fn html_flow() -> Result<(), String> { let danger = Options { allow_dangerous_html: true, ..Options::default() @@ -16,7 +16,7 @@ fn html_flow() { ); assert_eq!( - micromark_with_options("<!-- asd -->", &danger), + micromark_with_options("<!-- asd -->", &danger)?, "<!-- asd -->", "should support a heading w/ rank 1" ); @@ -31,14 +31,16 @@ fn html_flow() { }, ..Options::default() } - ), + )?, "<p><x></p>", "should support turning off html (flow)" ); + + Ok(()) } #[test] -fn html_flow_1_raw() { +fn html_flow_1_raw() -> Result<(), String> { let danger = Options { allow_dangerous_html: true, ..Options::default() @@ -54,7 +56,7 @@ main = print $ parseTags tags </code></pre> okay", &danger - ), + )?, "<pre language=\"haskell\"><code> import Text.HTML.TagSoup @@ -74,7 +76,7 @@ document.getElementById(\"demo\").innerHTML = \"Hello JavaScript!\"; </script> okay", &danger - ), + )?, "<script type=\"text/javascript\"> // JavaScript example @@ -94,7 +96,7 @@ p {color:blue;} </style> okay", &danger - ), + )?, "<style type=\"text/css\"> h1 {color:red;} @@ -106,285 +108,291 @@ p {color:blue;} ); assert_eq!( - micromark_with_options("<style\n type=\"text/css\">\n\nfoo", &danger), + micromark_with_options("<style\n type=\"text/css\">\n\nfoo", &danger)?, "<style\n type=\"text/css\">\n\nfoo", "should support raw tags w/o ending" ); assert_eq!( - micromark_with_options("<style>p{color:red;}</style>\n*foo*", &danger), + micromark_with_options("<style>p{color:red;}</style>\n*foo*", &danger)?, "<style>p{color:red;}</style>\n<p><em>foo</em></p>", "should support raw tags w/ start and end on a single line" ); assert_eq!( - micromark_with_options("<script>\nfoo\n</script>1. *bar*", &danger), + micromark_with_options("<script>\nfoo\n</script>1. *bar*", &danger)?, "<script>\nfoo\n</script>1. *bar*", "should support raw tags w/ more data on ending line" ); assert_eq!( - micromark_with_options("<script", &danger), + micromark_with_options("<script", &danger)?, "<script", "should support an eof directly after a raw tag name" ); assert_eq!( - micromark_with_options("</script\nmore", &danger), + micromark_with_options("</script\nmore", &danger)?, "<p></script\nmore</p>", "should not support a raw closing tag" ); assert_eq!( - micromark_with_options("<script/", &danger), + micromark_with_options("<script/", &danger)?, "<p><script/</p>", "should not support an eof after a self-closing slash" ); assert_eq!( - micromark_with_options("<script/\n*asd*", &danger), + micromark_with_options("<script/\n*asd*", &danger)?, "<p><script/\n<em>asd</em></p>", "should not support a line ending after a self-closing slash" ); assert_eq!( - micromark_with_options("<script/>", &danger), + micromark_with_options("<script/>", &danger)?, "<script/>", "should support an eof after a self-closing tag" ); assert_eq!( - micromark_with_options("<script/>\na", &danger), + micromark_with_options("<script/>\na", &danger)?, "<script/>\na", "should support a line ending after a self-closing tag" ); assert_eq!( - micromark_with_options("<script/>a", &danger), + micromark_with_options("<script/>a", &danger)?, "<p><script/>a</p>", "should not support other characters after a self-closing tag" ); assert_eq!( - micromark_with_options("<script>a", &danger), + micromark_with_options("<script>a", &danger)?, "<script>a", "should support other characters after a raw opening tag" ); // Extra. assert_eq!( - micromark_with_options("Foo\n<script", &danger), + micromark_with_options("Foo\n<script", &danger)?, "<p>Foo</p>\n<script", "should support interrupting paragraphs w/ raw tags" ); assert_eq!( - micromark_with_options("<script>\n \n \n</script>", &danger), + micromark_with_options("<script>\n \n \n</script>", &danger)?, "<script>\n \n \n</script>", "should support blank lines in raw" ); assert_eq!( - micromark_with_options("> <script>\na", &danger), + micromark_with_options("> <script>\na", &danger)?, "<blockquote>\n<script>\n</blockquote>\n<p>a</p>", "should not support lazyness (1)" ); assert_eq!( - micromark_with_options("> a\n<script>", &danger), + micromark_with_options("> a\n<script>", &danger)?, "<blockquote>\n<p>a</p>\n</blockquote>\n<script>", "should not support lazyness (2)" ); + + Ok(()) } #[test] -fn html_flow_2_comment() { +fn html_flow_2_comment() -> Result<(), String> { let danger = Options { allow_dangerous_html: true, ..Options::default() }; assert_eq!( - micromark_with_options("<!-- Foo\n\nbar\n baz -->\nokay", &danger), + micromark_with_options("<!-- Foo\n\nbar\n baz -->\nokay", &danger)?, "<!-- Foo\n\nbar\n baz -->\n<p>okay</p>", "should support comments (type 2)" ); assert_eq!( - micromark_with_options("<!-- foo -->*bar*\n*baz*", &danger), + micromark_with_options("<!-- foo -->*bar*\n*baz*", &danger)?, "<!-- foo -->*bar*\n<p><em>baz</em></p>", "should support comments w/ start and end on a single line" ); assert_eq!( - micromark_with_options("<!-asd-->", &danger), + micromark_with_options("<!-asd-->", &danger)?, "<p><!-asd--></p>", "should not support a single dash to start comments" ); assert_eq!( - micromark_with_options("<!-->", &danger), + micromark_with_options("<!-->", &danger)?, "<!-->", "should support comments where the start dashes are the end dashes (1)" ); assert_eq!( - micromark_with_options("<!--->", &danger), + micromark_with_options("<!--->", &danger)?, "<!--->", "should support comments where the start dashes are the end dashes (2)" ); assert_eq!( - micromark_with_options("<!---->", &danger), + micromark_with_options("<!---->", &danger)?, "<!---->", "should support empty comments" ); // If the `\"` is encoded, we’re in text. If it remains, we’re in HTML. assert_eq!( - micromark_with_options("<!--\n->\n\"", &danger), + micromark_with_options("<!--\n->\n\"", &danger)?, "<!--\n->\n\"", "should not end a comment at one dash (`->`)" ); assert_eq!( - micromark_with_options("<!--\n-->\n\"", &danger), + micromark_with_options("<!--\n-->\n\"", &danger)?, "<!--\n-->\n<p>"</p>", "should end a comment at two dashes (`-->`)" ); assert_eq!( - micromark_with_options("<!--\n--->\n\"", &danger), + micromark_with_options("<!--\n--->\n\"", &danger)?, "<!--\n--->\n<p>"</p>", "should end a comment at three dashes (`--->`)" ); assert_eq!( - micromark_with_options("<!--\n---->\n\"", &danger), + micromark_with_options("<!--\n---->\n\"", &danger)?, "<!--\n---->\n<p>"</p>", "should end a comment at four dashes (`---->`)" ); assert_eq!( - micromark_with_options(" <!-- foo -->", &danger), + micromark_with_options(" <!-- foo -->", &danger)?, " <!-- foo -->", "should support comments w/ indent" ); assert_eq!( - micromark_with_options(" <!-- foo -->", &danger), + micromark_with_options(" <!-- foo -->", &danger)?, "<pre><code><!-- foo -->\n</code></pre>", "should not support comments w/ a 4 character indent" ); // Extra. assert_eq!( - micromark_with_options("Foo\n<!--", &danger), + micromark_with_options("Foo\n<!--", &danger)?, "<p>Foo</p>\n<!--", "should support interrupting paragraphs w/ comments" ); assert_eq!( - micromark_with_options("<!--\n \n \n-->", &danger), + micromark_with_options("<!--\n \n \n-->", &danger)?, "<!--\n \n \n-->", "should support blank lines in comments" ); assert_eq!( - micromark_with_options("> <!--\na", &danger), + micromark_with_options("> <!--\na", &danger)?, "<blockquote>\n<!--\n</blockquote>\n<p>a</p>", "should not support lazyness (1)" ); assert_eq!( - micromark_with_options("> a\n<!--", &danger), + micromark_with_options("> a\n<!--", &danger)?, "<blockquote>\n<p>a</p>\n</blockquote>\n<!--", "should not support lazyness (2)" ); + + Ok(()) } #[test] -fn html_flow_3_instruction() { +fn html_flow_3_instruction() -> Result<(), String> { let danger = Options { allow_dangerous_html: true, ..Options::default() }; assert_eq!( - micromark_with_options("<?php\n\n echo \">\";\n\n?>\nokay", &danger), + micromark_with_options("<?php\n\n echo \">\";\n\n?>\nokay", &danger)?, "<?php\n\n echo \">\";\n\n?>\n<p>okay</p>", "should support instructions (type 3)" ); assert_eq!( - micromark_with_options("<?>", &danger), + micromark_with_options("<?>", &danger)?, "<?>", "should support empty instructions where the `?` is part of both the start and the end" ); assert_eq!( - micromark_with_options("<??>", &danger), + micromark_with_options("<??>", &danger)?, "<??>", "should support empty instructions" ); // Extra. assert_eq!( - micromark_with_options("Foo\n<?", &danger), + micromark_with_options("Foo\n<?", &danger)?, "<p>Foo</p>\n<?", "should support interrupting paragraphs w/ instructions" ); assert_eq!( - micromark_with_options("<?\n \n \n?>", &danger), + micromark_with_options("<?\n \n \n?>", &danger)?, "<?\n \n \n?>", "should support blank lines in instructions" ); assert_eq!( - micromark_with_options("> <?\na", &danger), + micromark_with_options("> <?\na", &danger)?, "<blockquote>\n<?\n</blockquote>\n<p>a</p>", "should not support lazyness (1)" ); assert_eq!( - micromark_with_options("> a\n<?", &danger), + micromark_with_options("> a\n<?", &danger)?, "<blockquote>\n<p>a</p>\n</blockquote>\n<?", "should not support lazyness (2)" ); + + Ok(()) } #[test] -fn html_flow_4_declaration() { +fn html_flow_4_declaration() -> Result<(), String> { let danger = Options { allow_dangerous_html: true, ..Options::default() }; assert_eq!( - micromark_with_options("<!DOCTYPE html>", &danger), + micromark_with_options("<!DOCTYPE html>", &danger)?, "<!DOCTYPE html>", "should support declarations (type 4)" ); assert_eq!( - micromark_with_options("<!123>", &danger), + micromark_with_options("<!123>", &danger)?, "<p><!123></p>", "should not support declarations that start w/o an alpha" ); assert_eq!( - micromark_with_options("<!>", &danger), + micromark_with_options("<!>", &danger)?, "<p><!></p>", "should not support declarations w/o an identifier" ); assert_eq!( - micromark_with_options("<!a>", &danger), + micromark_with_options("<!a>", &danger)?, "<!a>", "should support declarations w/o a single alpha as identifier" ); // Extra. assert_eq!( - micromark_with_options("Foo\n<!d", &danger), + micromark_with_options("Foo\n<!d", &danger)?, "<p>Foo</p>\n<!d", "should support interrupting paragraphs w/ declarations" ); @@ -392,26 +400,28 @@ fn html_flow_4_declaration() { // Note about the lower letter: // <https://github.com/commonmark/commonmark-spec/pull/621> assert_eq!( - micromark_with_options("<!a\n \n \n>", &danger), + micromark_with_options("<!a\n \n \n>", &danger)?, "<!a\n \n \n>", "should support blank lines in declarations" ); assert_eq!( - micromark_with_options("> <!a\nb", &danger), + micromark_with_options("> <!a\nb", &danger)?, "<blockquote>\n<!a\n</blockquote>\n<p>b</p>", "should not support lazyness (1)" ); assert_eq!( - micromark_with_options("> a\n<!b", &danger), + micromark_with_options("> a\n<!b", &danger)?, "<blockquote>\n<p>a</p>\n</blockquote>\n<!b", "should not support lazyness (2)" ); + + Ok(()) } #[test] -fn html_flow_5_cdata() { +fn html_flow_5_cdata() -> Result<(), String> { let danger = Options { allow_dangerous_html: true, ..Options::default() @@ -421,32 +431,32 @@ fn html_flow_5_cdata() { micromark_with_options( "<![CDATA[\nfunction matchwo(a,b)\n{\n if (a < b && a < 0) then {\n return 1;\n\n } else {\n\n return 0;\n }\n}\n]]>\nokay", &danger - ), + )?, "<![CDATA[\nfunction matchwo(a,b)\n{\n if (a < b && a < 0) then {\n return 1;\n\n } else {\n\n return 0;\n }\n}\n]]>\n<p>okay</p>", "should support cdata (type 5)" ); assert_eq!( - micromark_with_options("<![CDATA[]]>", &danger), + micromark_with_options("<![CDATA[]]>", &danger)?, "<![CDATA[]]>", "should support empty cdata" ); assert_eq!( - micromark_with_options("<![CDATA]]>", &danger), + micromark_with_options("<![CDATA]]>", &danger)?, "<p><![CDATA]]></p>", "should not support cdata w/ a missing `[`" ); assert_eq!( - micromark_with_options("<![CDATA[]]]>", &danger), + micromark_with_options("<![CDATA[]]]>", &danger)?, "<![CDATA[]]]>", "should support cdata w/ a single `]` as content" ); // Extra. assert_eq!( - micromark_with_options("Foo\n<![CDATA[", &danger), + micromark_with_options("Foo\n<![CDATA[", &danger)?, "<p>Foo</p>\n<![CDATA[", "should support interrupting paragraphs w/ cdata" ); @@ -454,32 +464,34 @@ fn html_flow_5_cdata() { // Note: cmjs parses this differently. // See: <https://github.com/commonmark/commonmark.js/issues/193> assert_eq!( - micromark_with_options("<![cdata[]]>", &danger), + micromark_with_options("<![cdata[]]>", &danger)?, "<p><![cdata[]]></p>", "should not support lowercase cdata" ); assert_eq!( - micromark_with_options("<![CDATA[\n \n \n]]>", &danger), + micromark_with_options("<![CDATA[\n \n \n]]>", &danger)?, "<![CDATA[\n \n \n]]>", "should support blank lines in cdata" ); assert_eq!( - micromark_with_options("> <![CDATA[\na", &danger), + micromark_with_options("> <![CDATA[\na", &danger)?, "<blockquote>\n<![CDATA[\n</blockquote>\n<p>a</p>", "should not support lazyness (1)" ); assert_eq!( - micromark_with_options("> a\n<![CDATA[", &danger), + micromark_with_options("> a\n<![CDATA[", &danger)?, "<blockquote>\n<p>a</p>\n</blockquote>\n<![CDATA[", "should not support lazyness (2)" ); + + Ok(()) } #[test] -fn html_flow_6_basic() { +fn html_flow_6_basic() -> Result<(), String> { let danger = Options { allow_dangerous_html: true, ..Options::default() @@ -489,7 +501,7 @@ fn html_flow_6_basic() { micromark_with_options( "<table><tr><td>\n<pre>\n**Hello**,\n\n_world_.\n</pre>\n</td></tr></table>", &danger - ), + )?, "<table><tr><td>\n<pre>\n**Hello**,\n<p><em>world</em>.\n</pre></p>\n</td></tr></table>", "should support html (basic)" ); @@ -506,7 +518,7 @@ fn html_flow_6_basic() { okay.", &danger - ), + )?, "<table> <tr> <td> @@ -519,121 +531,121 @@ okay.", ); assert_eq!( - micromark_with_options(" <div>\n *hello*\n <foo><a>", &danger), + micromark_with_options(" <div>\n *hello*\n <foo><a>", &danger)?, " <div>\n *hello*\n <foo><a>", "should support html of type 6 (2)" ); assert_eq!( - micromark_with_options("</div>\n*foo*", &danger), + micromark_with_options("</div>\n*foo*", &danger)?, "</div>\n*foo*", "should support html starting w/ a closing tag" ); assert_eq!( - micromark_with_options("<DIV CLASS=\"foo\">\n\n*Markdown*\n\n</DIV>", &danger), + micromark_with_options("<DIV CLASS=\"foo\">\n\n*Markdown*\n\n</DIV>", &danger)?, "<DIV CLASS=\"foo\">\n<p><em>Markdown</em></p>\n</DIV>", "should support html w/ markdown in between" ); assert_eq!( - micromark_with_options("<div id=\"foo\"\n class=\"bar\">\n</div>", &danger), + micromark_with_options("<div id=\"foo\"\n class=\"bar\">\n</div>", &danger)?, "<div id=\"foo\"\n class=\"bar\">\n</div>", "should support html w/ line endings (1)" ); assert_eq!( - micromark_with_options("<div id=\"foo\" class=\"bar\n baz\">\n</div>", &danger), + micromark_with_options("<div id=\"foo\" class=\"bar\n baz\">\n</div>", &danger)?, "<div id=\"foo\" class=\"bar\n baz\">\n</div>", "should support html w/ line endings (2)" ); assert_eq!( - micromark_with_options("<div>\n*foo*\n\n*bar*", &danger), + micromark_with_options("<div>\n*foo*\n\n*bar*", &danger)?, "<div>\n*foo*\n<p><em>bar</em></p>", "should support an unclosed html element" ); assert_eq!( - micromark_with_options("<div id=\"foo\"\n*hi*", &danger), + micromark_with_options("<div id=\"foo\"\n*hi*", &danger)?, "<div id=\"foo\"\n*hi*", "should support garbage html (1)" ); assert_eq!( - micromark_with_options("<div class\nfoo", &danger), + micromark_with_options("<div class\nfoo", &danger)?, "<div class\nfoo", "should support garbage html (2)" ); assert_eq!( - micromark_with_options("<div *???-&&&-<---\n*foo*", &danger), + micromark_with_options("<div *???-&&&-<---\n*foo*", &danger)?, "<div *???-&&&-<---\n*foo*", "should support garbage html (3)" ); assert_eq!( - micromark_with_options("<div><a href=\"bar\">*foo*</a></div>", &danger), + micromark_with_options("<div><a href=\"bar\">*foo*</a></div>", &danger)?, "<div><a href=\"bar\">*foo*</a></div>", "should support other tags in the opening (1)" ); assert_eq!( - micromark_with_options("<table><tr><td>\nfoo\n</td></tr></table>", &danger), + micromark_with_options("<table><tr><td>\nfoo\n</td></tr></table>", &danger)?, "<table><tr><td>\nfoo\n</td></tr></table>", "should support other tags in the opening (2)" ); assert_eq!( - micromark_with_options("<div></div>\n``` c\nint x = 33;\n```", &danger), + micromark_with_options("<div></div>\n``` c\nint x = 33;\n```", &danger)?, "<div></div>\n``` c\nint x = 33;\n```", "should include everything ’till a blank line" ); assert_eq!( - micromark_with_options("> <div>\n> foo\n\nbar", &danger), + micromark_with_options("> <div>\n> foo\n\nbar", &danger)?, "<blockquote>\n<div>\nfoo\n</blockquote>\n<p>bar</p>", "should support basic tags w/o ending in containers (1)" ); assert_eq!( - micromark_with_options("- <div>\n- foo", &danger), + micromark_with_options("- <div>\n- foo", &danger)?, "<ul>\n<li>\n<div>\n</li>\n<li>foo</li>\n</ul>", "should support basic tags w/o ending in containers (2)" ); assert_eq!( - micromark_with_options(" <div>", &danger), + micromark_with_options(" <div>", &danger)?, " <div>", "should support basic tags w/ indent" ); assert_eq!( - micromark_with_options(" <div>", &danger), + micromark_with_options(" <div>", &danger)?, "<pre><code><div>\n</code></pre>", "should not support basic tags w/ a 4 character indent" ); assert_eq!( - micromark_with_options("Foo\n<div>\nbar\n</div>", &danger), + micromark_with_options("Foo\n<div>\nbar\n</div>", &danger)?, "<p>Foo</p>\n<div>\nbar\n</div>", "should support interrupting paragraphs w/ basic tags" ); assert_eq!( - micromark_with_options("<div>\nbar\n</div>\n*foo*", &danger), + micromark_with_options("<div>\nbar\n</div>\n*foo*", &danger)?, "<div>\nbar\n</div>\n*foo*", "should require a blank line to end" ); assert_eq!( - micromark_with_options("<div>\n\n*Emphasized* text.\n\n</div>", &danger), + micromark_with_options("<div>\n\n*Emphasized* text.\n\n</div>", &danger)?, "<div>\n<p><em>Emphasized</em> text.</p>\n</div>", "should support interleaving w/ blank lines" ); assert_eq!( - micromark_with_options("<div>\n*Emphasized* text.\n</div>", &danger), + micromark_with_options("<div>\n*Emphasized* text.\n</div>", &danger)?, "<div>\n*Emphasized* text.\n</div>", "should not support interleaving w/o blank lines" ); @@ -642,7 +654,7 @@ okay.", micromark_with_options( "<table>\n\n<tr>\n\n<td>\nHi\n</td>\n\n</tr>\n\n</table>", &danger - ), + )?, "<table>\n<tr>\n<td>\nHi\n</td>\n</tr>\n</table>", "should support blank lines between adjacent html" ); @@ -661,7 +673,7 @@ okay.", </table>", &danger - ), + )?, "<table> <tr> <pre><code><td> @@ -674,395 +686,399 @@ okay.", ); assert_eq!( - micromark_with_options("</1>", &danger), + micromark_with_options("</1>", &danger)?, "<p></1></p>", "should not support basic tags w/ an incorrect name start character" ); assert_eq!( - micromark_with_options("<div", &danger), + micromark_with_options("<div", &danger)?, "<div", "should support an eof directly after a basic tag name" ); assert_eq!( - micromark_with_options("<div\n", &danger), + micromark_with_options("<div\n", &danger)?, "<div\n", "should support a line ending directly after a tag name" ); assert_eq!( - micromark_with_options("<div ", &danger), + micromark_with_options("<div ", &danger)?, "<div ", "should support an eof after a space directly after a tag name" ); assert_eq!( - micromark_with_options("<div/", &danger), + micromark_with_options("<div/", &danger)?, "<p><div/</p>", "should not support an eof directly after a self-closing slash" ); assert_eq!( - micromark_with_options("<div/\n*asd*", &danger), + micromark_with_options("<div/\n*asd*", &danger)?, "<p><div/\n<em>asd</em></p>", "should not support a line ending after a self-closing slash" ); assert_eq!( - micromark_with_options("<div/>", &danger), + micromark_with_options("<div/>", &danger)?, "<div/>", "should support an eof after a self-closing tag" ); assert_eq!( - micromark_with_options("<div/>\na", &danger), + micromark_with_options("<div/>\na", &danger)?, "<div/>\na", "should support a line ending after a self-closing tag" ); assert_eq!( - micromark_with_options("<div/>a", &danger), + micromark_with_options("<div/>a", &danger)?, "<div/>a", "should support another character after a self-closing tag" ); assert_eq!( - micromark_with_options("<div>a", &danger), + micromark_with_options("<div>a", &danger)?, "<div>a", "should support another character after a basic opening tag" ); // Extra. assert_eq!( - micromark_with_options("Foo\n<div/>", &danger), + micromark_with_options("Foo\n<div/>", &danger)?, "<p>Foo</p>\n<div/>", "should support interrupting paragraphs w/ self-closing basic tags" ); assert_eq!( - micromark_with_options("<div\n \n \n>", &danger), + micromark_with_options("<div\n \n \n>", &danger)?, "<div\n<blockquote>\n</blockquote>", "should not support blank lines in basic" ); assert_eq!( - micromark_with_options("> <div\na", &danger), + micromark_with_options("> <div\na", &danger)?, "<blockquote>\n<div\n</blockquote>\n<p>a</p>", "should not support lazyness (1)" ); assert_eq!( - micromark_with_options("> a\n<div", &danger), + micromark_with_options("> a\n<div", &danger)?, "<blockquote>\n<p>a</p>\n</blockquote>\n<div", "should not support lazyness (2)" ); + + Ok(()) } #[test] -fn html_flow_7_complete() { +fn html_flow_7_complete() -> Result<(), String> { let danger = Options { allow_dangerous_html: true, ..Options::default() }; assert_eq!( - micromark_with_options("<a href=\"foo\">\n*bar*\n</a>", &danger), + micromark_with_options("<a href=\"foo\">\n*bar*\n</a>", &danger)?, "<a href=\"foo\">\n*bar*\n</a>", "should support complete tags (type 7)" ); assert_eq!( - micromark_with_options("<Warning>\n*bar*\n</Warning>", &danger), + micromark_with_options("<Warning>\n*bar*\n</Warning>", &danger)?, "<Warning>\n*bar*\n</Warning>", "should support non-html tag names" ); assert_eq!( - micromark_with_options("<i class=\"foo\">\n*bar*\n</i>", &danger), + micromark_with_options("<i class=\"foo\">\n*bar*\n</i>", &danger)?, "<i class=\"foo\">\n*bar*\n</i>", "should support non-“block” html tag names (1)" ); assert_eq!( - micromark_with_options("<del>\n*foo*\n</del>", &danger), + micromark_with_options("<del>\n*foo*\n</del>", &danger)?, "<del>\n*foo*\n</del>", "should support non-“block” html tag names (2)" ); assert_eq!( - micromark_with_options("</ins>\n*bar*", &danger), + micromark_with_options("</ins>\n*bar*", &danger)?, "</ins>\n*bar*", "should support closing tags" ); assert_eq!( - micromark_with_options("<del>\n\n*foo*\n\n</del>", &danger), + micromark_with_options("<del>\n\n*foo*\n\n</del>", &danger)?, "<del>\n<p><em>foo</em></p>\n</del>", "should support interleaving" ); assert_eq!( - micromark_with_options("<del>*foo*</del>", &danger), + micromark_with_options("<del>*foo*</del>", &danger)?, "<p><del><em>foo</em></del></p>", "should not support interleaving w/o blank lines" ); assert_eq!( - micromark_with_options("<div>\n \nasd", &danger), + micromark_with_options("<div>\n \nasd", &danger)?, "<div>\n<p>asd</p>", "should support interleaving w/ whitespace-only blank lines" ); assert_eq!( - micromark_with_options("Foo\n<a href=\"bar\">\nbaz", &danger), + micromark_with_options("Foo\n<a href=\"bar\">\nbaz", &danger)?, "<p>Foo\n<a href=\"bar\">\nbaz</p>", "should not support interrupting paragraphs w/ complete tags" ); assert_eq!( - micromark_with_options("<x", &danger), + micromark_with_options("<x", &danger)?, "<p><x</p>", "should not support an eof directly after a tag name" ); assert_eq!( - micromark_with_options("<x/", &danger), + micromark_with_options("<x/", &danger)?, "<p><x/</p>", "should not support an eof directly after a self-closing slash" ); assert_eq!( - micromark_with_options("<x\n", &danger), + micromark_with_options("<x\n", &danger)?, "<p><x</p>\n", "should not support a line ending directly after a tag name" ); assert_eq!( - micromark_with_options("<x ", &danger), + micromark_with_options("<x ", &danger)?, "<p><x</p>", "should not support an eof after a space directly after a tag name" ); assert_eq!( - micromark_with_options("<x/", &danger), + micromark_with_options("<x/", &danger)?, "<p><x/</p>", "should not support an eof directly after a self-closing slash" ); assert_eq!( - micromark_with_options("<x/\n*asd*", &danger), + micromark_with_options("<x/\n*asd*", &danger)?, "<p><x/\n<em>asd</em></p>", "should not support a line ending after a self-closing slash" ); assert_eq!( - micromark_with_options("<x/>", &danger), + micromark_with_options("<x/>", &danger)?, "<x/>", "should support an eof after a self-closing tag" ); assert_eq!( - micromark_with_options("<x/>\na", &danger), + micromark_with_options("<x/>\na", &danger)?, "<x/>\na", "should support a line ending after a self-closing tag" ); assert_eq!( - micromark_with_options("<x/>a", &danger), + micromark_with_options("<x/>a", &danger)?, "<p><x/>a</p>", "should not support another character after a self-closing tag" ); assert_eq!( - micromark_with_options("<x>a", &danger), + micromark_with_options("<x>a", &danger)?, "<p><x>a</p>", "should not support another character after an opening tag" ); assert_eq!( - micromark_with_options("<x y>", &danger), + micromark_with_options("<x y>", &danger)?, "<x y>", "should support boolean attributes in a complete tag" ); assert_eq!( - micromark_with_options("<x\ny>", &danger), + micromark_with_options("<x\ny>", &danger)?, "<p><x\ny></p>", "should not support a line ending before an attribute name" ); assert_eq!( - micromark_with_options("<x\n y>", &danger), + micromark_with_options("<x\n y>", &danger)?, "<p><x\ny></p>", "should not support a line ending w/ whitespace before an attribute name" ); assert_eq!( - micromark_with_options("<x\n \ny>", &danger), + micromark_with_options("<x\n \ny>", &danger)?, "<p><x</p>\n<p>y></p>", "should not support a line ending w/ whitespace and another line ending before an attribute name" ); assert_eq!( - micromark_with_options("<x y\nz>", &danger), + micromark_with_options("<x y\nz>", &danger)?, "<p><x y\nz></p>", "should not support a line ending between attribute names" ); assert_eq!( - micromark_with_options("<x y z>", &danger), + micromark_with_options("<x y z>", &danger)?, "<x y z>", "should support whitespace between attribute names" ); assert_eq!( - micromark_with_options("<x:y>", &danger), + micromark_with_options("<x:y>", &danger)?, "<p><x:y></p>", "should not support a colon in a tag name" ); assert_eq!( - micromark_with_options("<x_y>", &danger), + micromark_with_options("<x_y>", &danger)?, "<p><x_y></p>", "should not support an underscore in a tag name" ); assert_eq!( - micromark_with_options("<x.y>", &danger), + micromark_with_options("<x.y>", &danger)?, "<p><x.y></p>", "should not support a dot in a tag name" ); assert_eq!( - micromark_with_options("<x :y>", &danger), + micromark_with_options("<x :y>", &danger)?, "<x :y>", "should support a colon to start an attribute name" ); assert_eq!( - micromark_with_options("<x _y>", &danger), + micromark_with_options("<x _y>", &danger)?, "<x _y>", "should support an underscore to start an attribute name" ); assert_eq!( - micromark_with_options("<x .y>", &danger), + micromark_with_options("<x .y>", &danger)?, "<p><x .y></p>", "should not support a dot to start an attribute name" ); assert_eq!( - micromark_with_options("<x y:>", &danger), + micromark_with_options("<x y:>", &danger)?, "<x y:>", "should support a colon to end an attribute name" ); assert_eq!( - micromark_with_options("<x y_>", &danger), + micromark_with_options("<x y_>", &danger)?, "<x y_>", "should support an underscore to end an attribute name" ); assert_eq!( - micromark_with_options("<x y.>", &danger), + micromark_with_options("<x y.>", &danger)?, "<x y.>", "should support a dot to end an attribute name" ); assert_eq!( - micromark_with_options("<x y123>", &danger), + micromark_with_options("<x y123>", &danger)?, "<x y123>", "should support numbers to end an attribute name" ); assert_eq!( - micromark_with_options("<x data->", &danger), + micromark_with_options("<x data->", &danger)?, "<x data->", "should support a dash to end an attribute name" ); assert_eq!( - micromark_with_options("<x y=>", &danger), + micromark_with_options("<x y=>", &danger)?, "<p><x y=></p>", "should not upport an initializer w/o a value" ); assert_eq!( - micromark_with_options("<x y==>", &danger), + micromark_with_options("<x y==>", &danger)?, "<p><x y==></p>", "should not support an equals to as an initializer" ); assert_eq!( - micromark_with_options("<x y=z>", &danger), + micromark_with_options("<x y=z>", &danger)?, "<x y=z>", "should support a single character as an unquoted attribute value" ); assert_eq!( - micromark_with_options("<x y=\"\">", &danger), + micromark_with_options("<x y=\"\">", &danger)?, "<x y=\"\">", "should support an empty double quoted attribute value" ); assert_eq!( - micromark_with_options("<x y=\"\">", &danger), + micromark_with_options("<x y=\"\">", &danger)?, "<x y=\"\">", "should support an empty single quoted attribute value" ); assert_eq!( - micromark_with_options("<x y=\"\n\">", &danger), + micromark_with_options("<x y=\"\n\">", &danger)?, "<p><x y=\"\n\"></p>", "should not support a line ending in a double quoted attribute value" ); assert_eq!( - micromark_with_options("<x y=\"\n\">", &danger), + micromark_with_options("<x y=\"\n\">", &danger)?, "<p><x y=\"\n\"></p>", "should not support a line ending in a single quoted attribute value" ); assert_eq!( - micromark_with_options("<w x=y\nz>", &danger), + micromark_with_options("<w x=y\nz>", &danger)?, "<p><w x=y\nz></p>", "should not support a line ending in/after an unquoted attribute value" ); assert_eq!( - micromark_with_options("<w x=y\"z>", &danger), + micromark_with_options("<w x=y\"z>", &danger)?, "<p><w x=y"z></p>", "should not support a double quote in/after an unquoted attribute value" ); assert_eq!( - micromark_with_options("<w x=y'z>", &danger), + micromark_with_options("<w x=y'z>", &danger)?, "<p><w x=y'z></p>", "should not support a single quote in/after an unquoted attribute value" ); assert_eq!( - micromark_with_options("<x y=\"\"z>", &danger), + micromark_with_options("<x y=\"\"z>", &danger)?, "<p><x y=""z></p>", "should not support an attribute after a double quoted attribute value" ); assert_eq!( - micromark_with_options("<x>\n \n \n>", &danger), + micromark_with_options("<x>\n \n \n>", &danger)?, "<x>\n<blockquote>\n</blockquote>", "should not support blank lines in complete" ); assert_eq!( - micromark_with_options("> <a>\n*bar*", &danger), + micromark_with_options("> <a>\n*bar*", &danger)?, "<blockquote>\n<a>\n</blockquote>\n<p><em>bar</em></p>", "should not support lazyness (1)" ); assert_eq!( - micromark_with_options("> a\n<a>", &danger), + micromark_with_options("> a\n<a>", &danger)?, "<blockquote>\n<p>a</p>\n</blockquote>\n<a>", "should not support lazyness (2)" ); + + Ok(()) } diff --git a/tests/html_text.rs b/tests/html_text.rs index 988ebbc..8fdbbd2 100644 --- a/tests/html_text.rs +++ b/tests/html_text.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn html_text() { +fn html_text() -> Result<(), String> { let danger = Options { allow_dangerous_html: true, ..Options::default() @@ -16,19 +16,19 @@ fn html_text() { ); assert_eq!( - micromark_with_options("<a><bab><c2c>", &danger), + micromark_with_options("<a><bab><c2c>", &danger)?, "<p><a><bab><c2c></p>", "should support opening tags" ); assert_eq!( - micromark_with_options("<a/><b2/>", &danger), + micromark_with_options("<a/><b2/>", &danger)?, "<p><a/><b2/></p>", "should support self-closing tags" ); assert_eq!( - micromark_with_options("<a /><b2\ndata=\"foo\" >", &danger), + micromark_with_options("<a /><b2\ndata=\"foo\" >", &danger)?, "<p><a /><b2\ndata=\"foo\" ></p>", "should support whitespace in tags" ); @@ -37,170 +37,170 @@ fn html_text() { micromark_with_options( "<a foo=\"bar\" bam = 'baz <em>\"</em>'\n_boolean zoop:33=zoop:33 />", &danger - ), + )?, "<p><a foo=\"bar\" bam = 'baz <em>\"</em>'\n_boolean zoop:33=zoop:33 /></p>", "should support attributes on tags" ); assert_eq!( - micromark_with_options("Foo <responsive-image src=\"foo.jpg\" />", &danger), + micromark_with_options("Foo <responsive-image src=\"foo.jpg\" />", &danger)?, "<p>Foo <responsive-image src=\"foo.jpg\" /></p>", "should support non-html tags" ); assert_eq!( - micromark_with_options("<33> <__>", &danger), + micromark_with_options("<33> <__>", &danger)?, "<p><33> <__></p>", "should not support nonconforming tag names" ); assert_eq!( - micromark_with_options("<a h*#ref=\"hi\">", &danger), + micromark_with_options("<a h*#ref=\"hi\">", &danger)?, "<p><a h*#ref="hi"></p>", "should not support nonconforming attribute names" ); assert_eq!( - micromark_with_options("<a href=\"hi'> <a href=hi'>", &danger), + micromark_with_options("<a href=\"hi'> <a href=hi'>", &danger)?, "<p><a href="hi'> <a href=hi'></p>", "should not support nonconforming attribute values" ); assert_eq!( - micromark_with_options("< a><\nfoo><bar/ >\n<foo bar=baz\nbim!bop />", &danger), + micromark_with_options("< a><\nfoo><bar/ >\n<foo bar=baz\nbim!bop />", &danger)?, "<p>< a><\nfoo><bar/ >\n<foo bar=baz\nbim!bop /></p>", "should not support nonconforming whitespace" ); assert_eq!( - micromark_with_options("<a href='bar'title=title>", &danger), + micromark_with_options("<a href='bar'title=title>", &danger)?, "<p><a href='bar'title=title></p>", "should not support missing whitespace" ); assert_eq!( - micromark_with_options("</a></foo >", &danger), + micromark_with_options("</a></foo >", &danger)?, "<p></a></foo ></p>", "should support closing tags" ); assert_eq!( - micromark_with_options("</a href=\"foo\">", &danger), + micromark_with_options("</a href=\"foo\">", &danger)?, "<p></a href="foo"></p>", "should not support closing tags w/ attributes" ); assert_eq!( - micromark_with_options("foo <!-- this is a\ncomment - with hyphen -->", &danger), + micromark_with_options("foo <!-- this is a\ncomment - with hyphen -->", &danger)?, "<p>foo <!-- this is a\ncomment - with hyphen --></p>", "should support comments" ); assert_eq!( - micromark_with_options("foo <!-- not a comment -- two hyphens -->", &danger), + micromark_with_options("foo <!-- not a comment -- two hyphens -->", &danger)?, "<p>foo <!-- not a comment -- two hyphens --></p>", "should not support comments w/ two dashes inside" ); assert_eq!( - micromark_with_options("foo <!--> foo -->", &danger), + micromark_with_options("foo <!--> foo -->", &danger)?, "<p>foo <!--> foo --></p>", "should not support nonconforming comments (1)" ); assert_eq!( - micromark_with_options("foo <!-- foo--->", &danger), + micromark_with_options("foo <!-- foo--->", &danger)?, "<p>foo <!-- foo---></p>", "should not support nonconforming comments (2)" ); assert_eq!( - micromark_with_options("foo <?php echo $a; ?>", &danger), + micromark_with_options("foo <?php echo $a; ?>", &danger)?, "<p>foo <?php echo $a; ?></p>", "should support instructions" ); assert_eq!( - micromark_with_options("foo <!ELEMENT br EMPTY>", &danger), + micromark_with_options("foo <!ELEMENT br EMPTY>", &danger)?, "<p>foo <!ELEMENT br EMPTY></p>", "should support declarations" ); assert_eq!( - micromark_with_options("foo <![CDATA[>&<]]>", &danger), + micromark_with_options("foo <![CDATA[>&<]]>", &danger)?, "<p>foo <![CDATA[>&<]]></p>", "should support cdata" ); assert_eq!( - micromark_with_options("foo <a href=\"ö\">", &danger), + micromark_with_options("foo <a href=\"ö\">", &danger)?, "<p>foo <a href=\"ö\"></p>", "should support (ignore) character references" ); assert_eq!( - micromark_with_options("foo <a href=\"\\*\">", &danger), + micromark_with_options("foo <a href=\"\\*\">", &danger)?, "<p>foo <a href=\"\\*\"></p>", "should not support character escapes (1)" ); assert_eq!( - micromark_with_options("<a href=\"\\\"\">", &danger), + micromark_with_options("<a href=\"\\\"\">", &danger)?, "<p><a href="""></p>", "should not support character escapes (2)" ); // Extra: assert_eq!( - micromark_with_options("foo <!1>", &danger), + micromark_with_options("foo <!1>", &danger)?, "<p>foo <!1></p>", "should not support non-comment, non-cdata, and non-named declaration" ); assert_eq!( - micromark_with_options("foo <!-not enough!-->", &danger), + micromark_with_options("foo <!-not enough!-->", &danger)?, "<p>foo <!-not enough!--></p>", "should not support comments w/ not enough dashes" ); assert_eq!( - micromark_with_options("foo <!---ok-->", &danger), + micromark_with_options("foo <!---ok-->", &danger)?, "<p>foo <!---ok--></p>", "should support comments that start w/ a dash, if it’s not followed by a greater than" ); assert_eq!( - micromark_with_options("foo <!--->", &danger), + micromark_with_options("foo <!--->", &danger)?, "<p>foo <!---></p>", "should not support comments that start w/ `->`" ); assert_eq!( - micromark_with_options("foo <!-- -> -->", &danger), + micromark_with_options("foo <!-- -> -->", &danger)?, "<p>foo <!-- -> --></p>", "should support `->` in a comment" ); assert_eq!( - micromark_with_options("foo <!--", &danger), + micromark_with_options("foo <!--", &danger)?, "<p>foo <!--</p>", "should not support eof in a comment (1)" ); assert_eq!( - micromark_with_options("foo <!--a", &danger), + micromark_with_options("foo <!--a", &danger)?, "<p>foo <!--a</p>", "should not support eof in a comment (2)" ); assert_eq!( - micromark_with_options("foo <!--a-", &danger), + micromark_with_options("foo <!--a-", &danger)?, "<p>foo <!--a-</p>", "should not support eof in a comment (3)" ); assert_eq!( - micromark_with_options("foo <!--a--", &danger), + micromark_with_options("foo <!--a--", &danger)?, "<p>foo <!--a--</p>", "should not support eof in a comment (4)" ); @@ -208,204 +208,204 @@ fn html_text() { // Note: cmjs parses this differently. // See: <https://github.com/commonmark/commonmark.js/issues/193> assert_eq!( - micromark_with_options("foo <![cdata[]]>", &danger), + micromark_with_options("foo <![cdata[]]>", &danger)?, "<p>foo <![cdata[]]></p>", "should not support lowercase “cdata”" ); assert_eq!( - micromark_with_options("foo <![CDATA", &danger), + micromark_with_options("foo <![CDATA", &danger)?, "<p>foo <![CDATA</p>", "should not support eof in a CDATA (1)" ); assert_eq!( - micromark_with_options("foo <![CDATA[", &danger), + micromark_with_options("foo <![CDATA[", &danger)?, "<p>foo <![CDATA[</p>", "should not support eof in a CDATA (2)" ); assert_eq!( - micromark_with_options("foo <![CDATA[]", &danger), + micromark_with_options("foo <![CDATA[]", &danger)?, "<p>foo <![CDATA[]</p>", "should not support eof in a CDATA (3)" ); assert_eq!( - micromark_with_options("foo <![CDATA[]]", &danger), + micromark_with_options("foo <![CDATA[]]", &danger)?, "<p>foo <![CDATA[]]</p>", "should not support eof in a CDATA (4)" ); assert_eq!( - micromark_with_options("foo <![CDATA[asd", &danger), + micromark_with_options("foo <![CDATA[asd", &danger)?, "<p>foo <![CDATA[asd</p>", "should not support eof in a CDATA (5)" ); assert_eq!( - micromark_with_options("foo <![CDATA[]]]]>", &danger), + micromark_with_options("foo <![CDATA[]]]]>", &danger)?, "<p>foo <![CDATA[]]]]></p>", "should support end-like constructs in CDATA" ); assert_eq!( - micromark_with_options("foo <!doctype", &danger), + micromark_with_options("foo <!doctype", &danger)?, "<p>foo <!doctype</p>", "should not support eof in declarations" ); assert_eq!( - micromark_with_options("foo <?php", &danger), + micromark_with_options("foo <?php", &danger)?, "<p>foo <?php</p>", "should not support eof in instructions (1)" ); assert_eq!( - micromark_with_options("foo <?php?", &danger), + micromark_with_options("foo <?php?", &danger)?, "<p>foo <?php?</p>", "should not support eof in instructions (2)" ); assert_eq!( - micromark_with_options("foo <???>", &danger), + micromark_with_options("foo <???>", &danger)?, "<p>foo <???></p>", "should support question marks in instructions" ); assert_eq!( - micromark_with_options("foo </3>", &danger), + micromark_with_options("foo </3>", &danger)?, "<p>foo </3></p>", "should not support closing tags that don’t start w/ alphas" ); assert_eq!( - micromark_with_options("foo </a->", &danger), + micromark_with_options("foo </a->", &danger)?, "<p>foo </a-></p>", "should support dashes in closing tags" ); assert_eq!( - micromark_with_options("foo </a >", &danger), + micromark_with_options("foo </a >", &danger)?, "<p>foo </a ></p>", "should support whitespace after closing tag names" ); assert_eq!( - micromark_with_options("foo </a!>", &danger), + micromark_with_options("foo </a!>", &danger)?, "<p>foo </a!></p>", "should not support other characters after closing tag names" ); assert_eq!( - micromark_with_options("foo <a->", &danger), + micromark_with_options("foo <a->", &danger)?, "<p>foo <a-></p>", "should support dashes in opening tags" ); assert_eq!( - micromark_with_options("foo <a >", &danger), + micromark_with_options("foo <a >", &danger)?, "<p>foo <a ></p>", "should support whitespace after opening tag names" ); assert_eq!( - micromark_with_options("foo <a!>", &danger), + micromark_with_options("foo <a!>", &danger)?, "<p>foo <a!></p>", "should not support other characters after opening tag names" ); assert_eq!( - micromark_with_options("foo <a !>", &danger), + micromark_with_options("foo <a !>", &danger)?, "<p>foo <a !></p>", "should not support other characters in opening tags (1)" ); assert_eq!( - micromark_with_options("foo <a b!>", &danger), + micromark_with_options("foo <a b!>", &danger)?, "<p>foo <a b!></p>", "should not support other characters in opening tags (2)" ); assert_eq!( - micromark_with_options("foo <a b/>", &danger), + micromark_with_options("foo <a b/>", &danger)?, "<p>foo <a b/></p>", "should support a self-closing slash after an attribute name" ); assert_eq!( - micromark_with_options("foo <a b>", &danger), + micromark_with_options("foo <a b>", &danger)?, "<p>foo <a b></p>", "should support a greater than after an attribute name" ); assert_eq!( - micromark_with_options("foo <a b=<>", &danger), + micromark_with_options("foo <a b=<>", &danger)?, "<p>foo <a b=<></p>", "should not support less than to start an unquoted attribute value" ); assert_eq!( - micromark_with_options("foo <a b=>>", &danger), + micromark_with_options("foo <a b=>>", &danger)?, "<p>foo <a b=>></p>", "should not support greater than to start an unquoted attribute value" ); assert_eq!( - micromark_with_options("foo <a b==>", &danger), + micromark_with_options("foo <a b==>", &danger)?, "<p>foo <a b==></p>", "should not support equals to to start an unquoted attribute value" ); assert_eq!( - micromark_with_options("foo <a b=`>", &danger), + micromark_with_options("foo <a b=`>", &danger)?, "<p>foo <a b=`></p>", "should not support grave accent to start an unquoted attribute value" ); assert_eq!( - micromark_with_options("foo <a b=\"asd", &danger), + micromark_with_options("foo <a b=\"asd", &danger)?, "<p>foo <a b="asd</p>", "should not support eof in double quoted attribute value" ); assert_eq!( - micromark_with_options("foo <a b='asd", &danger), + micromark_with_options("foo <a b='asd", &danger)?, "<p>foo <a b='asd</p>", "should not support eof in single quoted attribute value" ); assert_eq!( - micromark_with_options("foo <a b=asd", &danger), + micromark_with_options("foo <a b=asd", &danger)?, "<p>foo <a b=asd</p>", "should not support eof in unquoted attribute value" ); assert_eq!( - micromark_with_options("foo <a b=\nasd>", &danger), + micromark_with_options("foo <a b=\nasd>", &danger)?, "<p>foo <a b=\nasd></p>", "should support an eol before an attribute value" ); assert_eq!( -micromark_with_options("<x> a", &danger), +micromark_with_options("<x> a", &danger)?, "<p><x> a</p>", "should support starting a line w/ a tag if followed by anything other than an eol (after optional space/tabs)" ); assert_eq!( - micromark_with_options("<span foo=", &danger), + micromark_with_options("<span foo=", &danger)?, "<p><span foo=</p>", "should support an EOF before an attribute value" ); assert_eq!( - micromark_with_options("a <!b\nc>", &danger), + micromark_with_options("a <!b\nc>", &danger)?, "<p>a <!b\nc></p>", "should support an EOL in a declaration" ); assert_eq!( - micromark_with_options("a <![CDATA[\n]]>", &danger), + micromark_with_options("a <![CDATA[\n]]>", &danger)?, "<p>a <![CDATA[\n]]></p>", "should support an EOL in cdata" ); @@ -413,7 +413,7 @@ micromark_with_options("<x> a", &danger), // Note: cmjs parses this differently. // See: <https://github.com/commonmark/commonmark.js/issues/196> assert_eq!( - micromark_with_options("a <?\n?>", &danger), + micromark_with_options("a <?\n?>", &danger)?, "<p>a <?\n?></p>", "should support an EOL in an instruction" ); @@ -428,8 +428,10 @@ micromark_with_options("<x> a", &danger), }, ..Options::default() } - ), + )?, "<p>a <x></p>", "should support turning off html (text)" ); + + Ok(()) } diff --git a/tests/image.rs b/tests/image.rs index e7865e6..966b653 100644 --- a/tests/image.rs +++ b/tests/image.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn image() { +fn image() -> Result<(), String> { assert_eq!( micromark("[link](/uri \"title\")"), "<p><a href=\"/uri\" title=\"title\">link</a></p>", @@ -202,7 +202,7 @@ fn image() { }, ..Options::default() } - ), + )?, "<p>!<a href=\"\">x</a></p>", "should support turning off label start (image)" ); @@ -220,8 +220,10 @@ fn image() { allow_dangerous_protocol: true, ..Options::default() } - ), + )?, "<p><img src=\"javascript:alert(1)\" alt=\"\" /></p>", "should allow non-http protocols w/ `allowDangerousProtocol`" ); + + Ok(()) } diff --git a/tests/link_reference.rs b/tests/link_reference.rs index d4f5d87..9c853f7 100644 --- a/tests/link_reference.rs +++ b/tests/link_reference.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn link_reference() { +fn link_reference() -> Result<(), String> { let danger = Options { allow_dangerous_html: true, allow_dangerous_protocol: true, @@ -65,7 +65,7 @@ fn link_reference() { ); assert_eq!( - micromark_with_options("[ref]: /uri\n\n[foo <bar attr=\"][ref]\">", &danger), + micromark_with_options("[ref]: /uri\n\n[foo <bar attr=\"][ref]\">", &danger)?, "<p>[foo <bar attr=\"][ref]\"></p>", "should prefer HTML over link references" ); @@ -394,7 +394,7 @@ fn link_reference() { }, ..Options::default() } - ), + )?, "<p>[x]()</p>", "should support turning off label start (link)" ); @@ -409,8 +409,10 @@ fn link_reference() { }, ..Options::default() } - ), + )?, "<p>[x]()</p>", "should support turning off label end" ); + + Ok(()) } diff --git a/tests/link_resource.rs b/tests/link_resource.rs index aaf4b8b..6bcbb8c 100644 --- a/tests/link_resource.rs +++ b/tests/link_resource.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Options}; use pretty_assertions::assert_eq; #[test] -fn link_resource() { +fn link_resource() -> Result<(), String> { let danger = Options { allow_dangerous_html: true, allow_dangerous_protocol: true, @@ -53,7 +53,7 @@ fn link_resource() { ); assert_eq!( - micromark_with_options("[link](<foo\nbar>)", &danger), + micromark_with_options("[link](<foo\nbar>)", &danger)?, "<p>[link](<foo\nbar>)</p>", "should not support links w/ line endings in enclosed destination" ); @@ -71,7 +71,7 @@ fn link_resource() { ); assert_eq!( - micromark_with_options("[a](<b)c\n[a](<b)c>\n[a](<b>c)", &danger), + micromark_with_options("[a](<b)c\n[a](<b)c>\n[a](<b>c)", &danger)?, "<p>[a](<b)c\n[a](<b)c>\n[a](<b>c)</p>", "should not support links w/ unmatched enclosed destinations" ); @@ -101,7 +101,7 @@ fn link_resource() { ); assert_eq!( - micromark_with_options("[link](foo\\)\\:)", &danger), + micromark_with_options("[link](foo\\)\\:)", &danger)?, "<p><a href=\"foo):\">link</a></p>", "should support links w/ escapes in destinations" ); @@ -275,7 +275,7 @@ fn link_resource() { ); assert_eq!( - micromark_with_options("[foo <bar attr=\"](baz)\">", &danger), + micromark_with_options("[foo <bar attr=\"](baz)\">", &danger)?, "<p>[foo <bar attr=\"](baz)\"></p>", "should prefer HTML over links" ); @@ -313,7 +313,7 @@ fn link_resource() { ); assert_eq!( - micromark_with_options("[a](<b>\"c\")", &danger), + micromark_with_options("[a](<b>\"c\")", &danger)?, "<p>[a](<b>"c")</p>", "should require whitespace between enclosed destination and title" ); @@ -428,16 +428,14 @@ fn link_resource() { assert_eq!( micromark( - "[a](1(2(3(4(5(6(7(8(9(10(11(12(13(14(15(16(17(18(19(20(21(22(23(24(25(26(27(28(29(30(31(32()))))))))))))))))))))))))))))))))" - ), + "[a](1(2(3(4(5(6(7(8(9(10(11(12(13(14(15(16(17(18(19(20(21(22(23(24(25(26(27(28(29(30(31(32()))))))))))))))))))))))))))))))))"), "<p><a href=\"1(2(3(4(5(6(7(8(9(10(11(12(13(14(15(16(17(18(19(20(21(22(23(24(25(26(27(28(29(30(31(32())))))))))))))))))))))))))))))))\">a</a></p>", "should support 32 sets of parens" ); assert_eq!( micromark( - "[a](1(2(3(4(5(6(7(8(9(10(11(12(13(14(15(16(17(18(19(20(21(22(23(24(25(26(27(28(29(30(31(32(33())))))))))))))))))))))))))))))))))" - ), + "[a](1(2(3(4(5(6(7(8(9(10(11(12(13(14(15(16(17(18(19(20(21(22(23(24(25(26(27(28(29(30(31(32(33())))))))))))))))))))))))))))))))))"), "<p>[a](1(2(3(4(5(6(7(8(9(10(11(12(13(14(15(16(17(18(19(20(21(22(23(24(25(26(27(28(29(30(31(32(33())))))))))))))))))))))))))))))))))</p>", "should not support 33 or more sets of parens" ); @@ -459,4 +457,6 @@ fn link_resource() { "<p><a href=\"%EF%BF%BD\">a</a></p>", "should support a single NUL character as a link resource" ); + + Ok(()) } diff --git a/tests/list.rs b/tests/list.rs index bbba7cd..4007251 100644 --- a/tests/list.rs +++ b/tests/list.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn list() { +fn list() -> Result<(), String> { let danger = Options { allow_dangerous_html: true, ..Options::default() @@ -11,8 +11,7 @@ fn list() { assert_eq!( micromark( - "A paragraph\nwith two lines.\n\n indented code\n\n> A block quote." - ), + "A paragraph\nwith two lines.\n\n indented code\n\n> A block quote."), "<p>A paragraph\nwith two lines.</p>\n<pre><code>indented code\n</code></pre>\n<blockquote>\n<p>A block quote.</p>\n</blockquote>", "should support documents" ); @@ -205,40 +204,35 @@ fn list() { assert_eq!( micromark( - " 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote." - ), + " 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote."), "<ol>\n<li>\n<p>A paragraph\nwith two lines.</p>\n<pre><code>indented code\n</code></pre>\n<blockquote>\n<p>A block quote.</p>\n</blockquote>\n</li>\n</ol>", "should support indenting w/ 1 space" ); assert_eq!( micromark( - " 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote." - ), + " 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote."), "<ol>\n<li>\n<p>A paragraph\nwith two lines.</p>\n<pre><code>indented code\n</code></pre>\n<blockquote>\n<p>A block quote.</p>\n</blockquote>\n</li>\n</ol>", "should support indenting w/ 2 spaces" ); assert_eq!( micromark( - " 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote." - ), + " 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote."), "<ol>\n<li>\n<p>A paragraph\nwith two lines.</p>\n<pre><code>indented code\n</code></pre>\n<blockquote>\n<p>A block quote.</p>\n</blockquote>\n</li>\n</ol>", "should support indenting w/ 3 spaces" ); assert_eq!( micromark( - " 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote." - ), + " 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote."), "<pre><code>1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote.\n</code></pre>", "should not support indenting w/ 4 spaces" ); assert_eq!( micromark( - " 1. A paragraph\nwith two lines.\n\n indented code\n\n > A block quote." - ), + " 1. A paragraph\nwith two lines.\n\n indented code\n\n > A block quote."), "<ol>\n<li>\n<p>A paragraph\nwith two lines.</p>\n<pre><code>indented code\n</code></pre>\n<blockquote>\n<p>A block quote.</p>\n</blockquote>\n</li>\n</ol>", "should support lazy lines" ); @@ -370,13 +364,13 @@ fn list() { ); assert_eq!( - micromark_with_options("- foo\n- bar\n\n<!-- -->\n\n- baz\n- bim", &danger), + micromark_with_options("- foo\n- bar\n\n<!-- -->\n\n- baz\n- bim", &danger)?, "<ul>\n<li>foo</li>\n<li>bar</li>\n</ul>\n<!-- -->\n<ul>\n<li>baz</li>\n<li>bim</li>\n</ul>", "should support HTML comments between lists" ); assert_eq!( - micromark_with_options("- foo\n\n notcode\n\n- foo\n\n<!-- -->\n\n code", &danger), + micromark_with_options("- foo\n\n notcode\n\n- foo\n\n<!-- -->\n\n code", &danger)?, "<ul>\n<li>\n<p>foo</p>\n<p>notcode</p>\n</li>\n<li>\n<p>foo</p>\n</li>\n</ul>\n<!-- -->\n<pre><code>code\n</code></pre>", "should support HTML comments between lists and indented code" ); @@ -498,8 +492,7 @@ fn list() { assert_eq!( micromark( - "* a tight item that ends with an html element: `x`\n\nParagraph" - ), + "* a tight item that ends with an html element: `x`\n\nParagraph"), "<ul>\n<li>a tight item that ends with an html element: <code>x</code></li>\n</ul>\n<p>Paragraph</p>", "should ignore line endings after tight items ending in tags" ); @@ -565,7 +558,7 @@ fn list() { ); assert_eq!( - micromark_with_options("* a\n\n<!---->\n\n* b", &danger), + micromark_with_options("* a\n\n<!---->\n\n* b", &danger)?, "<ul>\n<li>a</li>\n</ul>\n<!---->\n<ul>\n<li>b</li>\n</ul>", "should support the common list breaking comment method" ); @@ -580,8 +573,10 @@ fn list() { }, ..Options::default() } - ), + )?, "<p>- one</p>\n<p>two</p>", "should support turning off lists" ); + + Ok(()) } diff --git a/tests/math_flow.rs b/tests/math_flow.rs index 5d161f6..c277326 100644 --- a/tests/math_flow.rs +++ b/tests/math_flow.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn math_flow() { +fn math_flow() -> Result<(), String> { let math = Options { constructs: Constructs { math_text: true, @@ -20,231 +20,233 @@ fn math_flow() { ); assert_eq!( - micromark_with_options("$$\na\n$$", &math), + micromark_with_options("$$\na\n$$", &math)?, "<pre><code class=\"language-math math-display\">a\n</code></pre>", "should support math (flow) if enabled" ); assert_eq!( - micromark_with_options("$$\n<\n >\n$$", &math), + micromark_with_options("$$\n<\n >\n$$", &math)?, "<pre><code class=\"language-math math-display\"><\n >\n</code></pre>", "should support math (flow)" ); assert_eq!( - micromark_with_options("$\nfoo\n$", &math), + micromark_with_options("$\nfoo\n$", &math)?, "<p><code class=\"language-math math-inline\">foo</code></p>", "should not support math (flow) w/ less than two markers" ); assert_eq!( - micromark_with_options("$$$\naaa\n$$\n$$$$", &math), + micromark_with_options("$$$\naaa\n$$\n$$$$", &math)?, "<pre><code class=\"language-math math-display\">aaa\n$$\n</code></pre>", "should support a closing sequence longer, but not shorter than, the opening" ); assert_eq!( - micromark_with_options("$$", &math), + micromark_with_options("$$", &math)?, "<pre><code class=\"language-math math-display\"></code></pre>\n", "should support an eof right after an opening sequence" ); assert_eq!( - micromark_with_options("$$$\n\n$$\naaa\n", &math), + micromark_with_options("$$$\n\n$$\naaa\n", &math)?, "<pre><code class=\"language-math math-display\">\n$$\naaa\n</code></pre>\n", "should support an eof somewhere in content" ); assert_eq!( - micromark_with_options("> $$\n> aaa\n\nbbb", &math), + micromark_with_options("> $$\n> aaa\n\nbbb", &math)?, "<blockquote>\n<pre><code class=\"language-math math-display\">aaa\n</code></pre>\n</blockquote>\n<p>bbb</p>", "should support no closing sequence in a block quote" ); assert_eq!( - micromark_with_options("$$\n\n \n$$", &math), + micromark_with_options("$$\n\n \n$$", &math)?, "<pre><code class=\"language-math math-display\">\n \n</code></pre>", "should support blank lines in math (flow)" ); assert_eq!( - micromark_with_options("$$\n$$", &math), + micromark_with_options("$$\n$$", &math)?, "<pre><code class=\"language-math math-display\"></code></pre>", "should support empty math (flow)" ); assert_eq!( - micromark_with_options(" $$\n aaa\naaa\n$$", &math), + micromark_with_options(" $$\n aaa\naaa\n$$", &math)?, "<pre><code class=\"language-math math-display\">aaa\naaa\n</code></pre>", "should remove up to one space from the content if the opening sequence is indented w/ 1 space" ); assert_eq!( - micromark_with_options(" $$\naaa\n aaa\naaa\n $$", &math), + micromark_with_options(" $$\naaa\n aaa\naaa\n $$", &math)?, "<pre><code class=\"language-math math-display\">aaa\naaa\naaa\n</code></pre>", "should remove up to two space from the content if the opening sequence is indented w/ 2 spaces" ); assert_eq!( - micromark_with_options(" $$\n aaa\n aaa\n aaa\n $$", &math), + micromark_with_options(" $$\n aaa\n aaa\n aaa\n $$", &math)?, "<pre><code class=\"language-math math-display\">aaa\n aaa\naaa\n</code></pre>", "should remove up to three space from the content if the opening sequence is indented w/ 3 spaces" ); assert_eq!( - micromark_with_options(" $$\n aaa\n $$", &math), + micromark_with_options(" $$\n aaa\n $$", &math)?, "<pre><code>$$\naaa\n$$\n</code></pre>", "should not support indenteding the opening sequence w/ 4 spaces" ); assert_eq!( - micromark_with_options("$$\naaa\n $$", &math), + micromark_with_options("$$\naaa\n $$", &math)?, "<pre><code class=\"language-math math-display\">aaa\n</code></pre>", "should support an indented closing sequence" ); assert_eq!( - micromark_with_options(" $$\naaa\n $$", &math), + micromark_with_options(" $$\naaa\n $$", &math)?, "<pre><code class=\"language-math math-display\">aaa\n</code></pre>", "should support a differently indented closing sequence than the opening sequence" ); assert_eq!( - micromark_with_options("$$\naaa\n $$\n", &math), + micromark_with_options("$$\naaa\n $$\n", &math)?, "<pre><code class=\"language-math math-display\">aaa\n $$\n</code></pre>\n", "should not support an indented closing sequence w/ 4 spaces" ); assert_eq!( - micromark_with_options("$$ $$\naaa", &math), + micromark_with_options("$$ $$\naaa", &math)?, "<p><code class=\"language-math math-inline\"> </code>\naaa</p>", "should not support dollars in the opening fence after the opening sequence" ); assert_eq!( - micromark_with_options("$$$\naaa\n$$$ $$\n", &math), + micromark_with_options("$$$\naaa\n$$$ $$\n", &math)?, "<pre><code class=\"language-math math-display\">aaa\n$$$ $$\n</code></pre>\n", "should not support spaces in the closing sequence" ); assert_eq!( - micromark_with_options("foo\n$$\nbar\n$$\nbaz", &math), + micromark_with_options("foo\n$$\nbar\n$$\nbaz", &math)?, "<p>foo</p>\n<pre><code class=\"language-math math-display\">bar\n</code></pre>\n<p>baz</p>", "should support interrupting paragraphs" ); assert_eq!( - micromark_with_options("foo\n---\n$$\nbar\n$$\n# baz", &math), + micromark_with_options("foo\n---\n$$\nbar\n$$\n# baz", &math)?, "<h2>foo</h2>\n<pre><code class=\"language-math math-display\">bar\n</code></pre>\n<h1>baz</h1>", "should support interrupting other content" ); assert_eq!( - micromark_with_options("$$ruby\ndef foo(x)\n return 3\nend\n$$", &math), + micromark_with_options("$$ruby\ndef foo(x)\n return 3\nend\n$$", &math)?, "<pre><code class=\"language-math math-display\">def foo(x)\n return 3\nend\n</code></pre>", "should not support an “info” string (1)" ); assert_eq!( - micromark_with_options("$$$;\n$$$", &math), + micromark_with_options("$$$;\n$$$", &math)?, "<pre><code class=\"language-math math-display\"></code></pre>", "should not support an “info” string (2)" ); assert_eq!( - micromark_with_options("$$ ruby startline=3 `%@#`\ndef foo(x)\n return 3\nend\n$$$$", &math), + micromark_with_options("$$ ruby startline=3 `%@#`\ndef foo(x)\n return 3\nend\n$$$$", &math)?, "<pre><code class=\"language-math math-display\">def foo(x)\n return 3\nend\n</code></pre>", "should not support an “info” string (3)" ); assert_eq!( - micromark_with_options("$$ aa $$\nfoo", &math), + micromark_with_options("$$ aa $$\nfoo", &math)?, "<p><code class=\"language-math math-inline\">aa</code>\nfoo</p>", "should not support dollars in the meta string" ); assert_eq!( - micromark_with_options("$$\n$$ aaa\n$$", &math), + micromark_with_options("$$\n$$ aaa\n$$", &math)?, "<pre><code class=\"language-math math-display\">$$ aaa\n</code></pre>", "should not support meta string on closing sequences" ); // Our own: assert_eq!( - micromark_with_options("$$ ", &math), + micromark_with_options("$$ ", &math)?, "<pre><code class=\"language-math math-display\"></code></pre>\n", "should support an eof after whitespace, after the start fence sequence" ); assert_eq!( - micromark_with_options("$$ js\nalert(1)\n$$", &math), + micromark_with_options("$$ js\nalert(1)\n$$", &math)?, "<pre><code class=\"language-math math-display\">alert(1)\n</code></pre>", "should support whitespace between the sequence and the meta string" ); assert_eq!( - micromark_with_options("$$js", &math), + micromark_with_options("$$js", &math)?, "<pre><code class=\"language-math math-display\"></code></pre>\n", "should support an eof after the meta string" ); assert_eq!( - micromark_with_options("$$ js \nalert(1)\n$$", &math), + micromark_with_options("$$ js \nalert(1)\n$$", &math)?, "<pre><code class=\"language-math math-display\">alert(1)\n</code></pre>", "should support whitespace after the meta string" ); assert_eq!( - micromark_with_options("$$\n ", &math), + micromark_with_options("$$\n ", &math)?, "<pre><code class=\"language-math math-display\"> \n</code></pre>\n", "should support an eof after whitespace in content" ); assert_eq!( - micromark_with_options(" $$\n ", &math), + micromark_with_options(" $$\n ", &math)?, "<pre><code class=\"language-math math-display\"></code></pre>\n", "should support an eof in the prefix, in content" ); assert_eq!( - micromark_with_options("$$j\\+s©", &math), + micromark_with_options("$$j\\+s©", &math)?, "<pre><code class=\"language-math math-display\"></code></pre>\n", "should support character escapes and character references in meta strings" ); assert_eq!( - micromark_with_options("$$a\\&b\0c", &math), + micromark_with_options("$$a\\&b\0c", &math)?, "<pre><code class=\"language-math math-display\"></code></pre>\n", "should support dangerous characters in meta strings" ); assert_eq!( - micromark_with_options(" $$\naaa\n $$", &math), + micromark_with_options(" $$\naaa\n $$", &math)?, "<pre><code class=\"language-math math-display\">aaa\n $$\n</code></pre>\n", "should not support a closing sequence w/ too much indent, regardless of opening sequence (1)" ); assert_eq!( - micromark_with_options("> $$\n>\n>\n>\n\na", &math), + micromark_with_options("> $$\n>\n>\n>\n\na", &math)?, "<blockquote>\n<pre><code class=\"language-math math-display\">\n\n\n</code></pre>\n</blockquote>\n<p>a</p>", "should not support a closing sequence w/ too much indent, regardless of opening sequence (2)" ); assert_eq!( - micromark_with_options("> $$a\nb", &math), + micromark_with_options("> $$a\nb", &math)?, "<blockquote>\n<pre><code class=\"language-math math-display\"></code></pre>\n</blockquote>\n<p>b</p>", "should not support lazyness (1)" ); assert_eq!( - micromark_with_options("> a\n$$b", &math), + micromark_with_options("> a\n$$b", &math)?, "<blockquote>\n<p>a</p>\n</blockquote>\n<pre><code class=\"language-math math-display\"></code></pre>\n", "should not support lazyness (2)" ); assert_eq!( - micromark_with_options("> $$a\n$$", &math), + micromark_with_options("> $$a\n$$", &math)?, "<blockquote>\n<pre><code class=\"language-math math-display\"></code></pre>\n</blockquote>\n<pre><code class=\"language-math math-display\"></code></pre>\n", "should not support lazyness (3)" ); + + Ok(()) } diff --git a/tests/math_text.rs b/tests/math_text.rs index 4fe0288..dced393 100644 --- a/tests/math_text.rs +++ b/tests/math_text.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn math_text() { +fn math_text() -> Result<(), String> { let math = Options { constructs: Constructs { math_text: true, @@ -20,7 +20,7 @@ fn math_text() { ); assert_eq!( - micromark_with_options("$foo$ $$bar$$", &math), + micromark_with_options("$foo$ $$bar$$", &math)?, "<p><code class=\"language-math math-inline\">foo</code> <code class=\"language-math math-inline\">bar</code></p>", "should support math (text) if enabled" ); @@ -32,97 +32,97 @@ fn math_text() { math_text_single_dollar: false, ..math.clone() } - ), + )?, "<p>$foo$ <code class=\"language-math math-inline\">bar</code></p>", "should not support math (text) w/ a single dollar, w/ `math_text_single_dollar: false`" ); assert_eq!( - micromark_with_options("$$ foo $ bar $$", &math), + micromark_with_options("$$ foo $ bar $$", &math)?, "<p><code class=\"language-math math-inline\">foo $ bar</code></p>", "should support math (text) w/ more dollars" ); assert_eq!( - micromark_with_options("$ $$ $", &math), + micromark_with_options("$ $$ $", &math)?, "<p><code class=\"language-math math-inline\">$$</code></p>", "should support math (text) w/ fences inside, and padding" ); assert_eq!( - micromark_with_options("$ $$ $", &math), + micromark_with_options("$ $$ $", &math)?, "<p><code class=\"language-math math-inline\"> $$ </code></p>", "should support math (text) w/ extra padding" ); assert_eq!( - micromark_with_options("$ a$", &math), + micromark_with_options("$ a$", &math)?, "<p><code class=\"language-math math-inline\"> a</code></p>", "should support math (text) w/ unbalanced padding" ); assert_eq!( - micromark_with_options("$\u{a0}b\u{a0}$", &math), + micromark_with_options("$\u{a0}b\u{a0}$", &math)?, "<p><code class=\"language-math math-inline\">\u{a0}b\u{a0}</code></p>", "should support math (text) w/ non-padding whitespace" ); assert_eq!( - micromark_with_options("$ $\n$ $", &math), + micromark_with_options("$ $\n$ $", &math)?, "<p><code class=\"language-math math-inline\"> </code>\n<code class=\"language-math math-inline\"> </code></p>", "should support math (text) w/o data" ); assert_eq!( - micromark_with_options("$\nfoo\nbar \nbaz\n$", &math), + micromark_with_options("$\nfoo\nbar \nbaz\n$", &math)?, "<p><code class=\"language-math math-inline\">foo bar baz</code></p>", "should support math (text) w/o line endings (1)" ); assert_eq!( - micromark_with_options("$\nfoo \n$", &math), + micromark_with_options("$\nfoo \n$", &math)?, "<p><code class=\"language-math math-inline\">foo </code></p>", "should support math (text) w/o line endings (2)" ); assert_eq!( - micromark_with_options("$foo bar \nbaz$", &math), + micromark_with_options("$foo bar \nbaz$", &math)?, "<p><code class=\"language-math math-inline\">foo bar baz</code></p>", "should not support whitespace collapsing" ); assert_eq!( - micromark_with_options("$foo\\$bar$", &math), + micromark_with_options("$foo\\$bar$", &math)?, "<p><code class=\"language-math math-inline\">foo\\</code>bar$</p>", "should not support character escapes" ); assert_eq!( - micromark_with_options("$$foo$bar$$", &math), + micromark_with_options("$$foo$bar$$", &math)?, "<p><code class=\"language-math math-inline\">foo$bar</code></p>", "should support more dollars" ); assert_eq!( - micromark_with_options("$ foo $$ bar $", &math), + micromark_with_options("$ foo $$ bar $", &math)?, "<p><code class=\"language-math math-inline\">foo $$ bar</code></p>", "should support less dollars" ); assert_eq!( - micromark_with_options("*foo$*$", &math), + micromark_with_options("*foo$*$", &math)?, "<p>*foo<code class=\"language-math math-inline\">*</code></p>", "should precede over emphasis" ); assert_eq!( - micromark_with_options("[not a $link](/foo$)", &math), + micromark_with_options("[not a $link](/foo$)", &math)?, "<p>[not a <code class=\"language-math math-inline\">link](/foo</code>)</p>", "should precede over links" ); assert_eq!( - micromark_with_options("$<a href=\"$\">$", &math), + micromark_with_options("$<a href=\"$\">$", &math)?, "<p><code class=\"language-math math-inline\"><a href="</code>">$</p>", "should have same precedence as HTML (1)" ); @@ -135,50 +135,52 @@ fn math_text() { allow_dangerous_protocol: true, ..math.clone() } - ), + )?, "<p><a href=\"$\">$</p>", "should have same precedence as HTML (2)" ); assert_eq!( - micromark_with_options("$<http://foo.bar.$baz>$", &math), + micromark_with_options("$<http://foo.bar.$baz>$", &math)?, "<p><code class=\"language-math math-inline\"><http://foo.bar.</code>baz>$</p>", "should have same precedence as autolinks (1)" ); assert_eq!( - micromark_with_options("<http://foo.bar.$baz>$", &math), + micromark_with_options("<http://foo.bar.$baz>$", &math)?, "<p><a href=\"http://foo.bar.$baz\">http://foo.bar.$baz</a>$</p>", "should have same precedence as autolinks (2)" ); assert_eq!( - micromark_with_options("$$$foo$$", &math), + micromark_with_options("$$$foo$$", &math)?, "<p>$$$foo$$</p>", "should not support more dollars before a fence" ); assert_eq!( - micromark_with_options("$foo", &math), + micromark_with_options("$foo", &math)?, "<p>$foo</p>", "should not support no closing fence (1)" ); assert_eq!( - micromark_with_options("$foo$$bar$$", &math), + micromark_with_options("$foo$$bar$$", &math)?, "<p>$foo<code class=\"language-math math-inline\">bar</code></p>", "should not support no closing fence (2)" ); assert_eq!( - micromark_with_options("$foo\t\tbar$", &math), + micromark_with_options("$foo\t\tbar$", &math)?, "<p><code class=\"language-math math-inline\">foo\t\tbar</code></p>", "should support tabs in code" ); assert_eq!( - micromark_with_options("\\$$x$", &math), + micromark_with_options("\\$$x$", &math)?, "<p>$<code class=\"language-math math-inline\">x</code></p>", "should support an escaped initial dollar" ); + + Ok(()) } diff --git a/tests/misc_bom.rs b/tests/misc_bom.rs index 47ce902..e26b407 100644 --- a/tests/misc_bom.rs +++ b/tests/misc_bom.rs @@ -3,7 +3,7 @@ use micromark::micromark; use pretty_assertions::assert_eq; #[test] -fn bom() { +fn bom() -> Result<(), String> { assert_eq!(micromark("\u{FEFF}"), "", "should ignore just a bom"); assert_eq!( @@ -11,4 +11,6 @@ fn bom() { "<h1>hea\u{FEFF}ding</h1>", "should ignore a bom" ); + + Ok(()) } diff --git a/tests/misc_dangerous_html.rs b/tests/misc_dangerous_html.rs index 6bc73d8..8afa481 100644 --- a/tests/misc_dangerous_html.rs +++ b/tests/misc_dangerous_html.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Options}; use pretty_assertions::assert_eq; #[test] -fn dangerous_html() { +fn dangerous_html() -> Result<(), String> { let danger = &Options { allow_dangerous_html: true, allow_dangerous_protocol: true, @@ -23,8 +23,10 @@ fn dangerous_html() { ); assert_eq!( - micromark_with_options("<x>", danger), + micromark_with_options("<x>", danger)?, "<x>", "should be unsafe w/ `allowDangerousHtml`" ); + + Ok(()) } diff --git a/tests/misc_dangerous_protocol.rs b/tests/misc_dangerous_protocol.rs index 0c25eba..88058f2 100644 --- a/tests/misc_dangerous_protocol.rs +++ b/tests/misc_dangerous_protocol.rs @@ -3,7 +3,7 @@ use micromark::micromark; use pretty_assertions::assert_eq; #[test] -fn dangerous_protocol_autolink() { +fn dangerous_protocol_autolink() -> Result<(), String> { assert_eq!( micromark("<javascript:alert(1)>"), "<p><a href=\"\">javascript:alert(1)</a></p>", @@ -33,10 +33,12 @@ fn dangerous_protocol_autolink() { "<p><a href=\"mailto:a\">mailto:a</a></p>", "should allow `mailto:`" ); + + Ok(()) } #[test] -fn dangerous_protocol_image() { +fn dangerous_protocol_image() -> Result<(), String> { assert_eq!( micromark("![](javascript:alert(1))"), "<p><img src=\"\" alt=\"\" /></p>", @@ -114,10 +116,12 @@ fn dangerous_protocol_image() { "<p><img src=\"a/b:c\" alt=\"\" /></p>", "should allow a colon in a path" ); + + Ok(()) } #[test] -fn dangerous_protocol_link() { +fn dangerous_protocol_link() -> Result<(), String> { assert_eq!( micromark("[](javascript:alert(1))"), "<p><a href=\"\"></a></p>", @@ -195,4 +199,6 @@ fn dangerous_protocol_link() { "<p><a href=\"a/b:c\"></a></p>", "should allow a colon in a path" ); + + Ok(()) } diff --git a/tests/misc_default_line_ending.rs b/tests/misc_default_line_ending.rs index 531165c..b122c50 100644 --- a/tests/misc_default_line_ending.rs +++ b/tests/misc_default_line_ending.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, LineEnding, Options}; use pretty_assertions::assert_eq; #[test] -fn default_line_ending() { +fn default_line_ending() -> Result<(), String> { assert_eq!( micromark("> a"), "<blockquote>\n<p>a</p>\n</blockquote>", @@ -35,7 +35,7 @@ fn default_line_ending() { default_line_ending: LineEnding::CarriageReturn, ..Options::default() } - ), + )?, "<blockquote>\r<p>a</p>\r</blockquote>", "should support the given line ending" ); @@ -47,10 +47,12 @@ fn default_line_ending() { default_line_ending: LineEnding::CarriageReturn, ..Options::default() } - ), + )?, // To do: is this a bug in `micromark.js` that it uses `\r` for earlier line endings? // "<blockquote>\r<p>a</p>\r</blockquote>\n", "<blockquote>\n<p>a</p>\n</blockquote>\n", "should support the given line ending, even if line endings exist" ); + + Ok(()) } diff --git a/tests/misc_line_ending.rs b/tests/misc_line_ending.rs index d8334d8..6713b32 100644 --- a/tests/misc_line_ending.rs +++ b/tests/misc_line_ending.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Options}; use pretty_assertions::assert_eq; #[test] -fn line_ending() { +fn line_ending() -> Result<(), String> { let danger = &Options { allow_dangerous_html: true, allow_dangerous_protocol: true, @@ -131,56 +131,58 @@ fn line_ending() { ); assert_eq!( - micromark_with_options("<div\n", danger), + micromark_with_options("<div\n", danger)?, "<div\n", "should support a line feed after html" ); assert_eq!( - micromark_with_options("<div\r", danger), + micromark_with_options("<div\r", danger)?, "<div\r", "should support a carriage return after html" ); assert_eq!( - micromark_with_options("<div\r\n", danger), + micromark_with_options("<div\r\n", danger)?, "<div\r\n", "should support a carriage return + line feed after html" ); assert_eq!( - micromark_with_options("<div>\n\nx", danger), + micromark_with_options("<div>\n\nx", danger)?, "<div>\n<p>x</p>", "should support a blank line w/ line feeds after html" ); assert_eq!( - micromark_with_options("<div>\r\rx", danger), + micromark_with_options("<div>\r\rx", danger)?, "<div>\r<p>x</p>", "should support a blank line w/ carriage returns after html" ); assert_eq!( - micromark_with_options("<div>\r\n\r\nx", danger), + micromark_with_options("<div>\r\n\r\nx", danger)?, "<div>\r\n<p>x</p>", "should support a blank line w/ carriage return + line feeds after html" ); assert_eq!( - micromark_with_options("<div>\nx", danger), + micromark_with_options("<div>\nx", danger)?, "<div>\nx", "should support a non-blank line w/ line feed in html" ); assert_eq!( - micromark_with_options("<div>\rx", danger), + micromark_with_options("<div>\rx", danger)?, "<div>\rx", "should support a non-blank line w/ carriage return in html" ); assert_eq!( - micromark_with_options("<div>\r\nx", danger), + micromark_with_options("<div>\r\nx", danger)?, "<div>\r\nx", "should support a non-blank line w/ carriage return + line feed in html" ); + + Ok(()) } diff --git a/tests/misc_soft_break.rs b/tests/misc_soft_break.rs index 43e2f3d..746b41d 100644 --- a/tests/misc_soft_break.rs +++ b/tests/misc_soft_break.rs @@ -3,7 +3,7 @@ use micromark::micromark; use pretty_assertions::assert_eq; #[test] -fn soft_break() { +fn soft_break() -> Result<(), String> { assert_eq!( micromark("foo\nbaz"), "<p>foo\nbaz</p>", @@ -15,4 +15,6 @@ fn soft_break() { "<p>foo\nbaz</p>", "should trim spaces around line endings" ); + + Ok(()) } diff --git a/tests/misc_tabs.rs b/tests/misc_tabs.rs index 138aa7b..feb8177 100644 --- a/tests/misc_tabs.rs +++ b/tests/misc_tabs.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Options}; use pretty_assertions::assert_eq; #[test] -fn tabs_flow() { +fn tabs_flow() -> Result<(), String> { let danger = &Options { allow_dangerous_html: true, ..Options::default() @@ -112,7 +112,7 @@ fn tabs_flow() { ); assert_eq!( - micromark_with_options("<x\ty\tz\t=\t\"\tx\t\">", danger), + micromark_with_options("<x\ty\tz\t=\t\"\tx\t\">", danger)?, "<x\ty\tz\t=\t\"\tx\t\">", "should support tabs in HTML (if whitespace is allowed)" ); @@ -128,10 +128,12 @@ fn tabs_flow() { "<hr />", "should support arbitrary tabs in thematic breaks" ); + + Ok(()) } #[test] -fn tabs_text() { +fn tabs_text() -> Result<(), String> { assert_eq!( micromark("<http:\t>"), "<p><http:\t></p>", @@ -249,10 +251,12 @@ fn tabs_text() { "<p><a href=\"y\" title=\"z\">x</a></p>", "should support a tab between a link destination and title" ); + + Ok(()) } #[test] -fn tabs_virtual_spaces() { +fn tabs_virtual_spaces() -> Result<(), String> { assert_eq!( micromark("```\n\tx"), "<pre><code>\tx\n</code></pre>\n", @@ -284,4 +288,6 @@ fn tabs_virtual_spaces() { // "<ul>\n<li>\n<p>a</p>\n<p>b</p>\n</li>\n</ul>", "should support a part of a tab as a container, and the rest of a tab as flow" ); + + Ok(()) } diff --git a/tests/misc_url.rs b/tests/misc_url.rs index 4fff26d..fd9ae05 100644 --- a/tests/misc_url.rs +++ b/tests/misc_url.rs @@ -3,7 +3,7 @@ use micromark::micromark; use pretty_assertions::assert_eq; #[test] -fn url() { +fn url() -> Result<(), String> { assert_eq!( micromark("<https://%>"), "<p><a href=\"https://%25\">https://%</a></p>", @@ -145,4 +145,6 @@ fn url() { format!("<p><a href=\"{}\"></a></p>", ascii_out), "should support ascii characters" ); + + Ok(()) } diff --git a/tests/misc_zero.rs b/tests/misc_zero.rs index 0b54d50..f8d0c56 100644 --- a/tests/misc_zero.rs +++ b/tests/misc_zero.rs @@ -3,7 +3,7 @@ use micromark::micromark; use pretty_assertions::assert_eq; #[test] -fn zero() { +fn zero() -> Result<(), String> { assert_eq!(micromark(""), "", "should support no markdown"); assert_eq!( @@ -25,4 +25,6 @@ fn zero() { "<p>\\0</p>", "should not support NUL in a character escape" ); + + Ok(()) } diff --git a/tests/text.rs b/tests/text.rs index 584f463..a2ef1fb 100644 --- a/tests/text.rs +++ b/tests/text.rs @@ -3,7 +3,7 @@ use micromark::micromark; use pretty_assertions::assert_eq; #[test] -fn text() { +fn text() -> Result<(), String> { assert_eq!( micromark("hello $.;'there"), "<p>hello $.;'there</p>", @@ -21,4 +21,6 @@ fn text() { "<p>Multiple spaces</p>", "should preserve internal spaces verbatim" ); + + Ok(()) } diff --git a/tests/thematic_break.rs b/tests/thematic_break.rs index fd90236..f4cb376 100644 --- a/tests/thematic_break.rs +++ b/tests/thematic_break.rs @@ -3,7 +3,7 @@ use micromark::{micromark, micromark_with_options, Constructs, Options}; use pretty_assertions::assert_eq; #[test] -fn thematic_break() { +fn thematic_break() -> Result<(), String> { assert_eq!( micromark("***\n---\n___"), "<hr />\n<hr />\n<hr />", @@ -176,8 +176,10 @@ fn thematic_break() { }, ..Options::default() } - ), + )?, "<p>***</p>", "should support turning off thematic breaks" ); + + Ok(()) } |