diff options
Diffstat (limited to '')
-rw-r--r-- | tests/commonmark.rs | 9142 |
1 files changed, 9142 insertions, 0 deletions
diff --git a/tests/commonmark.rs b/tests/commonmark.rs new file mode 100644 index 0000000..dade5ff --- /dev/null +++ b/tests/commonmark.rs @@ -0,0 +1,9142 @@ +//! CommonMark test suite. + +// > 👉 **Important**: this module is generated by `build.rs`. +// > It is generate from the latest Unicode data. + +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, +}; + +#[test] +fn commonmark() { + assert_eq!( + micromark_with_options( + r###" foo baz bim +"###, + DANGER + ), + r###"<pre><code>foo baz bim +</code></pre> +"###, + r###"Tabs (0)"### + ); + + assert_eq!( + micromark_with_options( + r###" foo baz bim +"###, + DANGER + ), + r###"<pre><code>foo baz bim +</code></pre> +"###, + r###"Tabs (1)"### + ); + + assert_eq!( + micromark_with_options( + r###" a a + ὐ a +"###, + DANGER + ), + r###"<pre><code>a a +ὐ a +</code></pre> +"###, + r###"Tabs (2)"### + ); + + assert_eq!( + micromark_with_options( + r###" - foo + + bar +"###, + DANGER + ), + r###"<ul> +<li> +<p>foo</p> +<p>bar</p> +</li> +</ul> +"###, + r###"Tabs (3)"### + ); + + assert_eq!( + micromark_with_options( + r###"- foo + + bar +"###, + DANGER + ), + r###"<ul> +<li> +<p>foo</p> +<pre><code> bar +</code></pre> +</li> +</ul> +"###, + r###"Tabs (4)"### + ); + + assert_eq!( + micromark_with_options( + r###"> foo +"###, + DANGER + ), + r###"<blockquote> +<pre><code> foo +</code></pre> +</blockquote> +"###, + r###"Tabs (5)"### + ); + + assert_eq!( + micromark_with_options( + r###"- foo +"###, + DANGER + ), + r###"<ul> +<li> +<pre><code> foo +</code></pre> +</li> +</ul> +"###, + r###"Tabs (6)"### + ); + + assert_eq!( + micromark_with_options( + r###" foo + bar +"###, + DANGER + ), + r###"<pre><code>foo +bar +</code></pre> +"###, + r###"Tabs (7)"### + ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options(r###" - foo + // - bar + // - baz + // "###, DANGER), + // r###"<ul> + // <li>foo + // <ul> + // <li>bar + // <ul> + // <li>baz</li> + // </ul> + // </li> + // </ul> + // </li> + // </ul> + // "###, + // r###"Tabs (8)"### + // ); + + assert_eq!( + micromark_with_options( + r###"# Foo +"###, + DANGER + ), + r###"<h1>Foo</h1> +"###, + r###"Tabs (9)"### + ); + + assert_eq!( + micromark_with_options( + r###"* * * +"###, + DANGER + ), + r###"<hr /> +"###, + r###"Tabs (10)"### + ); + + assert_eq!( + micromark_with_options( + r###"\!\"\#\$\%\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\\\]\^\_\`\{\|\}\~ +"###, + DANGER + ), + r###"<p>!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~</p> +"###, + r###"Backslash escapes (11)"### + ); + + assert_eq!( + micromark_with_options( + r###"\ \A\a\ \3\φ\« +"###, + DANGER + ), + r###"<p>\ \A\a\ \3\φ\«</p> +"###, + r###"Backslash escapes (12)"### + ); + + assert_eq!( + micromark_with_options( + r###"\*not emphasized* +\<br/> not a tag +\[not a link](/foo) +\`not code` +1\. not a list +\* not a list +\# not a heading +\[foo]: /url "not a reference" +\ö not a character entity +"###, + DANGER + ), + r###"<p>*not emphasized* +<br/> not a tag +[not a link](/foo) +`not code` +1. not a list +* not a list +# not a heading +[foo]: /url "not a reference" +&ouml; not a character entity</p> +"###, + r###"Backslash escapes (13)"### + ); + + assert_eq!( + micromark_with_options( + r###"\\*emphasis* +"###, + DANGER + ), + r###"<p>\<em>emphasis</em></p> +"###, + r###"Backslash escapes (14)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo\ +bar +"###, + DANGER + ), + r###"<p>foo<br /> +bar</p> +"###, + r###"Backslash escapes (15)"### + ); + + assert_eq!( + micromark_with_options( + r###"`` \[\` `` +"###, + DANGER + ), + r###"<p><code>\[\`</code></p> +"###, + r###"Backslash escapes (16)"### + ); + + assert_eq!( + micromark_with_options( + r###" \[\] +"###, + DANGER + ), + r###"<pre><code>\[\] +</code></pre> +"###, + r###"Backslash escapes (17)"### + ); + + assert_eq!( + micromark_with_options( + r###"~~~ +\[\] +~~~ +"###, + DANGER + ), + r###"<pre><code>\[\] +</code></pre> +"###, + r###"Backslash escapes (18)"### + ); + + assert_eq!( + 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 (19)"### + ); + + assert_eq!( + micromark_with_options( + r###"<a href="/bar\/)"> +"###, + DANGER + ), + r###"<a href="/bar\/)"> +"###, + r###"Backslash escapes (20)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo](/bar\* "ti\*tle") +"###, + DANGER + ), + r###"<p><a href="/bar*" title="ti*tle">foo</a></p> +"###, + r###"Backslash escapes (21)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo] + +[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\+bar +foo +``` +"###, + DANGER + ), + r###"<pre><code class="language-foo+bar">foo +</code></pre> +"###, + r###"Backslash escapes (23)"### + ); + + // To do: bug. + // assert_eq!( + // micromark_with_options(r###" & © Æ Ď + // ¾ ℋ ⅆ + // ∲ ≧̸ + // "###, DANGER), + // r###"<p> & © Æ Ď + // ¾ ℋ ⅆ + // ∲ ≧̸</p> + // "###, + // r###"Entity and numeric character references (24)"### + // ); + + assert_eq!( + micromark_with_options( + r###"# Ӓ Ϡ � +"###, + DANGER + ), + r###"<p># Ӓ Ϡ �</p> +"###, + r###"Entity and numeric character references (25)"### + ); + + assert_eq!( + micromark_with_options( + r###"" ആ ಫ +"###, + DANGER + ), + r###"<p>" ആ ಫ</p> +"###, + r###"Entity and numeric character references (26)"### + ); + + assert_eq!( + micromark_with_options( + r###"  &x; &#; &#x; +� +&#abcdef0; +&ThisIsNotDefined; &hi?; +"###, + DANGER + ), + r###"<p>&nbsp &x; &#; &#x; +&#87654321; +&#abcdef0; +&ThisIsNotDefined; &hi?;</p> +"###, + r###"Entity and numeric character references (27)"### + ); + + assert_eq!( + micromark_with_options( + r###"© +"###, + DANGER + ), + r###"<p>&copy</p> +"###, + r###"Entity and numeric character references (28)"### + ); + + assert_eq!( + micromark_with_options( + r###"&MadeUpEntity; +"###, + DANGER + ), + r###"<p>&MadeUpEntity;</p> +"###, + r###"Entity and numeric character references (29)"### + ); + + assert_eq!( + micromark_with_options( + r###"<a href="öö.html"> +"###, + DANGER + ), + r###"<a href="öö.html"> +"###, + r###"Entity and numeric character references (30)"### + ); + + assert_eq!( + 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 (31)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo] + +[foo]: /föö "föö" +"###, + DANGER + ), + r###"<p><a href="/f%C3%B6%C3%B6" title="föö">foo</a></p> +"###, + r###"Entity and numeric character references (32)"### + ); + + assert_eq!( + micromark_with_options( + r###"``` föö +foo +``` +"###, + DANGER + ), + r###"<pre><code class="language-föö">foo +</code></pre> +"###, + r###"Entity and numeric character references (33)"### + ); + + assert_eq!( + micromark_with_options( + r###"`föö` +"###, + DANGER + ), + r###"<p><code>f&ouml;&ouml;</code></p> +"###, + r###"Entity and numeric character references (34)"### + ); + + assert_eq!( + micromark_with_options( + r###" föfö +"###, + DANGER + ), + r###"<pre><code>f&ouml;f&ouml; +</code></pre> +"###, + r###"Entity and numeric character references (35)"### + ); + + assert_eq!( + micromark_with_options( + r###"*foo* +*foo* +"###, + DANGER + ), + r###"<p>*foo* +<em>foo</em></p> +"###, + r###"Entity and numeric character references (36)"### + ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options(r###"* foo + + // * foo + // "###, DANGER), + // r###"<p>* foo</p> + // <ul> + // <li>foo</li> + // </ul> + // "###, + // r###"Entity and numeric character references (37)"### + // ); + + assert_eq!( + micromark_with_options( + r###"foo bar +"###, + DANGER + ), + r###"<p>foo + +bar</p> +"###, + r###"Entity and numeric character references (38)"### + ); + + assert_eq!( + micromark_with_options( + r###"	foo +"###, + DANGER + ), + r###"<p> foo</p> +"###, + r###"Entity and numeric character references (39)"### + ); + + assert_eq!( + micromark_with_options( + r###"[a](url "tit") +"###, + DANGER + ), + r###"<p>[a](url "tit")</p> +"###, + r###"Entity and numeric character references (40)"### + ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options(r###"- `one + // - two` + // "###, DANGER), + // r###"<ul> + // <li>`one</li> + // <li>two`</li> + // </ul> + // "###, + // r###"Precedence (41)"### + // ); + + assert_eq!( + micromark_with_options( + r###"*** +--- +___ +"###, + DANGER + ), + r###"<hr /> +<hr /> +<hr /> +"###, + r###"Thematic breaks (42)"### + ); + + assert_eq!( + micromark_with_options( + r###"+++ +"###, + DANGER + ), + r###"<p>+++</p> +"###, + r###"Thematic breaks (43)"### + ); + + assert_eq!( + micromark_with_options( + r###"=== +"###, + DANGER + ), + r###"<p>===</p> +"###, + r###"Thematic breaks (44)"### + ); + + assert_eq!( + micromark_with_options( + r###"-- +** +__ +"###, + DANGER + ), + r###"<p>-- +** +__</p> +"###, + r###"Thematic breaks (45)"### + ); + + assert_eq!( + micromark_with_options( + r###" *** + *** + *** +"###, + DANGER + ), + r###"<hr /> +<hr /> +<hr /> +"###, + r###"Thematic breaks (46)"### + ); + + assert_eq!( + micromark_with_options( + r###" *** +"###, + DANGER + ), + r###"<pre><code>*** +</code></pre> +"###, + r###"Thematic breaks (47)"### + ); + + assert_eq!( + micromark_with_options( + r###"Foo + *** +"###, + DANGER + ), + r###"<p>Foo +***</p> +"###, + r###"Thematic breaks (48)"### + ); + + assert_eq!( + micromark_with_options( + r###"_____________________________________ +"###, + DANGER + ), + r###"<hr /> +"###, + r###"Thematic breaks (49)"### + ); + + assert_eq!( + micromark_with_options( + r###" - - - +"###, + DANGER + ), + r###"<hr /> +"###, + r###"Thematic breaks (50)"### + ); + + assert_eq!( + micromark_with_options( + r###" ** * ** * ** * ** +"###, + DANGER + ), + r###"<hr /> +"###, + r###"Thematic breaks (51)"### + ); + + assert_eq!( + micromark_with_options( + r###"- - - - +"###, + DANGER + ), + r###"<hr /> +"###, + r###"Thematic breaks (52)"### + ); + + assert_eq!( + micromark_with_options( + r###"- - - - +"###, + DANGER + ), + r###"<hr /> +"###, + r###"Thematic breaks (53)"### + ); + + assert_eq!( + micromark_with_options( + r###"_ _ _ _ a + +a------ + +---a--- +"###, + DANGER + ), + r###"<p>_ _ _ _ a</p> +<p>a------</p> +<p>---a---</p> +"###, + r###"Thematic breaks (54)"### + ); + + assert_eq!( + micromark_with_options( + r###" *-* +"###, + DANGER + ), + r###"<p><em>-</em></p> +"###, + r###"Thematic breaks (55)"### + ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options(r###"- foo + // *** + // - bar + // "###, DANGER), + // r###"<ul> + // <li>foo</li> + // </ul> + // <hr /> + // <ul> + // <li>bar</li> + // </ul> + // "###, + // r###"Thematic breaks (56)"### + // ); + + assert_eq!( + micromark_with_options( + r###"Foo +*** +bar +"###, + DANGER + ), + r###"<p>Foo</p> +<hr /> +<p>bar</p> +"###, + r###"Thematic breaks (57)"### + ); + + assert_eq!( + micromark_with_options( + r###"Foo +--- +bar +"###, + DANGER + ), + r###"<h2>Foo</h2> +<p>bar</p> +"###, + r###"Thematic breaks (58)"### + ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options(r###"* Foo + // * * * + // * Bar + // "###, DANGER), + // r###"<ul> + // <li>Foo</li> + // </ul> + // <hr /> + // <ul> + // <li>Bar</li> + // </ul> + // "###, + // r###"Thematic breaks (59)"### + // ); + + assert_eq!( + micromark_with_options( + r###"- Foo +- * * * +"###, + DANGER + ), + r###"<ul> +<li>Foo</li> +<li> +<hr /> +</li> +</ul> +"###, + r###"Thematic breaks (60)"### + ); + + assert_eq!( + micromark_with_options( + r###"# foo +## foo +### foo +#### foo +##### foo +###### foo +"###, + DANGER + ), + r###"<h1>foo</h1> +<h2>foo</h2> +<h3>foo</h3> +<h4>foo</h4> +<h5>foo</h5> +<h6>foo</h6> +"###, + r###"ATX headings (61)"### + ); + + assert_eq!( + micromark_with_options( + r###"####### foo +"###, + DANGER + ), + r###"<p>####### foo</p> +"###, + r###"ATX headings (62)"### + ); + + assert_eq!( + micromark_with_options( + r###"#5 bolt + +#hashtag +"###, + DANGER + ), + r###"<p>#5 bolt</p> +<p>#hashtag</p> +"###, + r###"ATX headings (63)"### + ); + + assert_eq!( + micromark_with_options( + r###"\## foo +"###, + DANGER + ), + r###"<p>## foo</p> +"###, + r###"ATX headings (64)"### + ); + + assert_eq!( + micromark_with_options( + r###"# foo *bar* \*baz\* +"###, + DANGER + ), + r###"<h1>foo <em>bar</em> *baz*</h1> +"###, + r###"ATX headings (65)"### + ); + + assert_eq!( + micromark_with_options( + r###"# foo +"###, + DANGER + ), + r###"<h1>foo</h1> +"###, + r###"ATX headings (66)"### + ); + + assert_eq!( + micromark_with_options( + r###" ### foo + ## foo + # foo +"###, + DANGER + ), + r###"<h3>foo</h3> +<h2>foo</h2> +<h1>foo</h1> +"###, + r###"ATX headings (67)"### + ); + + assert_eq!( + micromark_with_options( + r###" # foo +"###, + DANGER + ), + r###"<pre><code># foo +</code></pre> +"###, + r###"ATX headings (68)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo + # bar +"###, + DANGER + ), + r###"<p>foo +# bar</p> +"###, + r###"ATX headings (69)"### + ); + + assert_eq!( + micromark_with_options( + r###"## foo ## + ### bar ### +"###, + DANGER + ), + r###"<h2>foo</h2> +<h3>bar</h3> +"###, + r###"ATX headings (70)"### + ); + + assert_eq!( + micromark_with_options( + r###"# foo ################################## +##### foo ## +"###, + DANGER + ), + r###"<h1>foo</h1> +<h5>foo</h5> +"###, + r###"ATX headings (71)"### + ); + + assert_eq!( + micromark_with_options( + r###"### foo ### +"###, + DANGER + ), + r###"<h3>foo</h3> +"###, + r###"ATX headings (72)"### + ); + + assert_eq!( + micromark_with_options( + r###"### foo ### b +"###, + DANGER + ), + r###"<h3>foo ### b</h3> +"###, + r###"ATX headings (73)"### + ); + + assert_eq!( + micromark_with_options( + r###"# foo# +"###, + DANGER + ), + r###"<h1>foo#</h1> +"###, + r###"ATX headings (74)"### + ); + + assert_eq!( + micromark_with_options( + r###"### foo \### +## foo #\## +# foo \# +"###, + DANGER + ), + r###"<h3>foo ###</h3> +<h2>foo ###</h2> +<h1>foo #</h1> +"###, + r###"ATX headings (75)"### + ); + + assert_eq!( + micromark_with_options( + r###"**** +## foo +**** +"###, + DANGER + ), + r###"<hr /> +<h2>foo</h2> +<hr /> +"###, + r###"ATX headings (76)"### + ); + + assert_eq!( + micromark_with_options( + r###"Foo bar +# baz +Bar foo +"###, + DANGER + ), + r###"<p>Foo bar</p> +<h1>baz</h1> +<p>Bar foo</p> +"###, + r###"ATX headings (77)"### + ); + + assert_eq!( + micromark_with_options( + r###"## +# +### ### +"###, + DANGER + ), + r###"<h2></h2> +<h1></h1> +<h3></h3> +"###, + r###"ATX headings (78)"### + ); + + assert_eq!( + micromark_with_options( + r###"Foo *bar* +========= + +Foo *bar* +--------- +"###, + DANGER + ), + r###"<h1>Foo <em>bar</em></h1> +<h2>Foo <em>bar</em></h2> +"###, + r###"Setext headings (79)"### + ); + + assert_eq!( + micromark_with_options( + r###"Foo *bar +baz* +==== +"###, + DANGER + ), + r###"<h1>Foo <em>bar +baz</em></h1> +"###, + r###"Setext headings (80)"### + ); + + assert_eq!( + micromark_with_options( + r###" Foo *bar +baz* +==== +"###, + DANGER + ), + r###"<h1>Foo <em>bar +baz</em></h1> +"###, + r###"Setext headings (81)"### + ); + + assert_eq!( + micromark_with_options( + r###"Foo +------------------------- + +Foo += +"###, + DANGER + ), + r###"<h2>Foo</h2> +<h1>Foo</h1> +"###, + r###"Setext headings (82)"### + ); + + assert_eq!( + micromark_with_options( + r###" Foo +--- + + Foo +----- + + Foo + === +"###, + DANGER + ), + r###"<h2>Foo</h2> +<h2>Foo</h2> +<h1>Foo</h1> +"###, + r###"Setext headings (83)"### + ); + + assert_eq!( + micromark_with_options( + r###" Foo + --- + + Foo +--- +"###, + DANGER + ), + r###"<pre><code>Foo +--- + +Foo +</code></pre> +<hr /> +"###, + r###"Setext headings (84)"### + ); + + assert_eq!( + micromark_with_options( + r###"Foo + ---- +"###, + DANGER + ), + r###"<h2>Foo</h2> +"###, + r###"Setext headings (85)"### + ); + + assert_eq!( + micromark_with_options( + r###"Foo + --- +"###, + DANGER + ), + r###"<p>Foo +---</p> +"###, + r###"Setext headings (86)"### + ); + + assert_eq!( + micromark_with_options( + r###"Foo += = + +Foo +--- - +"###, + DANGER + ), + r###"<p>Foo += =</p> +<p>Foo</p> +<hr /> +"###, + r###"Setext headings (87)"### + ); + + assert_eq!( + micromark_with_options( + r###"Foo +----- +"###, + DANGER + ), + r###"<h2>Foo</h2> +"###, + r###"Setext headings (88)"### + ); + + assert_eq!( + micromark_with_options( + r###"Foo\ +---- +"###, + DANGER + ), + r###"<h2>Foo\</h2> +"###, + r###"Setext headings (89)"### + ); + + assert_eq!( + micromark_with_options( + r###"`Foo +---- +` + +<a title="a lot +--- +of dashes"/> +"###, + DANGER + ), + r###"<h2>`Foo</h2> +<p>`</p> +<h2><a title="a lot</h2> +<p>of dashes"/></p> +"###, + r###"Setext headings (90)"### + ); + + assert_eq!( + micromark_with_options( + r###"> Foo +--- +"###, + DANGER + ), + r###"<blockquote> +<p>Foo</p> +</blockquote> +<hr /> +"###, + r###"Setext headings (91)"### + ); + + // To do: setext heading interrupt? + // assert_eq!( + // micromark_with_options(r###"> foo + // bar + // === + // "###, DANGER), + // r###"<blockquote> + // <p>foo + // bar + // ===</p> + // </blockquote> + // "###, + // r###"Setext headings (92)"### + // ); + + assert_eq!( + micromark_with_options( + r###"- Foo +--- +"###, + DANGER + ), + r###"<ul> +<li>Foo</li> +</ul> +<hr /> +"###, + r###"Setext headings (93)"### + ); + + assert_eq!( + micromark_with_options( + r###"Foo +Bar +--- +"###, + DANGER + ), + r###"<h2>Foo +Bar</h2> +"###, + r###"Setext headings (94)"### + ); + + assert_eq!( + micromark_with_options( + r###"--- +Foo +--- +Bar +--- +Baz +"###, + DANGER + ), + r###"<hr /> +<h2>Foo</h2> +<h2>Bar</h2> +<p>Baz</p> +"###, + r###"Setext headings (95)"### + ); + + assert_eq!( + micromark_with_options( + r###" +==== +"###, + DANGER + ), + r###"<p>====</p> +"###, + r###"Setext headings (96)"### + ); + + assert_eq!( + micromark_with_options( + r###"--- +--- +"###, + DANGER + ), + r###"<hr /> +<hr /> +"###, + r###"Setext headings (97)"### + ); + + assert_eq!( + micromark_with_options( + r###"- foo +----- +"###, + DANGER + ), + r###"<ul> +<li>foo</li> +</ul> +<hr /> +"###, + r###"Setext headings (98)"### + ); + + assert_eq!( + micromark_with_options( + r###" foo +--- +"###, + DANGER + ), + r###"<pre><code>foo +</code></pre> +<hr /> +"###, + r###"Setext headings (99)"### + ); + + assert_eq!( + micromark_with_options( + r###"> foo +----- +"###, + DANGER + ), + r###"<blockquote> +<p>foo</p> +</blockquote> +<hr /> +"###, + r###"Setext headings (100)"### + ); + + assert_eq!( + micromark_with_options( + r###"\> foo +------ +"###, + DANGER + ), + r###"<h2>> foo</h2> +"###, + r###"Setext headings (101)"### + ); + + assert_eq!( + micromark_with_options( + r###"Foo + +bar +--- +baz +"###, + DANGER + ), + r###"<p>Foo</p> +<h2>bar</h2> +<p>baz</p> +"###, + r###"Setext headings (102)"### + ); + + assert_eq!( + micromark_with_options( + r###"Foo +bar + +--- + +baz +"###, + DANGER + ), + r###"<p>Foo +bar</p> +<hr /> +<p>baz</p> +"###, + r###"Setext headings (103)"### + ); + + assert_eq!( + micromark_with_options( + r###"Foo +bar +* * * +baz +"###, + DANGER + ), + r###"<p>Foo +bar</p> +<hr /> +<p>baz</p> +"###, + r###"Setext headings (104)"### + ); + + assert_eq!( + micromark_with_options( + r###"Foo +bar +\--- +baz +"###, + DANGER + ), + r###"<p>Foo +bar +--- +baz</p> +"###, + r###"Setext headings (105)"### + ); + + assert_eq!( + micromark_with_options( + r###" a simple + indented code block +"###, + DANGER + ), + r###"<pre><code>a simple + indented code block +</code></pre> +"###, + r###"Indented code blocks (106)"### + ); + + assert_eq!( + micromark_with_options( + r###" - foo + + bar +"###, + DANGER + ), + r###"<ul> +<li> +<p>foo</p> +<p>bar</p> +</li> +</ul> +"###, + r###"Indented code blocks (107)"### + ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options(r###"1. foo + + // - bar + // "###, DANGER), + // r###"<ol> + // <li> + // <p>foo</p> + // <ul> + // <li>bar</li> + // </ul> + // </li> + // </ol> + // "###, + // r###"Indented code blocks (108)"### + // ); + + assert_eq!( + micromark_with_options( + r###" <a/> + *hi* + + - one +"###, + DANGER + ), + r###"<pre><code><a/> +*hi* + +- one +</code></pre> +"###, + r###"Indented code blocks (109)"### + ); + + assert_eq!( + micromark_with_options( + r###" chunk1 + + chunk2 + + + + chunk3 +"###, + DANGER + ), + r###"<pre><code>chunk1 + +chunk2 + + + +chunk3 +</code></pre> +"###, + r###"Indented code blocks (110)"### + ); + + assert_eq!( + micromark_with_options( + r###" chunk1 + + chunk2 +"###, + DANGER + ), + r###"<pre><code>chunk1 + + chunk2 +</code></pre> +"###, + r###"Indented code blocks (111)"### + ); + + assert_eq!( + micromark_with_options( + r###"Foo + bar + +"###, + DANGER + ), + r###"<p>Foo +bar</p> +"###, + r###"Indented code blocks (112)"### + ); + + assert_eq!( + micromark_with_options( + r###" foo +bar +"###, + DANGER + ), + r###"<pre><code>foo +</code></pre> +<p>bar</p> +"###, + r###"Indented code blocks (113)"### + ); + + assert_eq!( + micromark_with_options( + r###"# Heading + foo +Heading +------ + foo +---- +"###, + DANGER + ), + r###"<h1>Heading</h1> +<pre><code>foo +</code></pre> +<h2>Heading</h2> +<pre><code>foo +</code></pre> +<hr /> +"###, + r###"Indented code blocks (114)"### + ); + + assert_eq!( + micromark_with_options( + r###" foo + bar +"###, + DANGER + ), + r###"<pre><code> foo +bar +</code></pre> +"###, + r###"Indented code blocks (115)"### + ); + + assert_eq!( + micromark_with_options( + r###" + + foo + + +"###, + DANGER + ), + r###"<pre><code>foo +</code></pre> +"###, + r###"Indented code blocks (116)"### + ); + + assert_eq!( + micromark_with_options( + r###" foo +"###, + DANGER + ), + r###"<pre><code>foo +</code></pre> +"###, + r###"Indented code blocks (117)"### + ); + + assert_eq!( + micromark_with_options( + r###"``` +< + > +``` +"###, + DANGER + ), + r###"<pre><code>< + > +</code></pre> +"###, + r###"Fenced code blocks (118)"### + ); + + assert_eq!( + micromark_with_options( + r###"~~~ +< + > +~~~ +"###, + DANGER + ), + r###"<pre><code>< + > +</code></pre> +"###, + r###"Fenced code blocks (119)"### + ); + + assert_eq!( + micromark_with_options( + r###"`` +foo +`` +"###, + DANGER + ), + r###"<p><code>foo</code></p> +"###, + r###"Fenced code blocks (120)"### + ); + + assert_eq!( + micromark_with_options( + r###"``` +aaa +~~~ +``` +"###, + DANGER + ), + r###"<pre><code>aaa +~~~ +</code></pre> +"###, + r###"Fenced code blocks (121)"### + ); + + assert_eq!( + micromark_with_options( + r###"~~~ +aaa +``` +~~~ +"###, + DANGER + ), + r###"<pre><code>aaa +``` +</code></pre> +"###, + r###"Fenced code blocks (122)"### + ); + + assert_eq!( + micromark_with_options( + r###"```` +aaa +``` +`````` +"###, + DANGER + ), + r###"<pre><code>aaa +``` +</code></pre> +"###, + r###"Fenced code blocks (123)"### + ); + + assert_eq!( + micromark_with_options( + r###"~~~~ +aaa +~~~ +~~~~ +"###, + DANGER + ), + r###"<pre><code>aaa +~~~ +</code></pre> +"###, + r###"Fenced code blocks (124)"### + ); + + assert_eq!( + micromark_with_options( + r###"``` +"###, + DANGER + ), + r###"<pre><code></code></pre> +"###, + r###"Fenced code blocks (125)"### + ); + + assert_eq!( + micromark_with_options( + r###"````` + +``` +aaa +"###, + DANGER + ), + r###"<pre><code> +``` +aaa +</code></pre> +"###, + r###"Fenced code blocks (126)"### + ); + + assert_eq!( + micromark_with_options( + r###"> ``` +> aaa + +bbb +"###, + DANGER + ), + r###"<blockquote> +<pre><code>aaa +</code></pre> +</blockquote> +<p>bbb</p> +"###, + r###"Fenced code blocks (127)"### + ); + + assert_eq!( + micromark_with_options( + r###"``` + + +``` +"###, + DANGER + ), + r###"<pre><code> + +</code></pre> +"###, + r###"Fenced code blocks (128)"### + ); + + assert_eq!( + micromark_with_options( + r###"``` +``` +"###, + DANGER + ), + r###"<pre><code></code></pre> +"###, + r###"Fenced code blocks (129)"### + ); + + assert_eq!( + micromark_with_options( + r###" ``` + aaa +aaa +``` +"###, + DANGER + ), + r###"<pre><code>aaa +aaa +</code></pre> +"###, + r###"Fenced code blocks (130)"### + ); + + assert_eq!( + micromark_with_options( + r###" ``` +aaa + aaa +aaa + ``` +"###, + DANGER + ), + r###"<pre><code>aaa +aaa +aaa +</code></pre> +"###, + r###"Fenced code blocks (131)"### + ); + + assert_eq!( + micromark_with_options( + r###" ``` + aaa + aaa + aaa + ``` +"###, + DANGER + ), + r###"<pre><code>aaa + aaa +aaa +</code></pre> +"###, + r###"Fenced code blocks (132)"### + ); + + assert_eq!( + micromark_with_options( + r###" ``` + aaa + ``` +"###, + DANGER + ), + r###"<pre><code>``` +aaa +``` +</code></pre> +"###, + r###"Fenced code blocks (133)"### + ); + + assert_eq!( + micromark_with_options( + r###"``` +aaa + ``` +"###, + DANGER + ), + r###"<pre><code>aaa +</code></pre> +"###, + r###"Fenced code blocks (134)"### + ); + + assert_eq!( + micromark_with_options( + r###" ``` +aaa + ``` +"###, + DANGER + ), + r###"<pre><code>aaa +</code></pre> +"###, + r###"Fenced code blocks (135)"### + ); + + assert_eq!( + micromark_with_options( + r###"``` +aaa + ``` +"###, + DANGER + ), + r###"<pre><code>aaa + ``` +</code></pre> +"###, + r###"Fenced code blocks (136)"### + ); + + assert_eq!( + micromark_with_options( + r###"``` ``` +aaa +"###, + DANGER + ), + r###"<p><code> </code> +aaa</p> +"###, + r###"Fenced code blocks (137)"### + ); + + assert_eq!( + micromark_with_options( + r###"~~~~~~ +aaa +~~~ ~~ +"###, + DANGER + ), + r###"<pre><code>aaa +~~~ ~~ +</code></pre> +"###, + r###"Fenced code blocks (138)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo +``` +bar +``` +baz +"###, + DANGER + ), + r###"<p>foo</p> +<pre><code>bar +</code></pre> +<p>baz</p> +"###, + r###"Fenced code blocks (139)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo +--- +~~~ +bar +~~~ +# baz +"###, + DANGER + ), + r###"<h2>foo</h2> +<pre><code>bar +</code></pre> +<h1>baz</h1> +"###, + r###"Fenced code blocks (140)"### + ); + + assert_eq!( + micromark_with_options( + r###"```ruby +def foo(x) + return 3 +end +``` +"###, + DANGER + ), + r###"<pre><code class="language-ruby">def foo(x) + return 3 +end +</code></pre> +"###, + r###"Fenced code blocks (141)"### + ); + + assert_eq!( + micromark_with_options( + r###"~~~~ ruby startline=3 $%@#$ +def foo(x) + return 3 +end +~~~~~~~ +"###, + DANGER + ), + r###"<pre><code class="language-ruby">def foo(x) + return 3 +end +</code></pre> +"###, + r###"Fenced code blocks (142)"### + ); + + assert_eq!( + micromark_with_options( + r###"````; +```` +"###, + DANGER + ), + r###"<pre><code class="language-;"></code></pre> +"###, + r###"Fenced code blocks (143)"### + ); + + assert_eq!( + micromark_with_options( + r###"``` aa ``` +foo +"###, + DANGER + ), + r###"<p><code>aa</code> +foo</p> +"###, + r###"Fenced code blocks (144)"### + ); + + assert_eq!( + micromark_with_options( + r###"~~~ aa ``` ~~~ +foo +~~~ +"###, + DANGER + ), + r###"<pre><code class="language-aa">foo +</code></pre> +"###, + r###"Fenced code blocks (145)"### + ); + + assert_eq!( + micromark_with_options( + r###"``` +``` aaa +``` +"###, + DANGER + ), + r###"<pre><code>``` aaa +</code></pre> +"###, + r###"Fenced code blocks (146)"### + ); + + assert_eq!( + micromark_with_options( + r###"<table><tr><td> +<pre> +**Hello**, + +_world_. +</pre> +</td></tr></table> +"###, + DANGER + ), + r###"<table><tr><td> +<pre> +**Hello**, +<p><em>world</em>. +</pre></p> +</td></tr></table> +"###, + r###"HTML blocks (147)"### + ); + + assert_eq!( + micromark_with_options( + r###"<table> + <tr> + <td> + hi + </td> + </tr> +</table> + +okay. +"###, + DANGER + ), + r###"<table> + <tr> + <td> + hi + </td> + </tr> +</table> +<p>okay.</p> +"###, + r###"HTML blocks (148)"### + ); + + assert_eq!( + micromark_with_options( + r###" <div> + *hello* + <foo><a> +"###, + DANGER + ), + r###" <div> + *hello* + <foo><a> +"###, + r###"HTML blocks (149)"### + ); + + assert_eq!( + micromark_with_options( + r###"</div> +*foo* +"###, + DANGER + ), + r###"</div> +*foo* +"###, + r###"HTML blocks (150)"### + ); + + assert_eq!( + micromark_with_options( + r###"<DIV CLASS="foo"> + +*Markdown* + +</DIV> +"###, + DANGER + ), + r###"<DIV CLASS="foo"> +<p><em>Markdown</em></p> +</DIV> +"###, + r###"HTML blocks (151)"### + ); + + assert_eq!( + micromark_with_options( + r###"<div id="foo" + class="bar"> +</div> +"###, + DANGER + ), + r###"<div id="foo" + class="bar"> +</div> +"###, + r###"HTML blocks (152)"### + ); + + assert_eq!( + micromark_with_options( + r###"<div id="foo" class="bar + baz"> +</div> +"###, + DANGER + ), + r###"<div id="foo" class="bar + baz"> +</div> +"###, + r###"HTML blocks (153)"### + ); + + assert_eq!( + micromark_with_options( + r###"<div> +*foo* + +*bar* +"###, + DANGER + ), + r###"<div> +*foo* +<p><em>bar</em></p> +"###, + r###"HTML blocks (154)"### + ); + + assert_eq!( + micromark_with_options( + r###"<div id="foo" +*hi* +"###, + DANGER + ), + r###"<div id="foo" +*hi* +"###, + r###"HTML blocks (155)"### + ); + + assert_eq!( + micromark_with_options( + r###"<div class +foo +"###, + DANGER + ), + r###"<div class +foo +"###, + r###"HTML blocks (156)"### + ); + + assert_eq!( + micromark_with_options( + r###"<div *???-&&&-<--- +*foo* +"###, + DANGER + ), + r###"<div *???-&&&-<--- +*foo* +"###, + r###"HTML blocks (157)"### + ); + + assert_eq!( + micromark_with_options( + r###"<div><a href="bar">*foo*</a></div> +"###, + DANGER + ), + r###"<div><a href="bar">*foo*</a></div> +"###, + r###"HTML blocks (158)"### + ); + + assert_eq!( + micromark_with_options( + r###"<table><tr><td> +foo +</td></tr></table> +"###, + DANGER + ), + r###"<table><tr><td> +foo +</td></tr></table> +"###, + r###"HTML blocks (159)"### + ); + + assert_eq!( + micromark_with_options( + r###"<div></div> +``` c +int x = 33; +``` +"###, + DANGER + ), + r###"<div></div> +``` c +int x = 33; +``` +"###, + r###"HTML blocks (160)"### + ); + + assert_eq!( + micromark_with_options( + r###"<a href="foo"> +*bar* +</a> +"###, + DANGER + ), + r###"<a href="foo"> +*bar* +</a> +"###, + r###"HTML blocks (161)"### + ); + + assert_eq!( + micromark_with_options( + r###"<Warning> +*bar* +</Warning> +"###, + DANGER + ), + r###"<Warning> +*bar* +</Warning> +"###, + r###"HTML blocks (162)"### + ); + + assert_eq!( + micromark_with_options( + r###"<i class="foo"> +*bar* +</i> +"###, + DANGER + ), + r###"<i class="foo"> +*bar* +</i> +"###, + r###"HTML blocks (163)"### + ); + + assert_eq!( + micromark_with_options( + r###"</ins> +*bar* +"###, + DANGER + ), + r###"</ins> +*bar* +"###, + r###"HTML blocks (164)"### + ); + + assert_eq!( + micromark_with_options( + r###"<del> +*foo* +</del> +"###, + DANGER + ), + r###"<del> +*foo* +</del> +"###, + r###"HTML blocks (165)"### + ); + + assert_eq!( + micromark_with_options( + r###"<del> + +*foo* + +</del> +"###, + DANGER + ), + r###"<del> +<p><em>foo</em></p> +</del> +"###, + r###"HTML blocks (166)"### + ); + + assert_eq!( + micromark_with_options( + r###"<del>*foo*</del> +"###, + DANGER + ), + r###"<p><del><em>foo</em></del></p> +"###, + r###"HTML blocks (167)"### + ); + + assert_eq!( + micromark_with_options( + r###"<pre language="haskell"><code> +import Text.HTML.TagSoup + +main :: IO () +main = print $ parseTags tags +</code></pre> +okay +"###, + DANGER + ), + r###"<pre language="haskell"><code> +import Text.HTML.TagSoup + +main :: IO () +main = print $ parseTags tags +</code></pre> +<p>okay</p> +"###, + r###"HTML blocks (168)"### + ); + + assert_eq!( + micromark_with_options( + r###"<script type="text/javascript"> +// JavaScript example + +document.getElementById("demo").innerHTML = "Hello JavaScript!"; +</script> +okay +"###, + DANGER + ), + r###"<script type="text/javascript"> +// JavaScript example + +document.getElementById("demo").innerHTML = "Hello JavaScript!"; +</script> +<p>okay</p> +"###, + r###"HTML blocks (169)"### + ); + + assert_eq!( + micromark_with_options( + r###"<textarea> + +*foo* + +_bar_ + +</textarea> +"###, + DANGER + ), + r###"<textarea> + +*foo* + +_bar_ + +</textarea> +"###, + r###"HTML blocks (170)"### + ); + + assert_eq!( + micromark_with_options( + r###"<style + type="text/css"> +h1 {color:red;} + +p {color:blue;} +</style> +okay +"###, + DANGER + ), + r###"<style + type="text/css"> +h1 {color:red;} + +p {color:blue;} +</style> +<p>okay</p> +"###, + r###"HTML blocks (171)"### + ); + + assert_eq!( + micromark_with_options( + r###"<style + type="text/css"> + +foo +"###, + DANGER + ), + r###"<style + type="text/css"> + +foo +"###, + r###"HTML blocks (172)"### + ); + + assert_eq!( + micromark_with_options( + r###"> <div> +> foo + +bar +"###, + DANGER + ), + r###"<blockquote> +<div> +foo +</blockquote> +<p>bar</p> +"###, + r###"HTML blocks (173)"### + ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options(r###"- <div> + // - foo + // "###, DANGER), + // r###"<ul> + // <li> + // <div> + // </li> + // <li>foo</li> + // </ul> + // "###, + // r###"HTML blocks (174)"### + // ); + + assert_eq!( + micromark_with_options( + r###"<style>p{color:red;}</style> +*foo* +"###, + DANGER + ), + r###"<style>p{color:red;}</style> +<p><em>foo</em></p> +"###, + r###"HTML blocks (175)"### + ); + + assert_eq!( + micromark_with_options( + r###"<!-- foo -->*bar* +*baz* +"###, + DANGER + ), + r###"<!-- foo -->*bar* +<p><em>baz</em></p> +"###, + r###"HTML blocks (176)"### + ); + + assert_eq!( + micromark_with_options( + r###"<script> +foo +</script>1. *bar* +"###, + DANGER + ), + r###"<script> +foo +</script>1. *bar* +"###, + r###"HTML blocks (177)"### + ); + + assert_eq!( + micromark_with_options( + r###"<!-- Foo + +bar + baz --> +okay +"###, + DANGER + ), + r###"<!-- Foo + +bar + baz --> +<p>okay</p> +"###, + r###"HTML blocks (178)"### + ); + + assert_eq!( + micromark_with_options( + r###"<?php + + echo '>'; + +?> +okay +"###, + DANGER + ), + r###"<?php + + echo '>'; + +?> +<p>okay</p> +"###, + r###"HTML blocks (179)"### + ); + + assert_eq!( + micromark_with_options( + r###"<!DOCTYPE html> +"###, + DANGER + ), + r###"<!DOCTYPE html> +"###, + r###"HTML blocks (180)"### + ); + + assert_eq!( + micromark_with_options( + r###"<![CDATA[ +function matchwo(a,b) +{ + if (a < b && a < 0) then { + return 1; + + } else { + + return 0; + } +} +]]> +okay +"###, + DANGER + ), + r###"<![CDATA[ +function matchwo(a,b) +{ + if (a < b && a < 0) then { + return 1; + + } else { + + return 0; + } +} +]]> +<p>okay</p> +"###, + r###"HTML blocks (181)"### + ); + + assert_eq!( + micromark_with_options( + r###" <!-- foo --> + + <!-- foo --> +"###, + DANGER + ), + r###" <!-- foo --> +<pre><code><!-- foo --> +</code></pre> +"###, + r###"HTML blocks (182)"### + ); + + assert_eq!( + micromark_with_options( + r###" <div> + + <div> +"###, + DANGER + ), + r###" <div> +<pre><code><div> +</code></pre> +"###, + r###"HTML blocks (183)"### + ); + + assert_eq!( + micromark_with_options( + r###"Foo +<div> +bar +</div> +"###, + DANGER + ), + r###"<p>Foo</p> +<div> +bar +</div> +"###, + r###"HTML blocks (184)"### + ); + + assert_eq!( + micromark_with_options( + r###"<div> +bar +</div> +*foo* +"###, + DANGER + ), + r###"<div> +bar +</div> +*foo* +"###, + r###"HTML blocks (185)"### + ); + + assert_eq!( + micromark_with_options( + r###"Foo +<a href="bar"> +baz +"###, + DANGER + ), + r###"<p>Foo +<a href="bar"> +baz</p> +"###, + r###"HTML blocks (186)"### + ); + + assert_eq!( + micromark_with_options( + r###"<div> + +*Emphasized* text. + +</div> +"###, + DANGER + ), + r###"<div> +<p><em>Emphasized</em> text.</p> +</div> +"###, + r###"HTML blocks (187)"### + ); + + assert_eq!( + micromark_with_options( + r###"<div> +*Emphasized* text. +</div> +"###, + DANGER + ), + r###"<div> +*Emphasized* text. +</div> +"###, + r###"HTML blocks (188)"### + ); + + assert_eq!( + micromark_with_options( + r###"<table> + +<tr> + +<td> +Hi +</td> + +</tr> + +</table> +"###, + DANGER + ), + r###"<table> +<tr> +<td> +Hi +</td> +</tr> +</table> +"###, + r###"HTML blocks (189)"### + ); + + assert_eq!( + micromark_with_options( + r###"<table> + + <tr> + + <td> + Hi + </td> + + </tr> + +</table> +"###, + DANGER + ), + r###"<table> + <tr> +<pre><code><td> + Hi +</td> +</code></pre> + </tr> +</table> +"###, + r###"HTML blocks (190)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo]: /url "title" + +[foo] +"###, + DANGER + ), + r###"<p><a href="/url" title="title">foo</a></p> +"###, + r###"Link reference definitions (191)"### + ); + + assert_eq!( + micromark_with_options( + r###" [foo]: + /url + 'the title' + +[foo] +"###, + DANGER + ), + r###"<p><a href="/url" title="the title">foo</a></p> +"###, + r###"Link reference definitions (192)"### + ); + + assert_eq!( + micromark_with_options( + r###"[Foo*bar\]]:my_(url) 'title (with parens)' + +[Foo*bar\]] +"###, + DANGER + ), + r###"<p><a href="my_(url)" title="title (with parens)">Foo*bar]</a></p> +"###, + r###"Link reference definitions (193)"### + ); + + assert_eq!( + micromark_with_options( + r###"[Foo bar]: +<my url> +'title' + +[Foo bar] +"###, + DANGER + ), + r###"<p><a href="my%20url" title="title">Foo bar</a></p> +"###, + r###"Link reference definitions (194)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo]: /url ' +title +line1 +line2 +' + +[foo] +"###, + DANGER + ), + r###"<p><a href="/url" title=" +title +line1 +line2 +">foo</a></p> +"###, + r###"Link reference definitions (195)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo]: /url 'title + +with blank line' + +[foo] +"###, + DANGER + ), + r###"<p>[foo]: /url 'title</p> +<p>with blank line'</p> +<p>[foo]</p> +"###, + r###"Link reference definitions (196)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo]: +/url + +[foo] +"###, + DANGER + ), + r###"<p><a href="/url">foo</a></p> +"###, + r###"Link reference definitions (197)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo]: + +[foo] +"###, + DANGER + ), + r###"<p>[foo]:</p> +<p>[foo]</p> +"###, + r###"Link reference definitions (198)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo]: <> + +[foo] +"###, + DANGER + ), + r###"<p><a href="">foo</a></p> +"###, + r###"Link reference definitions (199)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo]: <bar>(baz) + +[foo] +"###, + DANGER + ), + r###"<p>[foo]: <bar>(baz)</p> +<p>[foo]</p> +"###, + r###"Link reference definitions (200)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo]: /url\bar\*baz "foo\"bar\baz" + +[foo] +"###, + DANGER + ), + r###"<p><a href="/url%5Cbar*baz" title="foo"bar\baz">foo</a></p> +"###, + r###"Link reference definitions (201)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo] + +[foo]: url +"###, + DANGER + ), + r###"<p><a href="url">foo</a></p> +"###, + r###"Link reference definitions (202)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo] + +[foo]: first +[foo]: second +"###, + DANGER + ), + r###"<p><a href="first">foo</a></p> +"###, + r###"Link reference definitions (203)"### + ); + + assert_eq!( + micromark_with_options( + r###"[FOO]: /url + +[Foo] +"###, + DANGER + ), + r###"<p><a href="/url">Foo</a></p> +"###, + r###"Link reference definitions (204)"### + ); + + assert_eq!( + micromark_with_options( + r###"[ΑΓΩ]: /φου + +[αγω] +"###, + DANGER + ), + r###"<p><a href="/%CF%86%CE%BF%CF%85">αγω</a></p> +"###, + r###"Link reference definitions (205)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo]: /url +"###, + DANGER + ), + r###""###, + r###"Link reference definitions (206)"### + ); + + assert_eq!( + micromark_with_options( + r###"[ +foo +]: /url +bar +"###, + DANGER + ), + r###"<p>bar</p> +"###, + r###"Link reference definitions (207)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo]: /url "title" ok +"###, + DANGER + ), + r###"<p>[foo]: /url "title" ok</p> +"###, + r###"Link reference definitions (208)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo]: /url +"title" ok +"###, + DANGER + ), + r###"<p>"title" ok</p> +"###, + r###"Link reference definitions (209)"### + ); + + assert_eq!( + micromark_with_options( + r###" [foo]: /url "title" + +[foo] +"###, + DANGER + ), + r###"<pre><code>[foo]: /url "title" +</code></pre> +<p>[foo]</p> +"###, + r###"Link reference definitions (210)"### + ); + + assert_eq!( + micromark_with_options( + r###"``` +[foo]: /url +``` + +[foo] +"###, + DANGER + ), + r###"<pre><code>[foo]: /url +</code></pre> +<p>[foo]</p> +"###, + r###"Link reference definitions (211)"### + ); + + assert_eq!( + micromark_with_options( + r###"Foo +[bar]: /baz + +[bar] +"###, + DANGER + ), + r###"<p>Foo +[bar]: /baz</p> +<p>[bar]</p> +"###, + r###"Link reference definitions (212)"### + ); + + assert_eq!( + micromark_with_options( + r###"# [Foo] +[foo]: /url +> bar +"###, + DANGER + ), + r###"<h1><a href="/url">Foo</a></h1> +<blockquote> +<p>bar</p> +</blockquote> +"###, + r###"Link reference definitions (213)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo]: /url +bar +=== +[foo] +"###, + DANGER + ), + r###"<h1>bar</h1> +<p><a href="/url">foo</a></p> +"###, + r###"Link reference definitions (214)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo]: /url +=== +[foo] +"###, + DANGER + ), + r###"<p>=== +<a href="/url">foo</a></p> +"###, + r###"Link reference definitions (215)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo]: /foo-url "foo" +[bar]: /bar-url + "bar" +[baz]: /baz-url + +[foo], +[bar], +[baz] +"###, + DANGER + ), + r###"<p><a href="/foo-url" title="foo">foo</a>, +<a href="/bar-url" title="bar">bar</a>, +<a href="/baz-url">baz</a></p> +"###, + r###"Link reference definitions (216)"### + ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options(r###"[foo] + + // > [foo]: /url + // "###, DANGER), + // r###"<p><a href="/url">foo</a></p> + // <blockquote> + // </blockquote> + // "###, + // r###"Link reference definitions (217)"### + // ); + + assert_eq!( + micromark_with_options( + r###"aaa + +bbb +"###, + DANGER + ), + r###"<p>aaa</p> +<p>bbb</p> +"###, + r###"Paragraphs (218)"### + ); + + assert_eq!( + micromark_with_options( + r###"aaa +bbb + +ccc +ddd +"###, + DANGER + ), + r###"<p>aaa +bbb</p> +<p>ccc +ddd</p> +"###, + r###"Paragraphs (219)"### + ); + + assert_eq!( + micromark_with_options( + r###"aaa + + +bbb +"###, + DANGER + ), + r###"<p>aaa</p> +<p>bbb</p> +"###, + r###"Paragraphs (220)"### + ); + + assert_eq!( + micromark_with_options( + r###" aaa + bbb +"###, + DANGER + ), + r###"<p>aaa +bbb</p> +"###, + r###"Paragraphs (221)"### + ); + + assert_eq!( + micromark_with_options( + r###"aaa + bbb + ccc +"###, + DANGER + ), + r###"<p>aaa +bbb +ccc</p> +"###, + r###"Paragraphs (222)"### + ); + + assert_eq!( + micromark_with_options( + r###" aaa +bbb +"###, + DANGER + ), + r###"<p>aaa +bbb</p> +"###, + r###"Paragraphs (223)"### + ); + + assert_eq!( + micromark_with_options( + r###" aaa +bbb +"###, + DANGER + ), + r###"<pre><code>aaa +</code></pre> +<p>bbb</p> +"###, + r###"Paragraphs (224)"### + ); + + // To do: whitespace trimming of editor likely? + // assert_eq!( + // micromark_with_options(r###"aaa + // bbb + // "###, DANGER), + // r###"<p>aaa<br /> + // bbb</p> + // "###, + // r###"Paragraphs (225)"### + // ); + + assert_eq!( + micromark_with_options( + r###" + +aaa + + +# aaa + + +"###, + DANGER + ), + r###"<p>aaa</p> +<h1>aaa</h1> +"###, + r###"Blank lines (226)"### + ); + + assert_eq!( + micromark_with_options( + r###"> # Foo +> bar +> baz +"###, + DANGER + ), + r###"<blockquote> +<h1>Foo</h1> +<p>bar +baz</p> +</blockquote> +"###, + r###"Block quotes (227)"### + ); + + assert_eq!( + micromark_with_options( + r###"># Foo +>bar +> baz +"###, + DANGER + ), + r###"<blockquote> +<h1>Foo</h1> +<p>bar +baz</p> +</blockquote> +"###, + r###"Block quotes (228)"### + ); + + assert_eq!( + micromark_with_options( + r###" > # Foo + > bar + > baz +"###, + DANGER + ), + r###"<blockquote> +<h1>Foo</h1> +<p>bar +baz</p> +</blockquote> +"###, + r###"Block quotes (229)"### + ); + + assert_eq!( + micromark_with_options( + r###" > # Foo + > bar + > baz +"###, + DANGER + ), + r###"<pre><code>> # Foo +> bar +> baz +</code></pre> +"###, + r###"Block quotes (230)"### + ); + + // To do: whitespace trimming of editor likely? + // assert_eq!( + // micromark_with_options(r###"> # Foo + // > bar + // baz + // "###, DANGER), + // r###"<blockquote> + // <h1>Foo</h1> + // <p>bar + // baz</p> + // </blockquote> + // "###, + // r###"Block quotes (231)"### + // ); + + assert_eq!( + micromark_with_options( + r###"> bar +baz +> foo +"###, + DANGER + ), + r###"<blockquote> +<p>bar +baz +foo</p> +</blockquote> +"###, + r###"Block quotes (232)"### + ); + + assert_eq!( + micromark_with_options( + r###"> foo +--- +"###, + DANGER + ), + r###"<blockquote> +<p>foo</p> +</blockquote> +<hr /> +"###, + r###"Block quotes (233)"### + ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options(r###"> - foo + // - bar + // "###, DANGER), + // r###"<blockquote> + // <ul> + // <li>foo</li> + // </ul> + // </blockquote> + // <ul> + // <li>bar</li> + // </ul> + // "###, + // r###"Block quotes (234)"### + // ); + + assert_eq!( + micromark_with_options( + r###"> foo + bar +"###, + DANGER + ), + r###"<blockquote> +<pre><code>foo +</code></pre> +</blockquote> +<pre><code>bar +</code></pre> +"###, + r###"Block quotes (235)"### + ); + + assert_eq!( + micromark_with_options( + r###"> ``` +foo +``` +"###, + DANGER + ), + r###"<blockquote> +<pre><code></code></pre> +</blockquote> +<p>foo</p> +<pre><code></code></pre> +"###, + r###"Block quotes (236)"### + ); + + // To do: some bug with laziness. + // assert_eq!( + // micromark_with_options(r###"> foo + // - bar + // "###, DANGER), + // r###"<blockquote> + // <p>foo + // - bar</p> + // </blockquote> + // "###, + // r###"Block quotes (237)"### + // ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options(r###"> + // "###, DANGER), + // r###"<blockquote> + // </blockquote> + // "###, + // r###"Block quotes (238)"### + // ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options(r###"> + // > + // > + // "###, DANGER), + // r###"<blockquote> + // </blockquote> + // "###, + // r###"Block quotes (239)"### + // ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options(r###"> + // > foo + // > + // "###, DANGER), + // r###"<blockquote> + // <p>foo</p> + // </blockquote> + // "###, + // r###"Block quotes (240)"### + // ); + + assert_eq!( + micromark_with_options( + r###"> foo + +> bar +"###, + DANGER + ), + r###"<blockquote> +<p>foo</p> +</blockquote> +<blockquote> +<p>bar</p> +</blockquote> +"###, + r###"Block quotes (241)"### + ); + + assert_eq!( + micromark_with_options( + r###"> foo +> bar +"###, + DANGER + ), + r###"<blockquote> +<p>foo +bar</p> +</blockquote> +"###, + r###"Block quotes (242)"### + ); + + assert_eq!( + micromark_with_options( + r###"> foo +> +> bar +"###, + DANGER + ), + r###"<blockquote> +<p>foo</p> +<p>bar</p> +</blockquote> +"###, + r###"Block quotes (243)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo +> bar +"###, + DANGER + ), + r###"<p>foo</p> +<blockquote> +<p>bar</p> +</blockquote> +"###, + r###"Block quotes (244)"### + ); + + assert_eq!( + micromark_with_options( + r###"> aaa +*** +> bbb +"###, + DANGER + ), + r###"<blockquote> +<p>aaa</p> +</blockquote> +<hr /> +<blockquote> +<p>bbb</p> +</blockquote> +"###, + r###"Block quotes (245)"### + ); + + // To do: some bug with laziness. + // assert_eq!( + // micromark_with_options(r###"> bar + // baz + // "###, DANGER), + // r###"<blockquote> + // <p>bar + // baz</p> + // </blockquote> + // "###, + // r###"Block quotes (246)"### + // ); + + assert_eq!( + micromark_with_options( + r###"> bar + +baz +"###, + DANGER + ), + r###"<blockquote> +<p>bar</p> +</blockquote> +<p>baz</p> +"###, + r###"Block quotes (247)"### + ); + + assert_eq!( + micromark_with_options( + r###"> bar +> +baz +"###, + DANGER + ), + r###"<blockquote> +<p>bar</p> +</blockquote> +<p>baz</p> +"###, + r###"Block quotes (248)"### + ); + + // To do: some bug with laziness. + // assert_eq!( + // micromark_with_options(r###"> > > foo + // bar + // "###, DANGER), + // r###"<blockquote> + // <blockquote> + // <blockquote> + // <p>foo + // bar</p> + // </blockquote> + // </blockquote> + // </blockquote> + // "###, + // r###"Block quotes (249)"### + // ); + + // To do: some bug with laziness. + // assert_eq!( + // micromark_with_options(r###">>> foo + // > bar + // >>baz + // "###, DANGER), + // r###"<blockquote> + // <blockquote> + // <blockquote> + // <p>foo + // bar + // baz</p> + // </blockquote> + // </blockquote> + // </blockquote> + // "###, + // r###"Block quotes (250)"### + // ); + + assert_eq!( + micromark_with_options( + r###"> code + +> not code +"###, + DANGER + ), + r###"<blockquote> +<pre><code>code +</code></pre> +</blockquote> +<blockquote> +<p>not code</p> +</blockquote> +"###, + r###"Block quotes (251)"### + ); + + assert_eq!( + micromark_with_options( + r###"A paragraph +with two lines. + + indented code + +> A block quote. +"###, + DANGER + ), + r###"<p>A paragraph +with two lines.</p> +<pre><code>indented code +</code></pre> +<blockquote> +<p>A block quote.</p> +</blockquote> +"###, + r###"List items (252)"### + ); + + assert_eq!( + micromark_with_options( + r###"1. A paragraph + with two lines. + + indented code + + > A block quote. +"###, + DANGER + ), + r###"<ol> +<li> +<p>A paragraph +with two lines.</p> +<pre><code>indented code +</code></pre> +<blockquote> +<p>A block quote.</p> +</blockquote> +</li> +</ol> +"###, + r###"List items (253)"### + ); + + assert_eq!( + micromark_with_options( + r###"- one + + two +"###, + DANGER + ), + r###"<ul> +<li>one</li> +</ul> +<p>two</p> +"###, + r###"List items (254)"### + ); + + assert_eq!( + micromark_with_options( + r###"- one + + two +"###, + DANGER + ), + r###"<ul> +<li> +<p>one</p> +<p>two</p> +</li> +</ul> +"###, + r###"List items (255)"### + ); + + assert_eq!( + micromark_with_options( + r###" - one + + two +"###, + DANGER + ), + r###"<ul> +<li>one</li> +</ul> +<pre><code> two +</code></pre> +"###, + r###"List items (256)"### + ); + + assert_eq!( + micromark_with_options( + r###" - one + + two +"###, + DANGER + ), + r###"<ul> +<li> +<p>one</p> +<p>two</p> +</li> +</ul> +"###, + r###"List items (257)"### + ); + + assert_eq!( + micromark_with_options( + r###" > > 1. one +>> +>> two +"###, + DANGER + ), + r###"<blockquote> +<blockquote> +<ol> +<li> +<p>one</p> +<p>two</p> +</li> +</ol> +</blockquote> +</blockquote> +"###, + r###"List items (258)"### + ); + + assert_eq!( + micromark_with_options( + r###">>- one +>> + > > two +"###, + DANGER + ), + r###"<blockquote> +<blockquote> +<ul> +<li>one</li> +</ul> +<p>two</p> +</blockquote> +</blockquote> +"###, + r###"List items (259)"### + ); + + assert_eq!( + micromark_with_options( + r###"-one + +2.two +"###, + DANGER + ), + r###"<p>-one</p> +<p>2.two</p> +"###, + r###"List items (260)"### + ); + + assert_eq!( + micromark_with_options( + r###"- foo + + + bar +"###, + DANGER + ), + r###"<ul> +<li> +<p>foo</p> +<p>bar</p> +</li> +</ul> +"###, + r###"List items (261)"### + ); + + assert_eq!( + micromark_with_options( + r###"1. foo + + ``` + bar + ``` + + baz + + > bam +"###, + DANGER + ), + r###"<ol> +<li> +<p>foo</p> +<pre><code>bar +</code></pre> +<p>baz</p> +<blockquote> +<p>bam</p> +</blockquote> +</li> +</ol> +"###, + r###"List items (262)"### + ); + + assert_eq!( + micromark_with_options( + r###"- Foo + + bar + + + baz +"###, + DANGER + ), + r###"<ul> +<li> +<p>Foo</p> +<pre><code>bar + + +baz +</code></pre> +</li> +</ul> +"###, + r###"List items (263)"### + ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options(r###"123456789. ok + // "###, DANGER), + // r###"<ol start="123456789"> + // <li>ok</li> + // </ol> + // "###, + // r###"List items (264)"### + // ); + + assert_eq!( + micromark_with_options( + r###"1234567890. not ok +"###, + DANGER + ), + r###"<p>1234567890. not ok</p> +"###, + r###"List items (265)"### + ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options(r###"0. ok + // "###, DANGER), + // r###"<ol start="0"> + // <li>ok</li> + // </ol> + // "###, + // r###"List items (266)"### + // ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options(r###"003. ok + // "###, DANGER), + // r###"<ol start="3"> + // <li>ok</li> + // </ol> + // "###, + // r###"List items (267)"### + // ); + + assert_eq!( + micromark_with_options( + r###"-1. not ok +"###, + DANGER + ), + r###"<p>-1. not ok</p> +"###, + r###"List items (268)"### + ); + + assert_eq!( + micromark_with_options( + r###"- foo + + bar +"###, + DANGER + ), + r###"<ul> +<li> +<p>foo</p> +<pre><code>bar +</code></pre> +</li> +</ul> +"###, + r###"List items (269)"### + ); + + assert_eq!( + micromark_with_options( + r###" 10. foo + + bar +"###, + DANGER + ), + r###"<ol start="10"> +<li> +<p>foo</p> +<pre><code>bar +</code></pre> +</li> +</ol> +"###, + r###"List items (270)"### + ); + + assert_eq!( + micromark_with_options( + r###" indented code + +paragraph + + more code +"###, + DANGER + ), + r###"<pre><code>indented code +</code></pre> +<p>paragraph</p> +<pre><code>more code +</code></pre> +"###, + r###"List items (271)"### + ); + + assert_eq!( + micromark_with_options( + r###"1. indented code + + paragraph + + more code +"###, + DANGER + ), + r###"<ol> +<li> +<pre><code>indented code +</code></pre> +<p>paragraph</p> +<pre><code>more code +</code></pre> +</li> +</ol> +"###, + r###"List items (272)"### + ); + + assert_eq!( + micromark_with_options( + r###"1. indented code + + paragraph + + more code +"###, + DANGER + ), + r###"<ol> +<li> +<pre><code> indented code +</code></pre> +<p>paragraph</p> +<pre><code>more code +</code></pre> +</li> +</ol> +"###, + r###"List items (273)"### + ); + + assert_eq!( + micromark_with_options( + r###" foo + +bar +"###, + DANGER + ), + r###"<p>foo</p> +<p>bar</p> +"###, + r###"List items (274)"### + ); + + assert_eq!( + micromark_with_options( + r###"- foo + + bar +"###, + DANGER + ), + r###"<ul> +<li>foo</li> +</ul> +<p>bar</p> +"###, + r###"List items (275)"### + ); + + assert_eq!( + micromark_with_options( + r###"- foo + + bar +"###, + DANGER + ), + r###"<ul> +<li> +<p>foo</p> +<p>bar</p> +</li> +</ul> +"###, + r###"List items (276)"### + ); + + assert_eq!( + micromark_with_options( + r###"- + foo +- + ``` + bar + ``` +- + baz +"###, + DANGER + ), + r###"<ul> +<li>foo</li> +<li> +<pre><code>bar +</code></pre> +</li> +<li> +<pre><code>baz +</code></pre> +</li> +</ul> +"###, + r###"List items (277)"### + ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options(r###"- + // foo + // "###, DANGER), + // r###"<ul> + // <li>foo</li> + // </ul> + // "###, + // r###"List items (278)"### + // ); + + assert_eq!( + micromark_with_options( + r###"- + + foo +"###, + DANGER + ), + r###"<ul> +<li></li> +</ul> +<p>foo</p> +"###, + r###"List items (279)"### + ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"- foo + // - + // - bar + // "###, + // DANGER + // ), + // r###"<ul> + // <li>foo</li> + // <li></li> + // <li>bar</li> + // </ul> + // "###, + // r###"List items (280)"### + // ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"- foo + // - + // - bar + // "###, + // DANGER + // ), + // r###"<ul> + // <li>foo</li> + // <li></li> + // <li>bar</li> + // </ul> + // "###, + // r###"List items (281)"### + // ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"1. foo + // 2. + // 3. bar + // "###, + // DANGER + // ), + // r###"<ol> + // <li>foo</li> + // <li></li> + // <li>bar</li> + // </ol> + // "###, + // r###"List items (282)"### + // ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"* + // "###, + // DANGER + // ), + // r###"<ul> + // <li></li> + // </ul> + // "###, + // r###"List items (283)"### + // ); + + assert_eq!( + micromark_with_options( + r###"foo +* + +foo +1. +"###, + DANGER + ), + r###"<p>foo +*</p> +<p>foo +1.</p> +"###, + r###"List items (284)"### + ); + + assert_eq!( + micromark_with_options( + r###" 1. A paragraph + with two lines. + + indented code + + > A block quote. +"###, + DANGER + ), + r###"<ol> +<li> +<p>A paragraph +with two lines.</p> +<pre><code>indented code +</code></pre> +<blockquote> +<p>A block quote.</p> +</blockquote> +</li> +</ol> +"###, + r###"List items (285)"### + ); + + assert_eq!( + micromark_with_options( + r###" 1. A paragraph + with two lines. + + indented code + + > A block quote. +"###, + DANGER + ), + r###"<ol> +<li> +<p>A paragraph +with two lines.</p> +<pre><code>indented code +</code></pre> +<blockquote> +<p>A block quote.</p> +</blockquote> +</li> +</ol> +"###, + r###"List items (286)"### + ); + + assert_eq!( + micromark_with_options( + r###" 1. A paragraph + with two lines. + + indented code + + > A block quote. +"###, + DANGER + ), + r###"<ol> +<li> +<p>A paragraph +with two lines.</p> +<pre><code>indented code +</code></pre> +<blockquote> +<p>A block quote.</p> +</blockquote> +</li> +</ol> +"###, + r###"List items (287)"### + ); + + assert_eq!( + micromark_with_options( + r###" 1. A paragraph + with two lines. + + indented code + + > A block quote. +"###, + DANGER + ), + r###"<pre><code>1. A paragraph + with two lines. + + indented code + + > A block quote. +</code></pre> +"###, + r###"List items (288)"### + ); + + assert_eq!( + micromark_with_options( + r###" 1. A paragraph +with two lines. + + indented code + + > A block quote. +"###, + DANGER + ), + r###"<ol> +<li> +<p>A paragraph +with two lines.</p> +<pre><code>indented code +</code></pre> +<blockquote> +<p>A block quote.</p> +</blockquote> +</li> +</ol> +"###, + r###"List items (289)"### + ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###" 1. A paragraph + // with two lines. + // "###, + // DANGER + // ), + // r###"<ol> + // <li>A paragraph + // with two lines.</li> + // </ol> + // "###, + // r###"List items (290)"### + // ); + + // To do: some bug with laziness. + // assert_eq!( + // micromark_with_options( + // r###"> 1. > Blockquote + // continued here. + // "###, + // DANGER + // ), + // r###"<blockquote> + // <ol> + // <li> + // <blockquote> + // <p>Blockquote + // continued here.</p> + // </blockquote> + // </li> + // </ol> + // </blockquote> + // "###, + // r###"List items (291)"### + // ); + + // To do: some bug with laziness. + // assert_eq!( + // micromark_with_options( + // r###"> 1. > Blockquote + // > continued here. + // "###, + // DANGER + // ), + // r###"<blockquote> + // <ol> + // <li> + // <blockquote> + // <p>Blockquote + // continued here.</p> + // </blockquote> + // </li> + // </ol> + // </blockquote> + // "###, + // r###"List items (292)"### + // ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"- foo + // - bar + // - baz + // - boo + // "###, + // DANGER + // ), + // r###"<ul> + // <li>foo + // <ul> + // <li>bar + // <ul> + // <li>baz + // <ul> + // <li>boo</li> + // </ul> + // </li> + // </ul> + // </li> + // </ul> + // </li> + // </ul> + // "###, + // r###"List items (293)"### + // ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"- foo + // - bar + // - baz + // - boo + // "###, + // DANGER + // ), + // r###"<ul> + // <li>foo</li> + // <li>bar</li> + // <li>baz</li> + // <li>boo</li> + // </ul> + // "###, + // r###"List items (294)"### + // ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"10) foo + // - bar + // "###, + // DANGER + // ), + // r###"<ol start="10"> + // <li>foo + // <ul> + // <li>bar</li> + // </ul> + // </li> + // </ol> + // "###, + // r###"List items (295)"### + // ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"10) foo + // - bar + // "###, + // DANGER + // ), + // r###"<ol start="10"> + // <li>foo</li> + // </ol> + // <ul> + // <li>bar</li> + // </ul> + // "###, + // r###"List items (296)"### + // ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"- - foo + // "###, + // DANGER + // ), + // r###"<ul> + // <li> + // <ul> + // <li>foo</li> + // </ul> + // </li> + // </ul> + // "###, + // r###"List items (297)"### + // ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"1. - 2. foo + // "###, + // DANGER + // ), + // r###"<ol> + // <li> + // <ul> + // <li> + // <ol start="2"> + // <li>foo</li> + // </ol> + // </li> + // </ul> + // </li> + // </ol> + // "###, + // r###"List items (298)"### + // ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"- # Foo + // - Bar + // --- + // baz + // "###, + // DANGER + // ), + // r###"<ul> + // <li> + // <h1>Foo</h1> + // </li> + // <li> + // <h2>Bar</h2> + // baz</li> + // </ul> + // "###, + // r###"List items (299)"### + // ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"- foo + // - bar + // + baz + // "###, + // DANGER + // ), + // r###"<ul> + // <li>foo</li> + // <li>bar</li> + // </ul> + // <ul> + // <li>baz</li> + // </ul> + // "###, + // r###"Lists (300)"### + // ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"1. foo + // 2. bar + // 3) baz + // "###, + // DANGER + // ), + // r###"<ol> + // <li>foo</li> + // <li>bar</li> + // </ol> + // <ol start="3"> + // <li>baz</li> + // </ol> + // "###, + // r###"Lists (301)"### + // ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"Foo + // - bar + // - baz + // "###, + // DANGER + // ), + // r###"<p>Foo</p> + // <ul> + // <li>bar</li> + // <li>baz</li> + // </ul> + // "###, + // r###"Lists (302)"### + // ); + + // To do: some bug with interrupting. + // assert_eq!( + // micromark_with_options( + // r###"The number of windows in my house is + // 14. The number of doors is 6. + // "###, + // DANGER + // ), + // r###"<p>The number of windows in my house is + // 14. The number of doors is 6.</p> + // "###, + // r###"Lists (303)"### + // ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"The number of windows in my house is + // 1. The number of doors is 6. + // "###, + // DANGER + // ), + // r###"<p>The number of windows in my house is</p> + // <ol> + // <li>The number of doors is 6.</li> + // </ol> + // "###, + // r###"Lists (304)"### + // ); + + assert_eq!( + micromark_with_options( + r###"- foo + +- bar + + +- baz +"###, + DANGER + ), + r###"<ul> +<li> +<p>foo</p> +</li> +<li> +<p>bar</p> +</li> +<li> +<p>baz</p> +</li> +</ul> +"###, + r###"Lists (305)"### + ); + + assert_eq!( + micromark_with_options( + r###"- foo + - bar + - baz + + + bim +"###, + DANGER + ), + r###"<ul> +<li>foo +<ul> +<li>bar +<ul> +<li> +<p>baz</p> +<p>bim</p> +</li> +</ul> +</li> +</ul> +</li> +</ul> +"###, + r###"Lists (306)"### + ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"- foo + // - bar + + // <!-- --> + + // - baz + // - bim + // "###, + // DANGER + // ), + // r###"<ul> + // <li>foo</li> + // <li>bar</li> + // </ul> + // <!-- --> + // <ul> + // <li>baz</li> + // <li>bim</li> + // </ul> + // "###, + // r###"Lists (307)"### + // ); + + assert_eq!( + micromark_with_options( + r###"- foo + + notcode + +- foo + +<!-- --> + + code +"###, + DANGER + ), + r###"<ul> +<li> +<p>foo</p> +<p>notcode</p> +</li> +<li> +<p>foo</p> +</li> +</ul> +<!-- --> +<pre><code>code +</code></pre> +"###, + r###"Lists (308)"### + ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"- a + // - b + // - c + // - d + // - e + // - f + // - g + // "###, + // DANGER + // ), + // r###"<ul> + // <li>a</li> + // <li>b</li> + // <li>c</li> + // <li>d</li> + // <li>e</li> + // <li>f</li> + // <li>g</li> + // </ul> + // "###, + // r###"Lists (309)"### + // ); + + assert_eq!( + micromark_with_options( + r###"1. a + + 2. b + + 3. c +"###, + DANGER + ), + r###"<ol> +<li> +<p>a</p> +</li> +<li> +<p>b</p> +</li> +<li> +<p>c</p> +</li> +</ol> +"###, + r###"Lists (310)"### + ); + + // To do: some bug with interrupting. + // assert_eq!( + // micromark_with_options( + // r###"- a + // - b + // - c + // - d + // - e + // "###, + // DANGER + // ), + // r###"<ul> + // <li>a</li> + // <li>b</li> + // <li>c</li> + // <li>d + // - e</li> + // </ul> + // "###, + // r###"Lists (311)"### + // ); + + assert_eq!( + micromark_with_options( + r###"1. a + + 2. b + + 3. c +"###, + DANGER + ), + r###"<ol> +<li> +<p>a</p> +</li> +<li> +<p>b</p> +</li> +</ol> +<pre><code>3. c +</code></pre> +"###, + r###"Lists (312)"### + ); + + assert_eq!( + micromark_with_options( + r###"- a +- b + +- c +"###, + DANGER + ), + r###"<ul> +<li> +<p>a</p> +</li> +<li> +<p>b</p> +</li> +<li> +<p>c</p> +</li> +</ul> +"###, + r###"Lists (313)"### + ); + + assert_eq!( + micromark_with_options( + r###"* a +* + +* c +"###, + DANGER + ), + r###"<ul> +<li> +<p>a</p> +</li> +<li></li> +<li> +<p>c</p> +</li> +</ul> +"###, + r###"Lists (314)"### + ); + + assert_eq!( + micromark_with_options( + r###"- a +- b + + c +- d +"###, + DANGER + ), + r###"<ul> +<li> +<p>a</p> +</li> +<li> +<p>b</p> +<p>c</p> +</li> +<li> +<p>d</p> +</li> +</ul> +"###, + r###"Lists (315)"### + ); + + assert_eq!( + micromark_with_options( + r###"- a +- b + + [ref]: /url +- d +"###, + DANGER + ), + r###"<ul> +<li> +<p>a</p> +</li> +<li> +<p>b</p> +</li> +<li> +<p>d</p> +</li> +</ul> +"###, + r###"Lists (316)"### + ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"- a + // - ``` + // b + + // ``` + // - c + // "###, + // DANGER + // ), + // r###"<ul> + // <li>a</li> + // <li> + // <pre><code>b + + // </code></pre> + // </li> + // <li>c</li> + // </ul> + // "###, + // r###"Lists (317)"### + // ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"- a + // - b + + // c + // - d + // "###, + // DANGER + // ), + // r###"<ul> + // <li>a + // <ul> + // <li> + // <p>b</p> + // <p>c</p> + // </li> + // </ul> + // </li> + // <li>d</li> + // </ul> + // "###, + // r###"Lists (318)"### + // ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"* a + // > b + // > + // * c + // "###, + // DANGER + // ), + // r###"<ul> + // <li>a + // <blockquote> + // <p>b</p> + // </blockquote> + // </li> + // <li>c</li> + // </ul> + // "###, + // r###"Lists (319)"### + // ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"- a + // > b + // ``` + // c + // ``` + // - d + // "###, + // DANGER + // ), + // r###"<ul> + // <li>a + // <blockquote> + // <p>b</p> + // </blockquote> + // <pre><code>c + // </code></pre> + // </li> + // <li>d</li> + // </ul> + // "###, + // r###"Lists (320)"### + // ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"- a + // "###, + // DANGER + // ), + // r###"<ul> + // <li>a</li> + // </ul> + // "###, + // r###"Lists (321)"### + // ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"- a + // - b + // "###, + // DANGER + // ), + // r###"<ul> + // <li>a + // <ul> + // <li>b</li> + // </ul> + // </li> + // </ul> + // "###, + // r###"Lists (322)"### + // ); + + assert_eq!( + micromark_with_options( + r###"1. ``` + foo + ``` + + bar +"###, + DANGER + ), + r###"<ol> +<li> +<pre><code>foo +</code></pre> +<p>bar</p> +</li> +</ol> +"###, + r###"Lists (323)"### + ); + + assert_eq!( + micromark_with_options( + r###"* foo + * bar + + baz +"###, + DANGER + ), + r###"<ul> +<li> +<p>foo</p> +<ul> +<li>bar</li> +</ul> +<p>baz</p> +</li> +</ul> +"###, + r###"Lists (324)"### + ); + + // To do: eol after containers. + // assert_eq!( + // micromark_with_options( + // r###"- a + // - b + // - c + + // - d + // - e + // - f + // "###, + // DANGER + // ), + // r###"<ul> + // <li> + // <p>a</p> + // <ul> + // <li>b</li> + // <li>c</li> + // </ul> + // </li> + // <li> + // <p>d</p> + // <ul> + // <li>e</li> + // <li>f</li> + // </ul> + // </li> + // </ul> + // "###, + // r###"Lists (325)"### + // ); + + assert_eq!( + micromark_with_options( + r###"`hi`lo` +"###, + DANGER + ), + r###"<p><code>hi</code>lo`</p> +"###, + r###"Inlines (326)"### + ); + + assert_eq!( + micromark_with_options( + r###"`foo` +"###, + DANGER + ), + r###"<p><code>foo</code></p> +"###, + r###"Code spans (327)"### + ); + + assert_eq!( + micromark_with_options( + r###"`` foo ` bar `` +"###, + DANGER + ), + r###"<p><code>foo ` bar</code></p> +"###, + r###"Code spans (328)"### + ); + + assert_eq!( + micromark_with_options( + r###"` `` ` +"###, + DANGER + ), + r###"<p><code>``</code></p> +"###, + r###"Code spans (329)"### + ); + + assert_eq!( + micromark_with_options( + r###"` `` ` +"###, + DANGER + ), + r###"<p><code> `` </code></p> +"###, + r###"Code spans (330)"### + ); + + assert_eq!( + micromark_with_options( + r###"` a` +"###, + DANGER + ), + r###"<p><code> a</code></p> +"###, + r###"Code spans (331)"### + ); + + assert_eq!( + micromark_with_options( + r###"` b ` +"###, + DANGER + ), + r###"<p><code> b </code></p> +"###, + r###"Code spans (332)"### + ); + + assert_eq!( + micromark_with_options( + r###"` ` +` ` +"###, + DANGER + ), + r###"<p><code> </code> +<code> </code></p> +"###, + r###"Code spans (333)"### + ); + + // To do: some bug with generating tests. + // assert_eq!( + // micromark_with_options( + // r###"`` + // foo + // bar + // baz + // `` + // "###, + // DANGER + // ), + // r###"<p><code>foo bar baz</code></p> + // "###, + // r###"Code spans (334)"### + // ); + + // To do: bug with a line ending sticking around? Generating this file? + // assert_eq!( + // micromark_with_options( + // r###"`` + // foo + // `` + // "###, + // DANGER + // ), + // r###"<p><code>foo </code></p> + // "###, + // r###"Code spans (335)"### + // ); + + // To do: bug generating this file? + // assert_eq!( + // micromark_with_options( + // r###"`foo bar + // baz` + // "###, + // DANGER + // ), + // r###"<p><code>foo bar baz</code></p> + // "###, + // r###"Code spans (336)"### + // ); + + assert_eq!( + micromark_with_options( + r###"`foo\`bar` +"###, + DANGER + ), + r###"<p><code>foo\</code>bar`</p> +"###, + r###"Code spans (337)"### + ); + + assert_eq!( + micromark_with_options( + r###"``foo`bar`` +"###, + DANGER + ), + r###"<p><code>foo`bar</code></p> +"###, + r###"Code spans (338)"### + ); + + assert_eq!( + 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`*` +"###, + DANGER + ), + r###"<p>*foo<code>*</code></p> +"###, + r###"Code spans (340)"### + ); + + assert_eq!( + micromark_with_options( + r###"[not a `link](/foo`) +"###, + DANGER + ), + r###"<p>[not a <code>link](/foo</code>)</p> +"###, + r###"Code spans (341)"### + ); + + assert_eq!( + micromark_with_options( + r###"`<a href="`">` +"###, + DANGER + ), + r###"<p><code><a href="</code>">`</p> +"###, + r###"Code spans (342)"### + ); + + assert_eq!( + micromark_with_options( + r###"<a href="`">` +"###, + DANGER + ), + r###"<p><a href="`">`</p> +"###, + r###"Code spans (343)"### + ); + + assert_eq!( + micromark_with_options( + r###"`<http://foo.bar.`baz>` +"###, + DANGER + ), + r###"<p><code><http://foo.bar.</code>baz>`</p> +"###, + r###"Code spans (344)"### + ); + + assert_eq!( + 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 (345)"### + ); + + assert_eq!( + micromark_with_options( + r###"```foo`` +"###, + DANGER + ), + r###"<p>```foo``</p> +"###, + r###"Code spans (346)"### + ); + + assert_eq!( + micromark_with_options( + r###"`foo +"###, + DANGER + ), + r###"<p>`foo</p> +"###, + r###"Code spans (347)"### + ); + + assert_eq!( + micromark_with_options( + r###"`foo``bar`` +"###, + DANGER + ), + r###"<p>`foo<code>bar</code></p> +"###, + r###"Code spans (348)"### + ); + + assert_eq!( + micromark_with_options( + r###"*foo bar* +"###, + DANGER + ), + r###"<p><em>foo bar</em></p> +"###, + r###"Emphasis and strong emphasis (349)"### + ); + + assert_eq!( + micromark_with_options( + r###"a * foo bar* +"###, + DANGER + ), + r###"<p>a * foo bar*</p> +"###, + r###"Emphasis and strong emphasis (350)"### + ); + + assert_eq!( + micromark_with_options( + r###"a*"foo"* +"###, + DANGER + ), + r###"<p>a*"foo"*</p> +"###, + r###"Emphasis and strong emphasis (351)"### + ); + + assert_eq!( + micromark_with_options( + r###"* a * +"###, + DANGER + ), + r###"<p>* a *</p> +"###, + r###"Emphasis and strong emphasis (352)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo*bar* +"###, + DANGER + ), + r###"<p>foo<em>bar</em></p> +"###, + r###"Emphasis and strong emphasis (353)"### + ); + + assert_eq!( + micromark_with_options( + r###"5*6*78 +"###, + DANGER + ), + r###"<p>5<em>6</em>78</p> +"###, + r###"Emphasis and strong emphasis (354)"### + ); + + assert_eq!( + micromark_with_options( + r###"_foo bar_ +"###, + DANGER + ), + r###"<p><em>foo bar</em></p> +"###, + r###"Emphasis and strong emphasis (355)"### + ); + + assert_eq!( + micromark_with_options( + r###"_ foo bar_ +"###, + DANGER + ), + r###"<p>_ foo bar_</p> +"###, + r###"Emphasis and strong emphasis (356)"### + ); + + assert_eq!( + micromark_with_options( + r###"a_"foo"_ +"###, + DANGER + ), + r###"<p>a_"foo"_</p> +"###, + r###"Emphasis and strong emphasis (357)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo_bar_ +"###, + DANGER + ), + r###"<p>foo_bar_</p> +"###, + r###"Emphasis and strong emphasis (358)"### + ); + + assert_eq!( + micromark_with_options( + r###"5_6_78 +"###, + DANGER + ), + r###"<p>5_6_78</p> +"###, + r###"Emphasis and strong emphasis (359)"### + ); + + assert_eq!( + micromark_with_options( + r###"пристаням_стремятся_ +"###, + DANGER + ), + r###"<p>пристаням_стремятся_</p> +"###, + r###"Emphasis and strong emphasis (360)"### + ); + + assert_eq!( + micromark_with_options( + r###"aa_"bb"_cc +"###, + DANGER + ), + r###"<p>aa_"bb"_cc</p> +"###, + r###"Emphasis and strong emphasis (361)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo-_(bar)_ +"###, + DANGER + ), + r###"<p>foo-<em>(bar)</em></p> +"###, + r###"Emphasis and strong emphasis (362)"### + ); + + assert_eq!( + micromark_with_options( + r###"_foo* +"###, + DANGER + ), + r###"<p>_foo*</p> +"###, + r###"Emphasis and strong emphasis (363)"### + ); + + assert_eq!( + micromark_with_options( + r###"*foo bar * +"###, + DANGER + ), + r###"<p>*foo bar *</p> +"###, + r###"Emphasis and strong emphasis (364)"### + ); + + assert_eq!( + 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) +"###, + DANGER + ), + r###"<p>*(*foo)</p> +"###, + r###"Emphasis and strong emphasis (366)"### + ); + + assert_eq!( + micromark_with_options( + r###"*(*foo*)* +"###, + DANGER + ), + r###"<p><em>(<em>foo</em>)</em></p> +"###, + r###"Emphasis and strong emphasis (367)"### + ); + + assert_eq!( + micromark_with_options( + r###"*foo*bar +"###, + DANGER + ), + r###"<p><em>foo</em>bar</p> +"###, + r###"Emphasis and strong emphasis (368)"### + ); + + assert_eq!( + micromark_with_options( + r###"_foo bar _ +"###, + DANGER + ), + r###"<p>_foo bar _</p> +"###, + r###"Emphasis and strong emphasis (369)"### + ); + + assert_eq!( + micromark_with_options( + r###"_(_foo) +"###, + DANGER + ), + r###"<p>_(_foo)</p> +"###, + r###"Emphasis and strong emphasis (370)"### + ); + + assert_eq!( + micromark_with_options( + r###"_(_foo_)_ +"###, + DANGER + ), + r###"<p><em>(<em>foo</em>)</em></p> +"###, + r###"Emphasis and strong emphasis (371)"### + ); + + assert_eq!( + micromark_with_options( + r###"_foo_bar +"###, + DANGER + ), + r###"<p>_foo_bar</p> +"###, + r###"Emphasis and strong emphasis (372)"### + ); + + assert_eq!( + micromark_with_options( + r###"_пристаням_стремятся +"###, + DANGER + ), + r###"<p>_пристаням_стремятся</p> +"###, + r###"Emphasis and strong emphasis (373)"### + ); + + assert_eq!( + micromark_with_options( + r###"_foo_bar_baz_ +"###, + DANGER + ), + r###"<p><em>foo_bar_baz</em></p> +"###, + r###"Emphasis and strong emphasis (374)"### + ); + + assert_eq!( + micromark_with_options( + r###"_(bar)_. +"###, + DANGER + ), + r###"<p><em>(bar)</em>.</p> +"###, + r###"Emphasis and strong emphasis (375)"### + ); + + assert_eq!( + micromark_with_options( + r###"**foo bar** +"###, + DANGER + ), + r###"<p><strong>foo bar</strong></p> +"###, + r###"Emphasis and strong emphasis (376)"### + ); + + assert_eq!( + micromark_with_options( + r###"** foo bar** +"###, + DANGER + ), + r###"<p>** foo bar**</p> +"###, + r###"Emphasis and strong emphasis (377)"### + ); + + assert_eq!( + micromark_with_options( + r###"a**"foo"** +"###, + DANGER + ), + r###"<p>a**"foo"**</p> +"###, + r###"Emphasis and strong emphasis (378)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo**bar** +"###, + DANGER + ), + r###"<p>foo<strong>bar</strong></p> +"###, + r###"Emphasis and strong emphasis (379)"### + ); + + assert_eq!( + micromark_with_options( + r###"__foo bar__ +"###, + DANGER + ), + r###"<p><strong>foo bar</strong></p> +"###, + r###"Emphasis and strong emphasis (380)"### + ); + + assert_eq!( + micromark_with_options( + r###"__ foo bar__ +"###, + DANGER + ), + r###"<p>__ foo bar__</p> +"###, + r###"Emphasis and strong emphasis (381)"### + ); + + assert_eq!( + micromark_with_options( + r###"__ +foo bar__ +"###, + DANGER + ), + r###"<p>__ +foo bar__</p> +"###, + r###"Emphasis and strong emphasis (382)"### + ); + + assert_eq!( + micromark_with_options( + r###"a__"foo"__ +"###, + DANGER + ), + r###"<p>a__"foo"__</p> +"###, + r###"Emphasis and strong emphasis (383)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo__bar__ +"###, + DANGER + ), + r###"<p>foo__bar__</p> +"###, + r###"Emphasis and strong emphasis (384)"### + ); + + assert_eq!( + micromark_with_options( + r###"5__6__78 +"###, + DANGER + ), + r###"<p>5__6__78</p> +"###, + r###"Emphasis and strong emphasis (385)"### + ); + + assert_eq!( + micromark_with_options( + r###"пристаням__стремятся__ +"###, + DANGER + ), + r###"<p>пристаням__стремятся__</p> +"###, + r###"Emphasis and strong emphasis (386)"### + ); + + assert_eq!( + micromark_with_options( + r###"__foo, __bar__, baz__ +"###, + DANGER + ), + r###"<p><strong>foo, <strong>bar</strong>, baz</strong></p> +"###, + r###"Emphasis and strong emphasis (387)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo-__(bar)__ +"###, + DANGER + ), + r###"<p>foo-<strong>(bar)</strong></p> +"###, + r###"Emphasis and strong emphasis (388)"### + ); + + assert_eq!( + micromark_with_options( + r###"**foo bar ** +"###, + DANGER + ), + r###"<p>**foo bar **</p> +"###, + r###"Emphasis and strong emphasis (389)"### + ); + + assert_eq!( + micromark_with_options( + r###"**(**foo) +"###, + DANGER + ), + r###"<p>**(**foo)</p> +"###, + r###"Emphasis and strong emphasis (390)"### + ); + + assert_eq!( + micromark_with_options( + r###"*(**foo**)* +"###, + DANGER + ), + r###"<p><em>(<strong>foo</strong>)</em></p> +"###, + r###"Emphasis and strong emphasis (391)"### + ); + + assert_eq!( + micromark_with_options( + r###"**Gomphocarpus (*Gomphocarpus physocarpus*, syn. +*Asclepias physocarpa*)** +"###, + DANGER + ), + r###"<p><strong>Gomphocarpus (<em>Gomphocarpus physocarpus</em>, syn. +<em>Asclepias physocarpa</em>)</strong></p> +"###, + r###"Emphasis and strong emphasis (392)"### + ); + + assert_eq!( + micromark_with_options( + r###"**foo "*bar*" foo** +"###, + DANGER + ), + r###"<p><strong>foo "<em>bar</em>" foo</strong></p> +"###, + r###"Emphasis and strong emphasis (393)"### + ); + + assert_eq!( + micromark_with_options( + r###"**foo**bar +"###, + DANGER + ), + r###"<p><strong>foo</strong>bar</p> +"###, + r###"Emphasis and strong emphasis (394)"### + ); + + assert_eq!( + micromark_with_options( + r###"__foo bar __ +"###, + DANGER + ), + r###"<p>__foo bar __</p> +"###, + r###"Emphasis and strong emphasis (395)"### + ); + + assert_eq!( + micromark_with_options( + r###"__(__foo) +"###, + DANGER + ), + r###"<p>__(__foo)</p> +"###, + r###"Emphasis and strong emphasis (396)"### + ); + + assert_eq!( + micromark_with_options( + r###"_(__foo__)_ +"###, + DANGER + ), + r###"<p><em>(<strong>foo</strong>)</em></p> +"###, + r###"Emphasis and strong emphasis (397)"### + ); + + assert_eq!( + micromark_with_options( + r###"__foo__bar +"###, + DANGER + ), + r###"<p>__foo__bar</p> +"###, + r###"Emphasis and strong emphasis (398)"### + ); + + assert_eq!( + micromark_with_options( + r###"__пристаням__стремятся +"###, + DANGER + ), + r###"<p>__пристаням__стремятся</p> +"###, + r###"Emphasis and strong emphasis (399)"### + ); + + assert_eq!( + micromark_with_options( + r###"__foo__bar__baz__ +"###, + DANGER + ), + r###"<p><strong>foo__bar__baz</strong></p> +"###, + r###"Emphasis and strong emphasis (400)"### + ); + + assert_eq!( + micromark_with_options( + r###"__(bar)__. +"###, + DANGER + ), + r###"<p><strong>(bar)</strong>.</p> +"###, + r###"Emphasis and strong emphasis (401)"### + ); + + assert_eq!( + micromark_with_options( + r###"*foo [bar](/url)* +"###, + DANGER + ), + r###"<p><em>foo <a href="/url">bar</a></em></p> +"###, + r###"Emphasis and strong emphasis (402)"### + ); + + assert_eq!( + micromark_with_options( + r###"*foo +bar* +"###, + DANGER + ), + r###"<p><em>foo +bar</em></p> +"###, + r###"Emphasis and strong emphasis (403)"### + ); + + assert_eq!( + micromark_with_options( + r###"_foo __bar__ baz_ +"###, + DANGER + ), + r###"<p><em>foo <strong>bar</strong> baz</em></p> +"###, + r###"Emphasis and strong emphasis (404)"### + ); + + assert_eq!( + micromark_with_options( + r###"_foo _bar_ baz_ +"###, + DANGER + ), + r###"<p><em>foo <em>bar</em> baz</em></p> +"###, + r###"Emphasis and strong emphasis (405)"### + ); + + assert_eq!( + micromark_with_options( + r###"__foo_ bar_ +"###, + DANGER + ), + r###"<p><em><em>foo</em> bar</em></p> +"###, + r###"Emphasis and strong emphasis (406)"### + ); + + assert_eq!( + micromark_with_options( + r###"*foo *bar** +"###, + DANGER + ), + r###"<p><em>foo <em>bar</em></em></p> +"###, + r###"Emphasis and strong emphasis (407)"### + ); + + assert_eq!( + micromark_with_options( + r###"*foo **bar** baz* +"###, + DANGER + ), + r###"<p><em>foo <strong>bar</strong> baz</em></p> +"###, + r###"Emphasis and strong emphasis (408)"### + ); + + assert_eq!( + 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* +"###, + DANGER + ), + r###"<p><em>foo**bar</em></p> +"###, + r###"Emphasis and strong emphasis (410)"### + ); + + assert_eq!( + micromark_with_options( + r###"***foo** bar* +"###, + DANGER + ), + r###"<p><em><strong>foo</strong> bar</em></p> +"###, + r###"Emphasis and strong emphasis (411)"### + ); + + assert_eq!( + micromark_with_options( + r###"*foo **bar*** +"###, + DANGER + ), + r###"<p><em>foo <strong>bar</strong></em></p> +"###, + r###"Emphasis and strong emphasis (412)"### + ); + + assert_eq!( + 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***baz +"###, + DANGER + ), + r###"<p>foo<em><strong>bar</strong></em>baz</p> +"###, + r###"Emphasis and strong emphasis (414)"### + ); + + assert_eq!( + 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 (415)"### + ); + + assert_eq!( + 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 (416)"### + ); + + assert_eq!( + 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 (417)"### + ); + + assert_eq!( + micromark_with_options( + r###"** is not an empty emphasis +"###, + DANGER + ), + r###"<p>** is not an empty emphasis</p> +"###, + r###"Emphasis and strong emphasis (418)"### + ); + + assert_eq!( + 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 (419)"### + ); + + assert_eq!( + micromark_with_options( + r###"**foo [bar](/url)** +"###, + DANGER + ), + r###"<p><strong>foo <a href="/url">bar</a></strong></p> +"###, + r###"Emphasis and strong emphasis (420)"### + ); + + assert_eq!( + micromark_with_options( + r###"**foo +bar** +"###, + DANGER + ), + r###"<p><strong>foo +bar</strong></p> +"###, + r###"Emphasis and strong emphasis (421)"### + ); + + assert_eq!( + micromark_with_options( + r###"__foo _bar_ baz__ +"###, + DANGER + ), + r###"<p><strong>foo <em>bar</em> baz</strong></p> +"###, + r###"Emphasis and strong emphasis (422)"### + ); + + assert_eq!( + micromark_with_options( + r###"__foo __bar__ baz__ +"###, + DANGER + ), + r###"<p><strong>foo <strong>bar</strong> baz</strong></p> +"###, + r###"Emphasis and strong emphasis (423)"### + ); + + assert_eq!( + micromark_with_options( + r###"____foo__ bar__ +"###, + DANGER + ), + r###"<p><strong><strong>foo</strong> bar</strong></p> +"###, + r###"Emphasis and strong emphasis (424)"### + ); + + assert_eq!( + micromark_with_options( + r###"**foo **bar**** +"###, + DANGER + ), + r###"<p><strong>foo <strong>bar</strong></strong></p> +"###, + r###"Emphasis and strong emphasis (425)"### + ); + + assert_eq!( + micromark_with_options( + r###"**foo *bar* baz** +"###, + DANGER + ), + r###"<p><strong>foo <em>bar</em> baz</strong></p> +"###, + r###"Emphasis and strong emphasis (426)"### + ); + + assert_eq!( + 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** +"###, + DANGER + ), + r###"<p><strong><em>foo</em> bar</strong></p> +"###, + r###"Emphasis and strong emphasis (428)"### + ); + + assert_eq!( + micromark_with_options( + r###"**foo *bar*** +"###, + DANGER + ), + r###"<p><strong>foo <em>bar</em></strong></p> +"###, + r###"Emphasis and strong emphasis (429)"### + ); + + assert_eq!( + micromark_with_options( + r###"**foo *bar **baz** +bim* bop** +"###, + DANGER + ), + r###"<p><strong>foo <em>bar <strong>baz</strong> +bim</em> bop</strong></p> +"###, + r###"Emphasis and strong emphasis (430)"### + ); + + assert_eq!( + 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 (431)"### + ); + + assert_eq!( + micromark_with_options( + r###"__ is not an empty emphasis +"###, + DANGER + ), + r###"<p>__ is not an empty emphasis</p> +"###, + r###"Emphasis and strong emphasis (432)"### + ); + + assert_eq!( + 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 (433)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo *** +"###, + DANGER + ), + r###"<p>foo ***</p> +"###, + r###"Emphasis and strong emphasis (434)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo *\** +"###, + DANGER + ), + r###"<p>foo <em>*</em></p> +"###, + r###"Emphasis and strong emphasis (435)"### + ); + + assert_eq!( + 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 + ), + r###"<p>foo *****</p> +"###, + r###"Emphasis and strong emphasis (437)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo **\*** +"###, + DANGER + ), + r###"<p>foo <strong>*</strong></p> +"###, + r###"Emphasis and strong emphasis (438)"### + ); + + assert_eq!( + 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 + ), + r###"<p>*<em>foo</em></p> +"###, + r###"Emphasis and strong emphasis (440)"### + ); + + assert_eq!( + 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 + ), + r###"<p>*<strong>foo</strong></p> +"###, + r###"Emphasis and strong emphasis (442)"### + ); + + assert_eq!( + micromark_with_options( + r###"****foo* +"###, + DANGER + ), + r###"<p>***<em>foo</em></p> +"###, + r###"Emphasis and strong emphasis (443)"### + ); + + assert_eq!( + micromark_with_options( + r###"**foo*** +"###, + DANGER + ), + r###"<p><strong>foo</strong>*</p> +"###, + r###"Emphasis and strong emphasis (444)"### + ); + + assert_eq!( + micromark_with_options( + r###"*foo**** +"###, + DANGER + ), + r###"<p><em>foo</em>***</p> +"###, + r###"Emphasis and strong emphasis (445)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo ___ +"###, + DANGER + ), + r###"<p>foo ___</p> +"###, + r###"Emphasis and strong emphasis (446)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo _\__ +"###, + DANGER + ), + r###"<p>foo <em>_</em></p> +"###, + r###"Emphasis and strong emphasis (447)"### + ); + + assert_eq!( + 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 + ), + r###"<p>foo _____</p> +"###, + r###"Emphasis and strong emphasis (449)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo __\___ +"###, + DANGER + ), + r###"<p>foo <strong>_</strong></p> +"###, + r###"Emphasis and strong emphasis (450)"### + ); + + assert_eq!( + 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 + ), + r###"<p>_<em>foo</em></p> +"###, + r###"Emphasis and strong emphasis (452)"### + ); + + assert_eq!( + 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 + ), + r###"<p>_<strong>foo</strong></p> +"###, + r###"Emphasis and strong emphasis (454)"### + ); + + assert_eq!( + micromark_with_options( + r###"____foo_ +"###, + DANGER + ), + r###"<p>___<em>foo</em></p> +"###, + r###"Emphasis and strong emphasis (455)"### + ); + + assert_eq!( + micromark_with_options( + r###"__foo___ +"###, + DANGER + ), + r###"<p><strong>foo</strong>_</p> +"###, + r###"Emphasis and strong emphasis (456)"### + ); + + assert_eq!( + micromark_with_options( + r###"_foo____ +"###, + DANGER + ), + r###"<p><em>foo</em>___</p> +"###, + r###"Emphasis and strong emphasis (457)"### + ); + + assert_eq!( + micromark_with_options( + r###"**foo** +"###, + DANGER + ), + r###"<p><strong>foo</strong></p> +"###, + r###"Emphasis and strong emphasis (458)"### + ); + + assert_eq!( + micromark_with_options( + r###"*_foo_* +"###, + DANGER + ), + r###"<p><em><em>foo</em></em></p> +"###, + r###"Emphasis and strong emphasis (459)"### + ); + + assert_eq!( + micromark_with_options( + r###"__foo__ +"###, + DANGER + ), + r###"<p><strong>foo</strong></p> +"###, + r###"Emphasis and strong emphasis (460)"### + ); + + assert_eq!( + micromark_with_options( + r###"_*foo*_ +"###, + DANGER + ), + r###"<p><em><em>foo</em></em></p> +"###, + r###"Emphasis and strong emphasis (461)"### + ); + + assert_eq!( + micromark_with_options( + r###"****foo**** +"###, + DANGER + ), + r###"<p><strong><strong>foo</strong></strong></p> +"###, + r###"Emphasis and strong emphasis (462)"### + ); + + assert_eq!( + 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 + ), + r###"<p><strong><strong><strong>foo</strong></strong></strong></p> +"###, + r###"Emphasis and strong emphasis (464)"### + ); + + assert_eq!( + micromark_with_options( + r###"***foo*** +"###, + DANGER + ), + r###"<p><em><strong>foo</strong></em></p> +"###, + r###"Emphasis and strong emphasis (465)"### + ); + + assert_eq!( + micromark_with_options( + r###"_____foo_____ +"###, + DANGER + ), + r###"<p><em><strong><strong>foo</strong></strong></em></p> +"###, + r###"Emphasis and strong emphasis (466)"### + ); + + assert_eq!( + micromark_with_options( + r###"*foo _bar* baz_ +"###, + DANGER + ), + r###"<p><em>foo _bar</em> baz_</p> +"###, + r###"Emphasis and strong emphasis (467)"### + ); + + assert_eq!( + 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 (468)"### + ); + + assert_eq!( + micromark_with_options( + r###"**foo **bar baz** +"###, + DANGER + ), + r###"<p>**foo <strong>bar baz</strong></p> +"###, + r###"Emphasis and strong emphasis (469)"### + ); + + assert_eq!( + micromark_with_options( + r###"*foo *bar baz* +"###, + DANGER + ), + r###"<p>*foo <em>bar baz</em></p> +"###, + r###"Emphasis and strong emphasis (470)"### + ); + + assert_eq!( + micromark_with_options( + r###"*[bar*](/url) +"###, + DANGER + ), + r###"<p>*<a href="/url">bar*</a></p> +"###, + r###"Emphasis and strong emphasis (471)"### + ); + + assert_eq!( + micromark_with_options( + r###"_foo [bar_](/url) +"###, + DANGER + ), + r###"<p>_foo <a href="/url">bar_</a></p> +"###, + r###"Emphasis and strong emphasis (472)"### + ); + + assert_eq!( + micromark_with_options( + r###"*<img src="foo" title="*"/> +"###, + DANGER + ), + r###"<p>*<img src="foo" title="*"/></p> +"###, + r###"Emphasis and strong emphasis (473)"### + ); + + assert_eq!( + micromark_with_options( + r###"**<a href="**"> +"###, + DANGER + ), + r###"<p>**<a href="**"></p> +"###, + r###"Emphasis and strong emphasis (474)"### + ); + + assert_eq!( + 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 `*`* +"###, + DANGER + ), + r###"<p><em>a <code>*</code></em></p> +"###, + r###"Emphasis and strong emphasis (476)"### + ); + + assert_eq!( + 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<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 (478)"### + ); + + assert_eq!( + 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###"[link](/uri "title") +"###, + DANGER + ), + r###"<p><a href="/uri" title="title">link</a></p> +"###, + r###"Links (480)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link](/uri) +"###, + DANGER + ), + r###"<p><a href="/uri">link</a></p> +"###, + r###"Links (481)"### + ); + + assert_eq!( + micromark_with_options( + r###"[](./target.md) +"###, + DANGER + ), + r###"<p><a href="./target.md"></a></p> +"###, + r###"Links (482)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link]() +"###, + DANGER + ), + r###"<p><a href="">link</a></p> +"###, + r###"Links (483)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link](<>) +"###, + DANGER + ), + r###"<p><a href="">link</a></p> +"###, + r###"Links (484)"### + ); + + assert_eq!( + micromark_with_options( + r###"[]() +"###, + DANGER + ), + r###"<p><a href=""></a></p> +"###, + r###"Links (485)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link](/my uri) +"###, + DANGER + ), + r###"<p>[link](/my uri)</p> +"###, + r###"Links (486)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link](</my uri>) +"###, + DANGER + ), + r###"<p><a href="/my%20uri">link</a></p> +"###, + r###"Links (487)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link](foo +bar) +"###, + DANGER + ), + r###"<p>[link](foo +bar)</p> +"###, + r###"Links (488)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link](<foo +bar>) +"###, + DANGER + ), + r###"<p>[link](<foo +bar>)</p> +"###, + r###"Links (489)"### + ); + + assert_eq!( + micromark_with_options( + r###"[a](<b)c>) +"###, + DANGER + ), + r###"<p><a href="b)c">a</a></p> +"###, + r###"Links (490)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link](<foo\>) +"###, + DANGER + ), + r###"<p>[link](<foo>)</p> +"###, + r###"Links (491)"### + ); + + assert_eq!( + micromark_with_options( + r###"[a](<b)c +[a](<b)c> +[a](<b>c) +"###, + DANGER + ), + r###"<p>[a](<b)c +[a](<b)c> +[a](<b>c)</p> +"###, + r###"Links (492)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link](\(foo\)) +"###, + DANGER + ), + r###"<p><a href="(foo)">link</a></p> +"###, + r###"Links (493)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link](foo(and(bar))) +"###, + DANGER + ), + r###"<p><a href="foo(and(bar))">link</a></p> +"###, + r###"Links (494)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link](foo(and(bar)) +"###, + DANGER + ), + r###"<p>[link](foo(and(bar))</p> +"###, + r###"Links (495)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link](foo\(and\(bar\)) +"###, + DANGER + ), + r###"<p><a href="foo(and(bar)">link</a></p> +"###, + r###"Links (496)"### + ); + + assert_eq!( + 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\)\:) +"###, + DANGER + ), + r###"<p><a href="foo):">link</a></p> +"###, + r###"Links (498)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link](#fragment) + +[link](http://example.com#fragment) + +[link](http://example.com?foo=3#frag) +"###, + DANGER + ), + r###"<p><a href="#fragment">link</a></p> +<p><a href="http://example.com#fragment">link</a></p> +<p><a href="http://example.com?foo=3#frag">link</a></p> +"###, + r###"Links (499)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link](foo\bar) +"###, + DANGER + ), + r###"<p><a href="foo%5Cbar">link</a></p> +"###, + r###"Links (500)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link](foo%20bä) +"###, + DANGER + ), + r###"<p><a href="foo%20b%C3%A4">link</a></p> +"###, + r###"Links (501)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link]("title") +"###, + DANGER + ), + r###"<p><a href="%22title%22">link</a></p> +"###, + r###"Links (502)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link](/url "title") +[link](/url 'title') +[link](/url (title)) +"###, + DANGER + ), + r###"<p><a href="/url" title="title">link</a> +<a href="/url" title="title">link</a> +<a href="/url" title="title">link</a></p> +"###, + r###"Links (503)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link](/url "title \""") +"###, + DANGER + ), + r###"<p><a href="/url" title="title """>link</a></p> +"###, + r###"Links (504)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link](/url "title") +"###, + DANGER + ), + r###"<p><a href="/url%C2%A0%22title%22">link</a></p> +"###, + r###"Links (505)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link](/url "title "and" title") +"###, + DANGER + ), + r###"<p>[link](/url "title "and" title")</p> +"###, + r###"Links (506)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link](/url 'title "and" title') +"###, + DANGER + ), + r###"<p><a href="/url" title="title "and" title">link</a></p> +"###, + r###"Links (507)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link]( /uri + "title" ) +"###, + DANGER + ), + r###"<p><a href="/uri" title="title">link</a></p> +"###, + r###"Links (508)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link] (/uri) +"###, + DANGER + ), + r###"<p>[link] (/uri)</p> +"###, + r###"Links (509)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link [foo [bar]]](/uri) +"###, + DANGER + ), + r###"<p><a href="/uri">link [foo [bar]]</a></p> +"###, + r###"Links (510)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link] bar](/uri) +"###, + DANGER + ), + r###"<p>[link] bar](/uri)</p> +"###, + r###"Links (511)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link [bar](/uri) +"###, + DANGER + ), + r###"<p>[link <a href="/uri">bar</a></p> +"###, + r###"Links (512)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link \[bar](/uri) +"###, + DANGER + ), + r###"<p><a href="/uri">link [bar</a></p> +"###, + r###"Links (513)"### + ); + + assert_eq!( + 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 (514)"### + ); + + assert_eq!( + micromark_with_options( + r###"[![moon](moon.jpg)](/uri) +"###, + DANGER + ), + r###"<p><a href="/uri"><img src="moon.jpg" alt="moon" /></a></p> +"###, + r###"Links (515)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo [bar](/uri)](/uri) +"###, + DANGER + ), + r###"<p>[foo <a href="/uri">bar</a>](/uri)</p> +"###, + r###"Links (516)"### + ); + + assert_eq!( + 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 (517)"### + ); + + assert_eq!( + micromark_with_options( + r###"![[[foo](uri1)](uri2)](uri3) +"###, + DANGER + ), + r###"<p><img src="uri3" alt="[foo](uri2)" /></p> +"###, + r###"Links (518)"### + ); + + assert_eq!( + micromark_with_options( + r###"*[foo*](/uri) +"###, + DANGER + ), + r###"<p>*<a href="/uri">foo*</a></p> +"###, + r###"Links (519)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo *bar](baz*) +"###, + DANGER + ), + r###"<p><a href="baz*">foo *bar</a></p> +"###, + r###"Links (520)"### + ); + + assert_eq!( + micromark_with_options( + r###"*foo [bar* baz] +"###, + DANGER + ), + r###"<p><em>foo [bar</em> baz]</p> +"###, + r###"Links (521)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo <bar attr="](baz)"> +"###, + DANGER + ), + r###"<p>[foo <bar attr="](baz)"></p> +"###, + r###"Links (522)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo`](/uri)` +"###, + DANGER + ), + r###"<p>[foo<code>](/uri)</code></p> +"###, + r###"Links (523)"### + ); + + assert_eq!( + 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 (524)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo][bar] + +[bar]: /url "title" +"###, + DANGER + ), + r###"<p><a href="/url" title="title">foo</a></p> +"###, + r###"Links (525)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link [foo [bar]]][ref] + +[ref]: /uri +"###, + DANGER + ), + r###"<p><a href="/uri">link [foo [bar]]</a></p> +"###, + r###"Links (526)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link \[bar][ref] + +[ref]: /uri +"###, + DANGER + ), + r###"<p><a href="/uri">link [bar</a></p> +"###, + r###"Links (527)"### + ); + + assert_eq!( + micromark_with_options( + r###"[link *foo **bar** `#`*][ref] + +[ref]: /uri +"###, + DANGER + ), + r###"<p><a href="/uri">link <em>foo <strong>bar</strong> <code>#</code></em></a></p> +"###, + r###"Links (528)"### + ); + + assert_eq!( + micromark_with_options( + r###"[![moon](moon.jpg)][ref] + +[ref]: /uri +"###, + DANGER + ), + r###"<p><a href="/uri"><img src="moon.jpg" alt="moon" /></a></p> +"###, + r###"Links (529)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo [bar](/uri)][ref] + +[ref]: /uri +"###, + DANGER + ), + r###"<p>[foo <a href="/uri">bar</a>]<a href="/uri">ref</a></p> +"###, + r###"Links (530)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo *bar [baz][ref]*][ref] + +[ref]: /uri +"###, + DANGER + ), + r###"<p>[foo <em>bar <a href="/uri">baz</a></em>]<a href="/uri">ref</a></p> +"###, + r###"Links (531)"### + ); + + assert_eq!( + micromark_with_options( + r###"*[foo*][ref] + +[ref]: /uri +"###, + DANGER + ), + r###"<p>*<a href="/uri">foo*</a></p> +"###, + r###"Links (532)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo *bar][ref]* + +[ref]: /uri +"###, + DANGER + ), + r###"<p><a href="/uri">foo *bar</a>*</p> +"###, + r###"Links (533)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo <bar attr="][ref]"> + +[ref]: /uri +"###, + DANGER + ), + r###"<p>[foo <bar attr="][ref]"></p> +"###, + r###"Links (534)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo`][ref]` + +[ref]: /uri +"###, + DANGER + ), + r###"<p>[foo<code>][ref]</code></p> +"###, + r###"Links (535)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo<http://example.com/?search=][ref]> + +[ref]: /uri +"###, + DANGER + ), + r###"<p>[foo<a href="http://example.com/?search=%5D%5Bref%5D">http://example.com/?search=][ref]</a></p> +"###, + r###"Links (536)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo][BaR] + +[bar]: /url "title" +"###, + DANGER + ), + r###"<p><a href="/url" title="title">foo</a></p> +"###, + r###"Links (537)"### + ); + + // To do: bug with unicode normalization. + // assert_eq!( + // micromark_with_options( + // r###"[ẞ] + + // [SS]: /url + // "###, + // DANGER + // ), + // r###"<p><a href="/url">ẞ</a></p> + // "###, + // r###"Links (538)"### + // ); + + assert_eq!( + micromark_with_options( + r###"[Foo + bar]: /url + +[Baz][Foo bar] +"###, + DANGER + ), + r###"<p><a href="/url">Baz</a></p> +"###, + r###"Links (539)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo] [bar] + +[bar]: /url "title" +"###, + DANGER + ), + r###"<p>[foo] <a href="/url" title="title">bar</a></p> +"###, + r###"Links (540)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo] +[bar] + +[bar]: /url "title" +"###, + DANGER + ), + r###"<p>[foo] +<a href="/url" title="title">bar</a></p> +"###, + r###"Links (541)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo]: /url1 + +[foo]: /url2 + +[bar][foo] +"###, + DANGER + ), + r###"<p><a href="/url1">bar</a></p> +"###, + r###"Links (542)"### + ); + + assert_eq!( + micromark_with_options( + r###"[bar][foo\!] + +[foo!]: /url +"###, + DANGER + ), + r###"<p>[bar][foo!]</p> +"###, + r###"Links (543)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo][ref[] + +[ref[]: /uri +"###, + DANGER + ), + r###"<p>[foo][ref[]</p> +<p>[ref[]: /uri</p> +"###, + r###"Links (544)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo][ref[bar]] + +[ref[bar]]: /uri +"###, + DANGER + ), + r###"<p>[foo][ref[bar]]</p> +<p>[ref[bar]]: /uri</p> +"###, + r###"Links (545)"### + ); + + assert_eq!( + micromark_with_options( + r###"[[[foo]]] + +[[[foo]]]: /url +"###, + DANGER + ), + r###"<p>[[[foo]]]</p> +<p>[[[foo]]]: /url</p> +"###, + r###"Links (546)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo][ref\[] + +[ref\[]: /uri +"###, + DANGER + ), + r###"<p><a href="/uri">foo</a></p> +"###, + r###"Links (547)"### + ); + + assert_eq!( + micromark_with_options( + r###"[bar\\]: /uri + +[bar\\] +"###, + DANGER + ), + r###"<p><a href="/uri">bar\</a></p> +"###, + r###"Links (548)"### + ); + + assert_eq!( + micromark_with_options( + r###"[] + +[]: /uri +"###, + DANGER + ), + r###"<p>[]</p> +<p>[]: /uri</p> +"###, + r###"Links (549)"### + ); + + assert_eq!( + micromark_with_options( + r###"[ + ] + +[ + ]: /uri +"###, + DANGER + ), + r###"<p>[ +]</p> +<p>[ +]: /uri</p> +"###, + r###"Links (550)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo][] + +[foo]: /url "title" +"###, + DANGER + ), + r###"<p><a href="/url" title="title">foo</a></p> +"###, + r###"Links (551)"### + ); + + assert_eq!( + micromark_with_options( + r###"[*foo* bar][] + +[*foo* bar]: /url "title" +"###, + DANGER + ), + r###"<p><a href="/url" title="title"><em>foo</em> bar</a></p> +"###, + r###"Links (552)"### + ); + + assert_eq!( + micromark_with_options( + r###"[Foo][] + +[foo]: /url "title" +"###, + DANGER + ), + r###"<p><a href="/url" title="title">Foo</a></p> +"###, + r###"Links (553)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo] +[] + +[foo]: /url "title" +"###, + DANGER + ), + r###"<p><a href="/url" title="title">foo</a> +[]</p> +"###, + r###"Links (554)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo] + +[foo]: /url "title" +"###, + DANGER + ), + r###"<p><a href="/url" title="title">foo</a></p> +"###, + r###"Links (555)"### + ); + + assert_eq!( + micromark_with_options( + r###"[*foo* bar] + +[*foo* bar]: /url "title" +"###, + DANGER + ), + r###"<p><a href="/url" title="title"><em>foo</em> bar</a></p> +"###, + r###"Links (556)"### + ); + + assert_eq!( + micromark_with_options( + r###"[[*foo* bar]] + +[*foo* bar]: /url "title" +"###, + DANGER + ), + r###"<p>[<a href="/url" title="title"><em>foo</em> bar</a>]</p> +"###, + r###"Links (557)"### + ); + + assert_eq!( + micromark_with_options( + r###"[[bar [foo] + +[foo]: /url +"###, + DANGER + ), + r###"<p>[[bar <a href="/url">foo</a></p> +"###, + r###"Links (558)"### + ); + + assert_eq!( + micromark_with_options( + r###"[Foo] + +[foo]: /url "title" +"###, + DANGER + ), + r###"<p><a href="/url" title="title">Foo</a></p> +"###, + r###"Links (559)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo] bar + +[foo]: /url +"###, + DANGER + ), + r###"<p><a href="/url">foo</a> bar</p> +"###, + r###"Links (560)"### + ); + + assert_eq!( + micromark_with_options( + r###"\[foo] + +[foo]: /url "title" +"###, + DANGER + ), + r###"<p>[foo]</p> +"###, + r###"Links (561)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo*]: /url + +*[foo*] +"###, + DANGER + ), + r###"<p>*<a href="/url">foo*</a></p> +"###, + r###"Links (562)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo][bar] + +[foo]: /url1 +[bar]: /url2 +"###, + DANGER + ), + r###"<p><a href="/url2">foo</a></p> +"###, + r###"Links (563)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo][] + +[foo]: /url1 +"###, + DANGER + ), + r###"<p><a href="/url1">foo</a></p> +"###, + r###"Links (564)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo]() + +[foo]: /url1 +"###, + DANGER + ), + r###"<p><a href="">foo</a></p> +"###, + r###"Links (565)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo](not a link) + +[foo]: /url1 +"###, + DANGER + ), + r###"<p><a href="/url1">foo</a>(not a link)</p> +"###, + r###"Links (566)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo][bar][baz] + +[baz]: /url +"###, + DANGER + ), + r###"<p>[foo]<a href="/url">bar</a></p> +"###, + r###"Links (567)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo][bar][baz] + +[baz]: /url1 +[bar]: /url2 +"###, + DANGER + ), + r###"<p><a href="/url2">foo</a><a href="/url1">baz</a></p> +"###, + r###"Links (568)"### + ); + + assert_eq!( + micromark_with_options( + r###"[foo][bar][baz] + +[baz]: /url1 +[foo]: /url2 +"###, + DANGER + ), + r###"<p>[foo]<a href="/url1">bar</a></p> +"###, + r###"Links (569)"### + ); + + assert_eq!( + micromark_with_options( + r###"![foo](/url "title") +"###, + DANGER + ), + r###"<p><img src="/url" alt="foo" title="title" /></p> +"###, + r###"Images (570)"### + ); + + assert_eq!( + micromark_with_options( + r###"![foo *bar*] + +[foo *bar*]: train.jpg "train & tracks" +"###, + DANGER + ), + r###"<p><img src="train.jpg" alt="foo bar" title="train & tracks" /></p> +"###, + r###"Images (571)"### + ); + + assert_eq!( + micromark_with_options( + r###"![foo ![bar](/url)](/url2) +"###, + DANGER + ), + r###"<p><img src="/url2" alt="foo bar" /></p> +"###, + r###"Images (572)"### + ); + + assert_eq!( + 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*][] + +[foo *bar*]: train.jpg "train & tracks" +"###, + DANGER + ), + r###"<p><img src="train.jpg" alt="foo bar" title="train & tracks" /></p> +"###, + r###"Images (574)"### + ); + + assert_eq!( + micromark_with_options( + r###"![foo *bar*][foobar] + +[FOOBAR]: train.jpg "train & tracks" +"###, + DANGER + ), + r###"<p><img src="train.jpg" alt="foo bar" title="train & tracks" /></p> +"###, + r###"Images (575)"### + ); + + assert_eq!( + micromark_with_options( + r###"![foo](train.jpg) +"###, + DANGER + ), + r###"<p><img src="train.jpg" alt="foo" /></p> +"###, + r###"Images (576)"### + ); + + assert_eq!( + 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 (577)"### + ); + + assert_eq!( + micromark_with_options( + r###"![foo](<url>) +"###, + DANGER + ), + r###"<p><img src="url" alt="foo" /></p> +"###, + r###"Images (578)"### + ); + + assert_eq!( + micromark_with_options( + r###"![](/url) +"###, + DANGER + ), + r###"<p><img src="/url" alt="" /></p> +"###, + r###"Images (579)"### + ); + + assert_eq!( + micromark_with_options( + r###"![foo][bar] + +[bar]: /url +"###, + DANGER + ), + r###"<p><img src="/url" alt="foo" /></p> +"###, + r###"Images (580)"### + ); + + assert_eq!( + micromark_with_options( + r###"![foo][bar] + +[BAR]: /url +"###, + DANGER + ), + r###"<p><img src="/url" alt="foo" /></p> +"###, + r###"Images (581)"### + ); + + assert_eq!( + micromark_with_options( + r###"![foo][] + +[foo]: /url "title" +"###, + DANGER + ), + r###"<p><img src="/url" alt="foo" title="title" /></p> +"###, + r###"Images (582)"### + ); + + assert_eq!( + micromark_with_options( + r###"![*foo* bar][] + +[*foo* bar]: /url "title" +"###, + DANGER + ), + r###"<p><img src="/url" alt="foo bar" title="title" /></p> +"###, + r###"Images (583)"### + ); + + assert_eq!( + micromark_with_options( + r###"![Foo][] + +[foo]: /url "title" +"###, + DANGER + ), + r###"<p><img src="/url" alt="Foo" title="title" /></p> +"###, + r###"Images (584)"### + ); + + assert_eq!( + micromark_with_options( + r###"![foo] +[] + +[foo]: /url "title" +"###, + DANGER + ), + r###"<p><img src="/url" alt="foo" title="title" /> +[]</p> +"###, + r###"Images (585)"### + ); + + assert_eq!( + micromark_with_options( + r###"![foo] + +[foo]: /url "title" +"###, + DANGER + ), + r###"<p><img src="/url" alt="foo" title="title" /></p> +"###, + r###"Images (586)"### + ); + + assert_eq!( + micromark_with_options( + r###"![*foo* bar] + +[*foo* bar]: /url "title" +"###, + DANGER + ), + r###"<p><img src="/url" alt="foo bar" title="title" /></p> +"###, + r###"Images (587)"### + ); + + assert_eq!( + micromark_with_options( + r###"![[foo]] + +[[foo]]: /url "title" +"###, + DANGER + ), + r###"<p>![[foo]]</p> +<p>[[foo]]: /url "title"</p> +"###, + r###"Images (588)"### + ); + + assert_eq!( + micromark_with_options( + r###"![Foo] + +[foo]: /url "title" +"###, + DANGER + ), + r###"<p><img src="/url" alt="Foo" title="title" /></p> +"###, + r###"Images (589)"### + ); + + assert_eq!( + micromark_with_options( + r###"!\[foo] + +[foo]: /url "title" +"###, + DANGER + ), + r###"<p>![foo]</p> +"###, + r###"Images (590)"### + ); + + assert_eq!( + micromark_with_options( + r###"\![foo] + +[foo]: /url "title" +"###, + DANGER + ), + r###"<p>!<a href="/url" title="title">foo</a></p> +"###, + r###"Images (591)"### + ); + + assert_eq!( + 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 (592)"### + ); + + assert_eq!( + 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 (593)"### + ); + + assert_eq!( + 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 (594)"### + ); + + assert_eq!( + 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 (595)"### + ); + + assert_eq!( + 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 (596)"### + ); + + assert_eq!( + 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 (597)"### + ); + + assert_eq!( + micromark_with_options( + r###"<http://../> +"###, + DANGER + ), + r###"<p><a href="http://../">http://../</a></p> +"###, + r###"Autolinks (598)"### + ); + + assert_eq!( + micromark_with_options( + r###"<localhost:5001/foo> +"###, + DANGER + ), + r###"<p><a href="localhost:5001/foo">localhost:5001/foo</a></p> +"###, + r###"Autolinks (599)"### + ); + + assert_eq!( + micromark_with_options( + r###"<http://foo.bar/baz bim> +"###, + DANGER + ), + r###"<p><http://foo.bar/baz bim></p> +"###, + r###"Autolinks (600)"### + ); + + assert_eq!( + 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 (601)"### + ); + + assert_eq!( + 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 (602)"### + ); + + assert_eq!( + 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 (603)"### + ); + + assert_eq!( + micromark_with_options( + r###"<foo\+@bar.example.com> +"###, + DANGER + ), + r###"<p><foo+@bar.example.com></p> +"###, + r###"Autolinks (604)"### + ); + + assert_eq!( + micromark_with_options( + r###"<> +"###, + DANGER + ), + r###"<p><></p> +"###, + r###"Autolinks (605)"### + ); + + assert_eq!( + micromark_with_options( + r###"< http://foo.bar > +"###, + DANGER + ), + r###"<p>< http://foo.bar ></p> +"###, + r###"Autolinks (606)"### + ); + + assert_eq!( + micromark_with_options( + r###"<m:abc> +"###, + DANGER + ), + r###"<p><m:abc></p> +"###, + r###"Autolinks (607)"### + ); + + assert_eq!( + micromark_with_options( + r###"<foo.bar.baz> +"###, + DANGER + ), + r###"<p><foo.bar.baz></p> +"###, + r###"Autolinks (608)"### + ); + + assert_eq!( + micromark_with_options( + r###"http://example.com +"###, + DANGER + ), + r###"<p>http://example.com</p> +"###, + r###"Autolinks (609)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo@bar.example.com +"###, + DANGER + ), + r###"<p>foo@bar.example.com</p> +"###, + r###"Autolinks (610)"### + ); + + assert_eq!( + micromark_with_options( + r###"<a><bab><c2c> +"###, + DANGER + ), + r###"<p><a><bab><c2c></p> +"###, + r###"Raw HTML (611)"### + ); + + assert_eq!( + micromark_with_options( + r###"<a/><b2/> +"###, + DANGER + ), + r###"<p><a/><b2/></p> +"###, + r###"Raw HTML (612)"### + ); + + assert_eq!( + micromark_with_options( + r###"<a /><b2 +data="foo" > +"###, + DANGER + ), + r###"<p><a /><b2 +data="foo" ></p> +"###, + r###"Raw HTML (613)"### + ); + + assert_eq!( + micromark_with_options( + r###"<a foo="bar" bam = 'baz <em>"</em>' +_boolean zoop:33=zoop:33 /> +"###, + DANGER + ), + r###"<p><a foo="bar" bam = 'baz <em>"</em>' +_boolean zoop:33=zoop:33 /></p> +"###, + r###"Raw HTML (614)"### + ); + + assert_eq!( + micromark_with_options( + r###"Foo <responsive-image src="foo.jpg" /> +"###, + DANGER + ), + r###"<p>Foo <responsive-image src="foo.jpg" /></p> +"###, + r###"Raw HTML (615)"### + ); + + assert_eq!( + micromark_with_options( + r###"<33> <__> +"###, + DANGER + ), + r###"<p><33> <__></p> +"###, + r###"Raw HTML (616)"### + ); + + assert_eq!( + micromark_with_options( + r###"<a h*#ref="hi"> +"###, + DANGER + ), + r###"<p><a h*#ref="hi"></p> +"###, + r###"Raw HTML (617)"### + ); + + assert_eq!( + micromark_with_options( + r###"<a href="hi'> <a href=hi'> +"###, + DANGER + ), + r###"<p><a href="hi'> <a href=hi'></p> +"###, + r###"Raw HTML (618)"### + ); + + assert_eq!( + micromark_with_options( + r###"< a>< +foo><bar/ > +<foo bar=baz +bim!bop /> +"###, + DANGER + ), + r###"<p>< a>< +foo><bar/ > +<foo bar=baz +bim!bop /></p> +"###, + r###"Raw HTML (619)"### + ); + + assert_eq!( + micromark_with_options( + r###"<a href='bar'title=title> +"###, + DANGER + ), + r###"<p><a href='bar'title=title></p> +"###, + r###"Raw HTML (620)"### + ); + + assert_eq!( + micromark_with_options( + r###"</a></foo > +"###, + DANGER + ), + r###"<p></a></foo ></p> +"###, + r###"Raw HTML (621)"### + ); + + assert_eq!( + micromark_with_options( + r###"</a href="foo"> +"###, + DANGER + ), + r###"<p></a href="foo"></p> +"###, + r###"Raw HTML (622)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo <!-- this is a +comment - with hyphen --> +"###, + DANGER + ), + r###"<p>foo <!-- this is a +comment - with hyphen --></p> +"###, + r###"Raw HTML (623)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo <!-- not a comment -- two hyphens --> +"###, + DANGER + ), + r###"<p>foo <!-- not a comment -- two hyphens --></p> +"###, + r###"Raw HTML (624)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo <!--> foo --> + +foo <!-- foo---> +"###, + DANGER + ), + r###"<p>foo <!--> foo --></p> +<p>foo <!-- foo---></p> +"###, + r###"Raw HTML (625)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo <?php echo $a; ?> +"###, + DANGER + ), + r###"<p>foo <?php echo $a; ?></p> +"###, + r###"Raw HTML (626)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo <!ELEMENT br EMPTY> +"###, + DANGER + ), + r###"<p>foo <!ELEMENT br EMPTY></p> +"###, + r###"Raw HTML (627)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo <![CDATA[>&<]]> +"###, + DANGER + ), + r###"<p>foo <![CDATA[>&<]]></p> +"###, + r###"Raw HTML (628)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo <a href="ö"> +"###, + DANGER + ), + r###"<p>foo <a href="ö"></p> +"###, + r###"Raw HTML (629)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo <a href="\*"> +"###, + DANGER + ), + r###"<p>foo <a href="\*"></p> +"###, + r###"Raw HTML (630)"### + ); + + assert_eq!( + micromark_with_options( + r###"<a href="\""> +"###, + DANGER + ), + r###"<p><a href="""></p> +"###, + r###"Raw HTML (631)"### + ); + + // To do: bug generating this file. + // assert_eq!( + // micromark_with_options( + // r###"foo + // baz + // "###, + // DANGER + // ), + // r###"<p>foo<br /> + // baz</p> + // "###, + // r###"Hard line breaks (632)"### + // ); + + assert_eq!( + micromark_with_options( + r###"foo\ +baz +"###, + DANGER + ), + r###"<p>foo<br /> +baz</p> +"###, + r###"Hard line breaks (633)"### + ); + + // To do: bug generating this file. + // assert_eq!( + // micromark_with_options( + // r###"foo + // baz + // "###, + // DANGER + // ), + // r###"<p>foo<br /> + // baz</p> + // "###, + // r###"Hard line breaks (634)"### + // ); + + // To do: bug generating this file. + // assert_eq!( + // micromark_with_options( + // r###"foo + // bar + // "###, + // DANGER + // ), + // r###"<p>foo<br /> + // bar</p> + // "###, + // r###"Hard line breaks (635)"### + // ); + + assert_eq!( + micromark_with_options( + r###"foo\ + bar +"###, + DANGER + ), + r###"<p>foo<br /> +bar</p> +"###, + r###"Hard line breaks (636)"### + ); + + // To do: bug generating this file. + // assert_eq!( + // micromark_with_options( + // r###"*foo + // bar* + // "###, + // DANGER + // ), + // r###"<p><em>foo<br /> + // bar</em></p> + // "###, + // r###"Hard line breaks (637)"### + // ); + + assert_eq!( + micromark_with_options( + r###"*foo\ +bar* +"###, + DANGER + ), + r###"<p><em>foo<br /> +bar</em></p> +"###, + r###"Hard line breaks (638)"### + ); + + // To do: bug generating this file. + // assert_eq!( + // micromark_with_options( + // r###"`code + // span` + // "###, + // DANGER + // ), + // r###"<p><code>code span</code></p> + // "###, + // r###"Hard line breaks (639)"### + // ); + + assert_eq!( + micromark_with_options( + r###"`code\ +span` +"###, + DANGER + ), + r###"<p><code>code\ span</code></p> +"###, + r###"Hard line breaks (640)"### + ); + + assert_eq!( + micromark_with_options( + r###"<a href="foo +bar"> +"###, + DANGER + ), + r###"<p><a href="foo +bar"></p> +"###, + r###"Hard line breaks (641)"### + ); + + assert_eq!( + micromark_with_options( + r###"<a href="foo\ +bar"> +"###, + DANGER + ), + r###"<p><a href="foo\ +bar"></p> +"###, + r###"Hard line breaks (642)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo\ +"###, + DANGER + ), + r###"<p>foo\</p> +"###, + r###"Hard line breaks (643)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo +"###, + DANGER + ), + r###"<p>foo</p> +"###, + r###"Hard line breaks (644)"### + ); + + assert_eq!( + micromark_with_options( + r###"### foo\ +"###, + DANGER + ), + r###"<h3>foo\</h3> +"###, + r###"Hard line breaks (645)"### + ); + + assert_eq!( + micromark_with_options( + r###"### foo +"###, + DANGER + ), + r###"<h3>foo</h3> +"###, + r###"Hard line breaks (646)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo +baz +"###, + DANGER + ), + r###"<p>foo +baz</p> +"###, + r###"Soft line breaks (647)"### + ); + + assert_eq!( + micromark_with_options( + r###"foo + baz +"###, + DANGER + ), + r###"<p>foo +baz</p> +"###, + r###"Soft line breaks (648)"### + ); + + assert_eq!( + micromark_with_options( + r###"hello $.;'there +"###, + DANGER + ), + r###"<p>hello $.;'there</p> +"###, + r###"Textual content (649)"### + ); + + assert_eq!( + micromark_with_options( + r###"Foo χρῆν +"###, + DANGER + ), + r###"<p>Foo χρῆν</p> +"###, + r###"Textual content (650)"### + ); + + assert_eq!( + micromark_with_options( + r###"Multiple spaces +"###, + DANGER + ), + r###"<p>Multiple spaces</p> +"###, + r###"Textual content (651)"### + ); +} |