diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-07-18 16:31:14 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-07-18 16:31:14 +0200 |
commit | 5403261e8213f68633a09fc3e9bc2e6e2cd777b2 (patch) | |
tree | bb3a6419ef42f7611c2cb24fe7024228f579331b /tests | |
parent | 03544cafaa82ba4bd7e0bc3372fc59549a8dc0cc (diff) | |
download | markdown-rs-5403261e8213f68633a09fc3e9bc2e6e2cd777b2.tar.gz markdown-rs-5403261e8213f68633a09fc3e9bc2e6e2cd777b2.tar.bz2 markdown-rs-5403261e8213f68633a09fc3e9bc2e6e2cd777b2.zip |
Add support for turning off constructs
Diffstat (limited to 'tests')
-rw-r--r-- | tests/attention.rs | 42 | ||||
-rw-r--r-- | tests/autolink.rs | 40 | ||||
-rw-r--r-- | tests/block_quote.rs | 24 | ||||
-rw-r--r-- | tests/character_escape.rs | 36 | ||||
-rw-r--r-- | tests/character_reference.rs | 38 | ||||
-rw-r--r-- | tests/code_fenced.rs | 22 | ||||
-rw-r--r-- | tests/code_indented.rs | 140 | ||||
-rw-r--r-- | tests/code_text.rs | 36 | ||||
-rw-r--r-- | tests/commonmark.rs | 4576 | ||||
-rw-r--r-- | tests/definition.rs | 40 | ||||
-rw-r--r-- | tests/hard_break_escape.rs | 22 | ||||
-rw-r--r-- | tests/hard_break_trailing.rs | 22 | ||||
-rw-r--r-- | tests/heading_atx.rs | 22 | ||||
-rw-r--r-- | tests/heading_setext.rs | 22 | ||||
-rw-r--r-- | tests/html_flow.rs | 362 | ||||
-rw-r--r-- | tests/html_text.rs | 165 | ||||
-rw-r--r-- | tests/image.rs | 25 | ||||
-rw-r--r-- | tests/link_reference.rs | 56 | ||||
-rw-r--r-- | tests/link_resource.rs | 22 | ||||
-rw-r--r-- | tests/list.rs | 39 | ||||
-rw-r--r-- | tests/misc_dangerous_html.rs | 14 | ||||
-rw-r--r-- | tests/misc_default_line_ending.rs | 6 | ||||
-rw-r--r-- | tests/misc_line_ending.rs | 30 | ||||
-rw-r--r-- | tests/misc_tabs.rs | 13 | ||||
-rw-r--r-- | tests/thematic_break.rs | 22 |
25 files changed, 3981 insertions, 1855 deletions
diff --git a/tests/attention.rs b/tests/attention.rs index 1d30dd4..9a3e2fe 100644 --- a/tests/attention.rs +++ b/tests/attention.rs @@ -1,14 +1,14 @@ extern crate micromark; -use micromark::{micromark, micromark_with_options, Options}; - -const DANGER: &Options = &Options { - allow_dangerous_html: true, - allow_dangerous_protocol: true, - default_line_ending: None, -}; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn attention() { + let danger = Options { + allow_dangerous_html: true, + allow_dangerous_protocol: true, + ..Options::default() + }; + // Rule 1. assert_eq!( micromark("*foo bar*"), @@ -764,25 +764,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)" ); @@ -811,10 +811,18 @@ fn attention() { "should not end strong emphasis inside autolinks (2)" ); - // To do: turning things off. - // assert_eq!( - // micromark("*a*", {extensions: [{disable: {null: ["attention"]}}]}), - // "<p>*a*</p>", - // "should support turning off attention" - // ); + assert_eq!( + micromark_with_options( + "*a*", + &Options { + constructs: Constructs { + attention: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "<p>*a*</p>", + "should support turning off attention" + ); } diff --git a/tests/autolink.rs b/tests/autolink.rs index 7396c7a..b6258e6 100644 --- a/tests/autolink.rs +++ b/tests/autolink.rs @@ -1,14 +1,14 @@ extern crate micromark; -use micromark::{micromark, micromark_with_options, Options}; - -const DANGER: &Options = &Options { - allow_dangerous_html: true, - allow_dangerous_protocol: true, - default_line_ending: None, -}; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn autolink() { + let danger = Options { + allow_dangerous_html: true, + allow_dangerous_protocol: true, + ..Options::default() + }; + assert_eq!( micromark("<http://foo.bar.baz>"), "<p><a href=\"http://foo.bar.baz\">http://foo.bar.baz</a></p>", @@ -40,7 +40,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)" ); @@ -52,7 +52,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)" ); @@ -64,7 +64,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)" ); @@ -246,10 +246,18 @@ fn autolink() { "should not support a dash before a dot in email autolinks" ); - // To do: turning things off. - // assert_eq!( - // micromark("<a@b.co>", {extensions: [{disable: {null: ["autolink"]}}]}), - // "<p><a@b.co></p>", - // "should support turning off autolinks" - // ); + assert_eq!( + micromark_with_options( + "<a@b.co>", + &Options { + constructs: Constructs { + autolink: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "<p><a@b.co></p>", + "should support turning off autolinks" + ); } diff --git a/tests/block_quote.rs b/tests/block_quote.rs index 06bd49a..13af078 100644 --- a/tests/block_quote.rs +++ b/tests/block_quote.rs @@ -1,5 +1,5 @@ extern crate micromark; -use micromark::micromark; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn block_quote() { @@ -165,12 +165,18 @@ fn block_quote() { "should support 5 spaces for indented code, not 4" ); - // To do: turning things off. - // assert_eq!( - // micromark("> # a\n> b\n> c", { - // extensions: [{disable: {null: ["blockQuote"]}}] - // }), - // "<p>> # a\n> b\n> c</p>", - // "should support turning off block quotes" - // ); + assert_eq!( + micromark_with_options( + "> # a\n> b\n> c", + &Options { + constructs: Constructs { + block_quote: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "<p>> # a\n> b\n> c</p>", + "should support turning off block quotes" + ); } diff --git a/tests/character_escape.rs b/tests/character_escape.rs index d27f20a..8cd170d 100644 --- a/tests/character_escape.rs +++ b/tests/character_escape.rs @@ -1,14 +1,14 @@ extern crate micromark; -use micromark::{micromark, micromark_with_options, Options}; - -const DANGER: &Options = &Options { - allow_dangerous_html: true, - allow_dangerous_protocol: true, - default_line_ending: None, -}; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn character_escape() { + let danger = Options { + allow_dangerous_html: true, + allow_dangerous_protocol: true, + ..Options::default() + }; + assert_eq!( micromark( "\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\-\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\_\\`\\{\\|\\}\\~" @@ -56,7 +56,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" ); @@ -79,10 +79,18 @@ fn character_escape() { "should escape in fenced code info" ); - // To do: turning things off - // assert_eq!( - // micromark("\\> a", {extensions: [{disable: {null: ["characterEscape"]}}]}), - // "<p>\\> a</p>", - // "should support turning off character escapes" - // ); + assert_eq!( + micromark_with_options( + "\\> a", + &Options { + constructs: Constructs { + character_escape: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "<p>\\> a</p>", + "should support turning off character escapes" + ); } diff --git a/tests/character_reference.rs b/tests/character_reference.rs index ef2ba0d..c41f47d 100644 --- a/tests/character_reference.rs +++ b/tests/character_reference.rs @@ -1,11 +1,5 @@ extern crate micromark; -use micromark::{micromark, micromark_with_options, Options}; - -const DANGER: &Options = &Options { - allow_dangerous_html: true, - allow_dangerous_protocol: true, - default_line_ending: None, -}; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn character_reference() { @@ -50,7 +44,13 @@ fn character_reference() { ); assert_eq!( - micromark_with_options("<a href=\"öö.html\">", DANGER), + micromark_with_options( + "<a href=\"öö.html\">", + &Options { + allow_dangerous_html: true, + ..Options::default() + } + ), "<a href=\"öö.html\">", "should not care about character references in html" ); @@ -188,12 +188,18 @@ fn character_reference() { "should not support the other characters inside a hexademical" ); - // To do: turning things off. - // assert_eq!( - // micromark("&", { - // extensions: [{disable: {null: ["characterReferences"]}}] - // }), - // "<p>&</p>", - // "should support turning off character references" - // ); + assert_eq!( + micromark_with_options( + "&", + &Options { + constructs: Constructs { + character_reference: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "<p>&amp;</p>", + "should support turning off character references" + ); } diff --git a/tests/code_fenced.rs b/tests/code_fenced.rs index fa9ed5f..f251952 100644 --- a/tests/code_fenced.rs +++ b/tests/code_fenced.rs @@ -1,5 +1,5 @@ extern crate micromark; -use micromark::micromark; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn code_fenced() { @@ -250,10 +250,18 @@ fn code_fenced() { "should not support lazyness (3)" ); - // To do: turning things off. - // assert_eq!( - // micromark("```", {extensions: [{disable: {null: ["codeFenced"]}}]}), - // "<p>```</p>", - // "should support turning off code (fenced)" - // ); + assert_eq!( + micromark_with_options( + "```", + &Options { + constructs: Constructs { + code_fenced: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "<p>```</p>", + "should support turning off code (fenced)" + ); } diff --git a/tests/code_indented.rs b/tests/code_indented.rs index 6735954..cb316e7 100644 --- a/tests/code_indented.rs +++ b/tests/code_indented.rs @@ -1,5 +1,5 @@ extern crate micromark; -use micromark::micromark; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn code_indented() { @@ -117,75 +117,71 @@ fn code_indented() { "should not support lazyness (7)" ); - // To do: turning things off. - // assert_eq!( - // micromark(" a", {extensions: [{disable: {null: ["codeIndented"]}}]}), - // "<p>a</p>", - // "should support turning off code (indented, 1)" - // ); - - // assert_eq!( - // micromark("> a\n b", { - // extensions: [{disable: {null: ["codeIndented"]}}] - // }), - // "<blockquote>\n<p>a\nb</p>\n</blockquote>", - // "should support turning off code (indented, 2)" - // ); - - // assert_eq!( - // micromark("- a\n b", { - // extensions: [{disable: {null: ["codeIndented"]}}] - // }), - // "<ul>\n<li>a\nb</li>\n</ul>", - // "should support turning off code (indented, 3)" - // ); - - // assert_eq!( - // micromark("- a\n - b", { - // extensions: [{disable: {null: ["codeIndented"]}}] - // }), - // "<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("- a\n - b", { - // extensions: [{disable: {null: ["codeIndented"]}}] - // }), - // "<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("```\na\n ```", { - // extensions: [{disable: {null: ["codeIndented"]}}] - // }), - // "<pre><code>a\n</code></pre>", - // "should support turning off code (indented, 6)" - // ); - - // assert_eq!( - // micromark("a <?\n ?>", { - // allowDangerousHtml: true, - // extensions: [{disable: {null: ["codeIndented"]}}] - // }), - // "<p>a <?\n?></p>", - // "should support turning off code (indented, 7)" - // ); - - // assert_eq!( - // micromark("- Foo\n---", { - // extensions: [{disable: {null: ["codeIndented"]}}] - // }), - // "<ul>\n<li>Foo</li>\n</ul>\n<hr />", - // "should support turning off code (indented, 8)" - // ); - - // assert_eq!( - // micromark("- Foo\n ---", { - // extensions: [{disable: {null: ["codeIndented"]}}] - // }), - // "<ul>\n<li>\n<h2>Foo</h2>\n</li>\n</ul>", - // "should support turning off code (indented, 9)" - // ); + let off = Options { + constructs: Constructs { + code_indented: false, + ..Constructs::default() + }, + ..Options::default() + }; + + assert_eq!( + micromark_with_options(" a", &off), + "<p>a</p>", + "should support turning off code (indented, 1)" + ); + + assert_eq!( + 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), + "<ul>\n<li>a\nb</li>\n</ul>", + "should support turning off code (indented, 3)" + ); + + assert_eq!( + 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), + "<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), + "<pre><code>a\n</code></pre>", + "should support turning off code (indented, 6)" + ); + + assert_eq!( + micromark_with_options( + "a <?\n ?>", + &Options { + 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), + "<ul>\n<li>Foo</li>\n</ul>\n<hr />", + "should support turning off code (indented, 8)" + ); + + assert_eq!( + micromark_with_options("- Foo\n ---", &off), + "<ul>\n<li>\n<h2>Foo</h2>\n</li>\n</ul>", + "should support turning off code (indented, 9)" + ); } diff --git a/tests/code_text.rs b/tests/code_text.rs index 054d8e2..834b831 100644 --- a/tests/code_text.rs +++ b/tests/code_text.rs @@ -1,14 +1,14 @@ extern crate micromark; -use micromark::{micromark, micromark_with_options, Options}; - -const DANGER: &Options = &Options { - allow_dangerous_html: true, - allow_dangerous_protocol: false, - default_line_ending: None, -}; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn code_text() { + let danger = Options { + allow_dangerous_html: true, + allow_dangerous_protocol: true, + ..Options::default() + }; + assert_eq!( micromark("`foo`"), "<p><code>foo</code></p>", @@ -106,7 +106,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)" ); @@ -154,10 +154,18 @@ fn code_text() { "should support an escaped initial grave accent" ); - // To do: turning things off. - // assert_eq!( - // micromark("`a`", {extensions: [{disable: {null: ["codeText"]}}]}), - // "<p>`a`</p>", - // "should support turning off code (text)" - // ); + assert_eq!( + micromark_with_options( + "`a`", + &Options { + constructs: Constructs { + code_text: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "<p>`a`</p>", + "should support turning off code (text)" + ); } diff --git a/tests/commonmark.rs b/tests/commonmark.rs index 59908a2..95871a4 100644 --- a/tests/commonmark.rs +++ b/tests/commonmark.rs @@ -6,18 +6,21 @@ extern crate micromark; use micromark::{micromark_with_options, Options}; -const DANGER: &Options = &Options { - allow_dangerous_html: true, - allow_dangerous_protocol: true, - default_line_ending: None, -}; - #[rustfmt::skip] #[test] fn commonmark() { + let danger = Options { + allow_dangerous_html: true, + allow_dangerous_protocol: true, + ..Options::default() + }; + assert_eq!( - micromark_with_options(r###" foo baz bim -"###, DANGER), + micromark_with_options( + r###" foo baz bim +"###, + &danger + ), r###"<pre><code>foo baz bim </code></pre> "###, @@ -25,8 +28,11 @@ fn commonmark() { ); assert_eq!( - micromark_with_options(r###" foo baz bim -"###, DANGER), + micromark_with_options( + r###" foo baz bim +"###, + &danger + ), r###"<pre><code>foo baz bim </code></pre> "###, @@ -34,9 +40,12 @@ fn commonmark() { ); assert_eq!( - micromark_with_options(r###" a a + micromark_with_options( + r###" a a ὐ a -"###, DANGER), +"###, + &danger + ), r###"<pre><code>a a ὐ a </code></pre> @@ -45,10 +54,13 @@ fn commonmark() { ); assert_eq!( - micromark_with_options(r###" - foo + micromark_with_options( + r###" - foo bar -"###, DANGER), +"###, + &danger + ), r###"<ul> <li> <p>foo</p> @@ -60,10 +72,13 @@ fn commonmark() { ); assert_eq!( - micromark_with_options(r###"- foo + micromark_with_options( + r###"- foo bar -"###, DANGER), +"###, + &danger + ), r###"<ul> <li> <p>foo</p> @@ -76,8 +91,11 @@ fn commonmark() { ); assert_eq!( - micromark_with_options(r###"> foo -"###, DANGER), + micromark_with_options( + r###"> foo +"###, + &danger + ), r###"<blockquote> <pre><code> foo </code></pre> @@ -87,8 +105,11 @@ fn commonmark() { ); assert_eq!( - micromark_with_options(r###"- foo -"###, DANGER), + micromark_with_options( + r###"- foo +"###, + &danger + ), r###"<ul> <li> <pre><code> foo @@ -100,9 +121,12 @@ fn commonmark() { ); assert_eq!( - micromark_with_options(r###" foo + micromark_with_options( + r###" foo bar -"###, DANGER), +"###, + &danger + ), r###"<pre><code>foo bar </code></pre> @@ -111,10 +135,13 @@ bar ); assert_eq!( - micromark_with_options(r###" - foo + micromark_with_options( + r###" - foo - bar - baz -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>foo <ul> @@ -131,39 +158,52 @@ bar ); assert_eq!( - micromark_with_options(r###"# Foo -"###, DANGER), + micromark_with_options( + r###"# Foo +"###, + &danger + ), r###"<h1>Foo</h1> "###, r###"Tabs (10)"### ); assert_eq!( - micromark_with_options(r###"* * * -"###, DANGER), + micromark_with_options( + r###"* * * +"###, + &danger + ), r###"<hr /> "###, r###"Tabs (11)"### ); assert_eq!( - micromark_with_options(r###"\!\"\#\$\%\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\\\]\^\_\`\{\|\}\~ -"###, DANGER), + micromark_with_options( + r###"\!\"\#\$\%\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\\\]\^\_\`\{\|\}\~ +"###, + &danger + ), r###"<p>!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~</p> "###, r###"Backslash escapes (12)"### ); assert_eq!( - micromark_with_options(r###"\ \A\a\ \3\φ\« -"###, DANGER), + micromark_with_options( + r###"\ \A\a\ \3\φ\« +"###, + &danger + ), r###"<p>\ \A\a\ \3\φ\«</p> "###, r###"Backslash escapes (13)"### ); assert_eq!( - micromark_with_options(r###"\*not emphasized* + micromark_with_options( + r###"\*not emphasized* \<br/> not a tag \[not a link](/foo) \`not code` @@ -172,7 +212,9 @@ bar \# not a heading \[foo]: /url "not a reference" \ö not a character entity -"###, DANGER), +"###, + &danger + ), r###"<p>*not emphasized* <br/> not a tag [not a link](/foo) @@ -187,17 +229,23 @@ bar ); assert_eq!( - micromark_with_options(r###"\\*emphasis* -"###, DANGER), + micromark_with_options( + r###"\\*emphasis* +"###, + &danger + ), r###"<p>\<em>emphasis</em></p> "###, r###"Backslash escapes (15)"### ); assert_eq!( - micromark_with_options(r###"foo\ + micromark_with_options( + r###"foo\ bar -"###, DANGER), +"###, + &danger + ), r###"<p>foo<br /> bar</p> "###, @@ -205,16 +253,22 @@ bar</p> ); assert_eq!( - micromark_with_options(r###"`` \[\` `` -"###, DANGER), + micromark_with_options( + r###"`` \[\` `` +"###, + &danger + ), r###"<p><code>\[\`</code></p> "###, r###"Backslash escapes (17)"### ); assert_eq!( - micromark_with_options(r###" \[\] -"###, DANGER), + micromark_with_options( + r###" \[\] +"###, + &danger + ), r###"<pre><code>\[\] </code></pre> "###, @@ -222,10 +276,13 @@ bar</p> ); assert_eq!( - micromark_with_options(r###"~~~ + micromark_with_options( + r###"~~~ \[\] ~~~ -"###, DANGER), +"###, + &danger + ), r###"<pre><code>\[\] </code></pre> "###, @@ -233,44 +290,59 @@ bar</p> ); assert_eq!( - micromark_with_options(r###"<http://example.com?find=\*> -"###, DANGER), + micromark_with_options( + 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)"### ); assert_eq!( - micromark_with_options(r###"<a href="/bar\/)"> -"###, DANGER), + micromark_with_options( + r###"<a href="/bar\/)"> +"###, + &danger + ), r###"<a href="/bar\/)"> "###, r###"Backslash escapes (21)"### ); assert_eq!( - micromark_with_options(r###"[foo](/bar\* "ti\*tle") -"###, DANGER), + micromark_with_options( + r###"[foo](/bar\* "ti\*tle") +"###, + &danger + ), r###"<p><a href="/bar*" title="ti*tle">foo</a></p> "###, r###"Backslash escapes (22)"### ); assert_eq!( - micromark_with_options(r###"[foo] + micromark_with_options( + r###"[foo] [foo]: /bar\* "ti\*tle" -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/bar*" title="ti*tle">foo</a></p> "###, r###"Backslash escapes (23)"### ); assert_eq!( - micromark_with_options(r###"``` foo\+bar + micromark_with_options( + r###"``` foo\+bar foo ``` -"###, DANGER), +"###, + &danger + ), r###"<pre><code class="language-foo+bar">foo </code></pre> "###, @@ -278,10 +350,13 @@ foo ); assert_eq!( - micromark_with_options(r###" & © Æ Ď + micromark_with_options( + r###" & © Æ Ď ¾ ℋ ⅆ ∲ ≧̸ -"###, DANGER), +"###, + &danger + ), r###"<p> & © Æ Ď ¾ ℋ ⅆ ∲ ≧̸</p> @@ -290,27 +365,36 @@ foo ); assert_eq!( - micromark_with_options(r###"# Ӓ Ϡ � -"###, DANGER), + micromark_with_options( + r###"# Ӓ Ϡ � +"###, + &danger + ), r###"<p># Ӓ Ϡ �</p> "###, r###"Entity and numeric character references (26)"### ); assert_eq!( - micromark_with_options(r###"" ആ ಫ -"###, DANGER), + micromark_with_options( + r###"" ആ ಫ +"###, + &danger + ), r###"<p>" ആ ಫ</p> "###, r###"Entity and numeric character references (27)"### ); assert_eq!( - micromark_with_options(r###"  &x; &#; &#x; + micromark_with_options( + r###"  &x; &#; &#x; � &#abcdef0; &ThisIsNotDefined; &hi?; -"###, DANGER), +"###, + &danger + ), r###"<p>&nbsp &x; &#; &#x; &#87654321; &#abcdef0; @@ -320,52 +404,70 @@ foo ); assert_eq!( - micromark_with_options(r###"© -"###, DANGER), + micromark_with_options( + r###"© +"###, + &danger + ), r###"<p>&copy</p> "###, r###"Entity and numeric character references (29)"### ); assert_eq!( - micromark_with_options(r###"&MadeUpEntity; -"###, DANGER), + micromark_with_options( + r###"&MadeUpEntity; +"###, + &danger + ), r###"<p>&MadeUpEntity;</p> "###, r###"Entity and numeric character references (30)"### ); assert_eq!( - micromark_with_options(r###"<a href="öö.html"> -"###, DANGER), + micromark_with_options( + r###"<a href="öö.html"> +"###, + &danger + ), r###"<a href="öö.html"> "###, r###"Entity and numeric character references (31)"### ); assert_eq!( - micromark_with_options(r###"[foo](/föö "föö") -"###, DANGER), + micromark_with_options( + 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)"### ); assert_eq!( - micromark_with_options(r###"[foo] + micromark_with_options( + r###"[foo] [foo]: /föö "föö" -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/f%C3%B6%C3%B6" title="föö">foo</a></p> "###, r###"Entity and numeric character references (33)"### ); assert_eq!( - micromark_with_options(r###"``` föö + micromark_with_options( + r###"``` föö foo ``` -"###, DANGER), +"###, + &danger + ), r###"<pre><code class="language-föö">foo </code></pre> "###, @@ -373,16 +475,22 @@ foo ); assert_eq!( - micromark_with_options(r###"`föö` -"###, DANGER), + micromark_with_options( + r###"`föö` +"###, + &danger + ), r###"<p><code>f&ouml;&ouml;</code></p> "###, r###"Entity and numeric character references (35)"### ); assert_eq!( - micromark_with_options(r###" föfö -"###, DANGER), + micromark_with_options( + r###" föfö +"###, + &danger + ), r###"<pre><code>f&ouml;f&ouml; </code></pre> "###, @@ -390,9 +498,12 @@ foo ); assert_eq!( - micromark_with_options(r###"*foo* + micromark_with_options( + r###"*foo* *foo* -"###, DANGER), +"###, + &danger + ), r###"<p>*foo* <em>foo</em></p> "###, @@ -400,10 +511,13 @@ foo ); assert_eq!( - micromark_with_options(r###"* foo + micromark_with_options( + r###"* foo * foo -"###, DANGER), +"###, + &danger + ), r###"<p>* foo</p> <ul> <li>foo</li> @@ -413,8 +527,11 @@ foo ); assert_eq!( - micromark_with_options(r###"foo bar -"###, DANGER), + micromark_with_options( + r###"foo bar +"###, + &danger + ), r###"<p>foo bar</p> @@ -423,25 +540,34 @@ bar</p> ); assert_eq!( - micromark_with_options(r###"	foo -"###, DANGER), + micromark_with_options( + r###"	foo +"###, + &danger + ), r###"<p> foo</p> "###, r###"Entity and numeric character references (40)"### ); assert_eq!( - micromark_with_options(r###"[a](url "tit") -"###, DANGER), + micromark_with_options( + r###"[a](url "tit") +"###, + &danger + ), r###"<p>[a](url "tit")</p> "###, r###"Entity and numeric character references (41)"### ); assert_eq!( - micromark_with_options(r###"- `one + micromark_with_options( + r###"- `one - two` -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>`one</li> <li>two`</li> @@ -451,10 +577,13 @@ bar</p> ); assert_eq!( - micromark_with_options(r###"*** + micromark_with_options( + r###"*** --- ___ -"###, DANGER), +"###, + &danger + ), r###"<hr /> <hr /> <hr /> @@ -463,26 +592,35 @@ ___ ); assert_eq!( - micromark_with_options(r###"+++ -"###, DANGER), + micromark_with_options( + r###"+++ +"###, + &danger + ), r###"<p>+++</p> "###, r###"Thematic breaks (44)"### ); assert_eq!( - micromark_with_options(r###"=== -"###, DANGER), + micromark_with_options( + r###"=== +"###, + &danger + ), r###"<p>===</p> "###, r###"Thematic breaks (45)"### ); assert_eq!( - micromark_with_options(r###"-- + micromark_with_options( + r###"-- ** __ -"###, DANGER), +"###, + &danger + ), r###"<p>-- ** __</p> @@ -491,10 +629,13 @@ __</p> ); assert_eq!( - micromark_with_options(r###" *** + micromark_with_options( + r###" *** *** *** -"###, DANGER), +"###, + &danger + ), r###"<hr /> <hr /> <hr /> @@ -503,8 +644,11 @@ __</p> ); assert_eq!( - micromark_with_options(r###" *** -"###, DANGER), + micromark_with_options( + r###" *** +"###, + &danger + ), r###"<pre><code>*** </code></pre> "###, @@ -512,9 +656,12 @@ __</p> ); assert_eq!( - micromark_with_options(r###"Foo + micromark_with_options( + r###"Foo *** -"###, DANGER), +"###, + &danger + ), r###"<p>Foo ***</p> "###, @@ -522,52 +669,70 @@ __</p> ); assert_eq!( - micromark_with_options(r###"_____________________________________ -"###, DANGER), + micromark_with_options( + r###"_____________________________________ +"###, + &danger + ), r###"<hr /> "###, r###"Thematic breaks (50)"### ); assert_eq!( - micromark_with_options(r###" - - - -"###, DANGER), + micromark_with_options( + r###" - - - +"###, + &danger + ), r###"<hr /> "###, r###"Thematic breaks (51)"### ); assert_eq!( - micromark_with_options(r###" ** * ** * ** * ** -"###, DANGER), + micromark_with_options( + r###" ** * ** * ** * ** +"###, + &danger + ), r###"<hr /> "###, r###"Thematic breaks (52)"### ); assert_eq!( - micromark_with_options(r###"- - - - -"###, DANGER), + micromark_with_options( + r###"- - - - +"###, + &danger + ), r###"<hr /> "###, r###"Thematic breaks (53)"### ); assert_eq!( - micromark_with_options(r###"- - - - -"###, DANGER), + micromark_with_options( + r###"- - - - +"###, + &danger + ), r###"<hr /> "###, r###"Thematic breaks (54)"### ); assert_eq!( - micromark_with_options(r###"_ _ _ _ a + micromark_with_options( + r###"_ _ _ _ a a------ ---a--- -"###, DANGER), +"###, + &danger + ), r###"<p>_ _ _ _ a</p> <p>a------</p> <p>---a---</p> @@ -576,18 +741,24 @@ a------ ); assert_eq!( - micromark_with_options(r###" *-* -"###, DANGER), + micromark_with_options( + r###" *-* +"###, + &danger + ), r###"<p><em>-</em></p> "###, r###"Thematic breaks (56)"### ); assert_eq!( - micromark_with_options(r###"- foo + micromark_with_options( + r###"- foo *** - bar -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>foo</li> </ul> @@ -600,10 +771,13 @@ a------ ); assert_eq!( - micromark_with_options(r###"Foo + micromark_with_options( + r###"Foo *** bar -"###, DANGER), +"###, + &danger + ), r###"<p>Foo</p> <hr /> <p>bar</p> @@ -612,10 +786,13 @@ bar ); assert_eq!( - micromark_with_options(r###"Foo + micromark_with_options( + r###"Foo --- bar -"###, DANGER), +"###, + &danger + ), r###"<h2>Foo</h2> <p>bar</p> "###, @@ -623,10 +800,13 @@ bar ); assert_eq!( - micromark_with_options(r###"* Foo + micromark_with_options( + r###"* Foo * * * * Bar -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>Foo</li> </ul> @@ -639,9 +819,12 @@ bar ); assert_eq!( - micromark_with_options(r###"- Foo + micromark_with_options( + r###"- Foo - * * * -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>Foo</li> <li> @@ -653,13 +836,16 @@ bar ); assert_eq!( - micromark_with_options(r###"# foo + micromark_with_options( + r###"# foo ## foo ### foo #### foo ##### foo ###### foo -"###, DANGER), +"###, + &danger + ), r###"<h1>foo</h1> <h2>foo</h2> <h3>foo</h3> @@ -671,18 +857,24 @@ bar ); assert_eq!( - micromark_with_options(r###"####### foo -"###, DANGER), + micromark_with_options( + r###"####### foo +"###, + &danger + ), r###"<p>####### foo</p> "###, r###"ATX headings (63)"### ); assert_eq!( - micromark_with_options(r###"#5 bolt + micromark_with_options( + r###"#5 bolt #hashtag -"###, DANGER), +"###, + &danger + ), r###"<p>#5 bolt</p> <p>#hashtag</p> "###, @@ -690,34 +882,46 @@ bar ); assert_eq!( - micromark_with_options(r###"\## foo -"###, DANGER), + micromark_with_options( + r###"\## foo +"###, + &danger + ), r###"<p>## foo</p> "###, r###"ATX headings (65)"### ); assert_eq!( - micromark_with_options(r###"# foo *bar* \*baz\* -"###, DANGER), + micromark_with_options( + r###"# foo *bar* \*baz\* +"###, + &danger + ), r###"<h1>foo <em>bar</em> *baz*</h1> "###, r###"ATX headings (66)"### ); assert_eq!( - micromark_with_options(r###"# foo -"###, DANGER), + micromark_with_options( + r###"# foo +"###, + &danger + ), r###"<h1>foo</h1> "###, r###"ATX headings (67)"### ); assert_eq!( - micromark_with_options(r###" ### foo + micromark_with_options( + r###" ### foo ## foo # foo -"###, DANGER), +"###, + &danger + ), r###"<h3>foo</h3> <h2>foo</h2> <h1>foo</h1> @@ -726,8 +930,11 @@ bar ); assert_eq!( - micromark_with_options(r###" # foo -"###, DANGER), + micromark_with_options( + r###" # foo +"###, + &danger + ), r###"<pre><code># foo </code></pre> "###, @@ -735,9 +942,12 @@ bar ); assert_eq!( - micromark_with_options(r###"foo + micromark_with_options( + r###"foo # bar -"###, DANGER), +"###, + &danger + ), r###"<p>foo # bar</p> "###, @@ -745,9 +955,12 @@ bar ); assert_eq!( - micromark_with_options(r###"## foo ## + micromark_with_options( + r###"## foo ## ### bar ### -"###, DANGER), +"###, + &danger + ), r###"<h2>foo</h2> <h3>bar</h3> "###, @@ -755,9 +968,12 @@ bar ); assert_eq!( - micromark_with_options(r###"# foo ################################## + micromark_with_options( + r###"# foo ################################## ##### foo ## -"###, DANGER), +"###, + &danger + ), r###"<h1>foo</h1> <h5>foo</h5> "###, @@ -765,34 +981,46 @@ bar ); assert_eq!( - micromark_with_options(r###"### foo ### -"###, DANGER), + micromark_with_options( + r###"### foo ### +"###, + &danger + ), r###"<h3>foo</h3> "###, r###"ATX headings (73)"### ); assert_eq!( - micromark_with_options(r###"### foo ### b -"###, DANGER), + micromark_with_options( + r###"### foo ### b +"###, + &danger + ), r###"<h3>foo ### b</h3> "###, r###"ATX headings (74)"### ); assert_eq!( - micromark_with_options(r###"# foo# -"###, DANGER), + micromark_with_options( + r###"# foo# +"###, + &danger + ), r###"<h1>foo#</h1> "###, r###"ATX headings (75)"### ); assert_eq!( - micromark_with_options(r###"### foo \### + micromark_with_options( + r###"### foo \### ## foo #\## # foo \# -"###, DANGER), +"###, + &danger + ), r###"<h3>foo ###</h3> <h2>foo ###</h2> <h1>foo #</h1> @@ -801,10 +1029,13 @@ bar ); assert_eq!( - micromark_with_options(r###"**** + micromark_with_options( + r###"**** ## foo **** -"###, DANGER), +"###, + &danger + ), r###"<hr /> <h2>foo</h2> <hr /> @@ -813,10 +1044,13 @@ bar ); assert_eq!( - micromark_with_options(r###"Foo bar + micromark_with_options( + r###"Foo bar # baz Bar foo -"###, DANGER), +"###, + &danger + ), r###"<p>Foo bar</p> <h1>baz</h1> <p>Bar foo</p> @@ -825,10 +1059,13 @@ Bar foo ); assert_eq!( - micromark_with_options(r###"## + micromark_with_options( + r###"## # ### ### -"###, DANGER), +"###, + &danger + ), r###"<h2></h2> <h1></h1> <h3></h3> @@ -837,12 +1074,15 @@ Bar foo ); assert_eq!( - micromark_with_options(r###"Foo *bar* + micromark_with_options( + r###"Foo *bar* ========= Foo *bar* --------- -"###, DANGER), +"###, + &danger + ), r###"<h1>Foo <em>bar</em></h1> <h2>Foo <em>bar</em></h2> "###, @@ -850,10 +1090,13 @@ Foo *bar* ); assert_eq!( - micromark_with_options(r###"Foo *bar + micromark_with_options( + r###"Foo *bar baz* ==== -"###, DANGER), +"###, + &danger + ), r###"<h1>Foo <em>bar baz</em></h1> "###, @@ -861,10 +1104,13 @@ baz</em></h1> ); assert_eq!( - micromark_with_options(r###" Foo *bar + micromark_with_options( + r###" Foo *bar baz* ==== -"###, DANGER), +"###, + &danger + ), r###"<h1>Foo <em>bar baz</em></h1> "###, @@ -872,12 +1118,15 @@ baz</em></h1> ); assert_eq!( - micromark_with_options(r###"Foo + micromark_with_options( + r###"Foo ------------------------- Foo = -"###, DANGER), +"###, + &danger + ), r###"<h2>Foo</h2> <h1>Foo</h1> "###, @@ -885,7 +1134,8 @@ Foo ); assert_eq!( - micromark_with_options(r###" Foo + micromark_with_options( + r###" Foo --- Foo @@ -893,7 +1143,9 @@ Foo Foo === -"###, DANGER), +"###, + &danger + ), r###"<h2>Foo</h2> <h2>Foo</h2> <h1>Foo</h1> @@ -902,12 +1154,15 @@ Foo ); assert_eq!( - micromark_with_options(r###" Foo + micromark_with_options( + r###" Foo --- Foo --- -"###, DANGER), +"###, + &danger + ), r###"<pre><code>Foo --- @@ -919,18 +1174,24 @@ Foo ); assert_eq!( - micromark_with_options(r###"Foo + micromark_with_options( + r###"Foo ---- -"###, DANGER), +"###, + &danger + ), r###"<h2>Foo</h2> "###, r###"Setext headings (86)"### ); assert_eq!( - micromark_with_options(r###"Foo + micromark_with_options( + r###"Foo --- -"###, DANGER), +"###, + &danger + ), r###"<p>Foo ---</p> "###, @@ -938,12 +1199,15 @@ Foo ); assert_eq!( - micromark_with_options(r###"Foo + micromark_with_options( + r###"Foo = = Foo --- - -"###, DANGER), +"###, + &danger + ), r###"<p>Foo = =</p> <p>Foo</p> @@ -953,32 +1217,41 @@ Foo ); assert_eq!( - micromark_with_options(r###"Foo + micromark_with_options( + r###"Foo ----- -"###, DANGER), +"###, + &danger + ), r###"<h2>Foo</h2> "###, r###"Setext headings (89)"### ); assert_eq!( - micromark_with_options(r###"Foo\ + micromark_with_options( + r###"Foo\ ---- -"###, DANGER), +"###, + &danger + ), r###"<h2>Foo\</h2> "###, r###"Setext headings (90)"### ); assert_eq!( - micromark_with_options(r###"`Foo + micromark_with_options( + r###"`Foo ---- ` <a title="a lot --- of dashes"/> -"###, DANGER), +"###, + &danger + ), r###"<h2>`Foo</h2> <p>`</p> <h2><a title="a lot</h2> @@ -988,9 +1261,12 @@ of dashes"/> ); assert_eq!( - micromark_with_options(r###"> Foo + micromark_with_options( + r###"> Foo --- -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <p>Foo</p> </blockquote> @@ -1000,10 +1276,13 @@ of dashes"/> ); assert_eq!( - micromark_with_options(r###"> foo + micromark_with_options( + r###"> foo bar === -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <p>foo bar @@ -1014,9 +1293,12 @@ bar ); assert_eq!( - micromark_with_options(r###"- Foo + micromark_with_options( + r###"- Foo --- -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>Foo</li> </ul> @@ -1026,10 +1308,13 @@ bar ); assert_eq!( - micromark_with_options(r###"Foo + micromark_with_options( + r###"Foo Bar --- -"###, DANGER), +"###, + &danger + ), r###"<h2>Foo Bar</h2> "###, @@ -1037,13 +1322,16 @@ Bar</h2> ); assert_eq!( - micromark_with_options(r###"--- + micromark_with_options( + r###"--- Foo --- Bar --- Baz -"###, DANGER), +"###, + &danger + ), r###"<hr /> <h2>Foo</h2> <h2>Bar</h2> @@ -1053,18 +1341,24 @@ Baz ); assert_eq!( - micromark_with_options(r###" + micromark_with_options( + r###" ==== -"###, DANGER), +"###, + &danger + ), r###"<p>====</p> "###, r###"Setext headings (97)"### ); assert_eq!( - micromark_with_options(r###"--- + micromark_with_options( + r###"--- --- -"###, DANGER), +"###, + &danger + ), r###"<hr /> <hr /> "###, @@ -1072,9 +1366,12 @@ Baz ); assert_eq!( - micromark_with_options(r###"- foo + micromark_with_options( + r###"- foo ----- -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>foo</li> </ul> @@ -1084,9 +1381,12 @@ Baz ); assert_eq!( - micromark_with_options(r###" foo + micromark_with_options( + r###" foo --- -"###, DANGER), +"###, + &danger + ), r###"<pre><code>foo </code></pre> <hr /> @@ -1095,9 +1395,12 @@ Baz ); assert_eq!( - micromark_with_options(r###"> foo + micromark_with_options( + r###"> foo ----- -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <p>foo</p> </blockquote> @@ -1107,21 +1410,27 @@ Baz ); assert_eq!( - micromark_with_options(r###"\> foo + micromark_with_options( + r###"\> foo ------ -"###, DANGER), +"###, + &danger + ), r###"<h2>> foo</h2> "###, r###"Setext headings (102)"### ); assert_eq!( - micromark_with_options(r###"Foo + micromark_with_options( + r###"Foo bar --- baz -"###, DANGER), +"###, + &danger + ), r###"<p>Foo</p> <h2>bar</h2> <p>baz</p> @@ -1130,13 +1439,16 @@ baz ); assert_eq!( - micromark_with_options(r###"Foo + micromark_with_options( + r###"Foo bar --- baz -"###, DANGER), +"###, + &danger + ), r###"<p>Foo bar</p> <hr /> @@ -1146,11 +1458,14 @@ bar</p> ); assert_eq!( - micromark_with_options(r###"Foo + micromark_with_options( + r###"Foo bar * * * baz -"###, DANGER), +"###, + &danger + ), r###"<p>Foo bar</p> <hr /> @@ -1160,11 +1475,14 @@ bar</p> ); assert_eq!( - micromark_with_options(r###"Foo + micromark_with_options( + r###"Foo bar \--- baz -"###, DANGER), +"###, + &danger + ), r###"<p>Foo bar --- @@ -1174,9 +1492,12 @@ baz</p> ); assert_eq!( - micromark_with_options(r###" a simple + micromark_with_options( + r###" a simple indented code block -"###, DANGER), +"###, + &danger + ), r###"<pre><code>a simple indented code block </code></pre> @@ -1185,10 +1506,13 @@ baz</p> ); assert_eq!( - micromark_with_options(r###" - foo + micromark_with_options( + r###" - foo bar -"###, DANGER), +"###, + &danger + ), r###"<ul> <li> <p>foo</p> @@ -1200,10 +1524,13 @@ baz</p> ); assert_eq!( - micromark_with_options(r###"1. foo + micromark_with_options( + r###"1. foo - bar -"###, DANGER), +"###, + &danger + ), r###"<ol> <li> <p>foo</p> @@ -1217,11 +1544,14 @@ baz</p> ); assert_eq!( - micromark_with_options(r###" <a/> + micromark_with_options( + r###" <a/> *hi* - one -"###, DANGER), +"###, + &danger + ), r###"<pre><code><a/> *hi* @@ -1232,14 +1562,17 @@ baz</p> ); assert_eq!( - micromark_with_options(r###" chunk1 + micromark_with_options( + r###" chunk1 chunk2 chunk3 -"###, DANGER), +"###, + &danger + ), r###"<pre><code>chunk1 chunk2 @@ -1253,10 +1586,13 @@ chunk3 ); assert_eq!( - micromark_with_options(r###" chunk1 + micromark_with_options( + r###" chunk1 chunk2 -"###, DANGER), +"###, + &danger + ), r###"<pre><code>chunk1 chunk2 @@ -1266,10 +1602,13 @@ chunk3 ); assert_eq!( - micromark_with_options(r###"Foo + micromark_with_options( + r###"Foo bar -"###, DANGER), +"###, + &danger + ), r###"<p>Foo bar</p> "###, @@ -1277,9 +1616,12 @@ bar</p> ); assert_eq!( - micromark_with_options(r###" foo + micromark_with_options( + r###" foo bar -"###, DANGER), +"###, + &danger + ), r###"<pre><code>foo </code></pre> <p>bar</p> @@ -1288,13 +1630,16 @@ bar ); assert_eq!( - micromark_with_options(r###"# Heading + micromark_with_options( + r###"# Heading foo Heading ------ foo ---- -"###, DANGER), +"###, + &danger + ), r###"<h1>Heading</h1> <pre><code>foo </code></pre> @@ -1307,9 +1652,12 @@ Heading ); assert_eq!( - micromark_with_options(r###" foo + micromark_with_options( + r###" foo bar -"###, DANGER), +"###, + &danger + ), r###"<pre><code> foo bar </code></pre> @@ -1318,12 +1666,15 @@ bar ); assert_eq!( - micromark_with_options(r###" + micromark_with_options( + r###" foo -"###, DANGER), +"###, + &danger + ), r###"<pre><code>foo </code></pre> "###, @@ -1331,8 +1682,11 @@ bar ); assert_eq!( - micromark_with_options(r###" foo -"###, DANGER), + micromark_with_options( + r###" foo +"###, + &danger + ), r###"<pre><code>foo </code></pre> "###, @@ -1340,11 +1694,14 @@ bar ); assert_eq!( - micromark_with_options(r###"``` + micromark_with_options( + r###"``` < > ``` -"###, DANGER), +"###, + &danger + ), r###"<pre><code>< > </code></pre> @@ -1353,11 +1710,14 @@ bar ); assert_eq!( - micromark_with_options(r###"~~~ + micromark_with_options( + r###"~~~ < > ~~~ -"###, DANGER), +"###, + &danger + ), r###"<pre><code>< > </code></pre> @@ -1366,21 +1726,27 @@ bar ); assert_eq!( - micromark_with_options(r###"`` + micromark_with_options( + r###"`` foo `` -"###, DANGER), +"###, + &danger + ), r###"<p><code>foo</code></p> "###, r###"Fenced code blocks (121)"### ); assert_eq!( - micromark_with_options(r###"``` + micromark_with_options( + r###"``` aaa ~~~ ``` -"###, DANGER), +"###, + &danger + ), r###"<pre><code>aaa ~~~ </code></pre> @@ -1389,11 +1755,14 @@ aaa ); assert_eq!( - micromark_with_options(r###"~~~ + micromark_with_options( + r###"~~~ aaa ``` ~~~ -"###, DANGER), +"###, + &danger + ), r###"<pre><code>aaa ``` </code></pre> @@ -1402,11 +1771,14 @@ aaa ); assert_eq!( - micromark_with_options(r###"```` + micromark_with_options( + r###"```` aaa ``` `````` -"###, DANGER), +"###, + &danger + ), r###"<pre><code>aaa ``` </code></pre> @@ -1415,11 +1787,14 @@ aaa ); assert_eq!( - micromark_with_options(r###"~~~~ + micromark_with_options( + r###"~~~~ aaa ~~~ ~~~~ -"###, DANGER), +"###, + &danger + ), r###"<pre><code>aaa ~~~ </code></pre> @@ -1428,19 +1803,25 @@ aaa ); assert_eq!( - micromark_with_options(r###"``` -"###, DANGER), + micromark_with_options( + r###"``` +"###, + &danger + ), r###"<pre><code></code></pre> "###, r###"Fenced code blocks (126)"### ); assert_eq!( - micromark_with_options(r###"````` + micromark_with_options( + r###"````` ``` aaa -"###, DANGER), +"###, + &danger + ), r###"<pre><code> ``` aaa @@ -1450,11 +1831,14 @@ aaa ); assert_eq!( - micromark_with_options(r###"> ``` + micromark_with_options( + r###"> ``` > aaa bbb -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <pre><code>aaa </code></pre> @@ -1465,11 +1849,14 @@ bbb ); assert_eq!( - micromark_with_options(r###"``` + micromark_with_options( + r###"``` ``` -"###, DANGER), +"###, + &danger + ), r###"<pre><code> </code></pre> @@ -1478,20 +1865,26 @@ bbb ); assert_eq!( - micromark_with_options(r###"``` + micromark_with_options( + r###"``` ``` -"###, DANGER), +"###, + &danger + ), r###"<pre><code></code></pre> "###, r###"Fenced code blocks (130)"### ); assert_eq!( - micromark_with_options(r###" ``` + micromark_with_options( + r###" ``` aaa aaa ``` -"###, DANGER), +"###, + &danger + ), r###"<pre><code>aaa aaa </code></pre> @@ -1500,12 +1893,15 @@ aaa ); assert_eq!( - micromark_with_options(r###" ``` + micromark_with_options( + r###" ``` aaa aaa aaa ``` -"###, DANGER), +"###, + &danger + ), r###"<pre><code>aaa aaa aaa @@ -1515,12 +1911,15 @@ aaa ); assert_eq!( - micromark_with_options(r###" ``` + micromark_with_options( + r###" ``` aaa aaa aaa ``` -"###, DANGER), +"###, + &danger + ), r###"<pre><code>aaa aaa aaa @@ -1530,10 +1929,13 @@ aaa ); assert_eq!( - micromark_with_options(r###" ``` + micromark_with_options( + r###" ``` aaa ``` -"###, DANGER), +"###, + &danger + ), r###"<pre><code>``` aaa ``` @@ -1543,10 +1945,13 @@ aaa ); assert_eq!( - micromark_with_options(r###"``` + micromark_with_options( + r###"``` aaa ``` -"###, DANGER), +"###, + &danger + ), r###"<pre><code>aaa </code></pre> "###, @@ -1554,10 +1959,13 @@ aaa ); assert_eq!( - micromark_with_options(r###" ``` + micromark_with_options( + r###" ``` aaa ``` -"###, DANGER), +"###, + &danger + ), r###"<pre><code>aaa </code></pre> "###, @@ -1565,10 +1973,13 @@ aaa ); assert_eq!( - micromark_with_options(r###"``` + micromark_with_options( + r###"``` aaa ``` -"###, DANGER), +"###, + &danger + ), r###"<pre><code>aaa ``` </code></pre> @@ -1577,9 +1988,12 @@ aaa ); assert_eq!( - micromark_with_options(r###"``` ``` + micromark_with_options( + r###"``` ``` aaa -"###, DANGER), +"###, + &danger + ), r###"<p><code> </code> aaa</p> "###, @@ -1587,10 +2001,13 @@ aaa</p> ); assert_eq!( - micromark_with_options(r###"~~~~~~ + micromark_with_options( + r###"~~~~~~ aaa ~~~ ~~ -"###, DANGER), +"###, + &danger + ), r###"<pre><code>aaa ~~~ ~~ </code></pre> @@ -1599,12 +2016,15 @@ aaa ); assert_eq!( - micromark_with_options(r###"foo + micromark_with_options( + r###"foo ``` bar ``` baz -"###, DANGER), +"###, + &danger + ), r###"<p>foo</p> <pre><code>bar </code></pre> @@ -1614,13 +2034,16 @@ baz ); assert_eq!( - micromark_with_options(r###"foo + micromark_with_options( + r###"foo --- ~~~ bar ~~~ # baz -"###, DANGER), +"###, + &danger + ), r###"<h2>foo</h2> <pre><code>bar </code></pre> @@ -1630,12 +2053,15 @@ bar ); assert_eq!( - micromark_with_options(r###"```ruby + micromark_with_options( + r###"```ruby def foo(x) return 3 end ``` -"###, DANGER), +"###, + &danger + ), r###"<pre><code class="language-ruby">def foo(x) return 3 end @@ -1645,12 +2071,15 @@ end ); assert_eq!( - micromark_with_options(r###"~~~~ ruby startline=3 $%@#$ + micromark_with_options( + r###"~~~~ ruby startline=3 $%@#$ def foo(x) return 3 end ~~~~~~~ -"###, DANGER), +"###, + &danger + ), r###"<pre><code class="language-ruby">def foo(x) return 3 end @@ -1660,18 +2089,24 @@ end ); assert_eq!( - micromark_with_options(r###"````; + micromark_with_options( + r###"````; ```` -"###, DANGER), +"###, + &danger + ), r###"<pre><code class="language-;"></code></pre> "###, r###"Fenced code blocks (144)"### ); assert_eq!( - micromark_with_options(r###"``` aa ``` + micromark_with_options( + r###"``` aa ``` foo -"###, DANGER), +"###, + &danger + ), r###"<p><code>aa</code> foo</p> "###, @@ -1679,10 +2114,13 @@ foo</p> ); assert_eq!( - micromark_with_options(r###"~~~ aa ``` ~~~ + micromark_with_options( + r###"~~~ aa ``` ~~~ foo ~~~ -"###, DANGER), +"###, + &danger + ), r###"<pre><code class="language-aa">foo </code></pre> "###, @@ -1690,10 +2128,13 @@ foo ); assert_eq!( - micromark_with_options(r###"``` + micromark_with_options( + r###"``` ``` aaa ``` -"###, DANGER), +"###, + &danger + ), r###"<pre><code>``` aaa </code></pre> "###, @@ -1701,14 +2142,17 @@ foo ); assert_eq!( - micromark_with_options(r###"<table><tr><td> + micromark_with_options( + r###"<table><tr><td> <pre> **Hello**, _world_. </pre> </td></tr></table> -"###, DANGER), +"###, + &danger + ), r###"<table><tr><td> <pre> **Hello**, @@ -1720,7 +2164,8 @@ _world_. ); assert_eq!( - micromark_with_options(r###"<table> + micromark_with_options( + r###"<table> <tr> <td> hi @@ -1729,7 +2174,9 @@ _world_. </table> okay. -"###, DANGER), +"###, + &danger + ), r###"<table> <tr> <td> @@ -1743,10 +2190,13 @@ okay. ); assert_eq!( - micromark_with_options(r###" <div> + micromark_with_options( + r###" <div> *hello* <foo><a> -"###, DANGER), +"###, + &danger + ), r###" <div> *hello* <foo><a> @@ -1755,9 +2205,12 @@ okay. ); assert_eq!( - micromark_with_options(r###"</div> + micromark_with_options( + r###"</div> *foo* -"###, DANGER), +"###, + &danger + ), r###"</div> *foo* "###, @@ -1765,12 +2218,15 @@ okay. ); assert_eq!( - micromark_with_options(r###"<DIV CLASS="foo"> + micromark_with_options( + r###"<DIV CLASS="foo"> *Markdown* </DIV> -"###, DANGER), +"###, + &danger + ), r###"<DIV CLASS="foo"> <p><em>Markdown</em></p> </DIV> @@ -1779,10 +2235,13 @@ okay. ); assert_eq!( - micromark_with_options(r###"<div id="foo" + micromark_with_options( + r###"<div id="foo" class="bar"> </div> -"###, DANGER), +"###, + &danger + ), r###"<div id="foo" class="bar"> </div> @@ -1791,10 +2250,13 @@ okay. ); assert_eq!( - micromark_with_options(r###"<div id="foo" class="bar + micromark_with_options( + r###"<div id="foo" class="bar baz"> </div> -"###, DANGER), +"###, + &danger + ), r###"<div id="foo" class="bar baz"> </div> @@ -1803,11 +2265,14 @@ okay. ); assert_eq!( - micromark_with_options(r###"<div> + micromark_with_options( + r###"<div> *foo* *bar* -"###, DANGER), +"###, + &danger + ), r###"<div> *foo* <p><em>bar</em></p> @@ -1816,9 +2281,12 @@ okay. ); assert_eq!( - micromark_with_options(r###"<div id="foo" + micromark_with_options( + r###"<div id="foo" *hi* -"###, DANGER), +"###, + &danger + ), r###"<div id="foo" *hi* "###, @@ -1826,9 +2294,12 @@ okay. ); assert_eq!( - micromark_with_options(r###"<div class + micromark_with_options( + r###"<div class foo -"###, DANGER), +"###, + &danger + ), r###"<div class foo "###, @@ -1836,9 +2307,12 @@ foo ); assert_eq!( - micromark_with_options(r###"<div *???-&&&-<--- + micromark_with_options( + r###"<div *???-&&&-<--- *foo* -"###, DANGER), +"###, + &danger + ), r###"<div *???-&&&-<--- *foo* "###, @@ -1846,18 +2320,24 @@ foo ); assert_eq!( - micromark_with_options(r###"<div><a href="bar">*foo*</a></div> -"###, DANGER), + micromark_with_options( + r###"<div><a href="bar">*foo*</a></div> +"###, + &danger + ), r###"<div><a href="bar">*foo*</a></div> "###, r###"HTML blocks (159)"### ); assert_eq!( - micromark_with_options(r###"<table><tr><td> + micromark_with_options( + r###"<table><tr><td> foo </td></tr></table> -"###, DANGER), +"###, + &danger + ), r###"<table><tr><td> foo </td></tr></table> @@ -1866,11 +2346,14 @@ foo ); assert_eq!( - micromark_with_options(r###"<div></div> + micromark_with_options( + r###"<div></div> ``` c int x = 33; ``` -"###, DANGER), +"###, + &danger + ), r###"<div></div> ``` c int x = 33; @@ -1880,10 +2363,13 @@ int x = 33; ); assert_eq!( - micromark_with_options(r###"<a href="foo"> + micromark_with_options( + r###"<a href="foo"> *bar* </a> -"###, DANGER), +"###, + &danger + ), r###"<a href="foo"> *bar* </a> @@ -1892,10 +2378,13 @@ int x = 33; ); assert_eq!( - micromark_with_options(r###"<Warning> + micromark_with_options( + r###"<Warning> *bar* </Warning> -"###, DANGER), +"###, + &danger + ), r###"<Warning> *bar* </Warning> @@ -1904,10 +2393,13 @@ int x = 33; ); assert_eq!( - micromark_with_options(r###"<i class="foo"> + micromark_with_options( + r###"<i class="foo"> *bar* </i> -"###, DANGER), +"###, + &danger + ), r###"<i class="foo"> *bar* </i> @@ -1916,9 +2408,12 @@ int x = 33; ); assert_eq!( - micromark_with_options(r###"</ins> + micromark_with_options( + r###"</ins> *bar* -"###, DANGER), +"###, + &danger + ), r###"</ins> *bar* "###, @@ -1926,10 +2421,13 @@ int x = 33; ); assert_eq!( - micromark_with_options(r###"<del> + micromark_with_options( + r###"<del> *foo* </del> -"###, DANGER), +"###, + &danger + ), r###"<del> *foo* </del> @@ -1938,12 +2436,15 @@ int x = 33; ); assert_eq!( - micromark_with_options(r###"<del> + micromark_with_options( + r###"<del> *foo* </del> -"###, DANGER), +"###, + &danger + ), r###"<del> <p><em>foo</em></p> </del> @@ -1952,22 +2453,28 @@ int x = 33; ); assert_eq!( - micromark_with_options(r###"<del>*foo*</del> -"###, DANGER), + micromark_with_options( + r###"<del>*foo*</del> +"###, + &danger + ), r###"<p><del><em>foo</em></del></p> "###, r###"HTML blocks (168)"### ); assert_eq!( - micromark_with_options(r###"<pre language="haskell"><code> + micromark_with_options( + r###"<pre language="haskell"><code> import Text.HTML.TagSoup main :: IO () main = print $ parseTags tags </code></pre> okay -"###, DANGER), +"###, + &danger + ), r###"<pre language="haskell"><code> import Text.HTML.TagSoup @@ -1980,13 +2487,16 @@ main = print $ parseTags tags ); assert_eq!( - micromark_with_options(r###"<script type="text/javascript"> + micromark_with_options( + r###"<script type="text/javascript"> // JavaScript example document.getElementById("demo").innerHTML = "Hello JavaScript!"; </script> okay -"###, DANGER), +"###, + &danger + ), r###"<script type="text/javascript"> // JavaScript example @@ -1998,14 +2508,17 @@ document.getElementById("demo").innerHTML = "Hello JavaScript!"; ); assert_eq!( - micromark_with_options(r###"<textarea> + micromark_with_options( + r###"<textarea> *foo* _bar_ </textarea> -"###, DANGER), +"###, + &danger + ), r###"<textarea> *foo* @@ -2018,14 +2531,17 @@ _bar_ ); assert_eq!( - micromark_with_options(r###"<style + micromark_with_options( + r###"<style type="text/css"> h1 {color:red;} p {color:blue;} </style> okay -"###, DANGER), +"###, + &danger + ), r###"<style type="text/css"> h1 {color:red;} @@ -2038,11 +2554,14 @@ p {color:blue;} ); assert_eq!( - micromark_with_options(r###"<style + micromark_with_options( + r###"<style type="text/css"> foo -"###, DANGER), +"###, + &danger + ), r###"<style type="text/css"> @@ -2052,11 +2571,14 @@ foo ); assert_eq!( - micromark_with_options(r###"> <div> + micromark_with_options( + r###"> <div> > foo bar -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <div> foo @@ -2067,9 +2589,12 @@ foo ); assert_eq!( - micromark_with_options(r###"- <div> + micromark_with_options( + r###"- <div> - foo -"###, DANGER), +"###, + &danger + ), r###"<ul> <li> <div> @@ -2081,9 +2606,12 @@ foo ); assert_eq!( - micromark_with_options(r###"<style>p{color:red;}</style> + micromark_with_options( + r###"<style>p{color:red;}</style> *foo* -"###, DANGER), +"###, + &danger + ), r###"<style>p{color:red;}</style> <p><em>foo</em></p> "###, @@ -2091,9 +2619,12 @@ foo ); assert_eq!( - micromark_with_options(r###"<!-- foo -->*bar* + micromark_with_options( + r###"<!-- foo -->*bar* *baz* -"###, DANGER), +"###, + &danger + ), r###"<!-- foo -->*bar* <p><em>baz</em></p> "###, @@ -2101,10 +2632,13 @@ foo ); assert_eq!( - micromark_with_options(r###"<script> + micromark_with_options( + r###"<script> foo </script>1. *bar* -"###, DANGER), +"###, + &danger + ), r###"<script> foo </script>1. *bar* @@ -2113,12 +2647,15 @@ foo ); assert_eq!( - micromark_with_options(r###"<!-- Foo + micromark_with_options( + r###"<!-- Foo bar baz --> okay -"###, DANGER), +"###, + &danger + ), r###"<!-- Foo bar @@ -2129,13 +2666,16 @@ bar ); assert_eq!( - micromark_with_options(r###"<?php + micromark_with_options( + r###"<?php echo '>'; ?> okay -"###, DANGER), +"###, + &danger + ), r###"<?php echo '>'; @@ -2147,15 +2687,19 @@ okay ); assert_eq!( - micromark_with_options(r###"<!DOCTYPE html> -"###, DANGER), + micromark_with_options( + r###"<!DOCTYPE html> +"###, + &danger + ), r###"<!DOCTYPE html> "###, r###"HTML blocks (181)"### ); assert_eq!( - micromark_with_options(r###"<![CDATA[ + micromark_with_options( + r###"<![CDATA[ function matchwo(a,b) { if (a < b && a < 0) then { @@ -2168,7 +2712,9 @@ function matchwo(a,b) } ]]> okay -"###, DANGER), +"###, + &danger + ), r###"<![CDATA[ function matchwo(a,b) { @@ -2187,10 +2733,13 @@ function matchwo(a,b) ); assert_eq!( - micromark_with_options(r###" <!-- foo --> + micromark_with_options( + r###" <!-- foo --> <!-- foo --> -"###, DANGER), +"###, + &danger + ), r###" <!-- foo --> <pre><code><!-- foo --> </code></pre> @@ -2199,10 +2748,13 @@ function matchwo(a,b) ); assert_eq!( - micromark_with_options(r###" <div> + micromark_with_options( + r###" <div> <div> -"###, DANGER), +"###, + &danger + ), r###" <div> <pre><code><div> </code></pre> @@ -2211,11 +2763,14 @@ function matchwo(a,b) ); assert_eq!( - micromark_with_options(r###"Foo + micromark_with_options( + r###"Foo <div> bar </div> -"###, DANGER), +"###, + &danger + ), r###"<p>Foo</p> <div> bar @@ -2225,11 +2780,14 @@ bar ); assert_eq!( - micromark_with_options(r###"<div> + micromark_with_options( + r###"<div> bar </div> *foo* -"###, DANGER), +"###, + &danger + ), r###"<div> bar </div> @@ -2239,10 +2797,13 @@ bar ); assert_eq!( - micromark_with_options(r###"Foo + micromark_with_options( + r###"Foo <a href="bar"> baz -"###, DANGER), +"###, + &danger + ), r###"<p>Foo <a href="bar"> baz</p> @@ -2251,12 +2812,15 @@ baz</p> ); assert_eq!( - micromark_with_options(r###"<div> + micromark_with_options( + r###"<div> *Emphasized* text. </div> -"###, DANGER), +"###, + &danger + ), r###"<div> <p><em>Emphasized</em> text.</p> </div> @@ -2265,10 +2829,13 @@ baz</p> ); assert_eq!( - micromark_with_options(r###"<div> + micromark_with_options( + r###"<div> *Emphasized* text. </div> -"###, DANGER), +"###, + &danger + ), r###"<div> *Emphasized* text. </div> @@ -2277,7 +2844,8 @@ baz</p> ); assert_eq!( - micromark_with_options(r###"<table> + micromark_with_options( + r###"<table> <tr> @@ -2288,7 +2856,9 @@ Hi </tr> </table> -"###, DANGER), +"###, + &danger + ), r###"<table> <tr> <td> @@ -2301,7 +2871,8 @@ Hi ); assert_eq!( - micromark_with_options(r###"<table> + micromark_with_options( + r###"<table> <tr> @@ -2312,7 +2883,9 @@ Hi </tr> </table> -"###, DANGER), +"###, + &danger + ), r###"<table> <tr> <pre><code><td> @@ -2326,58 +2899,73 @@ Hi ); assert_eq!( - micromark_with_options(r###"[foo]: /url "title" + micromark_with_options( + r###"[foo]: /url "title" [foo] -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url" title="title">foo</a></p> "###, r###"Link reference definitions (192)"### ); assert_eq!( - micromark_with_options(r###" [foo]: + micromark_with_options( + r###" [foo]: /url 'the title' [foo] -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url" title="the title">foo</a></p> "###, r###"Link reference definitions (193)"### ); assert_eq!( - micromark_with_options(r###"[Foo*bar\]]:my_(url) 'title (with parens)' + micromark_with_options( + r###"[Foo*bar\]]:my_(url) 'title (with parens)' [Foo*bar\]] -"###, DANGER), +"###, + &danger + ), r###"<p><a href="my_(url)" title="title (with parens)">Foo*bar]</a></p> "###, r###"Link reference definitions (194)"### ); assert_eq!( - micromark_with_options(r###"[Foo bar]: + micromark_with_options( + r###"[Foo bar]: <my url> 'title' [Foo bar] -"###, DANGER), +"###, + &danger + ), r###"<p><a href="my%20url" title="title">Foo bar</a></p> "###, r###"Link reference definitions (195)"### ); assert_eq!( - micromark_with_options(r###"[foo]: /url ' + micromark_with_options( + r###"[foo]: /url ' title line1 line2 ' [foo] -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url" title=" title line1 @@ -2388,12 +2976,15 @@ line2 ); assert_eq!( - micromark_with_options(r###"[foo]: /url 'title + micromark_with_options( + r###"[foo]: /url 'title with blank line' [foo] -"###, DANGER), +"###, + &danger + ), r###"<p>[foo]: /url 'title</p> <p>with blank line'</p> <p>[foo]</p> @@ -2402,21 +2993,27 @@ with blank line' ); assert_eq!( - micromark_with_options(r###"[foo]: + micromark_with_options( + r###"[foo]: /url [foo] -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url">foo</a></p> "###, r###"Link reference definitions (198)"### ); assert_eq!( - micromark_with_options(r###"[foo]: + micromark_with_options( + r###"[foo]: [foo] -"###, DANGER), +"###, + &danger + ), r###"<p>[foo]:</p> <p>[foo]</p> "###, @@ -2424,20 +3021,26 @@ with blank line' ); assert_eq!( - micromark_with_options(r###"[foo]: <> + micromark_with_options( + r###"[foo]: <> [foo] -"###, DANGER), +"###, + &danger + ), r###"<p><a href="">foo</a></p> "###, r###"Link reference definitions (200)"### ); assert_eq!( - micromark_with_options(r###"[foo]: <bar>(baz) + micromark_with_options( + r###"[foo]: <bar>(baz) [foo] -"###, DANGER), +"###, + &danger + ), r###"<p>[foo]: <bar>(baz)</p> <p>[foo]</p> "###, @@ -2445,96 +3048,126 @@ with blank line' ); assert_eq!( - micromark_with_options(r###"[foo]: /url\bar\*baz "foo\"bar\baz" + micromark_with_options( + r###"[foo]: /url\bar\*baz "foo\"bar\baz" [foo] -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url%5Cbar*baz" title="foo"bar\baz">foo</a></p> "###, r###"Link reference definitions (202)"### ); assert_eq!( - micromark_with_options(r###"[foo] + micromark_with_options( + r###"[foo] [foo]: url -"###, DANGER), +"###, + &danger + ), r###"<p><a href="url">foo</a></p> "###, r###"Link reference definitions (203)"### ); assert_eq!( - micromark_with_options(r###"[foo] + micromark_with_options( + r###"[foo] [foo]: first [foo]: second -"###, DANGER), +"###, + &danger + ), r###"<p><a href="first">foo</a></p> "###, r###"Link reference definitions (204)"### ); assert_eq!( - micromark_with_options(r###"[FOO]: /url + micromark_with_options( + r###"[FOO]: /url [Foo] -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url">Foo</a></p> "###, r###"Link reference definitions (205)"### ); assert_eq!( - micromark_with_options(r###"[ΑΓΩ]: /φου + micromark_with_options( + r###"[ΑΓΩ]: /φου [αγω] -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/%CF%86%CE%BF%CF%85">αγω</a></p> "###, r###"Link reference definitions (206)"### ); assert_eq!( - micromark_with_options(r###"[foo]: /url -"###, DANGER), + micromark_with_options( + r###"[foo]: /url +"###, + &danger + ), r###""###, r###"Link reference definitions (207)"### ); assert_eq!( - micromark_with_options(r###"[ + micromark_with_options( + r###"[ foo ]: /url bar -"###, DANGER), +"###, + &danger + ), r###"<p>bar</p> "###, r###"Link reference definitions (208)"### ); assert_eq!( - micromark_with_options(r###"[foo]: /url "title" ok -"###, DANGER), + micromark_with_options( + r###"[foo]: /url "title" ok +"###, + &danger + ), r###"<p>[foo]: /url "title" ok</p> "###, r###"Link reference definitions (209)"### ); assert_eq!( - micromark_with_options(r###"[foo]: /url + micromark_with_options( + r###"[foo]: /url "title" ok -"###, DANGER), +"###, + &danger + ), r###"<p>"title" ok</p> "###, r###"Link reference definitions (210)"### ); assert_eq!( - micromark_with_options(r###" [foo]: /url "title" + micromark_with_options( + r###" [foo]: /url "title" [foo] -"###, DANGER), +"###, + &danger + ), r###"<pre><code>[foo]: /url "title" </code></pre> <p>[foo]</p> @@ -2543,12 +3176,15 @@ bar ); assert_eq!( - micromark_with_options(r###"``` + micromark_with_options( + r###"``` [foo]: /url ``` [foo] -"###, DANGER), +"###, + &danger + ), r###"<pre><code>[foo]: /url </code></pre> <p>[foo]</p> @@ -2557,11 +3193,14 @@ bar ); assert_eq!( - micromark_with_options(r###"Foo + micromark_with_options( + r###"Foo [bar]: /baz [bar] -"###, DANGER), +"###, + &danger + ), r###"<p>Foo [bar]: /baz</p> <p>[bar]</p> @@ -2570,10 +3209,13 @@ bar ); assert_eq!( - micromark_with_options(r###"# [Foo] + micromark_with_options( + r###"# [Foo] [foo]: /url > bar -"###, DANGER), +"###, + &danger + ), r###"<h1><a href="/url">Foo</a></h1> <blockquote> <p>bar</p> @@ -2583,11 +3225,14 @@ bar ); assert_eq!( - micromark_with_options(r###"[foo]: /url + micromark_with_options( + r###"[foo]: /url bar === [foo] -"###, DANGER), +"###, + &danger + ), r###"<h1>bar</h1> <p><a href="/url">foo</a></p> "###, @@ -2595,10 +3240,13 @@ bar ); assert_eq!( - micromark_with_options(r###"[foo]: /url + micromark_with_options( + r###"[foo]: /url === [foo] -"###, DANGER), +"###, + &danger + ), r###"<p>=== <a href="/url">foo</a></p> "###, @@ -2606,7 +3254,8 @@ bar ); assert_eq!( - micromark_with_options(r###"[foo]: /foo-url "foo" + micromark_with_options( + r###"[foo]: /foo-url "foo" [bar]: /bar-url "bar" [baz]: /baz-url @@ -2614,7 +3263,9 @@ bar [foo], [bar], [baz] -"###, DANGER), +"###, + &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> @@ -2623,10 +3274,13 @@ bar ); assert_eq!( - micromark_with_options(r###"[foo] + micromark_with_options( + r###"[foo] > [foo]: /url -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url">foo</a></p> <blockquote> </blockquote> @@ -2635,10 +3289,13 @@ bar ); assert_eq!( - micromark_with_options(r###"aaa + micromark_with_options( + r###"aaa bbb -"###, DANGER), +"###, + &danger + ), r###"<p>aaa</p> <p>bbb</p> "###, @@ -2646,12 +3303,15 @@ bbb ); assert_eq!( - micromark_with_options(r###"aaa + micromark_with_options( + r###"aaa bbb ccc ddd -"###, DANGER), +"###, + &danger + ), r###"<p>aaa bbb</p> <p>ccc @@ -2661,11 +3321,14 @@ ddd</p> ); assert_eq!( - micromark_with_options(r###"aaa + micromark_with_options( + r###"aaa bbb -"###, DANGER), +"###, + &danger + ), r###"<p>aaa</p> <p>bbb</p> "###, @@ -2673,9 +3336,12 @@ bbb ); assert_eq!( - micromark_with_options(r###" aaa + micromark_with_options( + r###" aaa bbb -"###, DANGER), +"###, + &danger + ), r###"<p>aaa bbb</p> "###, @@ -2683,10 +3349,13 @@ bbb</p> ); assert_eq!( - micromark_with_options(r###"aaa + micromark_with_options( + r###"aaa bbb ccc -"###, DANGER), +"###, + &danger + ), r###"<p>aaa bbb ccc</p> @@ -2695,9 +3364,12 @@ ccc</p> ); assert_eq!( - micromark_with_options(r###" aaa + micromark_with_options( + r###" aaa bbb -"###, DANGER), +"###, + &danger + ), r###"<p>aaa bbb</p> "###, @@ -2705,9 +3377,12 @@ bbb</p> ); assert_eq!( - micromark_with_options(r###" aaa + micromark_with_options( + r###" aaa bbb -"###, DANGER), +"###, + &danger + ), r###"<pre><code>aaa </code></pre> <p>bbb</p> @@ -2716,9 +3391,12 @@ bbb ); assert_eq!( - micromark_with_options(r###"aaa + micromark_with_options( + r###"aaa bbb -"###, DANGER), +"###, + &danger + ), r###"<p>aaa<br /> bbb</p> "###, @@ -2726,7 +3404,8 @@ bbb</p> ); assert_eq!( - micromark_with_options(r###" + micromark_with_options( + r###" aaa @@ -2734,7 +3413,9 @@ aaa # aaa -"###, DANGER), +"###, + &danger + ), r###"<p>aaa</p> <h1>aaa</h1> "###, @@ -2742,10 +3423,13 @@ aaa ); assert_eq!( - micromark_with_options(r###"> # Foo + micromark_with_options( + r###"> # Foo > bar > baz -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <h1>Foo</h1> <p>bar @@ -2756,10 +3440,13 @@ baz</p> ); assert_eq!( - micromark_with_options(r###"># Foo + micromark_with_options( + r###"># Foo >bar > baz -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <h1>Foo</h1> <p>bar @@ -2770,10 +3457,13 @@ baz</p> ); assert_eq!( - micromark_with_options(r###" > # Foo + micromark_with_options( + r###" > # Foo > bar > baz -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <h1>Foo</h1> <p>bar @@ -2784,10 +3474,13 @@ baz</p> ); assert_eq!( - micromark_with_options(r###" > # Foo + micromark_with_options( + r###" > # Foo > bar > baz -"###, DANGER), +"###, + &danger + ), r###"<pre><code>> # Foo > bar > baz @@ -2797,10 +3490,13 @@ baz</p> ); assert_eq!( - micromark_with_options(r###"> # Foo + micromark_with_options( + r###"> # Foo > bar baz -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <h1>Foo</h1> <p>bar @@ -2811,10 +3507,13 @@ baz</p> ); assert_eq!( - micromark_with_options(r###"> bar + micromark_with_options( + r###"> bar baz > foo -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <p>bar baz @@ -2825,9 +3524,12 @@ foo</p> ); assert_eq!( - micromark_with_options(r###"> foo + micromark_with_options( + r###"> foo --- -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <p>foo</p> </blockquote> @@ -2837,9 +3539,12 @@ foo</p> ); assert_eq!( - micromark_with_options(r###"> - foo + micromark_with_options( + r###"> - foo - bar -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <ul> <li>foo</li> @@ -2853,9 +3558,12 @@ foo</p> ); assert_eq!( - micromark_with_options(r###"> foo + micromark_with_options( + r###"> foo bar -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <pre><code>foo </code></pre> @@ -2867,10 +3575,13 @@ foo</p> ); assert_eq!( - micromark_with_options(r###"> ``` + micromark_with_options( + r###"> ``` foo ``` -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <pre><code></code></pre> </blockquote> @@ -2881,9 +3592,12 @@ foo ); assert_eq!( - micromark_with_options(r###"> foo + micromark_with_options( + r###"> foo - bar -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <p>foo - bar</p> @@ -2893,8 +3607,11 @@ foo ); assert_eq!( - micromark_with_options(r###"> -"###, DANGER), + micromark_with_options( + r###"> +"###, + &danger + ), r###"<blockquote> </blockquote> "###, @@ -2902,10 +3619,13 @@ foo ); assert_eq!( - micromark_with_options(r###"> + micromark_with_options( + r###"> > > -"###, DANGER), +"###, + &danger + ), r###"<blockquote> </blockquote> "###, @@ -2913,10 +3633,13 @@ foo ); assert_eq!( - micromark_with_options(r###"> + micromark_with_options( + r###"> > foo > -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <p>foo</p> </blockquote> @@ -2925,10 +3648,13 @@ foo ); assert_eq!( - micromark_with_options(r###"> foo + micromark_with_options( + r###"> foo > bar -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <p>foo</p> </blockquote> @@ -2940,9 +3666,12 @@ foo ); assert_eq!( - micromark_with_options(r###"> foo + micromark_with_options( + r###"> foo > bar -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <p>foo bar</p> @@ -2952,10 +3681,13 @@ bar</p> ); assert_eq!( - micromark_with_options(r###"> foo + micromark_with_options( + r###"> foo > > bar -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <p>foo</p> <p>bar</p> @@ -2965,9 +3697,12 @@ bar</p> ); assert_eq!( - micromark_with_options(r###"foo + micromark_with_options( + r###"foo > bar -"###, DANGER), +"###, + &danger + ), r###"<p>foo</p> <blockquote> <p>bar</p> @@ -2977,10 +3712,13 @@ bar</p> ); assert_eq!( - micromark_with_options(r###"> aaa + micromark_with_options( + r###"> aaa *** > bbb -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <p>aaa</p> </blockquote> @@ -2993,9 +3731,12 @@ bar</p> ); assert_eq!( - micromark_with_options(r###"> bar + micromark_with_options( + r###"> bar baz -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <p>bar baz</p> @@ -3005,10 +3746,13 @@ baz</p> ); assert_eq!( - micromark_with_options(r###"> bar + micromark_with_options( + r###"> bar baz -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <p>bar</p> </blockquote> @@ -3018,10 +3762,13 @@ baz ); assert_eq!( - micromark_with_options(r###"> bar + micromark_with_options( + r###"> bar > baz -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <p>bar</p> </blockquote> @@ -3031,9 +3778,12 @@ baz ); assert_eq!( - micromark_with_options(r###"> > > foo + micromark_with_options( + r###"> > > foo bar -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <blockquote> <blockquote> @@ -3047,10 +3797,13 @@ bar</p> ); assert_eq!( - micromark_with_options(r###">>> foo + micromark_with_options( + r###">>> foo > bar >>baz -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <blockquote> <blockquote> @@ -3065,10 +3818,13 @@ baz</p> ); assert_eq!( - micromark_with_options(r###"> code + micromark_with_options( + r###"> code > not code -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <pre><code>code </code></pre> @@ -3081,13 +3837,16 @@ baz</p> ); assert_eq!( - micromark_with_options(r###"A paragraph + micromark_with_options( + r###"A paragraph with two lines. indented code > A block quote. -"###, DANGER), +"###, + &danger + ), r###"<p>A paragraph with two lines.</p> <pre><code>indented code @@ -3100,13 +3859,16 @@ with two lines.</p> ); assert_eq!( - micromark_with_options(r###"1. A paragraph + micromark_with_options( + r###"1. A paragraph with two lines. indented code > A block quote. -"###, DANGER), +"###, + &danger + ), r###"<ol> <li> <p>A paragraph @@ -3123,10 +3885,13 @@ with two lines.</p> ); assert_eq!( - micromark_with_options(r###"- one + micromark_with_options( + r###"- one two -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>one</li> </ul> @@ -3136,10 +3901,13 @@ with two lines.</p> ); assert_eq!( - micromark_with_options(r###"- one + micromark_with_options( + r###"- one two -"###, DANGER), +"###, + &danger + ), r###"<ul> <li> <p>one</p> @@ -3151,10 +3919,13 @@ with two lines.</p> ); assert_eq!( - micromark_with_options(r###" - one + micromark_with_options( + r###" - one two -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>one</li> </ul> @@ -3165,10 +3936,13 @@ with two lines.</p> ); assert_eq!( - micromark_with_options(r###" - one + micromark_with_options( + r###" - one two -"###, DANGER), +"###, + &danger + ), r###"<ul> <li> <p>one</p> @@ -3180,10 +3954,13 @@ with two lines.</p> ); assert_eq!( - micromark_with_options(r###" > > 1. one + micromark_with_options( + r###" > > 1. one >> >> two -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <blockquote> <ol> @@ -3199,10 +3976,13 @@ with two lines.</p> ); assert_eq!( - micromark_with_options(r###">>- one + micromark_with_options( + r###">>- one >> > > two -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <blockquote> <ul> @@ -3216,10 +3996,13 @@ with two lines.</p> ); assert_eq!( - micromark_with_options(r###"-one + micromark_with_options( + r###"-one 2.two -"###, DANGER), +"###, + &danger + ), r###"<p>-one</p> <p>2.two</p> "###, @@ -3227,11 +4010,14 @@ with two lines.</p> ); assert_eq!( - micromark_with_options(r###"- foo + micromark_with_options( + r###"- foo bar -"###, DANGER), +"###, + &danger + ), r###"<ul> <li> <p>foo</p> @@ -3243,7 +4029,8 @@ with two lines.</p> ); assert_eq!( - micromark_with_options(r###"1. foo + micromark_with_options( + r###"1. foo ``` bar @@ -3252,7 +4039,9 @@ with two lines.</p> baz > bam -"###, DANGER), +"###, + &danger + ), r###"<ol> <li> <p>foo</p> @@ -3269,13 +4058,16 @@ with two lines.</p> ); assert_eq!( - micromark_with_options(r###"- Foo + micromark_with_options( + r###"- Foo bar baz -"###, DANGER), +"###, + &danger + ), r###"<ul> <li> <p>Foo</p> @@ -3291,8 +4083,11 @@ baz ); assert_eq!( - micromark_with_options(r###"123456789. ok -"###, DANGER), + micromark_with_options( + r###"123456789. ok +"###, + &danger + ), r###"<ol start="123456789"> <li>ok</li> </ol> @@ -3301,16 +4096,22 @@ baz ); assert_eq!( - micromark_with_options(r###"1234567890. not ok -"###, DANGER), + micromark_with_options( + r###"1234567890. not ok +"###, + &danger + ), r###"<p>1234567890. not ok</p> "###, r###"List items (266)"### ); assert_eq!( - micromark_with_options(r###"0. ok -"###, DANGER), + micromark_with_options( + r###"0. ok +"###, + &danger + ), r###"<ol start="0"> <li>ok</li> </ol> @@ -3319,8 +4120,11 @@ baz ); assert_eq!( - micromark_with_options(r###"003. ok -"###, DANGER), + micromark_with_options( + r###"003. ok +"###, + &danger + ), r###"<ol start="3"> <li>ok</li> </ol> @@ -3329,18 +4133,24 @@ baz ); assert_eq!( - micromark_with_options(r###"-1. not ok -"###, DANGER), + micromark_with_options( + r###"-1. not ok +"###, + &danger + ), r###"<p>-1. not ok</p> "###, r###"List items (269)"### ); assert_eq!( - micromark_with_options(r###"- foo + micromark_with_options( + r###"- foo bar -"###, DANGER), +"###, + &danger + ), r###"<ul> <li> <p>foo</p> @@ -3353,10 +4163,13 @@ baz ); assert_eq!( - micromark_with_options(r###" 10. foo + micromark_with_options( + r###" 10. foo bar -"###, DANGER), +"###, + &danger + ), r###"<ol start="10"> <li> <p>foo</p> @@ -3369,12 +4182,15 @@ baz ); assert_eq!( - micromark_with_options(r###" indented code + micromark_with_options( + r###" indented code paragraph more code -"###, DANGER), +"###, + &danger + ), r###"<pre><code>indented code </code></pre> <p>paragraph</p> @@ -3385,12 +4201,15 @@ paragraph ); assert_eq!( - micromark_with_options(r###"1. indented code + micromark_with_options( + r###"1. indented code paragraph more code -"###, DANGER), +"###, + &danger + ), r###"<ol> <li> <pre><code>indented code @@ -3405,12 +4224,15 @@ paragraph ); assert_eq!( - micromark_with_options(r###"1. indented code + micromark_with_options( + r###"1. indented code paragraph more code -"###, DANGER), +"###, + &danger + ), r###"<ol> <li> <pre><code> indented code @@ -3425,10 +4247,13 @@ paragraph ); assert_eq!( - micromark_with_options(r###" foo + micromark_with_options( + r###" foo bar -"###, DANGER), +"###, + &danger + ), r###"<p>foo</p> <p>bar</p> "###, @@ -3436,10 +4261,13 @@ bar ); assert_eq!( - micromark_with_options(r###"- foo + micromark_with_options( + r###"- foo bar -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>foo</li> </ul> @@ -3449,10 +4277,13 @@ bar ); assert_eq!( - micromark_with_options(r###"- foo + micromark_with_options( + r###"- foo bar -"###, DANGER), +"###, + &danger + ), r###"<ul> <li> <p>foo</p> @@ -3464,7 +4295,8 @@ bar ); assert_eq!( - micromark_with_options(r###"- + micromark_with_options( + r###"- foo - ``` @@ -3472,7 +4304,9 @@ bar ``` - baz -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>foo</li> <li> @@ -3489,9 +4323,12 @@ bar ); assert_eq!( - micromark_with_options(r###"- + micromark_with_options( + r###"- foo -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>foo</li> </ul> @@ -3500,10 +4337,13 @@ bar ); assert_eq!( - micromark_with_options(r###"- + micromark_with_options( + r###"- foo -"###, DANGER), +"###, + &danger + ), r###"<ul> <li></li> </ul> @@ -3513,10 +4353,13 @@ bar ); assert_eq!( - micromark_with_options(r###"- foo + micromark_with_options( + r###"- foo - - bar -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>foo</li> <li></li> @@ -3527,10 +4370,13 @@ bar ); assert_eq!( - micromark_with_options(r###"- foo + micromark_with_options( + r###"- foo - - bar -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>foo</li> <li></li> @@ -3541,10 +4387,13 @@ bar ); assert_eq!( - micromark_with_options(r###"1. foo + micromark_with_options( + r###"1. foo 2. 3. bar -"###, DANGER), +"###, + &danger + ), r###"<ol> <li>foo</li> <li></li> @@ -3555,8 +4404,11 @@ bar ); assert_eq!( - micromark_with_options(r###"* -"###, DANGER), + micromark_with_options( + r###"* +"###, + &danger + ), r###"<ul> <li></li> </ul> @@ -3565,12 +4417,15 @@ bar ); assert_eq!( - micromark_with_options(r###"foo + micromark_with_options( + r###"foo * foo 1. -"###, DANGER), +"###, + &danger + ), r###"<p>foo *</p> <p>foo @@ -3580,13 +4435,16 @@ foo ); assert_eq!( - micromark_with_options(r###" 1. A paragraph + micromark_with_options( + r###" 1. A paragraph with two lines. indented code > A block quote. -"###, DANGER), +"###, + &danger + ), r###"<ol> <li> <p>A paragraph @@ -3603,13 +4461,16 @@ with two lines.</p> ); assert_eq!( - micromark_with_options(r###" 1. A paragraph + micromark_with_options( + r###" 1. A paragraph with two lines. indented code > A block quote. -"###, DANGER), +"###, + &danger + ), r###"<ol> <li> <p>A paragraph @@ -3626,13 +4487,16 @@ with two lines.</p> ); assert_eq!( - micromark_with_options(r###" 1. A paragraph + micromark_with_options( + r###" 1. A paragraph with two lines. indented code > A block quote. -"###, DANGER), +"###, + &danger + ), r###"<ol> <li> <p>A paragraph @@ -3649,13 +4513,16 @@ with two lines.</p> ); assert_eq!( - micromark_with_options(r###" 1. A paragraph + micromark_with_options( + r###" 1. A paragraph with two lines. indented code > A block quote. -"###, DANGER), +"###, + &danger + ), r###"<pre><code>1. A paragraph with two lines. @@ -3668,13 +4535,16 @@ with two lines.</p> ); assert_eq!( - micromark_with_options(r###" 1. A paragraph + micromark_with_options( + r###" 1. A paragraph with two lines. indented code > A block quote. -"###, DANGER), +"###, + &danger + ), r###"<ol> <li> <p>A paragraph @@ -3691,9 +4561,12 @@ with two lines.</p> ); assert_eq!( - micromark_with_options(r###" 1. A paragraph + micromark_with_options( + r###" 1. A paragraph with two lines. -"###, DANGER), +"###, + &danger + ), r###"<ol> <li>A paragraph with two lines.</li> @@ -3703,9 +4576,12 @@ with two lines.</li> ); assert_eq!( - micromark_with_options(r###"> 1. > Blockquote + micromark_with_options( + r###"> 1. > Blockquote continued here. -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <ol> <li> @@ -3721,9 +4597,12 @@ continued here.</p> ); assert_eq!( - micromark_with_options(r###"> 1. > Blockquote + micromark_with_options( + r###"> 1. > Blockquote > continued here. -"###, DANGER), +"###, + &danger + ), r###"<blockquote> <ol> <li> @@ -3739,11 +4618,14 @@ continued here.</p> ); assert_eq!( - micromark_with_options(r###"- foo + micromark_with_options( + r###"- foo - bar - baz - boo -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>foo <ul> @@ -3764,11 +4646,14 @@ continued here.</p> ); assert_eq!( - micromark_with_options(r###"- foo + micromark_with_options( + r###"- foo - bar - baz - boo -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>foo</li> <li>bar</li> @@ -3780,9 +4665,12 @@ continued here.</p> ); assert_eq!( - micromark_with_options(r###"10) foo + micromark_with_options( + r###"10) foo - bar -"###, DANGER), +"###, + &danger + ), r###"<ol start="10"> <li>foo <ul> @@ -3795,9 +4683,12 @@ continued here.</p> ); assert_eq!( - micromark_with_options(r###"10) foo + micromark_with_options( + r###"10) foo - bar -"###, DANGER), +"###, + &danger + ), r###"<ol start="10"> <li>foo</li> </ol> @@ -3809,8 +4700,11 @@ continued here.</p> ); assert_eq!( - micromark_with_options(r###"- - foo -"###, DANGER), + micromark_with_options( + r###"- - foo +"###, + &danger + ), r###"<ul> <li> <ul> @@ -3823,8 +4717,11 @@ continued here.</p> ); assert_eq!( - micromark_with_options(r###"1. - 2. foo -"###, DANGER), + micromark_with_options( + r###"1. - 2. foo +"###, + &danger + ), r###"<ol> <li> <ul> @@ -3841,11 +4738,14 @@ continued here.</p> ); assert_eq!( - micromark_with_options(r###"- # Foo + micromark_with_options( + r###"- # Foo - Bar --- baz -"###, DANGER), +"###, + &danger + ), r###"<ul> <li> <h1>Foo</h1> @@ -3859,10 +4759,13 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"- foo + micromark_with_options( + r###"- foo - bar + baz -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>foo</li> <li>bar</li> @@ -3875,10 +4778,13 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"1. foo + micromark_with_options( + r###"1. foo 2. bar 3) baz -"###, DANGER), +"###, + &danger + ), r###"<ol> <li>foo</li> <li>bar</li> @@ -3891,10 +4797,13 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"Foo + micromark_with_options( + r###"Foo - bar - baz -"###, DANGER), +"###, + &danger + ), r###"<p>Foo</p> <ul> <li>bar</li> @@ -3905,9 +4814,12 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"The number of windows in my house is + micromark_with_options( + r###"The number of windows in my house is 14. The number of doors is 6. -"###, DANGER), +"###, + &danger + ), r###"<p>The number of windows in my house is 14. The number of doors is 6.</p> "###, @@ -3915,9 +4827,12 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"The number of windows in my house is + micromark_with_options( + r###"The number of windows in my house is 1. The number of doors is 6. -"###, DANGER), +"###, + &danger + ), r###"<p>The number of windows in my house is</p> <ol> <li>The number of doors is 6.</li> @@ -3927,13 +4842,16 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"- foo + micromark_with_options( + r###"- foo - bar - baz -"###, DANGER), +"###, + &danger + ), r###"<ul> <li> <p>foo</p> @@ -3950,13 +4868,16 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"- foo + micromark_with_options( + r###"- foo - bar - baz bim -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>foo <ul> @@ -3976,14 +4897,17 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"- foo + micromark_with_options( + r###"- foo - bar <!-- --> - baz - bim -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>foo</li> <li>bar</li> @@ -3998,7 +4922,8 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"- foo + micromark_with_options( + r###"- foo notcode @@ -4007,7 +4932,9 @@ baz</li> <!-- --> code -"###, DANGER), +"###, + &danger + ), r###"<ul> <li> <p>foo</p> @@ -4025,14 +4952,17 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"- a + micromark_with_options( + r###"- a - b - c - d - e - f - g -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>a</li> <li>b</li> @@ -4047,12 +4977,15 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"1. a + micromark_with_options( + r###"1. a 2. b 3. c -"###, DANGER), +"###, + &danger + ), r###"<ol> <li> <p>a</p> @@ -4069,12 +5002,15 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"- a + micromark_with_options( + r###"- a - b - c - d - e -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>a</li> <li>b</li> @@ -4087,12 +5023,15 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"1. a + micromark_with_options( + r###"1. a 2. b 3. c -"###, DANGER), +"###, + &danger + ), r###"<ol> <li> <p>a</p> @@ -4108,11 +5047,14 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"- a + micromark_with_options( + r###"- a - b - c -"###, DANGER), +"###, + &danger + ), r###"<ul> <li> <p>a</p> @@ -4129,11 +5071,14 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"* a + micromark_with_options( + r###"* a * * c -"###, DANGER), +"###, + &danger + ), r###"<ul> <li> <p>a</p> @@ -4148,12 +5093,15 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"- a + micromark_with_options( + r###"- a - b c - d -"###, DANGER), +"###, + &danger + ), r###"<ul> <li> <p>a</p> @@ -4171,12 +5119,15 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"- a + micromark_with_options( + r###"- a - b [ref]: /url - d -"###, DANGER), +"###, + &danger + ), r###"<ul> <li> <p>a</p> @@ -4193,14 +5144,17 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"- a + micromark_with_options( + r###"- a - ``` b ``` - c -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>a</li> <li> @@ -4216,12 +5170,15 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"- a + micromark_with_options( + r###"- a - b c - d -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>a <ul> @@ -4238,11 +5195,14 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"* a + micromark_with_options( + r###"* a > b > * c -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>a <blockquote> @@ -4256,13 +5216,16 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"- a + micromark_with_options( + r###"- a > b ``` c ``` - d -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>a <blockquote> @@ -4278,8 +5241,11 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"- a -"###, DANGER), + micromark_with_options( + r###"- a +"###, + &danger + ), r###"<ul> <li>a</li> </ul> @@ -4288,9 +5254,12 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"- a + micromark_with_options( + r###"- a - b -"###, DANGER), +"###, + &danger + ), r###"<ul> <li>a <ul> @@ -4303,12 +5272,15 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"1. ``` + micromark_with_options( + r###"1. ``` foo ``` bar -"###, DANGER), +"###, + &danger + ), r###"<ol> <li> <pre><code>foo @@ -4321,11 +5293,14 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"* foo + micromark_with_options( + r###"* foo * bar baz -"###, DANGER), +"###, + &danger + ), r###"<ul> <li> <p>foo</p> @@ -4340,14 +5315,17 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"- a + micromark_with_options( + r###"- a - b - c - d - e - f -"###, DANGER), +"###, + &danger + ), r###"<ul> <li> <p>a</p> @@ -4369,65 +5347,89 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"`hi`lo` -"###, DANGER), + micromark_with_options( + r###"`hi`lo` +"###, + &danger + ), r###"<p><code>hi</code>lo`</p> "###, r###"Inlines (327)"### ); assert_eq!( - micromark_with_options(r###"`foo` -"###, DANGER), + micromark_with_options( + r###"`foo` +"###, + &danger + ), r###"<p><code>foo</code></p> "###, r###"Code spans (328)"### ); assert_eq!( - micromark_with_options(r###"`` foo ` bar `` -"###, DANGER), + micromark_with_options( + r###"`` foo ` bar `` +"###, + &danger + ), r###"<p><code>foo ` bar</code></p> "###, r###"Code spans (329)"### ); assert_eq!( - micromark_with_options(r###"` `` ` -"###, DANGER), + micromark_with_options( + r###"` `` ` +"###, + &danger + ), r###"<p><code>``</code></p> "###, r###"Code spans (330)"### ); assert_eq!( - micromark_with_options(r###"` `` ` -"###, DANGER), + micromark_with_options( + r###"` `` ` +"###, + &danger + ), r###"<p><code> `` </code></p> "###, r###"Code spans (331)"### ); assert_eq!( - micromark_with_options(r###"` a` -"###, DANGER), + micromark_with_options( + r###"` a` +"###, + &danger + ), r###"<p><code> a</code></p> "###, r###"Code spans (332)"### ); assert_eq!( - micromark_with_options(r###"` b ` -"###, DANGER), + micromark_with_options( + r###"` b ` +"###, + &danger + ), r###"<p><code> b </code></p> "###, r###"Code spans (333)"### ); assert_eq!( - micromark_with_options(r###"` ` + micromark_with_options( + r###"` ` ` ` -"###, DANGER), +"###, + &danger + ), r###"<p><code> </code> <code> </code></p> "###, @@ -4435,264 +5437,360 @@ baz</li> ); assert_eq!( - micromark_with_options(r###"`` + micromark_with_options( + r###"`` foo bar baz `` -"###, DANGER), +"###, + &danger + ), r###"<p><code>foo bar baz</code></p> "###, r###"Code spans (335)"### ); assert_eq!( - micromark_with_options(r###"`` + micromark_with_options( + r###"`` foo `` -"###, DANGER), +"###, + &danger + ), r###"<p><code>foo </code></p> "###, r###"Code spans (336)"### ); assert_eq!( - micromark_with_options(r###"`foo bar + micromark_with_options( + r###"`foo bar baz` -"###, DANGER), +"###, + &danger + ), r###"<p><code>foo bar baz</code></p> "###, r###"Code spans (337)"### ); assert_eq!( - micromark_with_options(r###"`foo\`bar` -"###, DANGER), + micromark_with_options( + r###"`foo\`bar` +"###, + &danger + ), r###"<p><code>foo\</code>bar`</p> "###, r###"Code spans (338)"### ); assert_eq!( - micromark_with_options(r###"``foo`bar`` -"###, DANGER), + micromark_with_options( + r###"``foo`bar`` +"###, + &danger + ), r###"<p><code>foo`bar</code></p> "###, r###"Code spans (339)"### ); assert_eq!( - micromark_with_options(r###"` foo `` bar ` -"###, DANGER), + micromark_with_options( + r###"` foo `` bar ` +"###, + &danger + ), r###"<p><code>foo `` bar</code></p> "###, r###"Code spans (340)"### ); assert_eq!( - micromark_with_options(r###"*foo`*` -"###, DANGER), + micromark_with_options( + r###"*foo`*` +"###, + &danger + ), r###"<p>*foo<code>*</code></p> "###, r###"Code spans (341)"### ); assert_eq!( - micromark_with_options(r###"[not a `link](/foo`) -"###, DANGER), + micromark_with_options( + r###"[not a `link](/foo`) +"###, + &danger + ), r###"<p>[not a <code>link](/foo</code>)</p> "###, r###"Code spans (342)"### ); assert_eq!( - micromark_with_options(r###"`<a href="`">` -"###, DANGER), + micromark_with_options( + r###"`<a href="`">` +"###, + &danger + ), r###"<p><code><a href="</code>">`</p> "###, r###"Code spans (343)"### ); assert_eq!( - micromark_with_options(r###"<a href="`">` -"###, DANGER), + micromark_with_options( + r###"<a href="`">` +"###, + &danger + ), r###"<p><a href="`">`</p> "###, r###"Code spans (344)"### ); assert_eq!( - micromark_with_options(r###"`<http://foo.bar.`baz>` -"###, DANGER), + micromark_with_options( + r###"`<http://foo.bar.`baz>` +"###, + &danger + ), r###"<p><code><http://foo.bar.</code>baz>`</p> "###, r###"Code spans (345)"### ); assert_eq!( - micromark_with_options(r###"<http://foo.bar.`baz>` -"###, DANGER), + micromark_with_options( + r###"<http://foo.bar.`baz>` +"###, + &danger + ), r###"<p><a href="http://foo.bar.%60baz">http://foo.bar.`baz</a>`</p> "###, r###"Code spans (346)"### ); assert_eq!( - micromark_with_options(r###"```foo`` -"###, DANGER), + micromark_with_options( + r###"```foo`` +"###, + &danger + ), r###"<p>```foo``</p> "###, r###"Code spans (347)"### ); assert_eq!( - micromark_with_options(r###"`foo -"###, DANGER), + micromark_with_options( + r###"`foo +"###, + &danger + ), r###"<p>`foo</p> "###, r###"Code spans (348)"### ); assert_eq!( - micromark_with_options(r###"`foo``bar`` -"###, DANGER), + micromark_with_options( + r###"`foo``bar`` +"###, + &danger + ), r###"<p>`foo<code>bar</code></p> "###, r###"Code spans (349)"### ); assert_eq!( - micromark_with_options(r###"*foo bar* -"###, DANGER), + micromark_with_options( + r###"*foo bar* +"###, + &danger + ), r###"<p><em>foo bar</em></p> "###, r###"Emphasis and strong emphasis (350)"### ); assert_eq!( - micromark_with_options(r###"a * foo bar* -"###, DANGER), + micromark_with_options( + r###"a * foo bar* +"###, + &danger + ), r###"<p>a * foo bar*</p> "###, r###"Emphasis and strong emphasis (351)"### ); assert_eq!( - micromark_with_options(r###"a*"foo"* -"###, DANGER), + micromark_with_options( + r###"a*"foo"* +"###, + &danger + ), r###"<p>a*"foo"*</p> "###, r###"Emphasis and strong emphasis (352)"### ); assert_eq!( - micromark_with_options(r###"* a * -"###, DANGER), + micromark_with_options( + r###"* a * +"###, + &danger + ), r###"<p>* a *</p> "###, r###"Emphasis and strong emphasis (353)"### ); assert_eq!( - micromark_with_options(r###"foo*bar* -"###, DANGER), + micromark_with_options( + r###"foo*bar* +"###, + &danger + ), r###"<p>foo<em>bar</em></p> "###, r###"Emphasis and strong emphasis (354)"### ); assert_eq!( - micromark_with_options(r###"5*6*78 -"###, DANGER), + micromark_with_options( + r###"5*6*78 +"###, + &danger + ), r###"<p>5<em>6</em>78</p> "###, r###"Emphasis and strong emphasis (355)"### ); assert_eq!( - micromark_with_options(r###"_foo bar_ -"###, DANGER), + micromark_with_options( + r###"_foo bar_ +"###, + &danger + ), r###"<p><em>foo bar</em></p> "###, r###"Emphasis and strong emphasis (356)"### ); assert_eq!( - micromark_with_options(r###"_ foo bar_ -"###, DANGER), + micromark_with_options( + r###"_ foo bar_ +"###, + &danger + ), r###"<p>_ foo bar_</p> "###, r###"Emphasis and strong emphasis (357)"### ); assert_eq!( - micromark_with_options(r###"a_"foo"_ -"###, DANGER), + micromark_with_options( + r###"a_"foo"_ +"###, + &danger + ), r###"<p>a_"foo"_</p> "###, r###"Emphasis and strong emphasis (358)"### ); assert_eq!( - micromark_with_options(r###"foo_bar_ -"###, DANGER), + micromark_with_options( + r###"foo_bar_ +"###, + &danger + ), r###"<p>foo_bar_</p> "###, r###"Emphasis and strong emphasis (359)"### ); assert_eq!( - micromark_with_options(r###"5_6_78 -"###, DANGER), + micromark_with_options( + r###"5_6_78 +"###, + &danger + ), r###"<p>5_6_78</p> "###, r###"Emphasis and strong emphasis (360)"### ); assert_eq!( - micromark_with_options(r###"пристаням_стремятся_ -"###, DANGER), + micromark_with_options( + r###"пристаням_стремятся_ +"###, + &danger + ), r###"<p>пристаням_стремятся_</p> "###, r###"Emphasis and strong emphasis (361)"### ); assert_eq!( - micromark_with_options(r###"aa_"bb"_cc -"###, DANGER), + micromark_with_options( + r###"aa_"bb"_cc +"###, + &danger + ), r###"<p>aa_"bb"_cc</p> "###, r###"Emphasis and strong emphasis (362)"### ); assert_eq!( - micromark_with_options(r###"foo-_(bar)_ -"###, DANGER), + micromark_with_options( + r###"foo-_(bar)_ +"###, + &danger + ), r###"<p>foo-<em>(bar)</em></p> "###, r###"Emphasis and strong emphasis (363)"### ); assert_eq!( - micromark_with_options(r###"_foo* -"###, DANGER), + micromark_with_options( + r###"_foo* +"###, + &danger + ), r###"<p>_foo*</p> "###, r###"Emphasis and strong emphasis (364)"### ); assert_eq!( - micromark_with_options(r###"*foo bar * -"###, DANGER), + micromark_with_options( + r###"*foo bar * +"###, + &danger + ), r###"<p>*foo bar *</p> "###, r###"Emphasis and strong emphasis (365)"### ); assert_eq!( - micromark_with_options(r###"*foo bar + micromark_with_options( + r###"*foo bar * -"###, DANGER), +"###, + &danger + ), r###"<p>*foo bar *</p> "###, @@ -4700,137 +5798,188 @@ baz` ); assert_eq!( - micromark_with_options(r###"*(*foo) -"###, DANGER), + micromark_with_options( + r###"*(*foo) +"###, + &danger + ), r###"<p>*(*foo)</p> "###, r###"Emphasis and strong emphasis (367)"### ); assert_eq!( - micromark_with_options(r###"*(*foo*)* -"###, DANGER), + micromark_with_options( + r###"*(*foo*)* +"###, + &danger + ), r###"<p><em>(<em>foo</em>)</em></p> "###, r###"Emphasis and strong emphasis (368)"### ); assert_eq!( - micromark_with_options(r###"*foo*bar -"###, DANGER), + micromark_with_options( + r###"*foo*bar +"###, + &danger + ), r###"<p><em>foo</em>bar</p> "###, r###"Emphasis and strong emphasis (369)"### ); assert_eq!( - micromark_with_options(r###"_foo bar _ -"###, DANGER), + micromark_with_options( + r###"_foo bar _ +"###, + &danger + ), r###"<p>_foo bar _</p> "###, r###"Emphasis and strong emphasis (370)"### ); assert_eq!( - micromark_with_options(r###"_(_foo) -"###, DANGER), + micromark_with_options( + r###"_(_foo) +"###, + &danger + ), r###"<p>_(_foo)</p> "###, r###"Emphasis and strong emphasis (371)"### ); assert_eq!( - micromark_with_options(r###"_(_foo_)_ -"###, DANGER), + micromark_with_options( + r###"_(_foo_)_ +"###, + &danger + ), r###"<p><em>(<em>foo</em>)</em></p> "###, r###"Emphasis and strong emphasis (372)"### ); assert_eq!( - micromark_with_options(r###"_foo_bar -"###, DANGER), + micromark_with_options( + r###"_foo_bar +"###, + &danger + ), r###"<p>_foo_bar</p> "###, r###"Emphasis and strong emphasis (373)"### ); assert_eq!( - micromark_with_options(r###"_пристаням_стремятся -"###, DANGER), + micromark_with_options( + r###"_пристаням_стремятся +"###, + &danger + ), r###"<p>_пристаням_стремятся</p> "###, r###"Emphasis and strong emphasis (374)"### ); assert_eq!( - micromark_with_options(r###"_foo_bar_baz_ -"###, DANGER), + micromark_with_options( + r###"_foo_bar_baz_ +"###, + &danger + ), r###"<p><em>foo_bar_baz</em></p> "###, r###"Emphasis and strong emphasis (375)"### ); assert_eq!( - micromark_with_options(r###"_(bar)_. -"###, DANGER), + micromark_with_options( + r###"_(bar)_. +"###, + &danger + ), r###"<p><em>(bar)</em>.</p> "###, r###"Emphasis and strong emphasis (376)"### ); assert_eq!( - micromark_with_options(r###"**foo bar** -"###, DANGER), + micromark_with_options( + r###"**foo bar** +"###, + &danger + ), r###"<p><strong>foo bar</strong></p> "###, r###"Emphasis and strong emphasis (377)"### ); assert_eq!( - micromark_with_options(r###"** foo bar** -"###, DANGER), + micromark_with_options( + r###"** foo bar** +"###, + &danger + ), r###"<p>** foo bar**</p> "###, r###"Emphasis and strong emphasis (378)"### ); assert_eq!( - micromark_with_options(r###"a**"foo"** -"###, DANGER), + micromark_with_options( + r###"a**"foo"** +"###, + &danger + ), r###"<p>a**"foo"**</p> "###, r###"Emphasis and strong emphasis (379)"### ); assert_eq!( - micromark_with_options(r###"foo**bar** -"###, DANGER), + micromark_with_options( + r###"foo**bar** +"###, + &danger + ), r###"<p>foo<strong>bar</strong></p> "###, r###"Emphasis and strong emphasis (380)"### ); assert_eq!( - micromark_with_options(r###"__foo bar__ -"###, DANGER), + micromark_with_options( + r###"__foo bar__ +"###, + &danger + ), r###"<p><strong>foo bar</strong></p> "###, r###"Emphasis and strong emphasis (381)"### ); assert_eq!( - micromark_with_options(r###"__ foo bar__ -"###, DANGER), + micromark_with_options( + r###"__ foo bar__ +"###, + &danger + ), r###"<p>__ foo bar__</p> "###, r###"Emphasis and strong emphasis (382)"### ); assert_eq!( - micromark_with_options(r###"__ + micromark_with_options( + r###"__ foo bar__ -"###, DANGER), +"###, + &danger + ), r###"<p>__ foo bar__</p> "###, @@ -4838,81 +5987,111 @@ foo bar__</p> ); assert_eq!( - micromark_with_options(r###"a__"foo"__ -"###, DANGER), + micromark_with_options( + r###"a__"foo"__ +"###, + &danger + ), r###"<p>a__"foo"__</p> "###, r###"Emphasis and strong emphasis (384)"### ); assert_eq!( - micromark_with_options(r###"foo__bar__ -"###, DANGER), + micromark_with_options( + r###"foo__bar__ +"###, + &danger + ), r###"<p>foo__bar__</p> "###, r###"Emphasis and strong emphasis (385)"### ); assert_eq!( - micromark_with_options(r###"5__6__78 -"###, DANGER), + micromark_with_options( + r###"5__6__78 +"###, + &danger + ), r###"<p>5__6__78</p> "###, r###"Emphasis and strong emphasis (386)"### ); assert_eq!( - micromark_with_options(r###"пристаням__стремятся__ -"###, DANGER), + micromark_with_options( + r###"пристаням__стремятся__ +"###, + &danger + ), r###"<p>пристаням__стремятся__</p> "###, r###"Emphasis and strong emphasis (387)"### ); assert_eq!( - micromark_with_options(r###"__foo, __bar__, baz__ -"###, DANGER), + micromark_with_options( + r###"__foo, __bar__, baz__ +"###, + &danger + ), r###"<p><strong>foo, <strong>bar</strong>, baz</strong></p> "###, r###"Emphasis and strong emphasis (388)"### ); assert_eq!( - micromark_with_options(r###"foo-__(bar)__ -"###, DANGER), + micromark_with_options( + r###"foo-__(bar)__ +"###, + &danger + ), r###"<p>foo-<strong>(bar)</strong></p> "###, r###"Emphasis and strong emphasis (389)"### ); assert_eq!( - micromark_with_options(r###"**foo bar ** -"###, DANGER), + micromark_with_options( + r###"**foo bar ** +"###, + &danger + ), r###"<p>**foo bar **</p> "###, r###"Emphasis and strong emphasis (390)"### ); assert_eq!( - micromark_with_options(r###"**(**foo) -"###, DANGER), + micromark_with_options( + r###"**(**foo) +"###, + &danger + ), r###"<p>**(**foo)</p> "###, r###"Emphasis and strong emphasis (391)"### ); assert_eq!( - micromark_with_options(r###"*(**foo**)* -"###, DANGER), + micromark_with_options( + r###"*(**foo**)* +"###, + &danger + ), r###"<p><em>(<strong>foo</strong>)</em></p> "###, r###"Emphasis and strong emphasis (392)"### ); assert_eq!( - micromark_with_options(r###"**Gomphocarpus (*Gomphocarpus physocarpus*, syn. + micromark_with_options( + r###"**Gomphocarpus (*Gomphocarpus physocarpus*, syn. *Asclepias physocarpa*)** -"###, DANGER), +"###, + &danger + ), r###"<p><strong>Gomphocarpus (<em>Gomphocarpus physocarpus</em>, syn. <em>Asclepias physocarpa</em>)</strong></p> "###, @@ -4920,89 +6099,122 @@ foo bar__</p> ); assert_eq!( - micromark_with_options(r###"**foo "*bar*" foo** -"###, DANGER), + micromark_with_options( + r###"**foo "*bar*" foo** +"###, + &danger + ), r###"<p><strong>foo "<em>bar</em>" foo</strong></p> "###, r###"Emphasis and strong emphasis (394)"### ); assert_eq!( - micromark_with_options(r###"**foo**bar -"###, DANGER), + micromark_with_options( + r###"**foo**bar +"###, + &danger + ), r###"<p><strong>foo</strong>bar</p> "###, r###"Emphasis and strong emphasis (395)"### ); assert_eq!( - micromark_with_options(r###"__foo bar __ -"###, DANGER), + micromark_with_options( + r###"__foo bar __ +"###, + &danger + ), r###"<p>__foo bar __</p> "###, r###"Emphasis and strong emphasis (396)"### ); assert_eq!( - micromark_with_options(r###"__(__foo) -"###, DANGER), + micromark_with_options( + r###"__(__foo) +"###, + &danger + ), r###"<p>__(__foo)</p> "###, r###"Emphasis and strong emphasis (397)"### ); assert_eq!( - micromark_with_options(r###"_(__foo__)_ -"###, DANGER), + micromark_with_options( + r###"_(__foo__)_ +"###, + &danger + ), r###"<p><em>(<strong>foo</strong>)</em></p> "###, r###"Emphasis and strong emphasis (398)"### ); assert_eq!( - micromark_with_options(r###"__foo__bar -"###, DANGER), + micromark_with_options( + r###"__foo__bar +"###, + &danger + ), r###"<p>__foo__bar</p> "###, r###"Emphasis and strong emphasis (399)"### ); assert_eq!( - micromark_with_options(r###"__пристаням__стремятся -"###, DANGER), + micromark_with_options( + r###"__пристаням__стремятся +"###, + &danger + ), r###"<p>__пристаням__стремятся</p> "###, r###"Emphasis and strong emphasis (400)"### ); assert_eq!( - micromark_with_options(r###"__foo__bar__baz__ -"###, DANGER), + micromark_with_options( + r###"__foo__bar__baz__ +"###, + &danger + ), r###"<p><strong>foo__bar__baz</strong></p> "###, r###"Emphasis and strong emphasis (401)"### ); assert_eq!( - micromark_with_options(r###"__(bar)__. -"###, DANGER), + micromark_with_options( + r###"__(bar)__. +"###, + &danger + ), r###"<p><strong>(bar)</strong>.</p> "###, r###"Emphasis and strong emphasis (402)"### ); assert_eq!( - micromark_with_options(r###"*foo [bar](/url)* -"###, DANGER), + micromark_with_options( + r###"*foo [bar](/url)* +"###, + &danger + ), r###"<p><em>foo <a href="/url">bar</a></em></p> "###, r###"Emphasis and strong emphasis (403)"### ); assert_eq!( - micromark_with_options(r###"*foo + micromark_with_options( + r###"*foo bar* -"###, DANGER), +"###, + &danger + ), r###"<p><em>foo bar</em></p> "###, @@ -5010,145 +6222,199 @@ bar</em></p> ); assert_eq!( - micromark_with_options(r###"_foo __bar__ baz_ -"###, DANGER), + micromark_with_options( + r###"_foo __bar__ baz_ +"###, + &danger + ), r###"<p><em>foo <strong>bar</strong> baz</em></p> "###, r###"Emphasis and strong emphasis (405)"### ); assert_eq!( - micromark_with_options(r###"_foo _bar_ baz_ -"###, DANGER), + micromark_with_options( + r###"_foo _bar_ baz_ +"###, + &danger + ), r###"<p><em>foo <em>bar</em> baz</em></p> "###, r###"Emphasis and strong emphasis (406)"### ); assert_eq!( - micromark_with_options(r###"__foo_ bar_ -"###, DANGER), + micromark_with_options( + r###"__foo_ bar_ +"###, + &danger + ), r###"<p><em><em>foo</em> bar</em></p> "###, r###"Emphasis and strong emphasis (407)"### ); assert_eq!( - micromark_with_options(r###"*foo *bar** -"###, DANGER), + micromark_with_options( + r###"*foo *bar** +"###, + &danger + ), r###"<p><em>foo <em>bar</em></em></p> "###, r###"Emphasis and strong emphasis (408)"### ); assert_eq!( - micromark_with_options(r###"*foo **bar** baz* -"###, DANGER), + micromark_with_options( + r###"*foo **bar** baz* +"###, + &danger + ), r###"<p><em>foo <strong>bar</strong> baz</em></p> "###, r###"Emphasis and strong emphasis (409)"### ); assert_eq!( - micromark_with_options(r###"*foo**bar**baz* -"###, DANGER), + micromark_with_options( + r###"*foo**bar**baz* +"###, + &danger + ), r###"<p><em>foo<strong>bar</strong>baz</em></p> "###, r###"Emphasis and strong emphasis (410)"### ); assert_eq!( - micromark_with_options(r###"*foo**bar* -"###, DANGER), + micromark_with_options( + r###"*foo**bar* +"###, + &danger + ), r###"<p><em>foo**bar</em></p> "###, r###"Emphasis and strong emphasis (411)"### ); assert_eq!( - micromark_with_options(r###"***foo** bar* -"###, DANGER), + micromark_with_options( + r###"***foo** bar* +"###, + &danger + ), r###"<p><em><strong>foo</strong> bar</em></p> "###, r###"Emphasis and strong emphasis (412)"### ); assert_eq!( - micromark_with_options(r###"*foo **bar*** -"###, DANGER), + micromark_with_options( + r###"*foo **bar*** +"###, + &danger + ), r###"<p><em>foo <strong>bar</strong></em></p> "###, r###"Emphasis and strong emphasis (413)"### ); assert_eq!( - micromark_with_options(r###"*foo**bar*** -"###, DANGER), + micromark_with_options( + r###"*foo**bar*** +"###, + &danger + ), r###"<p><em>foo<strong>bar</strong></em></p> "###, r###"Emphasis and strong emphasis (414)"### ); assert_eq!( - micromark_with_options(r###"foo***bar***baz -"###, DANGER), + micromark_with_options( + r###"foo***bar***baz +"###, + &danger + ), r###"<p>foo<em><strong>bar</strong></em>baz</p> "###, r###"Emphasis and strong emphasis (415)"### ); assert_eq!( - micromark_with_options(r###"foo******bar*********baz -"###, DANGER), + micromark_with_options( + r###"foo******bar*********baz +"###, + &danger + ), r###"<p>foo<strong><strong><strong>bar</strong></strong></strong>***baz</p> "###, r###"Emphasis and strong emphasis (416)"### ); assert_eq!( - micromark_with_options(r###"*foo **bar *baz* bim** bop* -"###, DANGER), + micromark_with_options( + 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)"### ); assert_eq!( - micromark_with_options(r###"*foo [*bar*](/url)* -"###, DANGER), + micromark_with_options( + r###"*foo [*bar*](/url)* +"###, + &danger + ), r###"<p><em>foo <a href="/url"><em>bar</em></a></em></p> "###, r###"Emphasis and strong emphasis (418)"### ); assert_eq!( - micromark_with_options(r###"** is not an empty emphasis -"###, DANGER), + micromark_with_options( + r###"** is not an empty emphasis +"###, + &danger + ), r###"<p>** is not an empty emphasis</p> "###, r###"Emphasis and strong emphasis (419)"### ); assert_eq!( - micromark_with_options(r###"**** is not an empty strong emphasis -"###, DANGER), + micromark_with_options( + r###"**** is not an empty strong emphasis +"###, + &danger + ), r###"<p>**** is not an empty strong emphasis</p> "###, r###"Emphasis and strong emphasis (420)"### ); assert_eq!( - micromark_with_options(r###"**foo [bar](/url)** -"###, DANGER), + micromark_with_options( + r###"**foo [bar](/url)** +"###, + &danger + ), r###"<p><strong>foo <a href="/url">bar</a></strong></p> "###, r###"Emphasis and strong emphasis (421)"### ); assert_eq!( - micromark_with_options(r###"**foo + micromark_with_options( + r###"**foo bar** -"###, DANGER), +"###, + &danger + ), r###"<p><strong>foo bar</strong></p> "###, @@ -5156,73 +6422,100 @@ bar</strong></p> ); assert_eq!( - micromark_with_options(r###"__foo _bar_ baz__ -"###, DANGER), + micromark_with_options( + r###"__foo _bar_ baz__ +"###, + &danger + ), r###"<p><strong>foo <em>bar</em> baz</strong></p> "###, r###"Emphasis and strong emphasis (423)"### ); assert_eq!( - micromark_with_options(r###"__foo __bar__ baz__ -"###, DANGER), + micromark_with_options( + r###"__foo __bar__ baz__ +"###, + &danger + ), r###"<p><strong>foo <strong>bar</strong> baz</strong></p> "###, r###"Emphasis and strong emphasis (424)"### ); assert_eq!( - micromark_with_options(r###"____foo__ bar__ -"###, DANGER), + micromark_with_options( + r###"____foo__ bar__ +"###, + &danger + ), r###"<p><strong><strong>foo</strong> bar</strong></p> "###, r###"Emphasis and strong emphasis (425)"### ); assert_eq!( - micromark_with_options(r###"**foo **bar**** -"###, DANGER), + micromark_with_options( + r###"**foo **bar**** +"###, + &danger + ), r###"<p><strong>foo <strong>bar</strong></strong></p> "###, r###"Emphasis and strong emphasis (426)"### ); assert_eq!( - micromark_with_options(r###"**foo *bar* baz** -"###, DANGER), + micromark_with_options( + r###"**foo *bar* baz** +"###, + &danger + ), r###"<p><strong>foo <em>bar</em> baz</strong></p> "###, r###"Emphasis and strong emphasis (427)"### ); assert_eq!( - micromark_with_options(r###"**foo*bar*baz** -"###, DANGER), + micromark_with_options( + r###"**foo*bar*baz** +"###, + &danger + ), r###"<p><strong>foo<em>bar</em>baz</strong></p> "###, r###"Emphasis and strong emphasis (428)"### ); assert_eq!( - micromark_with_options(r###"***foo* bar** -"###, DANGER), + micromark_with_options( + r###"***foo* bar** +"###, + &danger + ), r###"<p><strong><em>foo</em> bar</strong></p> "###, r###"Emphasis and strong emphasis (429)"### ); assert_eq!( - micromark_with_options(r###"**foo *bar*** -"###, DANGER), + micromark_with_options( + r###"**foo *bar*** +"###, + &danger + ), r###"<p><strong>foo <em>bar</em></strong></p> "###, r###"Emphasis and strong emphasis (430)"### ); assert_eq!( - micromark_with_options(r###"**foo *bar **baz** + micromark_with_options( + r###"**foo *bar **baz** bim* bop** -"###, DANGER), +"###, + &danger + ), r###"<p><strong>foo <em>bar <strong>baz</strong> bim</em> bop</strong></p> "###, @@ -5230,465 +6523,639 @@ bim</em> bop</strong></p> ); assert_eq!( - micromark_with_options(r###"**foo [*bar*](/url)** -"###, DANGER), + micromark_with_options( + r###"**foo [*bar*](/url)** +"###, + &danger + ), r###"<p><strong>foo <a href="/url"><em>bar</em></a></strong></p> "###, r###"Emphasis and strong emphasis (432)"### ); assert_eq!( - micromark_with_options(r###"__ is not an empty emphasis -"###, DANGER), + micromark_with_options( + r###"__ is not an empty emphasis +"###, + &danger + ), r###"<p>__ is not an empty emphasis</p> "###, r###"Emphasis and strong emphasis (433)"### ); assert_eq!( - micromark_with_options(r###"____ is not an empty strong emphasis -"###, DANGER), + micromark_with_options( + r###"____ is not an empty strong emphasis +"###, + &danger + ), r###"<p>____ is not an empty strong emphasis</p> "###, r###"Emphasis and strong emphasis (434)"### ); assert_eq!( - micromark_with_options(r###"foo *** -"###, DANGER), + micromark_with_options( + r###"foo *** +"###, + &danger + ), r###"<p>foo ***</p> "###, r###"Emphasis and strong emphasis (435)"### ); assert_eq!( - micromark_with_options(r###"foo *\** -"###, DANGER), + micromark_with_options( + r###"foo *\** +"###, + &danger + ), r###"<p>foo <em>*</em></p> "###, r###"Emphasis and strong emphasis (436)"### ); assert_eq!( - micromark_with_options(r###"foo *_* -"###, DANGER), + micromark_with_options( + r###"foo *_* +"###, + &danger + ), r###"<p>foo <em>_</em></p> "###, r###"Emphasis and strong emphasis (437)"### ); assert_eq!( - micromark_with_options(r###"foo ***** -"###, DANGER), + micromark_with_options( + r###"foo ***** +"###, + &danger + ), r###"<p>foo *****</p> "###, r###"Emphasis and strong emphasis (438)"### ); assert_eq!( - micromark_with_options(r###"foo **\*** -"###, DANGER), + micromark_with_options( + r###"foo **\*** +"###, + &danger + ), r###"<p>foo <strong>*</strong></p> "###, r###"Emphasis and strong emphasis (439)"### ); assert_eq!( - micromark_with_options(r###"foo **_** -"###, DANGER), + micromark_with_options( + r###"foo **_** +"###, + &danger + ), r###"<p>foo <strong>_</strong></p> "###, r###"Emphasis and strong emphasis (440)"### ); assert_eq!( - micromark_with_options(r###"**foo* -"###, DANGER), + micromark_with_options( + r###"**foo* +"###, + &danger + ), r###"<p>*<em>foo</em></p> "###, r###"Emphasis and strong emphasis (441)"### ); assert_eq!( - micromark_with_options(r###"*foo** -"###, DANGER), + micromark_with_options( + r###"*foo** +"###, + &danger + ), r###"<p><em>foo</em>*</p> "###, r###"Emphasis and strong emphasis (442)"### ); assert_eq!( - micromark_with_options(r###"***foo** -"###, DANGER), + micromark_with_options( + r###"***foo** +"###, + &danger + ), r###"<p>*<strong>foo</strong></p> "###, r###"Emphasis and strong emphasis (443)"### ); assert_eq!( - micromark_with_options(r###"****foo* -"###, DANGER), + micromark_with_options( + r###"****foo* +"###, + &danger + ), r###"<p>***<em>foo</em></p> "###, r###"Emphasis and strong emphasis (444)"### ); assert_eq!( - micromark_with_options(r###"**foo*** -"###, DANGER), + micromark_with_options( + r###"**foo*** +"###, + &danger + ), r###"<p><strong>foo</strong>*</p> "###, r###"Emphasis and strong emphasis (445)"### ); assert_eq!( - micromark_with_options(r###"*foo**** -"###, DANGER), + micromark_with_options( + r###"*foo**** +"###, + &danger + ), r###"<p><em>foo</em>***</p> "###, r###"Emphasis and strong emphasis (446)"### ); assert_eq!( - micromark_with_options(r###"foo ___ -"###, DANGER), + micromark_with_options( + r###"foo ___ +"###, + &danger + ), r###"<p>foo ___</p> "###, r###"Emphasis and strong emphasis (447)"### ); assert_eq!( - micromark_with_options(r###"foo _\__ -"###, DANGER), + micromark_with_options( + r###"foo _\__ +"###, + &danger + ), r###"<p>foo <em>_</em></p> "###, r###"Emphasis and strong emphasis (448)"### ); assert_eq!( - micromark_with_options(r###"foo _*_ -"###, DANGER), + micromark_with_options( + r###"foo _*_ +"###, + &danger + ), r###"<p>foo <em>*</em></p> "###, r###"Emphasis and strong emphasis (449)"### ); assert_eq!( - micromark_with_options(r###"foo _____ -"###, DANGER), + micromark_with_options( + r###"foo _____ +"###, + &danger + ), r###"<p>foo _____</p> "###, r###"Emphasis and strong emphasis (450)"### ); assert_eq!( - micromark_with_options(r###"foo __\___ -"###, DANGER), + micromark_with_options( + r###"foo __\___ +"###, + &danger + ), r###"<p>foo <strong>_</strong></p> "###, r###"Emphasis and strong emphasis (451)"### ); assert_eq!( - micromark_with_options(r###"foo __*__ -"###, DANGER), + micromark_with_options( + r###"foo __*__ +"###, + &danger + ), r###"<p>foo <strong>*</strong></p> "###, r###"Emphasis and strong emphasis (452)"### ); assert_eq!( - micromark_with_options(r###"__foo_ -"###, DANGER), + micromark_with_options( + r###"__foo_ +"###, + &danger + ), r###"<p>_<em>foo</em></p> "###, r###"Emphasis and strong emphasis (453)"### ); assert_eq!( - micromark_with_options(r###"_foo__ -"###, DANGER), + micromark_with_options( + r###"_foo__ +"###, + &danger + ), r###"<p><em>foo</em>_</p> "###, r###"Emphasis and strong emphasis (454)"### ); assert_eq!( - micromark_with_options(r###"___foo__ -"###, DANGER), + micromark_with_options( + r###"___foo__ +"###, + &danger + ), r###"<p>_<strong>foo</strong></p> "###, r###"Emphasis and strong emphasis (455)"### ); assert_eq!( - micromark_with_options(r###"____foo_ -"###, DANGER), + micromark_with_options( + r###"____foo_ +"###, + &danger + ), r###"<p>___<em>foo</em></p> "###, r###"Emphasis and strong emphasis (456)"### ); assert_eq!( - micromark_with_options(r###"__foo___ -"###, DANGER), + micromark_with_options( + r###"__foo___ +"###, + &danger + ), r###"<p><strong>foo</strong>_</p> "###, r###"Emphasis and strong emphasis (457)"### ); assert_eq!( - micromark_with_options(r###"_foo____ -"###, DANGER), + micromark_with_options( + r###"_foo____ +"###, + &danger + ), r###"<p><em>foo</em>___</p> "###, r###"Emphasis and strong emphasis (458)"### ); assert_eq!( - micromark_with_options(r###"**foo** -"###, DANGER), + micromark_with_options( + r###"**foo** +"###, + &danger + ), r###"<p><strong>foo</strong></p> "###, r###"Emphasis and strong emphasis (459)"### ); assert_eq!( - micromark_with_options(r###"*_foo_* -"###, DANGER), + micromark_with_options( + r###"*_foo_* +"###, + &danger + ), r###"<p><em><em>foo</em></em></p> "###, r###"Emphasis and strong emphasis (460)"### ); assert_eq!( - micromark_with_options(r###"__foo__ -"###, DANGER), + micromark_with_options( + r###"__foo__ +"###, + &danger + ), r###"<p><strong>foo</strong></p> "###, r###"Emphasis and strong emphasis (461)"### ); assert_eq!( - micromark_with_options(r###"_*foo*_ -"###, DANGER), + micromark_with_options( + r###"_*foo*_ +"###, + &danger + ), r###"<p><em><em>foo</em></em></p> "###, r###"Emphasis and strong emphasis (462)"### ); assert_eq!( - micromark_with_options(r###"****foo**** -"###, DANGER), + micromark_with_options( + r###"****foo**** +"###, + &danger + ), r###"<p><strong><strong>foo</strong></strong></p> "###, r###"Emphasis and strong emphasis (463)"### ); assert_eq!( - micromark_with_options(r###"____foo____ -"###, DANGER), + micromark_with_options( + r###"____foo____ +"###, + &danger + ), r###"<p><strong><strong>foo</strong></strong></p> "###, r###"Emphasis and strong emphasis (464)"### ); assert_eq!( - micromark_with_options(r###"******foo****** -"###, DANGER), + micromark_with_options( + r###"******foo****** +"###, + &danger + ), r###"<p><strong><strong><strong>foo</strong></strong></strong></p> "###, r###"Emphasis and strong emphasis (465)"### ); assert_eq!( - micromark_with_options(r###"***foo*** -"###, DANGER), + micromark_with_options( + r###"***foo*** +"###, + &danger + ), r###"<p><em><strong>foo</strong></em></p> "###, r###"Emphasis and strong emphasis (466)"### ); assert_eq!( - micromark_with_options(r###"_____foo_____ -"###, DANGER), + micromark_with_options( + r###"_____foo_____ +"###, + &danger + ), r###"<p><em><strong><strong>foo</strong></strong></em></p> "###, r###"Emphasis and strong emphasis (467)"### ); assert_eq!( - micromark_with_options(r###"*foo _bar* baz_ -"###, DANGER), + micromark_with_options( + r###"*foo _bar* baz_ +"###, + &danger + ), r###"<p><em>foo _bar</em> baz_</p> "###, r###"Emphasis and strong emphasis (468)"### ); assert_eq!( - micromark_with_options(r###"*foo __bar *baz bim__ bam* -"###, DANGER), + micromark_with_options( + 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)"### ); assert_eq!( - micromark_with_options(r###"**foo **bar baz** -"###, DANGER), + micromark_with_options( + r###"**foo **bar baz** +"###, + &danger + ), r###"<p>**foo <strong>bar baz</strong></p> "###, r###"Emphasis and strong emphasis (470)"### ); assert_eq!( - micromark_with_options(r###"*foo *bar baz* -"###, DANGER), + micromark_with_options( + r###"*foo *bar baz* +"###, + &danger + ), r###"<p>*foo <em>bar baz</em></p> "###, r###"Emphasis and strong emphasis (471)"### ); assert_eq!( - micromark_with_options(r###"*[bar*](/url) -"###, DANGER), + micromark_with_options( + r###"*[bar*](/url) +"###, + &danger + ), r###"<p>*<a href="/url">bar*</a></p> "###, r###"Emphasis and strong emphasis (472)"### ); assert_eq!( - micromark_with_options(r###"_foo [bar_](/url) -"###, DANGER), + micromark_with_options( + r###"_foo [bar_](/url) +"###, + &danger + ), r###"<p>_foo <a href="/url">bar_</a></p> "###, r###"Emphasis and strong emphasis (473)"### ); assert_eq!( - micromark_with_options(r###"*<img src="foo" title="*"/> -"###, DANGER), + micromark_with_options( + r###"*<img src="foo" title="*"/> +"###, + &danger + ), r###"<p>*<img src="foo" title="*"/></p> "###, r###"Emphasis and strong emphasis (474)"### ); assert_eq!( - micromark_with_options(r###"**<a href="**"> -"###, DANGER), + micromark_with_options( + r###"**<a href="**"> +"###, + &danger + ), r###"<p>**<a href="**"></p> "###, r###"Emphasis and strong emphasis (475)"### ); assert_eq!( - micromark_with_options(r###"__<a href="__"> -"###, DANGER), + micromark_with_options( + r###"__<a href="__"> +"###, + &danger + ), r###"<p>__<a href="__"></p> "###, r###"Emphasis and strong emphasis (476)"### ); assert_eq!( - micromark_with_options(r###"*a `*`* -"###, DANGER), + micromark_with_options( + r###"*a `*`* +"###, + &danger + ), r###"<p><em>a <code>*</code></em></p> "###, r###"Emphasis and strong emphasis (477)"### ); assert_eq!( - micromark_with_options(r###"_a `_`_ -"###, DANGER), + micromark_with_options( + r###"_a `_`_ +"###, + &danger + ), r###"<p><em>a <code>_</code></em></p> "###, r###"Emphasis and strong emphasis (478)"### ); assert_eq!( - micromark_with_options(r###"**a<http://foo.bar/?q=**> -"###, DANGER), + micromark_with_options( + 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)"### ); assert_eq!( - micromark_with_options(r###"__a<http://foo.bar/?q=__> -"###, DANGER), + micromark_with_options( + 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)"### ); assert_eq!( - micromark_with_options(r###"[link](/uri "title") -"###, DANGER), + micromark_with_options( + r###"[link](/uri "title") +"###, + &danger + ), r###"<p><a href="/uri" title="title">link</a></p> "###, r###"Links (481)"### ); assert_eq!( - micromark_with_options(r###"[link](/uri) -"###, DANGER), + micromark_with_options( + r###"[link](/uri) +"###, + &danger + ), r###"<p><a href="/uri">link</a></p> "###, r###"Links (482)"### ); assert_eq!( - micromark_with_options(r###"[](./target.md) -"###, DANGER), + micromark_with_options( + r###"[](./target.md) +"###, + &danger + ), r###"<p><a href="./target.md"></a></p> "###, r###"Links (483)"### ); assert_eq!( - micromark_with_options(r###"[link]() -"###, DANGER), + micromark_with_options( + r###"[link]() +"###, + &danger + ), r###"<p><a href="">link</a></p> "###, r###"Links (484)"### ); assert_eq!( - micromark_with_options(r###"[link](<>) -"###, DANGER), + micromark_with_options( + r###"[link](<>) +"###, + &danger + ), r###"<p><a href="">link</a></p> "###, r###"Links (485)"### ); assert_eq!( - micromark_with_options(r###"[]() -"###, DANGER), + micromark_with_options( + r###"[]() +"###, + &danger + ), r###"<p><a href=""></a></p> "###, r###"Links (486)"### ); assert_eq!( - micromark_with_options(r###"[link](/my uri) -"###, DANGER), + micromark_with_options( + r###"[link](/my uri) +"###, + &danger + ), r###"<p>[link](/my uri)</p> "###, r###"Links (487)"### ); assert_eq!( - micromark_with_options(r###"[link](</my uri>) -"###, DANGER), + micromark_with_options( + r###"[link](</my uri>) +"###, + &danger + ), r###"<p><a href="/my%20uri">link</a></p> "###, r###"Links (488)"### ); assert_eq!( - micromark_with_options(r###"[link](foo + micromark_with_options( + r###"[link](foo bar) -"###, DANGER), +"###, + &danger + ), r###"<p>[link](foo bar)</p> "###, @@ -5696,9 +7163,12 @@ bar)</p> ); assert_eq!( - micromark_with_options(r###"[link](<foo + micromark_with_options( + r###"[link](<foo bar>) -"###, DANGER), +"###, + &danger + ), r###"<p>[link](<foo bar>)</p> "###, @@ -5706,26 +7176,35 @@ bar>)</p> ); assert_eq!( - micromark_with_options(r###"[a](<b)c>) -"###, DANGER), + micromark_with_options( + r###"[a](<b)c>) +"###, + &danger + ), r###"<p><a href="b)c">a</a></p> "###, r###"Links (491)"### ); assert_eq!( - micromark_with_options(r###"[link](<foo\>) -"###, DANGER), + micromark_with_options( + r###"[link](<foo\>) +"###, + &danger + ), r###"<p>[link](<foo>)</p> "###, r###"Links (492)"### ); assert_eq!( - micromark_with_options(r###"[a](<b)c + micromark_with_options( + r###"[a](<b)c [a](<b)c> [a](<b>c) -"###, DANGER), +"###, + &danger + ), r###"<p>[a](<b)c [a](<b)c> [a](<b>c)</p> @@ -5734,60 +7213,81 @@ bar>)</p> ); assert_eq!( - micromark_with_options(r###"[link](\(foo\)) -"###, DANGER), + micromark_with_options( + r###"[link](\(foo\)) +"###, + &danger + ), r###"<p><a href="(foo)">link</a></p> "###, r###"Links (494)"### ); assert_eq!( - micromark_with_options(r###"[link](foo(and(bar))) -"###, DANGER), + micromark_with_options( + r###"[link](foo(and(bar))) +"###, + &danger + ), r###"<p><a href="foo(and(bar))">link</a></p> "###, r###"Links (495)"### ); assert_eq!( - micromark_with_options(r###"[link](foo(and(bar)) -"###, DANGER), + micromark_with_options( + r###"[link](foo(and(bar)) +"###, + &danger + ), r###"<p>[link](foo(and(bar))</p> "###, r###"Links (496)"### ); assert_eq!( - micromark_with_options(r###"[link](foo\(and\(bar\)) -"###, DANGER), + micromark_with_options( + r###"[link](foo\(and\(bar\)) +"###, + &danger + ), r###"<p><a href="foo(and(bar)">link</a></p> "###, r###"Links (497)"### ); assert_eq!( - micromark_with_options(r###"[link](<foo(and(bar)>) -"###, DANGER), + micromark_with_options( + r###"[link](<foo(and(bar)>) +"###, + &danger + ), r###"<p><a href="foo(and(bar)">link</a></p> "###, r###"Links (498)"### ); assert_eq!( - micromark_with_options(r###"[link](foo\)\:) -"###, DANGER), + micromark_with_options( + r###"[link](foo\)\:) +"###, + &danger + ), r###"<p><a href="foo):">link</a></p> "###, r###"Links (499)"### ); assert_eq!( - micromark_with_options(r###"[link](#fragment) + micromark_with_options( + r###"[link](#fragment) [link](http://example.com#fragment) [link](http://example.com?foo=3#frag) -"###, DANGER), +"###, + &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> @@ -5796,34 +7296,46 @@ bar>)</p> ); assert_eq!( - micromark_with_options(r###"[link](foo\bar) -"###, DANGER), + micromark_with_options( + r###"[link](foo\bar) +"###, + &danger + ), r###"<p><a href="foo%5Cbar">link</a></p> "###, r###"Links (501)"### ); assert_eq!( - micromark_with_options(r###"[link](foo%20bä) -"###, DANGER), + micromark_with_options( + r###"[link](foo%20bä) +"###, + &danger + ), r###"<p><a href="foo%20b%C3%A4">link</a></p> "###, r###"Links (502)"### ); assert_eq!( - micromark_with_options(r###"[link]("title") -"###, DANGER), + micromark_with_options( + r###"[link]("title") +"###, + &danger + ), r###"<p><a href="%22title%22">link</a></p> "###, r###"Links (503)"### ); assert_eq!( - micromark_with_options(r###"[link](/url "title") + micromark_with_options( + r###"[link](/url "title") [link](/url 'title') [link](/url (title)) -"###, DANGER), +"###, + &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> @@ -5832,341 +7344,455 @@ bar>)</p> ); assert_eq!( - micromark_with_options(r###"[link](/url "title \""") -"###, DANGER), + micromark_with_options( + r###"[link](/url "title \""") +"###, + &danger + ), r###"<p><a href="/url" title="title """>link</a></p> "###, r###"Links (505)"### ); assert_eq!( - micromark_with_options(r###"[link](/url "title") -"###, DANGER), + micromark_with_options( + r###"[link](/url "title") +"###, + &danger + ), r###"<p><a href="/url%C2%A0%22title%22">link</a></p> "###, r###"Links (506)"### ); assert_eq!( - micromark_with_options(r###"[link](/url "title "and" title") -"###, DANGER), + micromark_with_options( + r###"[link](/url "title "and" title") +"###, + &danger + ), r###"<p>[link](/url "title "and" title")</p> "###, r###"Links (507)"### ); assert_eq!( - micromark_with_options(r###"[link](/url 'title "and" title') -"###, DANGER), + micromark_with_options( + r###"[link](/url 'title "and" title') +"###, + &danger + ), r###"<p><a href="/url" title="title "and" title">link</a></p> "###, r###"Links (508)"### ); assert_eq!( - micromark_with_options(r###"[link]( /uri + micromark_with_options( + r###"[link]( /uri "title" ) -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/uri" title="title">link</a></p> "###, r###"Links (509)"### ); assert_eq!( - micromark_with_options(r###"[link] (/uri) -"###, DANGER), + micromark_with_options( + r###"[link] (/uri) +"###, + &danger + ), r###"<p>[link] (/uri)</p> "###, r###"Links (510)"### ); assert_eq!( - micromark_with_options(r###"[link [foo [bar]]](/uri) -"###, DANGER), + micromark_with_options( + r###"[link [foo [bar]]](/uri) +"###, + &danger + ), r###"<p><a href="/uri">link [foo [bar]]</a></p> "###, r###"Links (511)"### ); assert_eq!( - micromark_with_options(r###"[link] bar](/uri) -"###, DANGER), + micromark_with_options( + r###"[link] bar](/uri) +"###, + &danger + ), r###"<p>[link] bar](/uri)</p> "###, r###"Links (512)"### ); assert_eq!( - micromark_with_options(r###"[link [bar](/uri) -"###, DANGER), + micromark_with_options( + r###"[link [bar](/uri) +"###, + &danger + ), r###"<p>[link <a href="/uri">bar</a></p> "###, r###"Links (513)"### ); assert_eq!( - micromark_with_options(r###"[link \[bar](/uri) -"###, DANGER), + micromark_with_options( + r###"[link \[bar](/uri) +"###, + &danger + ), r###"<p><a href="/uri">link [bar</a></p> "###, r###"Links (514)"### ); assert_eq!( - micromark_with_options(r###"[link *foo **bar** `#`*](/uri) -"###, DANGER), + micromark_with_options( + 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)"### ); assert_eq!( - micromark_with_options(r###"[![moon](moon.jpg)](/uri) -"###, DANGER), + micromark_with_options( + r###"[![moon](moon.jpg)](/uri) +"###, + &danger + ), r###"<p><a href="/uri"><img src="moon.jpg" alt="moon" /></a></p> "###, r###"Links (516)"### ); assert_eq!( - micromark_with_options(r###"[foo [bar](/uri)](/uri) -"###, DANGER), + micromark_with_options( + r###"[foo [bar](/uri)](/uri) +"###, + &danger + ), r###"<p>[foo <a href="/uri">bar</a>](/uri)</p> "###, r###"Links (517)"### ); assert_eq!( - micromark_with_options(r###"[foo *[bar [baz](/uri)](/uri)*](/uri) -"###, DANGER), + micromark_with_options( + 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)"### ); assert_eq!( - micromark_with_options(r###"![[[foo](uri1)](uri2)](uri3) -"###, DANGER), + micromark_with_options( + r###"![[[foo](uri1)](uri2)](uri3) +"###, + &danger + ), r###"<p><img src="uri3" alt="[foo](uri2)" /></p> "###, r###"Links (519)"### ); assert_eq!( - micromark_with_options(r###"*[foo*](/uri) -"###, DANGER), + micromark_with_options( + r###"*[foo*](/uri) +"###, + &danger + ), r###"<p>*<a href="/uri">foo*</a></p> "###, r###"Links (520)"### ); assert_eq!( - micromark_with_options(r###"[foo *bar](baz*) -"###, DANGER), + micromark_with_options( + r###"[foo *bar](baz*) +"###, + &danger + ), r###"<p><a href="baz*">foo *bar</a></p> "###, r###"Links (521)"### ); assert_eq!( - micromark_with_options(r###"*foo [bar* baz] -"###, DANGER), + micromark_with_options( + r###"*foo [bar* baz] +"###, + &danger + ), r###"<p><em>foo [bar</em> baz]</p> "###, r###"Links (522)"### ); assert_eq!( - micromark_with_options(r###"[foo <bar attr="](baz)"> -"###, DANGER), + micromark_with_options( + r###"[foo <bar attr="](baz)"> +"###, + &danger + ), r###"<p>[foo <bar attr="](baz)"></p> "###, r###"Links (523)"### ); assert_eq!( - micromark_with_options(r###"[foo`](/uri)` -"###, DANGER), + micromark_with_options( + r###"[foo`](/uri)` +"###, + &danger + ), r###"<p>[foo<code>](/uri)</code></p> "###, r###"Links (524)"### ); assert_eq!( - micromark_with_options(r###"[foo<http://example.com/?search=](uri)> -"###, DANGER), + micromark_with_options( + 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)"### ); assert_eq!( - micromark_with_options(r###"[foo][bar] + micromark_with_options( + r###"[foo][bar] [bar]: /url "title" -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url" title="title">foo</a></p> "###, r###"Links (526)"### ); assert_eq!( - micromark_with_options(r###"[link [foo [bar]]][ref] + micromark_with_options( + r###"[link [foo [bar]]][ref] [ref]: /uri -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/uri">link [foo [bar]]</a></p> "###, r###"Links (527)"### ); assert_eq!( - micromark_with_options(r###"[link \[bar][ref] + micromark_with_options( + r###"[link \[bar][ref] [ref]: /uri -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/uri">link [bar</a></p> "###, r###"Links (528)"### ); assert_eq!( - micromark_with_options(r###"[link *foo **bar** `#`*][ref] + micromark_with_options( + r###"[link *foo **bar** `#`*][ref] [ref]: /uri -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/uri">link <em>foo <strong>bar</strong> <code>#</code></em></a></p> "###, r###"Links (529)"### ); assert_eq!( - micromark_with_options(r###"[![moon](moon.jpg)][ref] + micromark_with_options( + r###"[![moon](moon.jpg)][ref] [ref]: /uri -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/uri"><img src="moon.jpg" alt="moon" /></a></p> "###, r###"Links (530)"### ); assert_eq!( - micromark_with_options(r###"[foo [bar](/uri)][ref] + micromark_with_options( + r###"[foo [bar](/uri)][ref] [ref]: /uri -"###, DANGER), +"###, + &danger + ), r###"<p>[foo <a href="/uri">bar</a>]<a href="/uri">ref</a></p> "###, r###"Links (531)"### ); assert_eq!( - micromark_with_options(r###"[foo *bar [baz][ref]*][ref] + micromark_with_options( + r###"[foo *bar [baz][ref]*][ref] [ref]: /uri -"###, DANGER), +"###, + &danger + ), r###"<p>[foo <em>bar <a href="/uri">baz</a></em>]<a href="/uri">ref</a></p> "###, r###"Links (532)"### ); assert_eq!( - micromark_with_options(r###"*[foo*][ref] + micromark_with_options( + r###"*[foo*][ref] [ref]: /uri -"###, DANGER), +"###, + &danger + ), r###"<p>*<a href="/uri">foo*</a></p> "###, r###"Links (533)"### ); assert_eq!( - micromark_with_options(r###"[foo *bar][ref]* + micromark_with_options( + r###"[foo *bar][ref]* [ref]: /uri -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/uri">foo *bar</a>*</p> "###, r###"Links (534)"### ); assert_eq!( - micromark_with_options(r###"[foo <bar attr="][ref]"> + micromark_with_options( + r###"[foo <bar attr="][ref]"> [ref]: /uri -"###, DANGER), +"###, + &danger + ), r###"<p>[foo <bar attr="][ref]"></p> "###, r###"Links (535)"### ); assert_eq!( - micromark_with_options(r###"[foo`][ref]` + micromark_with_options( + r###"[foo`][ref]` [ref]: /uri -"###, DANGER), +"###, + &danger + ), r###"<p>[foo<code>][ref]</code></p> "###, r###"Links (536)"### ); assert_eq!( - micromark_with_options(r###"[foo<http://example.com/?search=][ref]> + micromark_with_options( + r###"[foo<http://example.com/?search=][ref]> [ref]: /uri -"###, DANGER), +"###, + &danger + ), r###"<p>[foo<a href="http://example.com/?search=%5D%5Bref%5D">http://example.com/?search=][ref]</a></p> "###, r###"Links (537)"### ); assert_eq!( - micromark_with_options(r###"[foo][BaR] + micromark_with_options( + r###"[foo][BaR] [bar]: /url "title" -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url" title="title">foo</a></p> "###, r###"Links (538)"### ); assert_eq!( - micromark_with_options(r###"[ẞ] + micromark_with_options( + r###"[ẞ] [SS]: /url -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url">ẞ</a></p> "###, r###"Links (539)"### ); assert_eq!( - micromark_with_options(r###"[Foo + micromark_with_options( + r###"[Foo bar]: /url [Baz][Foo bar] -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url">Baz</a></p> "###, r###"Links (540)"### ); assert_eq!( - micromark_with_options(r###"[foo] [bar] + micromark_with_options( + r###"[foo] [bar] [bar]: /url "title" -"###, DANGER), +"###, + &danger + ), r###"<p>[foo] <a href="/url" title="title">bar</a></p> "###, r###"Links (541)"### ); assert_eq!( - micromark_with_options(r###"[foo] + micromark_with_options( + r###"[foo] [bar] [bar]: /url "title" -"###, DANGER), +"###, + &danger + ), r###"<p>[foo] <a href="/url" title="title">bar</a></p> "###, @@ -6174,32 +7800,41 @@ bar>)</p> ); assert_eq!( - micromark_with_options(r###"[foo]: /url1 + micromark_with_options( + r###"[foo]: /url1 [foo]: /url2 [bar][foo] -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url1">bar</a></p> "###, r###"Links (543)"### ); assert_eq!( - micromark_with_options(r###"[bar][foo\!] + micromark_with_options( + r###"[bar][foo\!] [foo!]: /url -"###, DANGER), +"###, + &danger + ), r###"<p>[bar][foo!]</p> "###, r###"Links (544)"### ); assert_eq!( - micromark_with_options(r###"[foo][ref[] + micromark_with_options( + r###"[foo][ref[] [ref[]: /uri -"###, DANGER), +"###, + &danger + ), r###"<p>[foo][ref[]</p> <p>[ref[]: /uri</p> "###, @@ -6207,10 +7842,13 @@ bar>)</p> ); assert_eq!( - micromark_with_options(r###"[foo][ref[bar]] + micromark_with_options( + r###"[foo][ref[bar]] [ref[bar]]: /uri -"###, DANGER), +"###, + &danger + ), r###"<p>[foo][ref[bar]]</p> <p>[ref[bar]]: /uri</p> "###, @@ -6218,10 +7856,13 @@ bar>)</p> ); assert_eq!( - micromark_with_options(r###"[[[foo]]] + micromark_with_options( + r###"[[[foo]]] [[[foo]]]: /url -"###, DANGER), +"###, + &danger + ), r###"<p>[[[foo]]]</p> <p>[[[foo]]]: /url</p> "###, @@ -6229,30 +7870,39 @@ bar>)</p> ); assert_eq!( - micromark_with_options(r###"[foo][ref\[] + micromark_with_options( + r###"[foo][ref\[] [ref\[]: /uri -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/uri">foo</a></p> "###, r###"Links (548)"### ); assert_eq!( - micromark_with_options(r###"[bar\\]: /uri + micromark_with_options( + r###"[bar\\]: /uri [bar\\] -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/uri">bar\</a></p> "###, r###"Links (549)"### ); assert_eq!( - micromark_with_options(r###"[] + micromark_with_options( + r###"[] []: /uri -"###, DANGER), +"###, + &danger + ), r###"<p>[]</p> <p>[]: /uri</p> "###, @@ -6260,12 +7910,15 @@ bar>)</p> ); assert_eq!( - micromark_with_options(r###"[ + micromark_with_options( + r###"[ ] [ ]: /uri -"###, DANGER), +"###, + &danger + ), r###"<p>[ ]</p> <p>[ @@ -6275,41 +7928,53 @@ bar>)</p> ); assert_eq!( - micromark_with_options(r###"[foo][] + micromark_with_options( + r###"[foo][] [foo]: /url "title" -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url" title="title">foo</a></p> "###, r###"Links (552)"### ); assert_eq!( - micromark_with_options(r###"[*foo* bar][] + micromark_with_options( + r###"[*foo* bar][] [*foo* bar]: /url "title" -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url" title="title"><em>foo</em> bar</a></p> "###, r###"Links (553)"### ); assert_eq!( - micromark_with_options(r###"[Foo][] + micromark_with_options( + r###"[Foo][] [foo]: /url "title" -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url" title="title">Foo</a></p> "###, r###"Links (554)"### ); assert_eq!( - micromark_with_options(r###"[foo] + micromark_with_options( + r###"[foo] [] [foo]: /url "title" -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url" title="title">foo</a> []</p> "###, @@ -6317,300 +7982,393 @@ bar>)</p> ); assert_eq!( - micromark_with_options(r###"[foo] + micromark_with_options( + r###"[foo] [foo]: /url "title" -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url" title="title">foo</a></p> "###, r###"Links (556)"### ); assert_eq!( - micromark_with_options(r###"[*foo* bar] + micromark_with_options( + r###"[*foo* bar] [*foo* bar]: /url "title" -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url" title="title"><em>foo</em> bar</a></p> "###, r###"Links (557)"### ); assert_eq!( - micromark_with_options(r###"[[*foo* bar]] + micromark_with_options( + r###"[[*foo* bar]] [*foo* bar]: /url "title" -"###, DANGER), +"###, + &danger + ), r###"<p>[<a href="/url" title="title"><em>foo</em> bar</a>]</p> "###, r###"Links (558)"### ); assert_eq!( - micromark_with_options(r###"[[bar [foo] + micromark_with_options( + r###"[[bar [foo] [foo]: /url -"###, DANGER), +"###, + &danger + ), r###"<p>[[bar <a href="/url">foo</a></p> "###, r###"Links (559)"### ); assert_eq!( - micromark_with_options(r###"[Foo] + micromark_with_options( + r###"[Foo] [foo]: /url "title" -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url" title="title">Foo</a></p> "###, r###"Links (560)"### ); assert_eq!( - micromark_with_options(r###"[foo] bar + micromark_with_options( + r###"[foo] bar [foo]: /url -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url">foo</a> bar</p> "###, r###"Links (561)"### ); assert_eq!( - micromark_with_options(r###"\[foo] + micromark_with_options( + r###"\[foo] [foo]: /url "title" -"###, DANGER), +"###, + &danger + ), r###"<p>[foo]</p> "###, r###"Links (562)"### ); assert_eq!( - micromark_with_options(r###"[foo*]: /url + micromark_with_options( + r###"[foo*]: /url *[foo*] -"###, DANGER), +"###, + &danger + ), r###"<p>*<a href="/url">foo*</a></p> "###, r###"Links (563)"### ); assert_eq!( - micromark_with_options(r###"[foo][bar] + micromark_with_options( + r###"[foo][bar] [foo]: /url1 [bar]: /url2 -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url2">foo</a></p> "###, r###"Links (564)"### ); assert_eq!( - micromark_with_options(r###"[foo][] + micromark_with_options( + r###"[foo][] [foo]: /url1 -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url1">foo</a></p> "###, r###"Links (565)"### ); assert_eq!( - micromark_with_options(r###"[foo]() + micromark_with_options( + r###"[foo]() [foo]: /url1 -"###, DANGER), +"###, + &danger + ), r###"<p><a href="">foo</a></p> "###, r###"Links (566)"### ); assert_eq!( - micromark_with_options(r###"[foo](not a link) + micromark_with_options( + r###"[foo](not a link) [foo]: /url1 -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url1">foo</a>(not a link)</p> "###, r###"Links (567)"### ); assert_eq!( - micromark_with_options(r###"[foo][bar][baz] + micromark_with_options( + r###"[foo][bar][baz] [baz]: /url -"###, DANGER), +"###, + &danger + ), r###"<p>[foo]<a href="/url">bar</a></p> "###, r###"Links (568)"### ); assert_eq!( - micromark_with_options(r###"[foo][bar][baz] + micromark_with_options( + r###"[foo][bar][baz] [baz]: /url1 [bar]: /url2 -"###, DANGER), +"###, + &danger + ), r###"<p><a href="/url2">foo</a><a href="/url1">baz</a></p> "###, r###"Links (569)"### ); assert_eq!( - micromark_with_options(r###"[foo][bar][baz] + micromark_with_options( + r###"[foo][bar][baz] [baz]: /url1 [foo]: /url2 -"###, DANGER), +"###, + &danger + ), r###"<p>[foo]<a href="/url1">bar</a></p> "###, r###"Links (570)"### ); assert_eq!( - micromark_with_options(r###"![foo](/url "title") -"###, DANGER), + micromark_with_options( + r###"![foo](/url "title") +"###, + &danger + ), r###"<p><img src="/url" alt="foo" title="title" /></p> "###, r###"Images (571)"### ); assert_eq!( - micromark_with_options(r###"![foo *bar*] + micromark_with_options( + r###"![foo *bar*] [foo *bar*]: train.jpg "train & tracks" -"###, DANGER), +"###, + &danger + ), r###"<p><img src="train.jpg" alt="foo bar" title="train & tracks" /></p> "###, r###"Images (572)"### ); assert_eq!( - micromark_with_options(r###"![foo ![bar](/url)](/url2) -"###, DANGER), + micromark_with_options( + r###"![foo ![bar](/url)](/url2) +"###, + &danger + ), r###"<p><img src="/url2" alt="foo bar" /></p> "###, r###"Images (573)"### ); assert_eq!( - micromark_with_options(r###"![foo [bar](/url)](/url2) -"###, DANGER), + micromark_with_options( + r###"![foo [bar](/url)](/url2) +"###, + &danger + ), r###"<p><img src="/url2" alt="foo bar" /></p> "###, r###"Images (574)"### ); assert_eq!( - micromark_with_options(r###"![foo *bar*][] + micromark_with_options( + r###"![foo *bar*][] [foo *bar*]: train.jpg "train & tracks" -"###, DANGER), +"###, + &danger + ), r###"<p><img src="train.jpg" alt="foo bar" title="train & tracks" /></p> "###, r###"Images (575)"### ); assert_eq!( - micromark_with_options(r###"![foo *bar*][foobar] + micromark_with_options( + r###"![foo *bar*][foobar] [FOOBAR]: train.jpg "train & tracks" -"###, DANGER), +"###, + &danger + ), r###"<p><img src="train.jpg" alt="foo bar" title="train & tracks" /></p> "###, r###"Images (576)"### ); assert_eq!( - micromark_with_options(r###"![foo](train.jpg) -"###, DANGER), + micromark_with_options( + r###"![foo](train.jpg) +"###, + &danger + ), r###"<p><img src="train.jpg" alt="foo" /></p> "###, r###"Images (577)"### ); assert_eq!( - micromark_with_options(r###"My ![foo bar](/path/to/train.jpg "title" ) -"###, DANGER), + micromark_with_options( + 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)"### ); assert_eq!( - micromark_with_options(r###"![foo](<url>) -"###, DANGER), + micromark_with_options( + r###"![foo](<url>) +"###, + &danger + ), r###"<p><img src="url" alt="foo" /></p> "###, r###"Images (579)"### ); assert_eq!( - micromark_with_options(r###"![](/url) -"###, DANGER), + micromark_with_options( + r###"![](/url) +"###, + &danger + ), r###"<p><img src="/url" alt="" /></p> "###, r###"Images (580)"### ); assert_eq!( - micromark_with_options(r###"![foo][bar] + micromark_with_options( + r###"![foo][bar] [bar]: /url -"###, DANGER), +"###, + &danger + ), r###"<p><img src="/url" alt="foo" /></p> "###, r###"Images (581)"### ); assert_eq!( - micromark_with_options(r###"![foo][bar] + micromark_with_options( + r###"![foo][bar] [BAR]: /url -"###, DANGER), +"###, + &danger + ), r###"<p><img src="/url" alt="foo" /></p> "###, r###"Images (582)"### ); assert_eq!( - micromark_with_options(r###"![foo][] + micromark_with_options( + r###"![foo][] [foo]: /url "title" -"###, DANGER), +"###, + &danger + ), r###"<p><img src="/url" alt="foo" title="title" /></p> "###, r###"Images (583)"### ); assert_eq!( - micromark_with_options(r###"![*foo* bar][] + micromark_with_options( + r###"![*foo* bar][] [*foo* bar]: /url "title" -"###, DANGER), +"###, + &danger + ), r###"<p><img src="/url" alt="foo bar" title="title" /></p> "###, r###"Images (584)"### ); assert_eq!( - micromark_with_options(r###"![Foo][] + micromark_with_options( + r###"![Foo][] [foo]: /url "title" -"###, DANGER), +"###, + &danger + ), r###"<p><img src="/url" alt="Foo" title="title" /></p> "###, r###"Images (585)"### ); assert_eq!( - micromark_with_options(r###"![foo] + micromark_with_options( + r###"![foo] [] [foo]: /url "title" -"###, DANGER), +"###, + &danger + ), r###"<p><img src="/url" alt="foo" title="title" /> []</p> "###, @@ -6618,30 +8376,39 @@ bar>)</p> ); assert_eq!( - micromark_with_options(r###"![foo] + micromark_with_options( + r###"![foo] [foo]: /url "title" -"###, DANGER), +"###, + &danger + ), r###"<p><img src="/url" alt="foo" title="title" /></p> "###, r###"Images (587)"### ); assert_eq!( - micromark_with_options(r###"![*foo* bar] + micromark_with_options( + r###"![*foo* bar] [*foo* bar]: /url "title" -"###, DANGER), +"###, + &danger + ), r###"<p><img src="/url" alt="foo bar" title="title" /></p> "###, r###"Images (588)"### ); assert_eq!( - micromark_with_options(r###"![[foo]] + micromark_with_options( + r###"![[foo]] [[foo]]: /url "title" -"###, DANGER), +"###, + &danger + ), r###"<p>![[foo]]</p> <p>[[foo]]: /url "title"</p> "###, @@ -6649,207 +8416,282 @@ bar>)</p> ); assert_eq!( - micromark_with_options(r###"![Foo] + micromark_with_options( + r###"![Foo] [foo]: /url "title" -"###, DANGER), +"###, + &danger + ), r###"<p><img src="/url" alt="Foo" title="title" /></p> "###, r###"Images (590)"### ); assert_eq!( - micromark_with_options(r###"!\[foo] + micromark_with_options( + r###"!\[foo] [foo]: /url "title" -"###, DANGER), +"###, + &danger + ), r###"<p>![foo]</p> "###, r###"Images (591)"### ); assert_eq!( - micromark_with_options(r###"\![foo] + micromark_with_options( + r###"\![foo] [foo]: /url "title" -"###, DANGER), +"###, + &danger + ), r###"<p>!<a href="/url" title="title">foo</a></p> "###, r###"Images (592)"### ); assert_eq!( - micromark_with_options(r###"<http://foo.bar.baz> -"###, DANGER), + micromark_with_options( + r###"<http://foo.bar.baz> +"###, + &danger + ), r###"<p><a href="http://foo.bar.baz">http://foo.bar.baz</a></p> "###, r###"Autolinks (593)"### ); assert_eq!( - micromark_with_options(r###"<http://foo.bar.baz/test?q=hello&id=22&boolean> -"###, DANGER), + micromark_with_options( + 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)"### ); assert_eq!( - micromark_with_options(r###"<irc://foo.bar:2233/baz> -"###, DANGER), + micromark_with_options( + 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)"### ); assert_eq!( - micromark_with_options(r###"<MAILTO:FOO@BAR.BAZ> -"###, DANGER), + micromark_with_options( + r###"<MAILTO:FOO@BAR.BAZ> +"###, + &danger + ), r###"<p><a href="MAILTO:FOO@BAR.BAZ">MAILTO:FOO@BAR.BAZ</a></p> "###, r###"Autolinks (596)"### ); assert_eq!( - micromark_with_options(r###"<a+b+c:d> -"###, DANGER), + micromark_with_options( + r###"<a+b+c:d> +"###, + &danger + ), r###"<p><a href="a+b+c:d">a+b+c:d</a></p> "###, r###"Autolinks (597)"### ); assert_eq!( - micromark_with_options(r###"<made-up-scheme://foo,bar> -"###, DANGER), + micromark_with_options( + 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)"### ); assert_eq!( - micromark_with_options(r###"<http://../> -"###, DANGER), + micromark_with_options( + r###"<http://../> +"###, + &danger + ), r###"<p><a href="http://../">http://../</a></p> "###, r###"Autolinks (599)"### ); assert_eq!( - micromark_with_options(r###"<localhost:5001/foo> -"###, DANGER), + micromark_with_options( + r###"<localhost:5001/foo> +"###, + &danger + ), r###"<p><a href="localhost:5001/foo">localhost:5001/foo</a></p> "###, r###"Autolinks (600)"### ); assert_eq!( - micromark_with_options(r###"<http://foo.bar/baz bim> -"###, DANGER), + micromark_with_options( + r###"<http://foo.bar/baz bim> +"###, + &danger + ), r###"<p><http://foo.bar/baz bim></p> "###, r###"Autolinks (601)"### ); assert_eq!( - micromark_with_options(r###"<http://example.com/\[\> -"###, DANGER), + micromark_with_options( + r###"<http://example.com/\[\> +"###, + &danger + ), r###"<p><a href="http://example.com/%5C%5B%5C">http://example.com/\[\</a></p> "###, r###"Autolinks (602)"### ); assert_eq!( - micromark_with_options(r###"<foo@bar.example.com> -"###, DANGER), + micromark_with_options( + r###"<foo@bar.example.com> +"###, + &danger + ), r###"<p><a href="mailto:foo@bar.example.com">foo@bar.example.com</a></p> "###, r###"Autolinks (603)"### ); assert_eq!( - micromark_with_options(r###"<foo+special@Bar.baz-bar0.com> -"###, DANGER), + micromark_with_options( + 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)"### ); assert_eq!( - micromark_with_options(r###"<foo\+@bar.example.com> -"###, DANGER), + micromark_with_options( + r###"<foo\+@bar.example.com> +"###, + &danger + ), r###"<p><foo+@bar.example.com></p> "###, r###"Autolinks (605)"### ); assert_eq!( - micromark_with_options(r###"<> -"###, DANGER), + micromark_with_options( + r###"<> +"###, + &danger + ), r###"<p><></p> "###, r###"Autolinks (606)"### ); assert_eq!( - micromark_with_options(r###"< http://foo.bar > -"###, DANGER), + micromark_with_options( + r###"< http://foo.bar > +"###, + &danger + ), r###"<p>< http://foo.bar ></p> "###, r###"Autolinks (607)"### ); assert_eq!( - micromark_with_options(r###"<m:abc> -"###, DANGER), + micromark_with_options( + r###"<m:abc> +"###, + &danger + ), r###"<p><m:abc></p> "###, r###"Autolinks (608)"### ); assert_eq!( - micromark_with_options(r###"<foo.bar.baz> -"###, DANGER), + micromark_with_options( + r###"<foo.bar.baz> +"###, + &danger + ), r###"<p><foo.bar.baz></p> "###, r###"Autolinks (609)"### ); assert_eq!( - micromark_with_options(r###"http://example.com -"###, DANGER), + micromark_with_options( + r###"http://example.com +"###, + &danger + ), r###"<p>http://example.com</p> "###, r###"Autolinks (610)"### ); assert_eq!( - micromark_with_options(r###"foo@bar.example.com -"###, DANGER), + micromark_with_options( + r###"foo@bar.example.com +"###, + &danger + ), r###"<p>foo@bar.example.com</p> "###, r###"Autolinks (611)"### ); assert_eq!( - micromark_with_options(r###"<a><bab><c2c> -"###, DANGER), + micromark_with_options( + r###"<a><bab><c2c> +"###, + &danger + ), r###"<p><a><bab><c2c></p> "###, r###"Raw HTML (612)"### ); assert_eq!( - micromark_with_options(r###"<a/><b2/> -"###, DANGER), + micromark_with_options( + r###"<a/><b2/> +"###, + &danger + ), r###"<p><a/><b2/></p> "###, r###"Raw HTML (613)"### ); assert_eq!( - micromark_with_options(r###"<a /><b2 + micromark_with_options( + r###"<a /><b2 data="foo" > -"###, DANGER), +"###, + &danger + ), r###"<p><a /><b2 data="foo" ></p> "###, @@ -6857,9 +8699,12 @@ data="foo" ></p> ); assert_eq!( - micromark_with_options(r###"<a foo="bar" bam = 'baz <em>"</em>' + micromark_with_options( + r###"<a foo="bar" bam = 'baz <em>"</em>' _boolean zoop:33=zoop:33 /> -"###, DANGER), +"###, + &danger + ), r###"<p><a foo="bar" bam = 'baz <em>"</em>' _boolean zoop:33=zoop:33 /></p> "###, @@ -6867,43 +8712,58 @@ _boolean zoop:33=zoop:33 /></p> ); assert_eq!( - micromark_with_options(r###"Foo <responsive-image src="foo.jpg" /> -"###, DANGER), + micromark_with_options( + r###"Foo <responsive-image src="foo.jpg" /> +"###, + &danger + ), r###"<p>Foo <responsive-image src="foo.jpg" /></p> "###, r###"Raw HTML (616)"### ); assert_eq!( - micromark_with_options(r###"<33> <__> -"###, DANGER), + micromark_with_options( + r###"<33> <__> +"###, + &danger + ), r###"<p><33> <__></p> "###, r###"Raw HTML (617)"### ); assert_eq!( - micromark_with_options(r###"<a h*#ref="hi"> -"###, DANGER), + micromark_with_options( + r###"<a h*#ref="hi"> +"###, + &danger + ), r###"<p><a h*#ref="hi"></p> "###, r###"Raw HTML (618)"### ); assert_eq!( - micromark_with_options(r###"<a href="hi'> <a href=hi'> -"###, DANGER), + micromark_with_options( + r###"<a href="hi'> <a href=hi'> +"###, + &danger + ), r###"<p><a href="hi'> <a href=hi'></p> "###, r###"Raw HTML (619)"### ); assert_eq!( - micromark_with_options(r###"< a>< + micromark_with_options( + r###"< a>< foo><bar/ > <foo bar=baz bim!bop /> -"###, DANGER), +"###, + &danger + ), r###"<p>< a>< foo><bar/ > <foo bar=baz @@ -6913,33 +8773,45 @@ bim!bop /></p> ); assert_eq!( - micromark_with_options(r###"<a href='bar'title=title> -"###, DANGER), + micromark_with_options( + r###"<a href='bar'title=title> +"###, + &danger + ), r###"<p><a href='bar'title=title></p> "###, r###"Raw HTML (621)"### ); assert_eq!( - micromark_with_options(r###"</a></foo > -"###, DANGER), + micromark_with_options( + r###"</a></foo > +"###, + &danger + ), r###"<p></a></foo ></p> "###, r###"Raw HTML (622)"### ); assert_eq!( - micromark_with_options(r###"</a href="foo"> -"###, DANGER), + micromark_with_options( + r###"</a href="foo"> +"###, + &danger + ), r###"<p></a href="foo"></p> "###, r###"Raw HTML (623)"### ); assert_eq!( - micromark_with_options(r###"foo <!-- this is a + micromark_with_options( + r###"foo <!-- this is a comment - with hyphen --> -"###, DANGER), +"###, + &danger + ), r###"<p>foo <!-- this is a comment - with hyphen --></p> "###, @@ -6947,18 +8819,24 @@ comment - with hyphen --></p> ); assert_eq!( - micromark_with_options(r###"foo <!-- not a comment -- two hyphens --> -"###, DANGER), + micromark_with_options( + r###"foo <!-- not a comment -- two hyphens --> +"###, + &danger + ), r###"<p>foo <!-- not a comment -- two hyphens --></p> "###, r###"Raw HTML (625)"### ); assert_eq!( - micromark_with_options(r###"foo <!--> foo --> + micromark_with_options( + r###"foo <!--> foo --> foo <!-- foo---> -"###, DANGER), +"###, + &danger + ), r###"<p>foo <!--> foo --></p> <p>foo <!-- foo---></p> "###, @@ -6966,57 +8844,78 @@ foo <!-- foo---> ); assert_eq!( - micromark_with_options(r###"foo <?php echo $a; ?> -"###, DANGER), + micromark_with_options( + r###"foo <?php echo $a; ?> +"###, + &danger + ), r###"<p>foo <?php echo $a; ?></p> "###, r###"Raw HTML (627)"### ); assert_eq!( - micromark_with_options(r###"foo <!ELEMENT br EMPTY> -"###, DANGER), + micromark_with_options( + r###"foo <!ELEMENT br EMPTY> +"###, + &danger + ), r###"<p>foo <!ELEMENT br EMPTY></p> "###, r###"Raw HTML (628)"### ); assert_eq!( - micromark_with_options(r###"foo <![CDATA[>&<]]> -"###, DANGER), + micromark_with_options( + r###"foo <![CDATA[>&<]]> +"###, + &danger + ), r###"<p>foo <![CDATA[>&<]]></p> "###, r###"Raw HTML (629)"### ); assert_eq!( - micromark_with_options(r###"foo <a href="ö"> -"###, DANGER), + micromark_with_options( + r###"foo <a href="ö"> +"###, + &danger + ), r###"<p>foo <a href="ö"></p> "###, r###"Raw HTML (630)"### ); assert_eq!( - micromark_with_options(r###"foo <a href="\*"> -"###, DANGER), + micromark_with_options( + r###"foo <a href="\*"> +"###, + &danger + ), r###"<p>foo <a href="\*"></p> "###, r###"Raw HTML (631)"### ); assert_eq!( - micromark_with_options(r###"<a href="\""> -"###, DANGER), + micromark_with_options( + r###"<a href="\""> +"###, + &danger + ), r###"<p><a href="""></p> "###, r###"Raw HTML (632)"### ); assert_eq!( - micromark_with_options(r###"foo + micromark_with_options( + r###"foo baz -"###, DANGER), +"###, + &danger + ), r###"<p>foo<br /> baz</p> "###, @@ -7024,9 +8923,12 @@ baz</p> ); assert_eq!( - micromark_with_options(r###"foo\ + micromark_with_options( + r###"foo\ baz -"###, DANGER), +"###, + &danger + ), r###"<p>foo<br /> baz</p> "###, @@ -7034,9 +8936,12 @@ baz</p> ); assert_eq!( - micromark_with_options(r###"foo + micromark_with_options( + r###"foo baz -"###, DANGER), +"###, + &danger + ), r###"<p>foo<br /> baz</p> "###, @@ -7044,9 +8949,12 @@ baz</p> ); assert_eq!( - micromark_with_options(r###"foo + micromark_with_options( + r###"foo bar -"###, DANGER), +"###, + &danger + ), r###"<p>foo<br /> bar</p> "###, @@ -7054,9 +8962,12 @@ bar</p> ); assert_eq!( - micromark_with_options(r###"foo\ + micromark_with_options( + r###"foo\ bar -"###, DANGER), +"###, + &danger + ), r###"<p>foo<br /> bar</p> "###, @@ -7064,9 +8975,12 @@ bar</p> ); assert_eq!( - micromark_with_options(r###"*foo + micromark_with_options( + r###"*foo bar* -"###, DANGER), +"###, + &danger + ), r###"<p><em>foo<br /> bar</em></p> "###, @@ -7074,9 +8988,12 @@ bar</em></p> ); assert_eq!( - micromark_with_options(r###"*foo\ + micromark_with_options( + r###"*foo\ bar* -"###, DANGER), +"###, + &danger + ), r###"<p><em>foo<br /> bar</em></p> "###, @@ -7084,27 +9001,36 @@ bar</em></p> ); assert_eq!( - micromark_with_options(r###"`code + micromark_with_options( + r###"`code span` -"###, DANGER), +"###, + &danger + ), r###"<p><code>code span</code></p> "###, r###"Hard line breaks (640)"### ); assert_eq!( - micromark_with_options(r###"`code\ + micromark_with_options( + r###"`code\ span` -"###, DANGER), +"###, + &danger + ), r###"<p><code>code\ span</code></p> "###, r###"Hard line breaks (641)"### ); assert_eq!( - micromark_with_options(r###"<a href="foo + micromark_with_options( + r###"<a href="foo bar"> -"###, DANGER), +"###, + &danger + ), r###"<p><a href="foo bar"></p> "###, @@ -7112,9 +9038,12 @@ bar"></p> ); assert_eq!( - micromark_with_options(r###"<a href="foo\ + micromark_with_options( + r###"<a href="foo\ bar"> -"###, DANGER), +"###, + &danger + ), r###"<p><a href="foo\ bar"></p> "###, @@ -7122,41 +9051,56 @@ bar"></p> ); assert_eq!( - micromark_with_options(r###"foo\ -"###, DANGER), + micromark_with_options( + r###"foo\ +"###, + &danger + ), r###"<p>foo\</p> "###, r###"Hard line breaks (644)"### ); assert_eq!( - micromark_with_options(r###"foo -"###, DANGER), + micromark_with_options( + r###"foo +"###, + &danger + ), r###"<p>foo</p> "###, r###"Hard line breaks (645)"### ); assert_eq!( - micromark_with_options(r###"### foo\ -"###, DANGER), + micromark_with_options( + r###"### foo\ +"###, + &danger + ), r###"<h3>foo\</h3> "###, r###"Hard line breaks (646)"### ); assert_eq!( - micromark_with_options(r###"### foo -"###, DANGER), + micromark_with_options( + r###"### foo +"###, + &danger + ), r###"<h3>foo</h3> "###, r###"Hard line breaks (647)"### ); assert_eq!( - micromark_with_options(r###"foo + micromark_with_options( + r###"foo baz -"###, DANGER), +"###, + &danger + ), r###"<p>foo baz</p> "###, @@ -7164,9 +9108,12 @@ baz</p> ); assert_eq!( - micromark_with_options(r###"foo + micromark_with_options( + r###"foo baz -"###, DANGER), +"###, + &danger + ), r###"<p>foo baz</p> "###, @@ -7174,24 +9121,33 @@ baz</p> ); assert_eq!( - micromark_with_options(r###"hello $.;'there -"###, DANGER), + micromark_with_options( + r###"hello $.;'there +"###, + &danger + ), r###"<p>hello $.;'there</p> "###, r###"Textual content (650)"### ); assert_eq!( - micromark_with_options(r###"Foo χρῆν -"###, DANGER), + micromark_with_options( + r###"Foo χρῆν +"###, + &danger + ), r###"<p>Foo χρῆν</p> "###, r###"Textual content (651)"### ); assert_eq!( - micromark_with_options(r###"Multiple spaces -"###, DANGER), + micromark_with_options( + r###"Multiple spaces +"###, + &danger + ), r###"<p>Multiple spaces</p> "###, r###"Textual content (652)"### diff --git a/tests/definition.rs b/tests/definition.rs index 9bf4072..620ab69 100644 --- a/tests/definition.rs +++ b/tests/definition.rs @@ -1,14 +1,14 @@ extern crate micromark; -use micromark::{micromark, micromark_with_options, Options}; - -const DANGER: &Options = &Options { - allow_dangerous_html: true, - allow_dangerous_protocol: true, - default_line_ending: None, -}; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn definition() { + let danger = Options { + allow_dangerous_html: true, + allow_dangerous_protocol: true, + ..Options::default() + }; + assert_eq!( micromark("[foo]: /url \"title\"\n\n[foo]"), "<p><a href=\"/url\" title=\"title\">foo</a></p>", @@ -76,7 +76,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" ); @@ -357,7 +357,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" ); @@ -428,12 +428,18 @@ fn definition() { "should not support definitions w/ text + a closing paren as a raw destination" ); - // To do: turning things off. - // assert_eq!( - // micromark("[foo]: /url \"title\"", { - // extensions: [{disable: {null: ["definition"]}}] - // }), - // "<p>[foo]: /url "title"</p>", - // "should support turning off definitions" - // ); + assert_eq!( + micromark_with_options( + "[foo]: /url \"title\"", + &Options { + constructs: Constructs { + definition: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "<p>[foo]: /url "title"</p>", + "should support turning off definitions" + ); } diff --git a/tests/hard_break_escape.rs b/tests/hard_break_escape.rs index a486ade..1f93429 100644 --- a/tests/hard_break_escape.rs +++ b/tests/hard_break_escape.rs @@ -1,5 +1,5 @@ extern crate micromark; -use micromark::micromark; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn hard_break_escape() { @@ -39,10 +39,18 @@ fn hard_break_escape() { "should not support escape hard breaks at the end of a heading" ); - // // To do: turning things off. - // assert_eq!( - // micromark("a\\\nb", {extensions: [{disable: {null: ["hardBreakEscape"]}}]}), - // "<p>a\\\nb</p>", - // "should support turning off hard break (escape)" - // ); + assert_eq!( + micromark_with_options( + "a\\\nb", + &Options { + constructs: Constructs { + hard_break_escape: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "<p>a\\\nb</p>", + "should support turning off hard break (escape)" + ); } diff --git a/tests/hard_break_trailing.rs b/tests/hard_break_trailing.rs index d67ad37..2013c46 100644 --- a/tests/hard_break_trailing.rs +++ b/tests/hard_break_trailing.rs @@ -1,5 +1,5 @@ extern crate micromark; -use micromark::micromark; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn hard_break_trailing() { @@ -111,10 +111,18 @@ fn hard_break_trailing() { "should support a mixed line suffix after a span (3)" ); - // // To do: turning things off. - // assert_eq!( - // micromark("a \nb", {extensions: [{disable: {null: ["hardBreakTrailing"]}}]}), - // "<p>a\nb</p>", - // "should support turning off hard break (trailing)" - // ); + assert_eq!( + micromark_with_options( + "a \nb", + &Options { + constructs: Constructs { + hard_break_trailing: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "<p>a\nb</p>", + "should support turning off hard break (trailing)" + ); } diff --git a/tests/heading_atx.rs b/tests/heading_atx.rs index 530ddc5..22c9f82 100644 --- a/tests/heading_atx.rs +++ b/tests/heading_atx.rs @@ -1,5 +1,5 @@ extern crate micromark; -use micromark::micromark; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn heading_atx() { assert_eq!( @@ -194,10 +194,18 @@ fn heading_atx() { "should not support lazyness (2)" ); - // To do: turning things off: - // assert_eq!( - // micromark("# a", {extensions: [{disable: {null: ["headingAtx"]}}]}), - // "<p># a</p>", - // "should support turning off heading (atx)" - // ); + assert_eq!( + micromark_with_options( + "# a", + &Options { + constructs: Constructs { + heading_atx: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "<p># a</p>", + "should support turning off heading (atx)" + ); } diff --git a/tests/heading_setext.rs b/tests/heading_setext.rs index 8d4a5b7..e8d1492 100644 --- a/tests/heading_setext.rs +++ b/tests/heading_setext.rs @@ -1,5 +1,5 @@ extern crate micromark; -use micromark::micromark; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn heading_setext() { @@ -256,10 +256,18 @@ fn heading_setext() { "should not support lazyness (2)" ); - // To do: turning things off. - // assert_eq!( - // micromark("a\n-", {extensions: [{disable: {null: ["setextUnderline"]}}]}), - // "<p>a\n-</p>", - // "should support turning off setext underlines" - // ); + assert_eq!( + micromark_with_options( + "a\n-", + &Options { + constructs: Constructs { + heading_setext: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "<p>a\n-</p>", + "should support turning off setext underlines" + ); } diff --git a/tests/html_flow.rs b/tests/html_flow.rs index d35a570..d3dfe59 100644 --- a/tests/html_flow.rs +++ b/tests/html_flow.rs @@ -1,14 +1,13 @@ extern crate micromark; -use micromark::{micromark, micromark_with_options, Options}; - -const DANGER: &Options = &Options { - allow_dangerous_html: true, - allow_dangerous_protocol: false, - default_line_ending: None, -}; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn html_flow() { + let danger = Options { + allow_dangerous_html: true, + ..Options::default() + }; + assert_eq!( micromark("<!-- asd -->"), "<!-- asd -->", @@ -16,21 +15,34 @@ fn html_flow() { ); assert_eq!( - micromark_with_options("<!-- asd -->", DANGER), + micromark_with_options("<!-- asd -->", &danger), "<!-- asd -->", "should support a heading w/ rank 1" ); - // To do: turning things off. - // assert_eq!( - // micromark_with_options("<x>", {extensions: [{disable: {null: ["htmlFlow"]}}]}), - // "<p><x></p>", - // "should support turning off html (flow)" - // ); + assert_eq!( + micromark_with_options( + "<x>", + &Options { + constructs: Constructs { + html_flow: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "<p><x></p>", + "should support turning off html (flow)" + ); } #[test] fn html_flow_1_raw() { + let danger = Options { + allow_dangerous_html: true, + ..Options::default() + }; + assert_eq!( micromark_with_options( "<pre language=\"haskell\"><code> @@ -40,7 +52,7 @@ main :: IO () main = print $ parseTags tags </code></pre> okay", - DANGER + &danger ), "<pre language=\"haskell\"><code> import Text.HTML.TagSoup @@ -60,7 +72,7 @@ main = print $ parseTags tags document.getElementById(\"demo\").innerHTML = \"Hello JavaScript!\"; </script> okay", - DANGER + &danger ), "<script type=\"text/javascript\"> // JavaScript example @@ -80,7 +92,7 @@ h1 {color:red;} p {color:blue;} </style> okay", - DANGER + &danger ), "<style type=\"text/css\"> @@ -93,92 +105,92 @@ 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)" ); @@ -186,97 +198,102 @@ p {color:blue;} #[test] fn html_flow_2_comment() { + 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)" ); @@ -284,45 +301,50 @@ fn html_flow_2_comment() { #[test] fn html_flow_3_instruction() { + 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)" ); @@ -330,33 +352,38 @@ fn html_flow_3_instruction() { #[test] fn html_flow_4_declaration() { + 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" ); @@ -364,19 +391,19 @@ 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)" ); @@ -384,36 +411,41 @@ fn html_flow_4_declaration() { #[test] fn html_flow_5_cdata() { + let danger = Options { + allow_dangerous_html: true, + ..Options::default() + }; + assert_eq!( 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 + &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" ); @@ -421,25 +453,25 @@ 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)" ); @@ -447,10 +479,15 @@ fn html_flow_5_cdata() { #[test] fn html_flow_6_basic() { + let danger = Options { + allow_dangerous_html: true, + ..Options::default() + }; + assert_eq!( micromark_with_options( "<table><tr><td>\n<pre>\n**Hello**,\n\n_world_.\n</pre>\n</td></tr></table>", - DANGER + &danger ), "<table><tr><td>\n<pre>\n**Hello**,\n<p><em>world</em>.\n</pre></p>\n</td></tr></table>", "should support html (basic)" @@ -467,7 +504,7 @@ fn html_flow_6_basic() { </table> okay.", - DANGER + &danger ), "<table> <tr> @@ -481,121 +518,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" ); @@ -603,7 +640,7 @@ okay.", assert_eq!( micromark_with_options( "<table>\n\n<tr>\n\n<td>\nHi\n</td>\n\n</tr>\n\n</table>", - DANGER + &danger ), "<table>\n<tr>\n<td>\nHi\n</td>\n</tr>\n</table>", "should support blank lines between adjacent html" @@ -622,7 +659,7 @@ okay.", </tr> </table>", - DANGER + &danger ), "<table> <tr> @@ -636,86 +673,86 @@ 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)" ); @@ -723,302 +760,307 @@ okay.", #[test] fn html_flow_7_complete() { + 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)" ); diff --git a/tests/html_text.rs b/tests/html_text.rs index 0288af7..65030b2 100644 --- a/tests/html_text.rs +++ b/tests/html_text.rs @@ -1,14 +1,13 @@ extern crate micromark; -use micromark::{micromark, micromark_with_options, Options}; - -const DANGER: &Options = &Options { - allow_dangerous_html: true, - allow_dangerous_protocol: false, - default_line_ending: None, -}; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn html_text() { + let danger = Options { + allow_dangerous_html: true, + ..Options::default() + }; + assert_eq!( micromark("a <b> c"), "<p>a <b> c</p>", @@ -16,19 +15,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" ); @@ -36,171 +35,171 @@ fn html_text() { assert_eq!( micromark_with_options( "<a foo=\"bar\" bam = 'baz <em>\"</em>'\n_boolean zoop:33=zoop:33 />", - DANGER + &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 +207,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,15 +412,23 @@ 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" ); - // To do: turning things off. - // assert_eq!( - // micromark_with_options("a <x>", {extensions: [{disable: {null: ["htmlText"]}}]}), - // "<p>a <x></p>", - // "should support turning off html (text)" - // ); + assert_eq!( + micromark_with_options( + "a <x>", + &Options { + constructs: Constructs { + html_text: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "<p>a <x></p>", + "should support turning off html (text)" + ); } diff --git a/tests/image.rs b/tests/image.rs index 32d4171..460d8bb 100644 --- a/tests/image.rs +++ b/tests/image.rs @@ -1,5 +1,5 @@ extern crate micromark; -use micromark::{micromark, micromark_with_options, Options}; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn image() { @@ -191,12 +191,20 @@ fn image() { "should ignore an empty title" ); - // To do: turning things off. - // assert_eq!( - // micromark("![x]()", {extensions: [{disable: {null: ["labelStartImage"]}}]}), - // "<p>!<a href=\"\">x</a></p>", - // "should support turning off label start (image)" - // ); + assert_eq!( + micromark_with_options( + "![x]()", + &Options { + constructs: Constructs { + label_start_image: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "<p>!<a href=\"\">x</a></p>", + "should support turning off label start (image)" + ); assert_eq!( micromark("![](javascript:alert(1))"), @@ -209,8 +217,7 @@ fn image() { "![](javascript:alert(1))", &Options { allow_dangerous_protocol: true, - allow_dangerous_html: false, - default_line_ending: None + ..Options::default() } ), "<p><img src=\"javascript:alert(1)\" alt=\"\" /></p>", diff --git a/tests/link_reference.rs b/tests/link_reference.rs index 30fb2b5..17c8cde 100644 --- a/tests/link_reference.rs +++ b/tests/link_reference.rs @@ -1,14 +1,14 @@ extern crate micromark; -use micromark::{micromark, micromark_with_options, Options}; - -const DANGER: &Options = &Options { - allow_dangerous_html: true, - allow_dangerous_protocol: true, - default_line_ending: None, -}; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn link_reference() { + let danger = Options { + allow_dangerous_html: true, + allow_dangerous_protocol: true, + ..Options::default() + }; + assert_eq!( micromark("[bar]: /url \"title\"\n\n[foo][bar]"), "<p><a href=\"/url\" title=\"title\">foo</a></p>", @@ -64,7 +64,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" ); @@ -383,17 +383,33 @@ fn link_reference() { "should not fail on a missing colon in a definition" ); - // To do: turning things off. - // assert_eq!( - // micromark("[x]()", {extensions: [{disable: {null: ["labelStartLink"]}}]}), - // "<p>[x]()</p>", - // "should support turning off label start (link)" - // ); + assert_eq!( + micromark_with_options( + "[x]()", + &Options { + constructs: Constructs { + label_start_link: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "<p>[x]()</p>", + "should support turning off label start (link)" + ); - // To do: turning things off. - // assert_eq!( - // micromark("[x]()", {extensions: [{disable: {null: ["labelEnd"]}}]}), - // "<p>[x]()</p>", - // "should support turning off label end" - // ); + assert_eq!( + micromark_with_options( + "[x]()", + &Options { + constructs: Constructs { + label_end: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "<p>[x]()</p>", + "should support turning off label end" + ); } diff --git a/tests/link_resource.rs b/tests/link_resource.rs index 31e4b81..7f48fb1 100644 --- a/tests/link_resource.rs +++ b/tests/link_resource.rs @@ -1,14 +1,14 @@ extern crate micromark; use micromark::{micromark, micromark_with_options, Options}; -const DANGER: &Options = &Options { - allow_dangerous_html: true, - allow_dangerous_protocol: true, - default_line_ending: None, -}; - #[test] fn link_resource() { + let danger = Options { + allow_dangerous_html: true, + allow_dangerous_protocol: true, + ..Options::default() + }; + assert_eq!( micromark("[link](/uri \"title\")"), "<p><a href=\"/uri\" title=\"title\">link</a></p>", @@ -52,7 +52,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" ); @@ -70,7 +70,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" ); @@ -100,7 +100,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" ); @@ -274,7 +274,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" ); @@ -312,7 +312,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" ); diff --git a/tests/list.rs b/tests/list.rs index 2ef349b..b70b489 100644 --- a/tests/list.rs +++ b/tests/list.rs @@ -1,14 +1,13 @@ extern crate micromark; -use micromark::{micromark, micromark_with_options, Options}; - -const DANGER: &Options = &Options { - allow_dangerous_html: true, - allow_dangerous_protocol: false, - default_line_ending: None, -}; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn list() { + let danger = Options { + allow_dangerous_html: true, + ..Options::default() + }; + assert_eq!( micromark( "A paragraph\nwith two lines.\n\n indented code\n\n> A block quote." @@ -358,13 +357,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" ); @@ -553,15 +552,23 @@ 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" ); - // To do: turning things off. - // assert_eq!( - // micromark("- one\n\n two", {extensions: [{disable: {null: ["list"]}}]}), - // "<p>- one</p>\n<p>two</p>", - // "should support turning off lists" - // ); + assert_eq!( + micromark_with_options( + "- one\n\n two", + &Options { + constructs: Constructs { + list: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "<p>- one</p>\n<p>two</p>", + "should support turning off lists" + ); } diff --git a/tests/misc_dangerous_html.rs b/tests/misc_dangerous_html.rs index 76031c1..5559774 100644 --- a/tests/misc_dangerous_html.rs +++ b/tests/misc_dangerous_html.rs @@ -1,14 +1,14 @@ extern crate micromark; use micromark::{micromark, micromark_with_options, Options}; -const DANGER: &Options = &Options { - allow_dangerous_html: true, - allow_dangerous_protocol: true, - default_line_ending: None, -}; - #[test] fn dangerous_html() { + let danger = &Options { + allow_dangerous_html: true, + allow_dangerous_protocol: true, + ..Options::default() + }; + assert_eq!( micromark("<x>"), "<x>", @@ -22,7 +22,7 @@ fn dangerous_html() { ); assert_eq!( - micromark_with_options("<x>", DANGER), + micromark_with_options("<x>", danger), "<x>", "should be unsafe w/ `allowDangerousHtml`" ); diff --git a/tests/misc_default_line_ending.rs b/tests/misc_default_line_ending.rs index 8c2f047..ceada62 100644 --- a/tests/misc_default_line_ending.rs +++ b/tests/misc_default_line_ending.rs @@ -32,8 +32,7 @@ fn default_line_ending() { "> a", &Options { default_line_ending: Some(LineEnding::CarriageReturn), - allow_dangerous_html: false, - allow_dangerous_protocol: false + ..Options::default() } ), "<blockquote>\r<p>a</p>\r</blockquote>", @@ -45,8 +44,7 @@ fn default_line_ending() { "> a\n", &Options { default_line_ending: Some(LineEnding::CarriageReturn), - allow_dangerous_html: false, - allow_dangerous_protocol: false + ..Options::default() } ), // To do: is this a bug in `micromark.js` that it uses `\r` for earlier line endings? diff --git a/tests/misc_line_ending.rs b/tests/misc_line_ending.rs index 195ddaa..f6dbccd 100644 --- a/tests/misc_line_ending.rs +++ b/tests/misc_line_ending.rs @@ -1,14 +1,14 @@ extern crate micromark; use micromark::{micromark, micromark_with_options, Options}; -const DANGER: &Options = &Options { - allow_dangerous_html: true, - allow_dangerous_protocol: true, - default_line_ending: None, -}; - #[test] fn line_ending() { + let danger = &Options { + allow_dangerous_html: true, + allow_dangerous_protocol: true, + ..Options::default() + }; + assert_eq!( micromark("a\nb"), "<p>a\nb</p>", @@ -106,55 +106,55 @@ 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" ); diff --git a/tests/misc_tabs.rs b/tests/misc_tabs.rs index e82738d..7073c57 100644 --- a/tests/misc_tabs.rs +++ b/tests/misc_tabs.rs @@ -1,14 +1,13 @@ extern crate micromark; use micromark::{micromark, micromark_with_options, Options}; -const DANGER: &Options = &Options { - allow_dangerous_html: true, - allow_dangerous_protocol: true, - default_line_ending: None, -}; - #[test] fn tabs_flow() { + let danger = &Options { + allow_dangerous_html: true, + ..Options::default() + }; + assert_eq!( micromark(" x"), "<pre><code>x\n</code></pre>", @@ -118,7 +117,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)" ); diff --git a/tests/thematic_break.rs b/tests/thematic_break.rs index 0cedada..1bb66cc 100644 --- a/tests/thematic_break.rs +++ b/tests/thematic_break.rs @@ -1,5 +1,5 @@ extern crate micromark; -use micromark::micromark; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn thematic_break() { @@ -165,10 +165,18 @@ fn thematic_break() { "should not support lazyness (2)" ); - // To do: turning things off. - // assert_eq!( - // micromark("***", {extensions: [{disable: {null: ["thematicBreak"]}}]}), - // "<p>***</p>", - // "should support turning off thematic breaks" - // ); + assert_eq!( + micromark_with_options( + "***", + &Options { + constructs: Constructs { + thematic_break: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "<p>***</p>", + "should support turning off thematic breaks" + ); } |