aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/attention.rs272
-rw-r--r--tests/autolink.rs88
-rw-r--r--tests/block_quote.rs74
-rw-r--r--tests/character_escape.rs32
-rw-r--r--tests/character_reference.rs68
-rw-r--r--tests/code_fenced.rs96
-rw-r--r--tests/code_indented.rs64
-rw-r--r--tests/code_text.rs58
-rw-r--r--tests/commonmark.rs1308
-rw-r--r--tests/definition.rs164
-rw-r--r--tests/frontmatter.rs28
-rw-r--r--tests/fuzz.rs14
-rw-r--r--tests/gfm_autolink_literal.rs132
-rw-r--r--tests/gfm_footnote.rs110
-rw-r--r--tests/gfm_strikethrough.rs36
-rw-r--r--tests/gfm_table.rs134
-rw-r--r--tests/gfm_tagfilter.rs12
-rw-r--r--tests/gfm_task_list_item.rs20
-rw-r--r--tests/hard_break_escape.rs22
-rw-r--r--tests/hard_break_trailing.rs44
-rw-r--r--tests/heading_atx.rs76
-rw-r--r--tests/heading_setext.rs98
-rw-r--r--tests/html_flow.rs306
-rw-r--r--tests/html_text.rs144
-rw-r--r--tests/image.rs78
-rw-r--r--tests/link_reference.rs128
-rw-r--r--tests/link_resource.rs156
-rw-r--r--tests/list.rs196
-rw-r--r--tests/math_flow.rs86
-rw-r--r--tests/math_text.rs60
-rw-r--r--tests/mdx_esm.rs66
-rw-r--r--tests/mdx_expression_flow.rs68
-rw-r--r--tests/mdx_expression_text.rs84
-rw-r--r--tests/mdx_jsx_flow.rs44
-rw-r--r--tests/mdx_jsx_text.rs280
-rw-r--r--tests/mdx_swc.rs14
-rw-r--r--tests/misc_bom.rs8
-rw-r--r--tests/misc_dangerous_html.rs10
-rw-r--r--tests/misc_dangerous_protocol.rs66
-rw-r--r--tests/misc_default_line_ending.rs18
-rw-r--r--tests/misc_line_ending.rs66
-rw-r--r--tests/misc_soft_break.rs8
-rw-r--r--tests/misc_tabs.rs92
-rw-r--r--tests/misc_url.rs40
-rw-r--r--tests/misc_zero.rs12
-rw-r--r--tests/test_utils/hast.rs6
-rw-r--r--tests/test_utils/hast_util_to_swc.rs2
-rw-r--r--tests/test_utils/mdast_util_to_hast.rs2
-rw-r--r--tests/test_utils/mdx.rs4
-rw-r--r--tests/test_utils/mdx_plugin_recma_document.rs2
-rw-r--r--tests/test_utils/mdx_plugin_recma_jsx_rewrite.rs2
-rw-r--r--tests/test_utils/swc.rs6
-rw-r--r--tests/test_utils/swc_utils.rs2
-rw-r--r--tests/text.rs10
-rw-r--r--tests/thematic_break.rs64
-rw-r--r--tests/xxx_hast_util_to_swc.rs2
-rw-r--r--tests/xxx_mdast_util_to_hast.rs4
-rw-r--r--tests/xxx_mdx.rs2
-rw-r--r--tests/xxx_mdx_plugin_recma_document.rs6
-rw-r--r--tests/xxx_mdx_plugin_recma_jsx_rewrite.rs6
60 files changed, 2544 insertions, 2556 deletions
diff --git a/tests/attention.rs b/tests/attention.rs
index e627c4d..1eef10d 100644
--- a/tests/attention.rs
+++ b/tests/attention.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{Emphasis, Node, Paragraph, Root, Strong, Text},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
@@ -20,265 +20,265 @@ fn attention() -> Result<(), String> {
// Rule 1.
assert_eq!(
- micromark("*foo bar*"),
+ to_html("*foo bar*"),
"<p><em>foo bar</em></p>",
"should support emphasis w/ `*`"
);
assert_eq!(
- micromark("a * foo bar*"),
+ to_html("a * foo bar*"),
"<p>a * foo bar*</p>",
"should not support emphasis if the opening is not left flanking (1)"
);
assert_eq!(
- micromark("a*\"foo\"*"),
+ to_html("a*\"foo\"*"),
"<p>a*&quot;foo&quot;*</p>",
"should not support emphasis if the opening is not left flanking (2b)"
);
assert_eq!(
- micromark("* a *"),
+ to_html("* a *"),
"<p>* a *</p>",
"should not support emphasis unicode whitespace either"
);
assert_eq!(
- micromark("foo*bar*"),
+ to_html("foo*bar*"),
"<p>foo<em>bar</em></p>",
"should support intraword emphasis w/ `*` (1)"
);
assert_eq!(
- micromark("5*6*78"),
+ to_html("5*6*78"),
"<p>5<em>6</em>78</p>",
"should support intraword emphasis w/ `*` (2)"
);
// Rule 2.
assert_eq!(
- micromark("_foo bar_"),
+ to_html("_foo bar_"),
"<p><em>foo bar</em></p>",
"should support emphasis w/ `_`"
);
assert_eq!(
- micromark("_ foo bar_"),
+ to_html("_ foo bar_"),
"<p>_ foo bar_</p>",
"should not support emphasis if the opening is followed by whitespace"
);
assert_eq!(
- micromark("a_\"foo\"_"),
+ to_html("a_\"foo\"_"),
"<p>a_&quot;foo&quot;_</p>",
"should not support emphasis if the opening is preceded by something else and followed by punctuation"
);
assert_eq!(
- micromark("foo_bar_"),
+ to_html("foo_bar_"),
"<p>foo_bar_</p>",
"should not support intraword emphasis (1)"
);
assert_eq!(
- micromark("5_6_78"),
+ to_html("5_6_78"),
"<p>5_6_78</p>",
"should not support intraword emphasis (2)"
);
assert_eq!(
- micromark("пристаням_стремятся_"),
+ to_html("пристаням_стремятся_"),
"<p>пристаням_стремятся_</p>",
"should not support intraword emphasis (3)"
);
assert_eq!(
- micromark("aa_\"bb\"_cc"),
+ to_html("aa_\"bb\"_cc"),
"<p>aa_&quot;bb&quot;_cc</p>",
"should not support emphasis if the opening is right flanking and the closing is left flanking"
);
assert_eq!(
- micromark("foo-_(bar)_"),
+ to_html("foo-_(bar)_"),
"<p>foo-<em>(bar)</em></p>",
"should support emphasis if the opening is both left and right flanking, if it’s preceded by punctuation"
);
// Rule 3.
assert_eq!(
- micromark("_foo*"),
+ to_html("_foo*"),
"<p>_foo*</p>",
"should not support emphasis if opening and closing markers don’t match"
);
assert_eq!(
- micromark("*foo bar *"),
+ to_html("*foo bar *"),
"<p>*foo bar *</p>",
"should not support emphasis w/ `*` if the closing markers are preceded by whitespace"
);
assert_eq!(
- micromark("*foo bar\n*"),
+ to_html("*foo bar\n*"),
"<p>*foo bar\n*</p>",
"should not support emphasis w/ `*` if the closing markers are preceded by a line break (also whitespace)"
);
assert_eq!(
- micromark("*(*foo)"),
+ to_html("*(*foo)"),
"<p>*(*foo)</p>",
"should not support emphasis w/ `*` if the closing markers are not right flanking"
);
assert_eq!(
- micromark("*(*foo*)*"),
+ to_html("*(*foo*)*"),
"<p><em>(<em>foo</em>)</em></p>",
"should support nested emphasis"
);
// Rule 4.
assert_eq!(
- micromark("_foo bar _"),
+ to_html("_foo bar _"),
"<p>_foo bar _</p>",
"should not support emphasis if the closing `_` is preceded by whitespace"
);
assert_eq!(
- micromark("_(_foo)"),
+ to_html("_(_foo)"),
"<p>_(_foo)</p>",
"should not support emphasis w/ `_` if the closing markers are not right flanking"
);
assert_eq!(
- micromark("_(_foo_)_"),
+ to_html("_(_foo_)_"),
"<p><em>(<em>foo</em>)</em></p>",
"should support nested emphasis w/ `_`"
);
assert_eq!(
- micromark("_foo_bar"),
+ to_html("_foo_bar"),
"<p>_foo_bar</p>",
"should not support intraword emphasis w/ `_` (1)"
);
assert_eq!(
- micromark("_пристаням_стремятся"),
+ to_html("_пристаням_стремятся"),
"<p>_пристаням_стремятся</p>",
"should not support intraword emphasis w/ `_` (2)"
);
assert_eq!(
- micromark("_foo_bar_baz_"),
+ to_html("_foo_bar_baz_"),
"<p><em>foo_bar_baz</em></p>",
"should not support intraword emphasis w/ `_` (3)"
);
assert_eq!(
- micromark("_(bar)_."),
+ to_html("_(bar)_."),
"<p><em>(bar)</em>.</p>",
"should support emphasis if the opening is both left and right flanking, if it’s followed by punctuation"
);
// Rule 5.
assert_eq!(
- micromark("**foo bar**"),
+ to_html("**foo bar**"),
"<p><strong>foo bar</strong></p>",
"should support strong emphasis"
);
assert_eq!(
- micromark("** foo bar**"),
+ to_html("** foo bar**"),
"<p>** foo bar**</p>",
"should not support strong emphasis if the opening is followed by whitespace"
);
assert_eq!(
- micromark("a**\"foo\"**"),
+ to_html("a**\"foo\"**"),
"<p>a**&quot;foo&quot;**</p>",
"should not support strong emphasis if the opening is preceded by something else and followed by punctuation"
);
assert_eq!(
- micromark("foo**bar**"),
+ to_html("foo**bar**"),
"<p>foo<strong>bar</strong></p>",
"should support strong intraword emphasis"
);
// Rule 6.
assert_eq!(
- micromark("__foo bar__"),
+ to_html("__foo bar__"),
"<p><strong>foo bar</strong></p>",
"should support strong emphasis w/ `_`"
);
assert_eq!(
- micromark("__ foo bar__"),
+ to_html("__ foo bar__"),
"<p>__ foo bar__</p>",
"should not support strong emphasis if the opening is followed by whitespace"
);
assert_eq!(
- micromark("__\nfoo bar__"),
+ to_html("__\nfoo bar__"),
"<p>__\nfoo bar__</p>",
"should not support strong emphasis if the opening is followed by a line ending (also whitespace)"
);
assert_eq!(
- micromark("a__\"foo\"__"),
+ to_html("a__\"foo\"__"),
"<p>a__&quot;foo&quot;__</p>",
"should not support strong emphasis if the opening is preceded by something else and followed by punctuation"
);
assert_eq!(
- micromark("foo__bar__"),
+ to_html("foo__bar__"),
"<p>foo__bar__</p>",
"should not support strong intraword emphasis w/ `_` (1)"
);
assert_eq!(
- micromark("5__6__78"),
+ to_html("5__6__78"),
"<p>5__6__78</p>",
"should not support strong intraword emphasis w/ `_` (2)"
);
assert_eq!(
- micromark("пристаням__стремятся__"),
+ to_html("пристаням__стремятся__"),
"<p>пристаням__стремятся__</p>",
"should not support strong intraword emphasis w/ `_` (3)"
);
assert_eq!(
- micromark("__foo, __bar__, baz__"),
+ to_html("__foo, __bar__, baz__"),
"<p><strong>foo, <strong>bar</strong>, baz</strong></p>",
"should support nested strong emphasis"
);
assert_eq!(
- micromark("foo-__(bar)__"),
+ to_html("foo-__(bar)__"),
"<p>foo-<strong>(bar)</strong></p>",
"should support strong emphasis if the opening is both left and right flanking, if it’s preceded by punctuation"
);
// Rule 7.
assert_eq!(
- micromark("**foo bar **"),
+ to_html("**foo bar **"),
"<p>**foo bar **</p>",
"should not support strong emphasis w/ `*` if the closing is preceded by whitespace"
);
assert_eq!(
- micromark("**(**foo)"),
+ to_html("**(**foo)"),
"<p>**(**foo)</p>",
"should not support strong emphasis w/ `*` if the closing is preceded by punctuation and followed by something else"
);
assert_eq!(
- micromark("*(**foo**)*"),
+ to_html("*(**foo**)*"),
"<p><em>(<strong>foo</strong>)</em></p>",
"should support strong emphasis in emphasis"
);
assert_eq!(
- micromark(
+ to_html(
"**Gomphocarpus (*Gomphocarpus physocarpus*, syn.\n*Asclepias physocarpa*)**"
),
"<p><strong>Gomphocarpus (<em>Gomphocarpus physocarpus</em>, syn.\n<em>Asclepias physocarpa</em>)</strong></p>",
@@ -286,542 +286,542 @@ fn attention() -> Result<(), String> {
);
assert_eq!(
- micromark("**foo \"*bar*\" foo**"),
+ to_html("**foo \"*bar*\" foo**"),
"<p><strong>foo &quot;<em>bar</em>&quot; foo</strong></p>",
"should support emphasis in strong emphasis (2)"
);
assert_eq!(
- micromark("**foo**bar"),
+ to_html("**foo**bar"),
"<p><strong>foo</strong>bar</p>",
"should support strong intraword emphasis"
);
// Rule 8.
assert_eq!(
- micromark("__foo bar __"),
+ to_html("__foo bar __"),
"<p>__foo bar __</p>",
"should not support strong emphasis w/ `_` if the closing is preceded by whitespace"
);
assert_eq!(
- micromark("__(__foo)"),
+ to_html("__(__foo)"),
"<p>__(__foo)</p>",
"should not support strong emphasis w/ `_` if the closing is preceded by punctuation and followed by something else"
);
assert_eq!(
- micromark("_(__foo__)_"),
+ to_html("_(__foo__)_"),
"<p><em>(<strong>foo</strong>)</em></p>",
"should support strong emphasis w/ `_` in emphasis"
);
assert_eq!(
- micromark("__foo__bar"),
+ to_html("__foo__bar"),
"<p>__foo__bar</p>",
"should not support strong intraword emphasis w/ `_` (1)"
);
assert_eq!(
- micromark("__пристаням__стремятся"),
+ to_html("__пристаням__стремятся"),
"<p>__пристаням__стремятся</p>",
"should not support strong intraword emphasis w/ `_` (2)"
);
assert_eq!(
- micromark("__foo__bar__baz__"),
+ to_html("__foo__bar__baz__"),
"<p><strong>foo__bar__baz</strong></p>",
"should not support strong intraword emphasis w/ `_` (3)"
);
assert_eq!(
- micromark("__(bar)__."),
+ to_html("__(bar)__."),
"<p><strong>(bar)</strong>.</p>",
"should support strong emphasis if the opening is both left and right flanking, if it’s followed by punctuation"
);
// Rule 9.
assert_eq!(
- micromark("*foo [bar](/url)*"),
+ to_html("*foo [bar](/url)*"),
"<p><em>foo <a href=\"/url\">bar</a></em></p>",
"should support content in emphasis"
);
assert_eq!(
- micromark("*foo\nbar*"),
+ to_html("*foo\nbar*"),
"<p><em>foo\nbar</em></p>",
"should support line endings in emphasis"
);
assert_eq!(
- micromark("_foo __bar__ baz_"),
+ to_html("_foo __bar__ baz_"),
"<p><em>foo <strong>bar</strong> baz</em></p>",
"should support nesting emphasis and strong (1)"
);
assert_eq!(
- micromark("_foo _bar_ baz_"),
+ to_html("_foo _bar_ baz_"),
"<p><em>foo <em>bar</em> baz</em></p>",
"should support nesting emphasis and strong (2)"
);
assert_eq!(
- micromark("__foo_ bar_"),
+ to_html("__foo_ bar_"),
"<p><em><em>foo</em> bar</em></p>",
"should support nesting emphasis and strong (3)"
);
assert_eq!(
- micromark("*foo *bar**"),
+ to_html("*foo *bar**"),
"<p><em>foo <em>bar</em></em></p>",
"should support nesting emphasis and strong (4)"
);
assert_eq!(
- micromark("*foo **bar** baz*"),
+ to_html("*foo **bar** baz*"),
"<p><em>foo <strong>bar</strong> baz</em></p>",
"should support nesting emphasis and strong (5)"
);
assert_eq!(
- micromark("*foo**bar**baz*"),
+ to_html("*foo**bar**baz*"),
"<p><em>foo<strong>bar</strong>baz</em></p>",
"should support nesting emphasis and strong (6)"
);
assert_eq!(
- micromark("*foo**bar*"),
+ to_html("*foo**bar*"),
"<p><em>foo**bar</em></p>",
"should not support adjacent emphasis in certain cases"
);
assert_eq!(
- micromark("***foo** bar*"),
+ to_html("***foo** bar*"),
"<p><em><strong>foo</strong> bar</em></p>",
"complex (1)"
);
assert_eq!(
- micromark("*foo **bar***"),
+ to_html("*foo **bar***"),
"<p><em>foo <strong>bar</strong></em></p>",
"complex (2)"
);
assert_eq!(
- micromark("*foo**bar***"),
+ to_html("*foo**bar***"),
"<p><em>foo<strong>bar</strong></em></p>",
"complex (3)"
);
assert_eq!(
- micromark("foo***bar***baz"),
+ to_html("foo***bar***baz"),
"<p>foo<em><strong>bar</strong></em>baz</p>",
"complex (a)"
);
assert_eq!(
- micromark("foo******bar*********baz"),
+ to_html("foo******bar*********baz"),
"<p>foo<strong><strong><strong>bar</strong></strong></strong>***baz</p>",
"complex (b)"
);
assert_eq!(
- micromark("*foo **bar *baz* bim** bop*"),
+ to_html("*foo **bar *baz* bim** bop*"),
"<p><em>foo <strong>bar <em>baz</em> bim</strong> bop</em></p>",
"should support indefinite nesting of emphasis (1)"
);
assert_eq!(
- micromark("*foo [*bar*](/url)*"),
+ to_html("*foo [*bar*](/url)*"),
"<p><em>foo <a href=\"/url\"><em>bar</em></a></em></p>",
"should support indefinite nesting of emphasis (2)"
);
assert_eq!(
- micromark("** is not an empty emphasis"),
+ to_html("** is not an empty emphasis"),
"<p>** is not an empty emphasis</p>",
"should not support empty emphasis"
);
assert_eq!(
- micromark("**** is not an empty emphasis"),
+ to_html("**** is not an empty emphasis"),
"<p>**** is not an empty emphasis</p>",
"should not support empty strong emphasis"
);
// Rule 10.
assert_eq!(
- micromark("**foo [bar](/url)**"),
+ to_html("**foo [bar](/url)**"),
"<p><strong>foo <a href=\"/url\">bar</a></strong></p>",
"should support content in strong emphasis"
);
assert_eq!(
- micromark("**foo\nbar**"),
+ to_html("**foo\nbar**"),
"<p><strong>foo\nbar</strong></p>",
"should support line endings in emphasis"
);
assert_eq!(
- micromark("__foo _bar_ baz__"),
+ to_html("__foo _bar_ baz__"),
"<p><strong>foo <em>bar</em> baz</strong></p>",
"should support nesting emphasis and strong (1)"
);
assert_eq!(
- micromark("__foo __bar__ baz__"),
+ to_html("__foo __bar__ baz__"),
"<p><strong>foo <strong>bar</strong> baz</strong></p>",
"should support nesting emphasis and strong (2)"
);
assert_eq!(
- micromark("____foo__ bar__"),
+ to_html("____foo__ bar__"),
"<p><strong><strong>foo</strong> bar</strong></p>",
"should support nesting emphasis and strong (3)"
);
assert_eq!(
- micromark("**foo **bar****"),
+ to_html("**foo **bar****"),
"<p><strong>foo <strong>bar</strong></strong></p>",
"should support nesting emphasis and strong (4)"
);
assert_eq!(
- micromark("**foo *bar* baz**"),
+ to_html("**foo *bar* baz**"),
"<p><strong>foo <em>bar</em> baz</strong></p>",
"should support nesting emphasis and strong (5)"
);
assert_eq!(
- micromark("**foo*bar*baz**"),
+ to_html("**foo*bar*baz**"),
"<p><strong>foo<em>bar</em>baz</strong></p>",
"should support nesting emphasis and strong (6)"
);
assert_eq!(
- micromark("***foo* bar**"),
+ to_html("***foo* bar**"),
"<p><strong><em>foo</em> bar</strong></p>",
"should support nesting emphasis and strong (7)"
);
assert_eq!(
- micromark("**foo *bar***"),
+ to_html("**foo *bar***"),
"<p><strong>foo <em>bar</em></strong></p>",
"should support nesting emphasis and strong (8)"
);
assert_eq!(
- micromark("**foo *bar **baz**\nbim* bop**"),
+ to_html("**foo *bar **baz**\nbim* bop**"),
"<p><strong>foo <em>bar <strong>baz</strong>\nbim</em> bop</strong></p>",
"should support indefinite nesting of emphasis (1)"
);
assert_eq!(
- micromark("**foo [*bar*](/url)**"),
+ to_html("**foo [*bar*](/url)**"),
"<p><strong>foo <a href=\"/url\"><em>bar</em></a></strong></p>",
"should support indefinite nesting of emphasis (2)"
);
assert_eq!(
- micromark("__ is not an empty emphasis"),
+ to_html("__ is not an empty emphasis"),
"<p>__ is not an empty emphasis</p>",
"should not support empty emphasis"
);
assert_eq!(
- micromark("____ is not an empty emphasis"),
+ to_html("____ is not an empty emphasis"),
"<p>____ is not an empty emphasis</p>",
"should not support empty strong emphasis"
);
// Rule 11.
assert_eq!(
- micromark("foo ***"),
+ to_html("foo ***"),
"<p>foo ***</p>",
"should not support emphasis around the same marker"
);
assert_eq!(
- micromark("foo *\\**"),
+ to_html("foo *\\**"),
"<p>foo <em>*</em></p>",
"should support emphasis around an escaped marker"
);
assert_eq!(
- micromark("foo *_*"),
+ to_html("foo *_*"),
"<p>foo <em>_</em></p>",
"should support emphasis around the other marker"
);
assert_eq!(
- micromark("foo *****"),
+ to_html("foo *****"),
"<p>foo *****</p>",
"should not support strong emphasis around the same marker"
);
assert_eq!(
- micromark("foo **\\***"),
+ to_html("foo **\\***"),
"<p>foo <strong>*</strong></p>",
"should support strong emphasis around an escaped marker"
);
assert_eq!(
- micromark("foo **_**"),
+ to_html("foo **_**"),
"<p>foo <strong>_</strong></p>",
"should support strong emphasis around the other marker"
);
assert_eq!(
- micromark("**foo*"),
+ to_html("**foo*"),
"<p>*<em>foo</em></p>",
"should support a superfluous marker at the start of emphasis"
);
assert_eq!(
- micromark("*foo**"),
+ to_html("*foo**"),
"<p><em>foo</em>*</p>",
"should support a superfluous marker at the end of emphasis"
);
assert_eq!(
- micromark("***foo**"),
+ to_html("***foo**"),
"<p>*<strong>foo</strong></p>",
"should support a superfluous marker at the start of strong"
);
assert_eq!(
- micromark("****foo*"),
+ to_html("****foo*"),
"<p>***<em>foo</em></p>",
"should support multiple superfluous markers at the start of strong"
);
assert_eq!(
- micromark("**foo***"),
+ to_html("**foo***"),
"<p><strong>foo</strong>*</p>",
"should support a superfluous marker at the end of strong"
);
assert_eq!(
- micromark("*foo****"),
+ to_html("*foo****"),
"<p><em>foo</em>***</p>",
"should support multiple superfluous markers at the end of strong"
);
// Rule 12.
assert_eq!(
- micromark("foo ___"),
+ to_html("foo ___"),
"<p>foo ___</p>",
"should not support emphasis around the same marker"
);
assert_eq!(
- micromark("foo _\\__"),
+ to_html("foo _\\__"),
"<p>foo <em>_</em></p>",
"should support emphasis around an escaped marker"
);
assert_eq!(
- micromark("foo _X_"),
+ to_html("foo _X_"),
"<p>foo <em>X</em></p>",
"should support emphasis around the other marker"
);
assert_eq!(
- micromark("foo _____"),
+ to_html("foo _____"),
"<p>foo _____</p>",
"should not support strong emphasis around the same marker"
);
assert_eq!(
- micromark("foo __\\___"),
+ to_html("foo __\\___"),
"<p>foo <strong>_</strong></p>",
"should support strong emphasis around an escaped marker"
);
assert_eq!(
- micromark("foo __X__"),
+ to_html("foo __X__"),
"<p>foo <strong>X</strong></p>",
"should support strong emphasis around the other marker"
);
assert_eq!(
- micromark("__foo_"),
+ to_html("__foo_"),
"<p>_<em>foo</em></p>",
"should support a superfluous marker at the start of emphasis"
);
assert_eq!(
- micromark("_foo__"),
+ to_html("_foo__"),
"<p><em>foo</em>_</p>",
"should support a superfluous marker at the end of emphasis"
);
assert_eq!(
- micromark("___foo__"),
+ to_html("___foo__"),
"<p>_<strong>foo</strong></p>",
"should support a superfluous marker at the start of strong"
);
assert_eq!(
- micromark("____foo_"),
+ to_html("____foo_"),
"<p>___<em>foo</em></p>",
"should support multiple superfluous markers at the start of strong"
);
assert_eq!(
- micromark("__foo___"),
+ to_html("__foo___"),
"<p><strong>foo</strong>_</p>",
"should support a superfluous marker at the end of strong"
);
assert_eq!(
- micromark("_foo____"),
+ to_html("_foo____"),
"<p><em>foo</em>___</p>",
"should support multiple superfluous markers at the end of strong"
);
// Rule 13.
assert_eq!(
- micromark("**foo**"),
+ to_html("**foo**"),
"<p><strong>foo</strong></p>",
"should support strong w/ `*`"
);
assert_eq!(
- micromark("*_foo_*"),
+ to_html("*_foo_*"),
"<p><em><em>foo</em></em></p>",
"should support emphasis directly in emphasis w/ `_` in `*`"
);
assert_eq!(
- micromark("__foo__"),
+ to_html("__foo__"),
"<p><strong>foo</strong></p>",
"should support strong w/ `_`"
);
assert_eq!(
- micromark("_*foo*_"),
+ to_html("_*foo*_"),
"<p><em><em>foo</em></em></p>",
"should support emphasis directly in emphasis w/ `*` in `_`"
);
assert_eq!(
- micromark("****foo****"),
+ to_html("****foo****"),
"<p><strong><strong>foo</strong></strong></p>",
"should support strong emphasis directly in strong emphasis w/ `*`"
);
assert_eq!(
- micromark("____foo____"),
+ to_html("____foo____"),
"<p><strong><strong>foo</strong></strong></p>",
"should support strong emphasis directly in strong emphasis w/ `_`"
);
assert_eq!(
- micromark("******foo******"),
+ to_html("******foo******"),
"<p><strong><strong><strong>foo</strong></strong></strong></p>",
"should support indefinite strong emphasis"
);
// Rule 14.
assert_eq!(
- micromark("***foo***"),
+ to_html("***foo***"),
"<p><em><strong>foo</strong></em></p>",
"should support strong directly in emphasis w/ `*`"
);
assert_eq!(
- micromark("___foo___"),
+ to_html("___foo___"),
"<p><em><strong>foo</strong></em></p>",
"should support strong directly in emphasis w/ `_`"
);
// Rule 15.
assert_eq!(
- micromark("*foo _bar* baz_"),
+ to_html("*foo _bar* baz_"),
"<p><em>foo _bar</em> baz_</p>",
"should not support mismatched emphasis"
);
assert_eq!(
- micromark("*foo __bar *baz bim__ bam*"),
+ to_html("*foo __bar *baz bim__ bam*"),
"<p><em>foo <strong>bar *baz bim</strong> bam</em></p>",
"should not support mismatched strong emphasis"
);
// Rule 16.
assert_eq!(
- micromark("**foo **bar baz**"),
+ to_html("**foo **bar baz**"),
"<p>**foo <strong>bar baz</strong></p>",
"should not shortest strong possible"
);
assert_eq!(
- micromark("*foo *bar baz*"),
+ to_html("*foo *bar baz*"),
"<p>*foo <em>bar baz</em></p>",
"should not shortest emphasis possible"
);
// Rule 17.
assert_eq!(
- micromark("*[bar*](/url)"),
+ to_html("*[bar*](/url)"),
"<p>*<a href=\"/url\">bar*</a></p>",
"should not mismatch inside links (1)"
);
assert_eq!(
- micromark("_[bar_](/url)"),
+ to_html("_[bar_](/url)"),
"<p>_<a href=\"/url\">bar_</a></p>",
"should not mismatch inside links (1)"
);
assert_eq!(
- micromark_with_options("*<img src=\"foo\" title=\"*\"/>", &danger)?,
+ to_html_with_options("*<img src=\"foo\" title=\"*\"/>", &danger)?,
"<p>*<img src=\"foo\" title=\"*\"/></p>",
"should not end inside HTML"
);
assert_eq!(
- micromark_with_options("*<img src=\"foo\" title=\"*\"/>", &danger)?,
+ to_html_with_options("*<img src=\"foo\" title=\"*\"/>", &danger)?,
"<p>*<img src=\"foo\" title=\"*\"/></p>",
"should not end emphasis inside HTML"
);
assert_eq!(
- micromark_with_options("**<a href=\"**\">", &danger)?,
+ to_html_with_options("**<a href=\"**\">", &danger)?,
"<p>**<a href=\"**\"></p>",
"should not end strong inside HTML (1)"
);
assert_eq!(
- micromark_with_options("__<a href=\"__\">", &danger)?,
+ to_html_with_options("__<a href=\"__\">", &danger)?,
"<p>__<a href=\"__\"></p>",
"should not end strong inside HTML (2)"
);
assert_eq!(
- micromark("*a `*`*"),
+ to_html("*a `*`*"),
"<p><em>a <code>*</code></em></p>",
"should not end emphasis inside code (1)"
);
assert_eq!(
- micromark("_a `_`_"),
+ to_html("_a `_`_"),
"<p><em>a <code>_</code></em></p>",
"should not end emphasis inside code (2)"
);
assert_eq!(
- micromark("**a<http://foo.bar/?q=**>"),
+ to_html("**a<http://foo.bar/?q=**>"),
"<p>**a<a href=\"http://foo.bar/?q=**\">http://foo.bar/?q=**</a></p>",
"should not end strong emphasis inside autolinks (1)"
);
assert_eq!(
- micromark("__a<http://foo.bar/?q=__>"),
+ to_html("__a<http://foo.bar/?q=__>"),
"<p>__a<a href=\"http://foo.bar/?q=__\">http://foo.bar/?q=__</a></p>",
"should not end strong emphasis inside autolinks (2)"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"*a*",
&Options {
parse: ParseOptions {
@@ -839,7 +839,7 @@ fn attention() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("a *alpha* b **bravo** c.", &ParseOptions::default())?,
+ to_mdast("a *alpha* b **bravo** c.", &ParseOptions::default())?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![
diff --git a/tests/autolink.rs b/tests/autolink.rs
index d2b0956..1b20e08 100644
--- a/tests/autolink.rs
+++ b/tests/autolink.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{Link, Node, Paragraph, Root, Text},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
@@ -19,241 +19,241 @@ fn autolink() -> Result<(), String> {
};
assert_eq!(
- micromark("<http://foo.bar.baz>"),
+ to_html("<http://foo.bar.baz>"),
"<p><a href=\"http://foo.bar.baz\">http://foo.bar.baz</a></p>",
"should support protocol autolinks (1)"
);
assert_eq!(
- micromark("<http://foo.bar.baz/test?q=hello&id=22&boolean>"),
+ to_html("<http://foo.bar.baz/test?q=hello&id=22&boolean>"),
"<p><a href=\"http://foo.bar.baz/test?q=hello&amp;id=22&amp;boolean\">http://foo.bar.baz/test?q=hello&amp;id=22&amp;boolean</a></p>",
"should support protocol autolinks (2)"
);
assert_eq!(
- micromark("<irc://foo.bar:2233/baz>"),
+ to_html("<irc://foo.bar:2233/baz>"),
"<p><a href=\"irc://foo.bar:2233/baz\">irc://foo.bar:2233/baz</a></p>",
"should support protocol autolinks w/ non-HTTP schemes"
);
assert_eq!(
- micromark("<MAILTO:FOO@BAR.BAZ>"),
+ to_html("<MAILTO:FOO@BAR.BAZ>"),
"<p><a href=\"MAILTO:FOO@BAR.BAZ\">MAILTO:FOO@BAR.BAZ</a></p>",
"should support protocol autolinks in uppercase"
);
assert_eq!(
- micromark("<a+b+c:d>"),
+ to_html("<a+b+c:d>"),
"<p><a href=\"\">a+b+c:d</a></p>",
"should support protocol autolinks w/ incorrect URIs (1, default)"
);
assert_eq!(
- micromark_with_options("<a+b+c:d>", &danger)?,
+ to_html_with_options("<a+b+c:d>", &danger)?,
"<p><a href=\"a+b+c:d\">a+b+c:d</a></p>",
"should support protocol autolinks w/ incorrect URIs (1, danger)"
);
assert_eq!(
- micromark("<made-up-scheme://foo,bar>"),
+ to_html("<made-up-scheme://foo,bar>"),
"<p><a href=\"\">made-up-scheme://foo,bar</a></p>",
"should support protocol autolinks w/ incorrect URIs (2, default)"
);
assert_eq!(
- micromark_with_options("<made-up-scheme://foo,bar>", &danger)?,
+ to_html_with_options("<made-up-scheme://foo,bar>", &danger)?,
"<p><a href=\"made-up-scheme://foo,bar\">made-up-scheme://foo,bar</a></p>",
"should support protocol autolinks w/ incorrect URIs (2, danger)"
);
assert_eq!(
- micromark("<http://../>"),
+ to_html("<http://../>"),
"<p><a href=\"http://../\">http://../</a></p>",
"should support protocol autolinks w/ incorrect URIs (3)"
);
assert_eq!(
- micromark_with_options("<localhost:5001/foo>", &danger)?,
+ to_html_with_options("<localhost:5001/foo>", &danger)?,
"<p><a href=\"localhost:5001/foo\">localhost:5001/foo</a></p>",
"should support protocol autolinks w/ incorrect URIs (4)"
);
assert_eq!(
- micromark("<http://foo.bar/baz bim>"),
+ to_html("<http://foo.bar/baz bim>"),
"<p>&lt;http://foo.bar/baz bim&gt;</p>",
"should not support protocol autolinks w/ spaces"
);
assert_eq!(
- micromark("<http://example.com/\\[\\>"),
+ to_html("<http://example.com/\\[\\>"),
"<p><a href=\"http://example.com/%5C%5B%5C\">http://example.com/\\[\\</a></p>",
"should not support character escapes in protocol autolinks"
);
assert_eq!(
- micromark("<foo@bar.example.com>"),
+ to_html("<foo@bar.example.com>"),
"<p><a href=\"mailto:foo@bar.example.com\">foo@bar.example.com</a></p>",
"should support email autolinks (1)"
);
assert_eq!(
- micromark("<foo+special@Bar.baz-bar0.com>"),
+ to_html("<foo+special@Bar.baz-bar0.com>"),
"<p><a href=\"mailto:foo+special@Bar.baz-bar0.com\">foo+special@Bar.baz-bar0.com</a></p>",
"should support email autolinks (2)"
);
assert_eq!(
- micromark("<a@b.c>"),
+ to_html("<a@b.c>"),
"<p><a href=\"mailto:a@b.c\">a@b.c</a></p>",
"should support email autolinks (3)"
);
assert_eq!(
- micromark("<foo\\+@bar.example.com>"),
+ to_html("<foo\\+@bar.example.com>"),
"<p>&lt;foo+@bar.example.com&gt;</p>",
"should not support character escapes in email autolinks"
);
assert_eq!(
- micromark("<>"),
+ to_html("<>"),
"<p>&lt;&gt;</p>",
"should not support empty autolinks"
);
assert_eq!(
- micromark("< http://foo.bar >"),
+ to_html("< http://foo.bar >"),
"<p>&lt; http://foo.bar &gt;</p>",
"should not support autolinks w/ space"
);
assert_eq!(
- micromark("<m:abc>"),
+ to_html("<m:abc>"),
"<p>&lt;m:abc&gt;</p>",
"should not support autolinks w/ a single character for a scheme"
);
assert_eq!(
- micromark("<foo.bar.baz>"),
+ to_html("<foo.bar.baz>"),
"<p>&lt;foo.bar.baz&gt;</p>",
"should not support autolinks w/o a colon or at sign"
);
assert_eq!(
- micromark("http://example.com"),
+ to_html("http://example.com"),
"<p>http://example.com</p>",
"should not support protocol autolinks w/o angle brackets"
);
assert_eq!(
- micromark("foo@bar.example.com"),
+ to_html("foo@bar.example.com"),
"<p>foo@bar.example.com</p>",
"should not support email autolinks w/o angle brackets"
);
// Extra:
assert_eq!(
- micromark("<*@example.com>"),
+ to_html("<*@example.com>"),
"<p><a href=\"mailto:*@example.com\">*@example.com</a></p>",
"should support autolinks w/ atext (1)"
);
assert_eq!(
- micromark("<a*@example.com>"),
+ to_html("<a*@example.com>"),
"<p><a href=\"mailto:a*@example.com\">a*@example.com</a></p>",
"should support autolinks w/ atext (2)"
);
assert_eq!(
- micromark("<aa*@example.com>"),
+ to_html("<aa*@example.com>"),
"<p><a href=\"mailto:aa*@example.com\">aa*@example.com</a></p>",
"should support autolinks w/ atext (3)"
);
assert_eq!(
- micromark("<aaa©@example.com>"),
+ to_html("<aaa©@example.com>"),
"<p>&lt;aaa©@example.com&gt;</p>",
"should support non-atext in email autolinks local part (1)"
);
assert_eq!(
- micromark("<a*a©@example.com>"),
+ to_html("<a*a©@example.com>"),
"<p>&lt;a*a©@example.com&gt;</p>",
"should support non-atext in email autolinks local part (2)"
);
assert_eq!(
- micromark("<asd@.example.com>"),
+ to_html("<asd@.example.com>"),
"<p>&lt;asd@.example.com&gt;</p>",
"should not support a dot after an at sign in email autolinks"
);
assert_eq!(
- micromark("<asd@e..xample.com>"),
+ to_html("<asd@e..xample.com>"),
"<p>&lt;asd@e..xample.com&gt;</p>",
"should not support a dot after another dot in email autolinks"
);
assert_eq!(
- micromark(
+ to_html(
"<asd@012345678901234567890123456789012345678901234567890123456789012>"),
"<p><a href=\"mailto:asd@012345678901234567890123456789012345678901234567890123456789012\">asd@012345678901234567890123456789012345678901234567890123456789012</a></p>",
"should support 63 character in email autolinks domains"
);
assert_eq!(
- micromark("<asd@0123456789012345678901234567890123456789012345678901234567890123>"),
+ to_html("<asd@0123456789012345678901234567890123456789012345678901234567890123>"),
"<p>&lt;asd@0123456789012345678901234567890123456789012345678901234567890123&gt;</p>",
"should not support 64 character in email autolinks domains"
);
assert_eq!(
- micromark(
+ to_html(
"<asd@012345678901234567890123456789012345678901234567890123456789012.a>"),
"<p><a href=\"mailto:asd@012345678901234567890123456789012345678901234567890123456789012.a\">asd@012345678901234567890123456789012345678901234567890123456789012.a</a></p>",
"should support a TLD after a 63 character domain in email autolinks"
);
assert_eq!(
- micromark("<asd@0123456789012345678901234567890123456789012345678901234567890123.a>"),
+ to_html("<asd@0123456789012345678901234567890123456789012345678901234567890123.a>"),
"<p>&lt;asd@0123456789012345678901234567890123456789012345678901234567890123.a&gt;</p>",
"should not support a TLD after a 64 character domain in email autolinks"
);
assert_eq!(
- micromark(
+ to_html(
"<asd@a.012345678901234567890123456789012345678901234567890123456789012>"),
"<p><a href=\"mailto:asd@a.012345678901234567890123456789012345678901234567890123456789012\">asd@a.012345678901234567890123456789012345678901234567890123456789012</a></p>",
"should support a 63 character TLD in email autolinks"
);
assert_eq!(
- micromark("<asd@a.0123456789012345678901234567890123456789012345678901234567890123>"),
+ to_html("<asd@a.0123456789012345678901234567890123456789012345678901234567890123>"),
"<p>&lt;asd@a.0123456789012345678901234567890123456789012345678901234567890123&gt;</p>",
"should not support a 64 character TLD in email autolinks"
);
assert_eq!(
- micromark("<asd@-example.com>"),
+ to_html("<asd@-example.com>"),
"<p>&lt;asd@-example.com&gt;</p>",
"should not support a dash after `@` in email autolinks"
);
assert_eq!(
- micromark("<asd@e-xample.com>"),
+ to_html("<asd@e-xample.com>"),
"<p><a href=\"mailto:asd@e-xample.com\">asd@e-xample.com</a></p>",
"should support a dash after other domain characters in email autolinks"
);
assert_eq!(
- micromark("<asd@e--xample.com>"),
+ to_html("<asd@e--xample.com>"),
"<p><a href=\"mailto:asd@e--xample.com\">asd@e--xample.com</a></p>",
"should support a dash after another dash in email autolinks"
);
assert_eq!(
- micromark("<asd@example-.com>"),
+ to_html("<asd@example-.com>"),
"<p>&lt;asd@example-.com&gt;</p>",
"should not support a dash before a dot in email autolinks"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"<a@b.co>",
&Options {
parse: ParseOptions {
@@ -271,7 +271,7 @@ fn autolink() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast(
+ to_mdast(
"a <https://alpha.com> b <bravo@charlie.com> c.",
&ParseOptions::default()
)?,
diff --git a/tests/block_quote.rs b/tests/block_quote.rs
index 9d967ee..970b82e 100644
--- a/tests/block_quote.rs
+++ b/tests/block_quote.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{BlockQuote, Node, Paragraph, Root, Text},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
@@ -10,199 +10,199 @@ use pretty_assertions::assert_eq;
#[test]
fn block_quote() -> Result<(), String> {
assert_eq!(
- micromark("> # a\n> b\n> c"),
+ to_html("> # a\n> b\n> c"),
"<blockquote>\n<h1>a</h1>\n<p>b\nc</p>\n</blockquote>",
"should support block quotes"
);
assert_eq!(
- micromark("># a\n>b\n> c"),
+ to_html("># a\n>b\n> c"),
"<blockquote>\n<h1>a</h1>\n<p>b\nc</p>\n</blockquote>",
"should support block quotes w/o space"
);
assert_eq!(
- micromark(" > # a\n > b\n > c"),
+ to_html(" > # a\n > b\n > c"),
"<blockquote>\n<h1>a</h1>\n<p>b\nc</p>\n</blockquote>",
"should support prefixing block quotes w/ spaces"
);
assert_eq!(
- micromark(" > # a\n > b\n > c"),
+ to_html(" > # a\n > b\n > c"),
"<pre><code>&gt; # a\n&gt; b\n&gt; c\n</code></pre>",
"should not support block quotes w/ 4 spaces"
);
assert_eq!(
- micromark("> # a\n> b\nc"),
+ to_html("> # a\n> b\nc"),
"<blockquote>\n<h1>a</h1>\n<p>b\nc</p>\n</blockquote>",
"should support lazy content lines"
);
assert_eq!(
- micromark("> a\nb\n> c"),
+ to_html("> a\nb\n> c"),
"<blockquote>\n<p>a\nb\nc</p>\n</blockquote>",
"should support lazy content lines inside block quotes"
);
assert_eq!(
- micromark("> a\n> ---"),
+ to_html("> a\n> ---"),
"<blockquote>\n<h2>a</h2>\n</blockquote>",
"should support setext headings underlines in block quotes"
);
assert_eq!(
- micromark("> a\n---"),
+ to_html("> a\n---"),
"<blockquote>\n<p>a</p>\n</blockquote>\n<hr />",
"should not support lazy setext headings underlines in block quotes"
);
assert_eq!(
- micromark("> - a\n> - b"),
+ to_html("> - a\n> - b"),
"<blockquote>\n<ul>\n<li>a</li>\n<li>b</li>\n</ul>\n</blockquote>",
"should support lists in block quotes"
);
assert_eq!(
- micromark("> - a\n- b"),
+ to_html("> - a\n- b"),
"<blockquote>\n<ul>\n<li>a</li>\n</ul>\n</blockquote>\n<ul>\n<li>b</li>\n</ul>",
"should not support lazy lists in block quotes"
);
assert_eq!(
- micromark("> a\n b"),
+ to_html("> a\n b"),
"<blockquote>\n<pre><code>a\n</code></pre>\n</blockquote>\n<pre><code>b\n</code></pre>",
"should not support lazy indented code in block quotes"
);
assert_eq!(
- micromark("> ```\na\n```"),
+ to_html("> ```\na\n```"),
"<blockquote>\n<pre><code></code></pre>\n</blockquote>\n<p>a</p>\n<pre><code></code></pre>\n",
"should not support lazy fenced code in block quotes (1)"
);
assert_eq!(
- micromark("> a\n```\nb"),
+ to_html("> a\n```\nb"),
"<blockquote>\n<p>a</p>\n</blockquote>\n<pre><code>b\n</code></pre>\n",
"should not support lazy fenced code in block quotes (2)"
);
assert_eq!(
- micromark("> a\n - b"),
+ to_html("> a\n - b"),
"<blockquote>\n<p>a\n- b</p>\n</blockquote>",
"should not support lazy indented code (or lazy list) in block quotes"
);
assert_eq!(
- micromark("> [\na"),
+ to_html("> [\na"),
"<blockquote>\n<p>[\na</p>\n</blockquote>",
"should support lazy, definition-like lines"
);
assert_eq!(
- micromark("> [a]: b\nc"),
+ to_html("> [a]: b\nc"),
"<blockquote>\n<p>c</p>\n</blockquote>",
"should support a definition, followed by a lazy paragraph"
);
assert_eq!(
- micromark(">"),
+ to_html(">"),
"<blockquote>\n</blockquote>",
"should support empty block quotes (1)"
);
assert_eq!(
- micromark(">\n> \n> "),
+ to_html(">\n> \n> "),
"<blockquote>\n</blockquote>",
"should support empty block quotes (2)"
);
assert_eq!(
- micromark(">\n> a\n> "),
+ to_html(">\n> a\n> "),
"<blockquote>\n<p>a</p>\n</blockquote>",
"should support initial or final lazy empty block quote lines"
);
assert_eq!(
- micromark("> a\n\n> b"),
+ to_html("> a\n\n> b"),
"<blockquote>\n<p>a</p>\n</blockquote>\n<blockquote>\n<p>b</p>\n</blockquote>",
"should support adjacent block quotes"
);
assert_eq!(
- micromark("> a\n> b"),
+ to_html("> a\n> b"),
"<blockquote>\n<p>a\nb</p>\n</blockquote>",
"should support a paragraph in a block quote"
);
assert_eq!(
- micromark("> a\n>\n> b"),
+ to_html("> a\n>\n> b"),
"<blockquote>\n<p>a</p>\n<p>b</p>\n</blockquote>",
"should support adjacent paragraphs in block quotes"
);
assert_eq!(
- micromark("[a]\n\n> [a]: b"),
+ to_html("[a]\n\n> [a]: b"),
"<p><a href=\"b\">a</a></p>\n<blockquote>\n</blockquote>",
"should support a definition in a block quote (1)"
);
assert_eq!(
- micromark("> [a]: b\n\n[a]"),
+ to_html("> [a]: b\n\n[a]"),
"<blockquote>\n</blockquote>\n<p><a href=\"b\">a</a></p>",
"should support a definition in a block quote (2)"
);
assert_eq!(
- micromark("a\n> b"),
+ to_html("a\n> b"),
"<p>a</p>\n<blockquote>\n<p>b</p>\n</blockquote>",
"should support interrupting paragraphs w/ block quotes"
);
assert_eq!(
- micromark("> a\n***\n> b"),
+ to_html("> a\n***\n> b"),
"<blockquote>\n<p>a</p>\n</blockquote>\n<hr />\n<blockquote>\n<p>b</p>\n</blockquote>",
"should support interrupting block quotes w/ thematic breaks"
);
assert_eq!(
- micromark("> a\nb"),
+ to_html("> a\nb"),
"<blockquote>\n<p>a\nb</p>\n</blockquote>",
"should not support interrupting block quotes w/ paragraphs"
);
assert_eq!(
- micromark("> a\n\nb"),
+ to_html("> a\n\nb"),
"<blockquote>\n<p>a</p>\n</blockquote>\n<p>b</p>",
"should support interrupting block quotes w/ blank lines"
);
assert_eq!(
- micromark("> a\n>\nb"),
+ to_html("> a\n>\nb"),
"<blockquote>\n<p>a</p>\n</blockquote>\n<p>b</p>",
"should not support interrupting a blank line in a block quotes w/ paragraphs"
);
assert_eq!(
- micromark("> > > a\nb"),
+ to_html("> > > a\nb"),
"<blockquote>\n<blockquote>\n<blockquote>\n<p>a\nb</p>\n</blockquote>\n</blockquote>\n</blockquote>",
"should not support interrupting many block quotes w/ paragraphs (1)"
);
assert_eq!(
- micromark(">>> a\n> b\n>>c"),
+ to_html(">>> a\n> b\n>>c"),
"<blockquote>\n<blockquote>\n<blockquote>\n<p>a\nb\nc</p>\n</blockquote>\n</blockquote>\n</blockquote>",
"should not support interrupting many block quotes w/ paragraphs (2)"
);
assert_eq!(
- micromark("> a\n\n> b"),
+ to_html("> a\n\n> b"),
"<blockquote>\n<pre><code>a\n</code></pre>\n</blockquote>\n<blockquote>\n<p>b</p>\n</blockquote>",
"should support 5 spaces for indented code, not 4"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"> # a\n> b\n> c",
&Options {
parse: ParseOptions {
@@ -220,7 +220,7 @@ fn block_quote() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("> a", &ParseOptions::default())?,
+ to_mdast("> a", &ParseOptions::default())?,
Node::Root(Root {
children: vec![Node::BlockQuote(BlockQuote {
children: vec![Node::Paragraph(Paragraph {
diff --git a/tests/character_escape.rs b/tests/character_escape.rs
index c5c9004..0546269 100644
--- a/tests/character_escape.rs
+++ b/tests/character_escape.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{Node, Paragraph, Root, Text},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
@@ -19,75 +19,75 @@ fn character_escape() -> Result<(), String> {
};
assert_eq!(
- micromark(
+ to_html(
"\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\-\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\_\\`\\{\\|\\}\\~"),
"<p>!&quot;#$%&amp;'()*+,-./:;&lt;=&gt;?@[\\]^_`{|}~</p>",
"should support escaped ascii punctuation"
);
assert_eq!(
- micromark("\\→\\A\\a\\ \\3\\φ\\«"),
+ to_html("\\→\\A\\a\\ \\3\\φ\\«"),
"<p>\\→\\A\\a\\ \\3\\φ\\«</p>",
"should not support other characters after a backslash"
);
assert_eq!(
- micromark(
+ to_html(
"\\*not emphasized*\n\\<br/> not a tag\n\\[not a link](/foo)\n\\`not code`\n1\\. not a list\n\\* not a list\n\\# not a heading\n\\[foo]: /url \"not a reference\"\n\\&ouml; not a character entity"),
"<p>*not emphasized*\n&lt;br/&gt; not a tag\n[not a link](/foo)\n`not code`\n1. not a list\n* not a list\n# not a heading\n[foo]: /url &quot;not a reference&quot;\n&amp;ouml; not a character entity</p>",
"should escape other constructs"
);
assert_eq!(
- micromark("foo\\\nbar"),
+ to_html("foo\\\nbar"),
"<p>foo<br />\nbar</p>",
"should escape a line break"
);
assert_eq!(
- micromark("`` \\[\\` ``"),
+ to_html("`` \\[\\` ``"),
"<p><code>\\[\\`</code></p>",
"should not escape in text code"
);
assert_eq!(
- micromark(" \\[\\]"),
+ to_html(" \\[\\]"),
"<pre><code>\\[\\]\n</code></pre>",
"should not escape in indented code"
);
assert_eq!(
- micromark("<http://example.com?find=\\*>"),
+ to_html("<http://example.com?find=\\*>"),
"<p><a href=\"http://example.com?find=%5C*\">http://example.com?find=\\*</a></p>",
"should not escape in autolink"
);
assert_eq!(
- micromark_with_options("<a href=\"/bar\\/)\">", &danger)?,
+ to_html_with_options("<a href=\"/bar\\/)\">", &danger)?,
"<a href=\"/bar\\/)\">",
"should not escape in flow html"
);
assert_eq!(
- micromark("[foo](/bar\\* \"ti\\*tle\")"),
+ to_html("[foo](/bar\\* \"ti\\*tle\")"),
"<p><a href=\"/bar*\" title=\"ti*tle\">foo</a></p>",
"should escape in resource and title"
);
assert_eq!(
- micromark("[foo]: /bar\\* \"ti\\*tle\"\n\n[foo]"),
+ to_html("[foo]: /bar\\* \"ti\\*tle\"\n\n[foo]"),
"<p><a href=\"/bar*\" title=\"ti*tle\">foo</a></p>",
"should escape in definition resource and title"
);
assert_eq!(
- micromark("``` foo\\+bar\nfoo\n```"),
+ to_html("``` foo\\+bar\nfoo\n```"),
"<pre><code class=\"language-foo+bar\">foo\n</code></pre>",
"should escape in fenced code info"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"\\> a",
&Options {
parse: ParseOptions {
@@ -105,7 +105,7 @@ fn character_escape() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("a \\* b", &ParseOptions::default())?,
+ to_mdast("a \\* b", &ParseOptions::default())?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![Node::Text(Text {
diff --git a/tests/character_reference.rs b/tests/character_reference.rs
index 4e9a436..2d5c6df 100644
--- a/tests/character_reference.rs
+++ b/tests/character_reference.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{Node, Paragraph, Root, Text},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
@@ -10,7 +10,7 @@ use pretty_assertions::assert_eq;
#[test]
fn character_reference() -> Result<(), String> {
assert_eq!(
- micromark(
+ to_html(
"&nbsp; &amp; &copy; &AElig; &Dcaron;\n&frac34; &HilbertSpace; &DifferentialD;\n&ClockwiseContourIntegral; &ngE;"
),
"<p>\u{a0} &amp; © Æ Ď\n¾ ℋ ⅆ\n∲ ≧̸</p>",
@@ -18,38 +18,38 @@ fn character_reference() -> Result<(), String> {
);
assert_eq!(
- micromark("&#35; &#1234; &#992; &#0;"),
+ to_html("&#35; &#1234; &#992; &#0;"),
"<p># Ӓ Ϡ �</p>",
"should support decimal character references"
);
assert_eq!(
- micromark("&#X22; &#XD06; &#xcab;"),
+ to_html("&#X22; &#XD06; &#xcab;"),
"<p>&quot; ആ ಫ</p>",
"should support hexadecimal character references"
);
assert_eq!(
- micromark(
+ to_html(
"&nbsp &x; &#; &#x;\n&#987654321;\n&#abcdef0;\n&ThisIsNotDefined; &hi?;"),
"<p>&amp;nbsp &amp;x; &amp;#; &amp;#x;\n&amp;#987654321;\n&amp;#abcdef0;\n&amp;ThisIsNotDefined; &amp;hi?;</p>",
"should not support other things that look like character references"
);
assert_eq!(
- micromark("&copy"),
+ to_html("&copy"),
"<p>&amp;copy</p>",
"should not support character references w/o semicolon"
);
assert_eq!(
- micromark("&MadeUpEntity;"),
+ to_html("&MadeUpEntity;"),
"<p>&amp;MadeUpEntity;</p>",
"should not support unknown named character references"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"<a href=\"&ouml;&ouml;.html\">",
&Options {
compile: CompileOptions {
@@ -65,140 +65,140 @@ fn character_reference() -> Result<(), String> {
);
assert_eq!(
- micromark("[foo](/f&ouml;&ouml; \"f&ouml;&ouml;\")"),
+ to_html("[foo](/f&ouml;&ouml; \"f&ouml;&ouml;\")"),
"<p><a href=\"/f%C3%B6%C3%B6\" title=\"föö\">foo</a></p>",
"should support character references in resource URLs and titles"
);
assert_eq!(
- micromark("[foo]: /f&ouml;&ouml; \"f&ouml;&ouml;\"\n\n[foo]"),
+ to_html("[foo]: /f&ouml;&ouml; \"f&ouml;&ouml;\"\n\n[foo]"),
"<p><a href=\"/f%C3%B6%C3%B6\" title=\"föö\">foo</a></p>",
"should support character references in definition URLs and titles"
);
assert_eq!(
- micromark("``` f&ouml;&ouml;\nfoo\n```"),
+ to_html("``` f&ouml;&ouml;\nfoo\n```"),
"<pre><code class=\"language-föö\">foo\n</code></pre>",
"should support character references in code language"
);
assert_eq!(
- micromark("`f&ouml;&ouml;`"),
+ to_html("`f&ouml;&ouml;`"),
"<p><code>f&amp;ouml;&amp;ouml;</code></p>",
"should not support character references in text code"
);
assert_eq!(
- micromark(" f&ouml;f&ouml;"),
+ to_html(" f&ouml;f&ouml;"),
"<pre><code>f&amp;ouml;f&amp;ouml;\n</code></pre>",
"should not support character references in indented code"
);
assert_eq!(
- micromark("&#42;foo&#42;\n*foo*"),
+ to_html("&#42;foo&#42;\n*foo*"),
"<p>*foo*\n<em>foo</em></p>",
"should not support character references as construct markers (1)"
);
assert_eq!(
- micromark("&#42; foo\n\n* foo"),
+ to_html("&#42; foo\n\n* foo"),
"<p>* foo</p>\n<ul>\n<li>foo</li>\n</ul>",
"should not support character references as construct markers (2)"
);
assert_eq!(
- micromark("[a](url &quot;tit&quot;)"),
+ to_html("[a](url &quot;tit&quot;)"),
"<p>[a](url &quot;tit&quot;)</p>",
"should not support character references as construct markers (3)"
);
assert_eq!(
- micromark("foo&#10;&#10;bar"),
+ to_html("foo&#10;&#10;bar"),
"<p>foo\n\nbar</p>",
"should not support character references as whitespace (1)"
);
assert_eq!(
- micromark("&#9;foo"),
+ to_html("&#9;foo"),
"<p>\tfoo</p>",
"should not support character references as whitespace (2)"
);
// Extra:
assert_eq!(
- micromark("&CounterClockwiseContourIntegral;"),
+ to_html("&CounterClockwiseContourIntegral;"),
"<p>∳</p>",
"should support the longest possible named character reference"
);
assert_eq!(
- micromark("&#xff9999;"),
+ to_html("&#xff9999;"),
"<p>�</p>",
"should “support” a longest possible hexadecimal character reference"
);
assert_eq!(
- micromark("&#9999999;"),
+ to_html("&#9999999;"),
"<p>�</p>",
"should “support” a longest possible decimal character reference"
);
assert_eq!(
- micromark("&CounterClockwiseContourIntegrali;"),
+ to_html("&CounterClockwiseContourIntegrali;"),
"<p>&amp;CounterClockwiseContourIntegrali;</p>",
"should not support the longest possible named character reference"
);
assert_eq!(
- micromark("&#xff99999;"),
+ to_html("&#xff99999;"),
"<p>&amp;#xff99999;</p>",
"should not support a longest possible hexadecimal character reference"
);
assert_eq!(
- micromark("&#99999999;"),
+ to_html("&#99999999;"),
"<p>&amp;#99999999;</p>",
"should not support a longest possible decimal character reference"
);
assert_eq!(
- micromark("&-;"),
+ to_html("&-;"),
"<p>&amp;-;</p>",
"should not support the other characters after `&`"
);
assert_eq!(
- micromark("&#-;"),
+ to_html("&#-;"),
"<p>&amp;#-;</p>",
"should not support the other characters after `#`"
);
assert_eq!(
- micromark("&#x-;"),
+ to_html("&#x-;"),
"<p>&amp;#x-;</p>",
"should not support the other characters after `#x`"
);
assert_eq!(
- micromark("&lt-;"),
+ to_html("&lt-;"),
"<p>&amp;lt-;</p>",
"should not support the other characters inside a name"
);
assert_eq!(
- micromark("&#9-;"),
+ to_html("&#9-;"),
"<p>&amp;#9-;</p>",
"should not support the other characters inside a demical"
);
assert_eq!(
- micromark("&#x9-;"),
+ to_html("&#x9-;"),
"<p>&amp;#x9-;</p>",
"should not support the other characters inside a hexademical"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"&amp;",
&Options {
parse: ParseOptions {
@@ -216,7 +216,7 @@ fn character_reference() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("&nbsp; &amp; &copy; &AElig; &Dcaron;\n&frac34; &HilbertSpace; &DifferentialD;\n&ClockwiseContourIntegral; &ngE;", &ParseOptions::default())?,
+ to_mdast("&nbsp; &amp; &copy; &AElig; &Dcaron;\n&frac34; &HilbertSpace; &DifferentialD;\n&ClockwiseContourIntegral; &ngE;", &ParseOptions::default())?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![Node::Text(Text {
diff --git a/tests/code_fenced.rs b/tests/code_fenced.rs
index c41bd43..c064179 100644
--- a/tests/code_fenced.rs
+++ b/tests/code_fenced.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{Code, Node, Root},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
@@ -10,260 +10,260 @@ use pretty_assertions::assert_eq;
#[test]
fn code_fenced() -> Result<(), String> {
assert_eq!(
- micromark("```\n<\n >\n```"),
+ to_html("```\n<\n >\n```"),
"<pre><code>&lt;\n &gt;\n</code></pre>",
"should support fenced code w/ grave accents"
);
assert_eq!(
- micromark("~~~\n<\n >\n~~~"),
+ to_html("~~~\n<\n >\n~~~"),
"<pre><code>&lt;\n &gt;\n</code></pre>",
"should support fenced code w/ tildes"
);
assert_eq!(
- micromark("``\nfoo\n``"),
+ to_html("``\nfoo\n``"),
"<p><code>foo</code></p>",
"should not support fenced code w/ less than three markers"
);
assert_eq!(
- micromark("```\naaa\n~~~\n```"),
+ to_html("```\naaa\n~~~\n```"),
"<pre><code>aaa\n~~~\n</code></pre>",
"should not support a tilde closing sequence for a grave accent opening sequence"
);
assert_eq!(
- micromark("~~~\naaa\n```\n~~~"),
+ to_html("~~~\naaa\n```\n~~~"),
"<pre><code>aaa\n```\n</code></pre>",
"should not support a grave accent closing sequence for a tilde opening sequence"
);
assert_eq!(
- micromark("````\naaa\n```\n``````"),
+ to_html("````\naaa\n```\n``````"),
"<pre><code>aaa\n```\n</code></pre>",
"should support a closing sequence longer, but not shorter than, the opening"
);
assert_eq!(
- micromark("~~~~\naaa\n~~~\n~~~~"),
+ to_html("~~~~\naaa\n~~~\n~~~~"),
"<pre><code>aaa\n~~~\n</code></pre>",
"should support a closing sequence equal to, but not shorter than, the opening"
);
assert_eq!(
- micromark("```"),
+ to_html("```"),
"<pre><code></code></pre>\n",
"should support an eof right after an opening sequence"
);
assert_eq!(
- micromark("`````\n\n```\naaa\n"),
+ to_html("`````\n\n```\naaa\n"),
"<pre><code>\n```\naaa\n</code></pre>\n",
"should support an eof somewhere in content"
);
assert_eq!(
- micromark("> ```\n> aaa\n\nbbb"),
+ to_html("> ```\n> aaa\n\nbbb"),
"<blockquote>\n<pre><code>aaa\n</code></pre>\n</blockquote>\n<p>bbb</p>",
"should support no closing sequence in a block quote"
);
assert_eq!(
- micromark("```\n\n \n```"),
+ to_html("```\n\n \n```"),
"<pre><code>\n \n</code></pre>",
"should support blank lines in fenced code"
);
assert_eq!(
- micromark("```\n```"),
+ to_html("```\n```"),
"<pre><code></code></pre>",
"should support empty fenced code"
);
assert_eq!(
- micromark(" ```\n aaa\naaa\n```"),
+ to_html(" ```\n aaa\naaa\n```"),
"<pre><code>aaa\naaa\n</code></pre>",
"should remove up to one space from the content if the opening sequence is indented w/ 1 space"
);
assert_eq!(
- micromark(" ```\naaa\n aaa\naaa\n ```"),
+ to_html(" ```\naaa\n aaa\naaa\n ```"),
"<pre><code>aaa\naaa\naaa\n</code></pre>",
"should remove up to two space from the content if the opening sequence is indented w/ 2 spaces"
);
assert_eq!(
- micromark(" ```\n aaa\n aaa\n aaa\n ```"),
+ to_html(" ```\n aaa\n aaa\n aaa\n ```"),
"<pre><code>aaa\n aaa\naaa\n</code></pre>",
"should remove up to three space from the content if the opening sequence is indented w/ 3 spaces"
);
assert_eq!(
- micromark(" ```\n aaa\n ```"),
+ to_html(" ```\n aaa\n ```"),
"<pre><code>```\naaa\n```\n</code></pre>",
"should not support indenteding the opening sequence w/ 4 spaces"
);
assert_eq!(
- micromark("```\naaa\n ```"),
+ to_html("```\naaa\n ```"),
"<pre><code>aaa\n</code></pre>",
"should support an indented closing sequence"
);
assert_eq!(
- micromark(" ```\naaa\n ```"),
+ to_html(" ```\naaa\n ```"),
"<pre><code>aaa\n</code></pre>",
"should support a differently indented closing sequence than the opening sequence"
);
assert_eq!(
- micromark("```\naaa\n ```\n"),
+ to_html("```\naaa\n ```\n"),
"<pre><code>aaa\n ```\n</code></pre>\n",
"should not support an indented closing sequence w/ 4 spaces"
);
assert_eq!(
- micromark("``` ```\naaa"),
+ to_html("``` ```\naaa"),
"<p><code> </code>\naaa</p>",
"should not support grave accents in the opening fence after the opening sequence"
);
assert_eq!(
- micromark("~~~~~~\naaa\n~~~ ~~\n"),
+ to_html("~~~~~~\naaa\n~~~ ~~\n"),
"<pre><code>aaa\n~~~ ~~\n</code></pre>\n",
"should not support spaces in the closing sequence"
);
assert_eq!(
- micromark("foo\n```\nbar\n```\nbaz"),
+ to_html("foo\n```\nbar\n```\nbaz"),
"<p>foo</p>\n<pre><code>bar\n</code></pre>\n<p>baz</p>",
"should support interrupting paragraphs"
);
assert_eq!(
- micromark("foo\n---\n~~~\nbar\n~~~\n# baz"),
+ to_html("foo\n---\n~~~\nbar\n~~~\n# baz"),
"<h2>foo</h2>\n<pre><code>bar\n</code></pre>\n<h1>baz</h1>",
"should support interrupting other content"
);
assert_eq!(
- micromark("```ruby\ndef foo(x)\n return 3\nend\n```"),
+ to_html("```ruby\ndef foo(x)\n return 3\nend\n```"),
"<pre><code class=\"language-ruby\">def foo(x)\n return 3\nend\n</code></pre>",
"should support the info string as a `language-` class (1)"
);
assert_eq!(
- micromark("````;\n````"),
+ to_html("````;\n````"),
"<pre><code class=\"language-;\"></code></pre>",
"should support the info string as a `language-` class (2)"
);
assert_eq!(
- micromark("~~~~ ruby startline=3 $%@#$\ndef foo(x)\n return 3\nend\n~~~~~~~"),
+ to_html("~~~~ ruby startline=3 $%@#$\ndef foo(x)\n return 3\nend\n~~~~~~~"),
"<pre><code class=\"language-ruby\">def foo(x)\n return 3\nend\n</code></pre>",
"should support the info string as a `language-` class, but not the meta string"
);
assert_eq!(
- micromark("``` aa ```\nfoo"),
+ to_html("``` aa ```\nfoo"),
"<p><code>aa</code>\nfoo</p>",
"should not support grave accents in the meta string"
);
assert_eq!(
- micromark("~~~ aa ``` ~~~\nfoo\n~~~"),
+ to_html("~~~ aa ``` ~~~\nfoo\n~~~"),
"<pre><code class=\"language-aa\">foo\n</code></pre>",
"should support grave accents and tildes in the meta string of tilde fenced code"
);
assert_eq!(
- micromark("```\n``` aaa\n```"),
+ to_html("```\n``` aaa\n```"),
"<pre><code>``` aaa\n</code></pre>",
"should not support info string on closing sequences"
);
// Our own:
assert_eq!(
- micromark("``` "),
+ to_html("``` "),
"<pre><code></code></pre>\n",
"should support an eof after whitespace, after the start fence sequence"
);
assert_eq!(
- micromark("``` js\nalert(1)\n```"),
+ to_html("``` js\nalert(1)\n```"),
"<pre><code class=\"language-js\">alert(1)\n</code></pre>",
"should support whitespace between the sequence and the info string"
);
assert_eq!(
- micromark("```js"),
+ to_html("```js"),
"<pre><code class=\"language-js\"></code></pre>\n",
"should support an eof after the info string"
);
assert_eq!(
- micromark("``` js \nalert(1)\n```"),
+ to_html("``` js \nalert(1)\n```"),
"<pre><code class=\"language-js\">alert(1)\n</code></pre>",
"should support whitespace after the info string"
);
assert_eq!(
- micromark("```\n "),
+ to_html("```\n "),
"<pre><code> \n</code></pre>\n",
"should support an eof after whitespace in content"
);
assert_eq!(
- micromark(" ```\n "),
+ to_html(" ```\n "),
"<pre><code></code></pre>\n",
"should support an eof in the prefix, in content"
);
assert_eq!(
- micromark("```j\\+s&copy;"),
+ to_html("```j\\+s&copy;"),
"<pre><code class=\"language-j+s©\"></code></pre>\n",
"should support character escapes and character references in info strings"
);
assert_eq!(
- micromark("```a\\&b\0c"),
+ to_html("```a\\&b\0c"),
"<pre><code class=\"language-a&amp;b�c\"></code></pre>\n",
"should encode dangerous characters in languages"
);
assert_eq!(
- micromark(" ```\naaa\n ```"),
+ to_html(" ```\naaa\n ```"),
"<pre><code>aaa\n ```\n</code></pre>\n",
"should not support a closing sequence w/ too much indent, regardless of opening sequence (1)"
);
assert_eq!(
- micromark("> ```\n>\n>\n>\n\na"),
+ to_html("> ```\n>\n>\n>\n\na"),
"<blockquote>\n<pre><code>\n\n\n</code></pre>\n</blockquote>\n<p>a</p>",
"should not support a closing sequence w/ too much indent, regardless of opening sequence (2)"
);
assert_eq!(
- micromark("> ```a\nb"),
+ to_html("> ```a\nb"),
"<blockquote>\n<pre><code class=\"language-a\"></code></pre>\n</blockquote>\n<p>b</p>",
"should not support lazyness (1)"
);
assert_eq!(
- micromark("> a\n```b"),
+ to_html("> a\n```b"),
"<blockquote>\n<p>a</p>\n</blockquote>\n<pre><code class=\"language-b\"></code></pre>\n",
"should not support lazyness (2)"
);
assert_eq!(
- micromark("> ```a\n```"),
+ to_html("> ```a\n```"),
"<blockquote>\n<pre><code class=\"language-a\"></code></pre>\n</blockquote>\n<pre><code></code></pre>\n",
"should not support lazyness (3)"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"```",
&Options {
parse: ParseOptions {
@@ -281,7 +281,7 @@ fn code_fenced() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast(
+ to_mdast(
"```js extra\nconsole.log(1)\nconsole.log(2)\n```",
&ParseOptions::default()
)?,
@@ -298,7 +298,7 @@ fn code_fenced() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("```\nasd", &ParseOptions::default())?,
+ to_mdast("```\nasd", &ParseOptions::default())?,
Node::Root(Root {
children: vec![Node::Code(Code {
lang: None,
diff --git a/tests/code_indented.rs b/tests/code_indented.rs
index b02b092..6545ed6 100644
--- a/tests/code_indented.rs
+++ b/tests/code_indented.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{Code, Node, Root},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
@@ -10,115 +10,115 @@ use pretty_assertions::assert_eq;
#[test]
fn code_indented() -> Result<(), String> {
assert_eq!(
- micromark(" a simple\n indented code block"),
+ to_html(" a simple\n indented code block"),
"<pre><code>a simple\n indented code block\n</code></pre>",
"should support indented code"
);
assert_eq!(
- micromark(" - foo\n\n bar"),
+ to_html(" - foo\n\n bar"),
"<ul>\n<li>\n<p>foo</p>\n<p>bar</p>\n</li>\n</ul>",
"should prefer list item content over indented code (1)"
);
assert_eq!(
- micromark("1. foo\n\n - bar"),
+ to_html("1. foo\n\n - bar"),
"<ol>\n<li>\n<p>foo</p>\n<ul>\n<li>bar</li>\n</ul>\n</li>\n</ol>",
"should prefer list item content over indented code (2)"
);
assert_eq!(
- micromark(" <a/>\n *hi*\n\n - one"),
+ to_html(" <a/>\n *hi*\n\n - one"),
"<pre><code>&lt;a/&gt;\n*hi*\n\n- one\n</code></pre>",
"should support blank lines in indented code (1)"
);
assert_eq!(
- micromark(" chunk1\n\n chunk2\n \n \n \n chunk3"),
+ to_html(" chunk1\n\n chunk2\n \n \n \n chunk3"),
"<pre><code>chunk1\n\nchunk2\n\n\n\nchunk3\n</code></pre>",
"should support blank lines in indented code (2)"
);
assert_eq!(
- micromark(" chunk1\n \n chunk2"),
+ to_html(" chunk1\n \n chunk2"),
"<pre><code>chunk1\n \n chunk2\n</code></pre>",
"should support blank lines in indented code (3)"
);
assert_eq!(
- micromark("Foo\n bar"),
+ to_html("Foo\n bar"),
"<p>Foo\nbar</p>",
"should not support interrupting paragraphs"
);
assert_eq!(
- micromark(" foo\nbar"),
+ to_html(" foo\nbar"),
"<pre><code>foo\n</code></pre>\n<p>bar</p>",
"should support paragraphs directly after indented code"
);
assert_eq!(
- micromark("# Heading\n foo\nHeading\n------\n foo\n----"),
+ to_html("# Heading\n foo\nHeading\n------\n foo\n----"),
"<h1>Heading</h1>\n<pre><code>foo\n</code></pre>\n<h2>Heading</h2>\n<pre><code>foo\n</code></pre>\n<hr />",
"should mix w/ other content"
);
assert_eq!(
- micromark(" foo\n bar"),
+ to_html(" foo\n bar"),
"<pre><code> foo\nbar\n</code></pre>",
"should support extra whitespace on the first line"
);
assert_eq!(
- micromark("\n \n foo\n "),
+ to_html("\n \n foo\n "),
"<pre><code>foo\n</code></pre>",
"should not support initial blank lines"
);
assert_eq!(
- micromark(" foo "),
+ to_html(" foo "),
"<pre><code>foo \n</code></pre>",
"should support trailing whitespace"
);
assert_eq!(
- micromark("> a\nb"),
+ to_html("> a\nb"),
"<blockquote>\n<pre><code>a\n</code></pre>\n</blockquote>\n<p>b</p>",
"should not support lazyness (1)"
);
assert_eq!(
- micromark("> a\n b"),
+ to_html("> a\n b"),
"<blockquote>\n<p>a\nb</p>\n</blockquote>",
"should not support lazyness (2)"
);
assert_eq!(
- micromark("> a\n b"),
+ to_html("> a\n b"),
"<blockquote>\n<p>a\nb</p>\n</blockquote>",
"should not support lazyness (3)"
);
assert_eq!(
- micromark("> a\n b"),
+ to_html("> a\n b"),
"<blockquote>\n<p>a\nb</p>\n</blockquote>",
"should not support lazyness (4)"
);
assert_eq!(
- micromark("> a\n b"),
+ to_html("> a\n b"),
"<blockquote>\n<pre><code>a\n</code></pre>\n</blockquote>\n<pre><code>b\n</code></pre>",
"should not support lazyness (5)"
);
assert_eq!(
- micromark("> a\n b"),
+ to_html("> a\n b"),
"<blockquote>\n<pre><code>a\n</code></pre>\n</blockquote>\n<pre><code> b\n</code></pre>",
"should not support lazyness (6)"
);
assert_eq!(
- micromark("> a\n b"),
+ to_html("> a\n b"),
"<blockquote>\n<pre><code>a\n</code></pre>\n</blockquote>\n<pre><code> b\n</code></pre>",
"should not support lazyness (7)"
);
@@ -135,43 +135,43 @@ fn code_indented() -> Result<(), String> {
};
assert_eq!(
- micromark_with_options(" a", &off)?,
+ to_html_with_options(" a", &off)?,
"<p>a</p>",
"should support turning off code (indented, 1)"
);
assert_eq!(
- micromark_with_options("> a\n b", &off)?,
+ to_html_with_options("> a\n b", &off)?,
"<blockquote>\n<p>a\nb</p>\n</blockquote>",
"should support turning off code (indented, 2)"
);
assert_eq!(
- micromark_with_options("- a\n b", &off)?,
+ to_html_with_options("- a\n b", &off)?,
"<ul>\n<li>a\nb</li>\n</ul>",
"should support turning off code (indented, 3)"
);
assert_eq!(
- micromark_with_options("- a\n - b", &off)?,
+ to_html_with_options("- a\n - b", &off)?,
"<ul>\n<li>a\n<ul>\n<li>b</li>\n</ul>\n</li>\n</ul>",
"should support turning off code (indented, 4)"
);
assert_eq!(
- micromark_with_options("- a\n - b", &off)?,
+ to_html_with_options("- a\n - b", &off)?,
"<ul>\n<li>a\n<ul>\n<li>b</li>\n</ul>\n</li>\n</ul>",
"should support turning off code (indented, 5)"
);
assert_eq!(
- micromark_with_options("```\na\n ```", &off)?,
+ to_html_with_options("```\na\n ```", &off)?,
"<pre><code>a\n</code></pre>",
"should support turning off code (indented, 6)"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"a <?\n ?>",
&Options {
parse: ParseOptions {
@@ -192,19 +192,19 @@ fn code_indented() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("- Foo\n---", &off)?,
+ to_html_with_options("- Foo\n---", &off)?,
"<ul>\n<li>Foo</li>\n</ul>\n<hr />",
"should support turning off code (indented, 8)"
);
assert_eq!(
- micromark_with_options("- Foo\n ---", &off)?,
+ to_html_with_options("- Foo\n ---", &off)?,
"<ul>\n<li>\n<h2>Foo</h2>\n</li>\n</ul>",
"should support turning off code (indented, 9)"
);
assert_eq!(
- micromark_to_mdast(
+ to_mdast(
"\tconsole.log(1)\n console.log(2)\n",
&ParseOptions::default()
)?,
diff --git a/tests/code_text.rs b/tests/code_text.rs
index 89fa63f..2784398 100644
--- a/tests/code_text.rs
+++ b/tests/code_text.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{InlineCode, Node, Paragraph, Root, Text},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
@@ -19,152 +19,152 @@ fn code_text() -> Result<(), String> {
};
assert_eq!(
- micromark("`foo`"),
+ to_html("`foo`"),
"<p><code>foo</code></p>",
"should support code"
);
assert_eq!(
- micromark("`` foo ` bar ``"),
+ to_html("`` foo ` bar ``"),
"<p><code>foo ` bar</code></p>",
"should support code w/ more accents"
);
assert_eq!(
- micromark("` `` `"),
+ to_html("` `` `"),
"<p><code>``</code></p>",
"should support code w/ fences inside, and padding"
);
assert_eq!(
- micromark("` `` `"),
+ to_html("` `` `"),
"<p><code> `` </code></p>",
"should support code w/ extra padding"
);
assert_eq!(
- micromark("` a`"),
+ to_html("` a`"),
"<p><code> a</code></p>",
"should support code w/ unbalanced padding"
);
assert_eq!(
- micromark("`\u{a0}b\u{a0}`"),
+ to_html("`\u{a0}b\u{a0}`"),
"<p><code>\u{a0}b\u{a0}</code></p>",
"should support code w/ non-padding whitespace"
);
assert_eq!(
- micromark("` `\n` `"),
+ to_html("` `\n` `"),
"<p><code> </code>\n<code> </code></p>",
"should support code w/o data"
);
assert_eq!(
- micromark("``\nfoo\nbar \nbaz\n``"),
+ to_html("``\nfoo\nbar \nbaz\n``"),
"<p><code>foo bar baz</code></p>",
"should support code w/o line endings (1)"
);
assert_eq!(
- micromark("``\nfoo \n``"),
+ to_html("``\nfoo \n``"),
"<p><code>foo </code></p>",
"should support code w/o line endings (2)"
);
assert_eq!(
- micromark("`foo bar \nbaz`"),
+ to_html("`foo bar \nbaz`"),
"<p><code>foo bar baz</code></p>",
"should not support whitespace collapsing"
);
assert_eq!(
- micromark("`foo\\`bar`"),
+ to_html("`foo\\`bar`"),
"<p><code>foo\\</code>bar`</p>",
"should not support character escapes"
);
assert_eq!(
- micromark("``foo`bar``"),
+ to_html("``foo`bar``"),
"<p><code>foo`bar</code></p>",
"should support more accents"
);
assert_eq!(
- micromark("` foo `` bar `"),
+ to_html("` foo `` bar `"),
"<p><code>foo `` bar</code></p>",
"should support less accents"
);
assert_eq!(
- micromark("*foo`*`"),
+ to_html("*foo`*`"),
"<p>*foo<code>*</code></p>",
"should precede over emphasis"
);
assert_eq!(
- micromark("[not a `link](/foo`)"),
+ to_html("[not a `link](/foo`)"),
"<p>[not a <code>link](/foo</code>)</p>",
"should precede over links"
);
assert_eq!(
- micromark("`<a href=\"`\">`"),
+ to_html("`<a href=\"`\">`"),
"<p><code>&lt;a href=&quot;</code>&quot;&gt;`</p>",
"should have same precedence as HTML (1)"
);
assert_eq!(
- micromark_with_options("<a href=\"`\">`", &danger)?,
+ to_html_with_options("<a href=\"`\">`", &danger)?,
"<p><a href=\"`\">`</p>",
"should have same precedence as HTML (2)"
);
assert_eq!(
- micromark("`<http://foo.bar.`baz>`"),
+ to_html("`<http://foo.bar.`baz>`"),
"<p><code>&lt;http://foo.bar.</code>baz&gt;`</p>",
"should have same precedence as autolinks (1)"
);
assert_eq!(
- micromark("<http://foo.bar.`baz>`"),
+ to_html("<http://foo.bar.`baz>`"),
"<p><a href=\"http://foo.bar.%60baz\">http://foo.bar.`baz</a>`</p>",
"should have same precedence as autolinks (2)"
);
assert_eq!(
- micromark("```foo``"),
+ to_html("```foo``"),
"<p>```foo``</p>",
"should not support more accents before a fence"
);
assert_eq!(
- micromark("`foo"),
+ to_html("`foo"),
"<p>`foo</p>",
"should not support no closing fence (1)"
);
assert_eq!(
- micromark("`foo``bar``"),
+ to_html("`foo``bar``"),
"<p>`foo<code>bar</code></p>",
"should not support no closing fence (2)"
);
// Extra:
assert_eq!(
- micromark("`foo\t\tbar`"),
+ to_html("`foo\t\tbar`"),
"<p><code>foo\t\tbar</code></p>",
"should support tabs in code"
);
assert_eq!(
- micromark("\\``x`"),
+ to_html("\\``x`"),
"<p>`<code>x</code></p>",
"should support an escaped initial grave accent"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"`a`",
&Options {
parse: ParseOptions {
@@ -182,7 +182,7 @@ fn code_text() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("a `alpha` b.", &ParseOptions::default())?,
+ to_mdast("a `alpha` b.", &ParseOptions::default())?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![
diff --git a/tests/commonmark.rs b/tests/commonmark.rs
index cc3d69a..7d62016 100644
--- a/tests/commonmark.rs
+++ b/tests/commonmark.rs
@@ -3,8 +3,8 @@
// > 👉 **Important**: this module is generated by `build.rs`.
// > It is generate from the latest CommonMark website.
-extern crate micromark;
-use micromark::{micromark_with_options, CompileOptions, Options};
+extern crate markdown;
+use markdown::{to_html_with_options, CompileOptions, Options};
use pretty_assertions::assert_eq;
#[rustfmt::skip]
@@ -20,7 +20,7 @@ fn commonmark() -> Result<(), String> {
};
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" foo baz bim
"###,
&danger
@@ -32,7 +32,7 @@ fn commonmark() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" foo baz bim
"###,
&danger
@@ -44,7 +44,7 @@ fn commonmark() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" a a
ὐ a
"###,
@@ -58,7 +58,7 @@ fn commonmark() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" - foo
bar
@@ -76,7 +76,7 @@ fn commonmark() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- foo
bar
@@ -95,7 +95,7 @@ fn commonmark() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> foo
"###,
&danger
@@ -109,7 +109,7 @@ fn commonmark() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- foo
"###,
&danger
@@ -125,7 +125,7 @@ fn commonmark() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" foo
bar
"###,
@@ -139,7 +139,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" - foo
- bar
- baz
@@ -162,7 +162,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# Foo
"###,
&danger
@@ -173,7 +173,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"* * *
"###,
&danger
@@ -184,7 +184,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"\!\"\#\$\%\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\\\]\^\_\`\{\|\}\~
"###,
&danger
@@ -195,7 +195,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"\ \A\a\ \3\φ\«
"###,
&danger
@@ -206,7 +206,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"\*not emphasized*
\<br/> not a tag
\[not a link](/foo)
@@ -233,7 +233,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"\\*emphasis*
"###,
&danger
@@ -244,7 +244,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo\
bar
"###,
@@ -257,7 +257,7 @@ bar</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"`` \[\` ``
"###,
&danger
@@ -268,7 +268,7 @@ bar</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" \[\]
"###,
&danger
@@ -280,7 +280,7 @@ bar</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"~~~
\[\]
~~~
@@ -294,7 +294,7 @@ bar</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<http://example.com?find=\*>
"###,
&danger
@@ -305,7 +305,7 @@ bar</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<a href="/bar\/)">
"###,
&danger
@@ -316,7 +316,7 @@ bar</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo](/bar\* "ti\*tle")
"###,
&danger
@@ -327,7 +327,7 @@ bar</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]
[foo]: /bar\* "ti\*tle"
@@ -340,7 +340,7 @@ bar</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"``` foo\+bar
foo
```
@@ -354,7 +354,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"&nbsp; &amp; &copy; &AElig; &Dcaron;
&frac34; &HilbertSpace; &DifferentialD;
&ClockwiseContourIntegral; &ngE;
@@ -369,7 +369,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"&#35; &#1234; &#992; &#0;
"###,
&danger
@@ -380,7 +380,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"&#X22; &#XD06; &#xcab;
"###,
&danger
@@ -391,7 +391,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"&nbsp &x; &#; &#x;
&#87654321;
&#abcdef0;
@@ -408,7 +408,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"&copy
"###,
&danger
@@ -419,7 +419,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"&MadeUpEntity;
"###,
&danger
@@ -430,7 +430,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<a href="&ouml;&ouml;.html">
"###,
&danger
@@ -441,7 +441,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo](/f&ouml;&ouml; "f&ouml;&ouml;")
"###,
&danger
@@ -452,7 +452,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]
[foo]: /f&ouml;&ouml; "f&ouml;&ouml;"
@@ -465,7 +465,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"``` f&ouml;&ouml;
foo
```
@@ -479,7 +479,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"`f&ouml;&ouml;`
"###,
&danger
@@ -490,7 +490,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" f&ouml;f&ouml;
"###,
&danger
@@ -502,7 +502,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"&#42;foo&#42;
*foo*
"###,
@@ -515,7 +515,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"&#42; foo
* foo
@@ -531,7 +531,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo&#10;&#10;bar
"###,
&danger
@@ -544,7 +544,7 @@ bar</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"&#9;foo
"###,
&danger
@@ -555,7 +555,7 @@ bar</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[a](url &quot;tit&quot;)
"###,
&danger
@@ -566,7 +566,7 @@ bar</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- `one
- two`
"###,
@@ -581,7 +581,7 @@ bar</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"***
---
___
@@ -596,7 +596,7 @@ ___
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"+++
"###,
&danger
@@ -607,7 +607,7 @@ ___
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"===
"###,
&danger
@@ -618,7 +618,7 @@ ___
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"--
**
__
@@ -633,7 +633,7 @@ __</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" ***
***
***
@@ -648,7 +648,7 @@ __</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" ***
"###,
&danger
@@ -660,7 +660,7 @@ __</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo
***
"###,
@@ -673,7 +673,7 @@ __</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"_____________________________________
"###,
&danger
@@ -684,7 +684,7 @@ __</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" - - -
"###,
&danger
@@ -695,7 +695,7 @@ __</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" ** * ** * ** * **
"###,
&danger
@@ -706,7 +706,7 @@ __</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- - - -
"###,
&danger
@@ -717,7 +717,7 @@ __</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- - - -
"###,
&danger
@@ -728,7 +728,7 @@ __</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"_ _ _ _ a
a------
@@ -745,7 +745,7 @@ a------
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" *-*
"###,
&danger
@@ -756,7 +756,7 @@ a------
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- foo
***
- bar
@@ -775,7 +775,7 @@ a------
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo
***
bar
@@ -790,7 +790,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo
---
bar
@@ -804,7 +804,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"* Foo
* * *
* Bar
@@ -823,7 +823,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- Foo
- * * *
"###,
@@ -840,7 +840,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# foo
## foo
### foo
@@ -861,7 +861,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"####### foo
"###,
&danger
@@ -872,7 +872,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"#5 bolt
#hashtag
@@ -886,7 +886,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"\## foo
"###,
&danger
@@ -897,7 +897,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# foo *bar* \*baz\*
"###,
&danger
@@ -908,7 +908,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# foo
"###,
&danger
@@ -919,7 +919,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" ### foo
## foo
# foo
@@ -934,7 +934,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" # foo
"###,
&danger
@@ -946,7 +946,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo
# bar
"###,
@@ -959,7 +959,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"## foo ##
### bar ###
"###,
@@ -972,7 +972,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# foo ##################################
##### foo ##
"###,
@@ -985,7 +985,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"### foo ###
"###,
&danger
@@ -996,7 +996,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"### foo ### b
"###,
&danger
@@ -1007,7 +1007,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# foo#
"###,
&danger
@@ -1018,7 +1018,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"### foo \###
## foo #\##
# foo \#
@@ -1033,7 +1033,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"****
## foo
****
@@ -1048,7 +1048,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo bar
# baz
Bar foo
@@ -1063,7 +1063,7 @@ Bar foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"##
#
### ###
@@ -1078,7 +1078,7 @@ Bar foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo *bar*
=========
@@ -1094,7 +1094,7 @@ Foo *bar*
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo *bar
baz*
====
@@ -1108,7 +1108,7 @@ baz</em></h1>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" Foo *bar
baz*
====
@@ -1122,7 +1122,7 @@ baz</em></h1>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo
-------------------------
@@ -1138,7 +1138,7 @@ Foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" Foo
---
@@ -1158,7 +1158,7 @@ Foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" Foo
---
@@ -1178,7 +1178,7 @@ Foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo
----
"###,
@@ -1190,7 +1190,7 @@ Foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo
---
"###,
@@ -1203,7 +1203,7 @@ Foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo
= =
@@ -1221,7 +1221,7 @@ Foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo
-----
"###,
@@ -1233,7 +1233,7 @@ Foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo\
----
"###,
@@ -1245,7 +1245,7 @@ Foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"`Foo
----
`
@@ -1265,7 +1265,7 @@ of dashes"/>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> Foo
---
"###,
@@ -1280,7 +1280,7 @@ of dashes"/>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> foo
bar
===
@@ -1297,7 +1297,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- Foo
---
"###,
@@ -1312,7 +1312,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo
Bar
---
@@ -1326,7 +1326,7 @@ Bar</h2>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"---
Foo
---
@@ -1345,7 +1345,7 @@ Baz
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"
====
"###,
@@ -1357,7 +1357,7 @@ Baz
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"---
---
"###,
@@ -1370,7 +1370,7 @@ Baz
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- foo
-----
"###,
@@ -1385,7 +1385,7 @@ Baz
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" foo
---
"###,
@@ -1399,7 +1399,7 @@ Baz
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> foo
-----
"###,
@@ -1414,7 +1414,7 @@ Baz
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"\> foo
------
"###,
@@ -1426,7 +1426,7 @@ Baz
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo
bar
@@ -1443,7 +1443,7 @@ baz
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo
bar
@@ -1462,7 +1462,7 @@ bar</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo
bar
* * *
@@ -1479,7 +1479,7 @@ bar</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo
bar
\---
@@ -1496,7 +1496,7 @@ baz</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" a simple
indented code block
"###,
@@ -1510,7 +1510,7 @@ baz</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" - foo
bar
@@ -1528,7 +1528,7 @@ baz</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"1. foo
- bar
@@ -1548,7 +1548,7 @@ baz</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" <a/>
*hi*
@@ -1566,7 +1566,7 @@ baz</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" chunk1
chunk2
@@ -1590,7 +1590,7 @@ chunk3
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" chunk1
chunk2
@@ -1606,7 +1606,7 @@ chunk3
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo
bar
@@ -1620,7 +1620,7 @@ bar</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" foo
bar
"###,
@@ -1634,7 +1634,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# Heading
foo
Heading
@@ -1656,7 +1656,7 @@ Heading
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" foo
bar
"###,
@@ -1670,7 +1670,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"
foo
@@ -1686,7 +1686,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" foo
"###,
&danger
@@ -1698,7 +1698,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"```
<
>
@@ -1714,7 +1714,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"~~~
<
>
@@ -1730,7 +1730,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"``
foo
``
@@ -1743,7 +1743,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"```
aaa
~~~
@@ -1759,7 +1759,7 @@ aaa
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"~~~
aaa
```
@@ -1775,7 +1775,7 @@ aaa
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"````
aaa
```
@@ -1791,7 +1791,7 @@ aaa
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"~~~~
aaa
~~~
@@ -1807,7 +1807,7 @@ aaa
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"```
"###,
&danger
@@ -1818,7 +1818,7 @@ aaa
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"`````
```
@@ -1835,7 +1835,7 @@ aaa
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> ```
> aaa
@@ -1853,7 +1853,7 @@ bbb
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"```
@@ -1869,7 +1869,7 @@ bbb
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"```
```
"###,
@@ -1881,7 +1881,7 @@ bbb
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" ```
aaa
aaa
@@ -1897,7 +1897,7 @@ aaa
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" ```
aaa
aaa
@@ -1915,7 +1915,7 @@ aaa
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" ```
aaa
aaa
@@ -1933,7 +1933,7 @@ aaa
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" ```
aaa
```
@@ -1949,7 +1949,7 @@ aaa
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"```
aaa
```
@@ -1963,7 +1963,7 @@ aaa
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" ```
aaa
```
@@ -1977,7 +1977,7 @@ aaa
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"```
aaa
```
@@ -1992,7 +1992,7 @@ aaa
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"``` ```
aaa
"###,
@@ -2005,7 +2005,7 @@ aaa</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"~~~~~~
aaa
~~~ ~~
@@ -2020,7 +2020,7 @@ aaa
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo
```
bar
@@ -2038,7 +2038,7 @@ baz
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo
---
~~~
@@ -2057,7 +2057,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"```ruby
def foo(x)
return 3
@@ -2075,7 +2075,7 @@ end
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"~~~~ ruby startline=3 $%@#$
def foo(x)
return 3
@@ -2093,7 +2093,7 @@ end
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"````;
````
"###,
@@ -2105,7 +2105,7 @@ end
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"``` aa ```
foo
"###,
@@ -2118,7 +2118,7 @@ foo</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"~~~ aa ``` ~~~
foo
~~~
@@ -2132,7 +2132,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"```
``` aaa
```
@@ -2146,7 +2146,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<table><tr><td>
<pre>
**Hello**,
@@ -2168,7 +2168,7 @@ _world_.
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<table>
<tr>
<td>
@@ -2194,7 +2194,7 @@ okay.
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" <div>
*hello*
<foo><a>
@@ -2209,7 +2209,7 @@ okay.
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"</div>
*foo*
"###,
@@ -2222,7 +2222,7 @@ okay.
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<DIV CLASS="foo">
*Markdown*
@@ -2239,7 +2239,7 @@ okay.
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<div id="foo"
class="bar">
</div>
@@ -2254,7 +2254,7 @@ okay.
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<div id="foo" class="bar
baz">
</div>
@@ -2269,7 +2269,7 @@ okay.
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<div>
*foo*
@@ -2285,7 +2285,7 @@ okay.
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<div id="foo"
*hi*
"###,
@@ -2298,7 +2298,7 @@ okay.
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<div class
foo
"###,
@@ -2311,7 +2311,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<div *???-&&&-<---
*foo*
"###,
@@ -2324,7 +2324,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<div><a href="bar">*foo*</a></div>
"###,
&danger
@@ -2335,7 +2335,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<table><tr><td>
foo
</td></tr></table>
@@ -2350,7 +2350,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<div></div>
``` c
int x = 33;
@@ -2367,7 +2367,7 @@ int x = 33;
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<a href="foo">
*bar*
</a>
@@ -2382,7 +2382,7 @@ int x = 33;
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<Warning>
*bar*
</Warning>
@@ -2397,7 +2397,7 @@ int x = 33;
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<i class="foo">
*bar*
</i>
@@ -2412,7 +2412,7 @@ int x = 33;
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"</ins>
*bar*
"###,
@@ -2425,7 +2425,7 @@ int x = 33;
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<del>
*foo*
</del>
@@ -2440,7 +2440,7 @@ int x = 33;
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<del>
*foo*
@@ -2457,7 +2457,7 @@ int x = 33;
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<del>*foo*</del>
"###,
&danger
@@ -2468,7 +2468,7 @@ int x = 33;
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<pre language="haskell"><code>
import Text.HTML.TagSoup
@@ -2491,7 +2491,7 @@ main = print $ parseTags tags
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<script type="text/javascript">
// JavaScript example
@@ -2512,7 +2512,7 @@ document.getElementById("demo").innerHTML = "Hello JavaScript!";
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<textarea>
*foo*
@@ -2535,7 +2535,7 @@ _bar_
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<style
type="text/css">
h1 {color:red;}
@@ -2558,7 +2558,7 @@ p {color:blue;}
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<style
type="text/css">
@@ -2575,7 +2575,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> <div>
> foo
@@ -2593,7 +2593,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- <div>
- foo
"###,
@@ -2610,7 +2610,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<style>p{color:red;}</style>
*foo*
"###,
@@ -2623,7 +2623,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<!-- foo -->*bar*
*baz*
"###,
@@ -2636,7 +2636,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<script>
foo
</script>1. *bar*
@@ -2651,7 +2651,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<!-- Foo
bar
@@ -2670,7 +2670,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<?php
echo '>';
@@ -2691,7 +2691,7 @@ okay
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<!DOCTYPE html>
"###,
&danger
@@ -2702,7 +2702,7 @@ okay
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<![CDATA[
function matchwo(a,b)
{
@@ -2737,7 +2737,7 @@ function matchwo(a,b)
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" <!-- foo -->
<!-- foo -->
@@ -2752,7 +2752,7 @@ function matchwo(a,b)
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" <div>
<div>
@@ -2767,7 +2767,7 @@ function matchwo(a,b)
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo
<div>
bar
@@ -2784,7 +2784,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<div>
bar
</div>
@@ -2801,7 +2801,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo
<a href="bar">
baz
@@ -2816,7 +2816,7 @@ baz</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<div>
*Emphasized* text.
@@ -2833,7 +2833,7 @@ baz</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<div>
*Emphasized* text.
</div>
@@ -2848,7 +2848,7 @@ baz</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<table>
<tr>
@@ -2875,7 +2875,7 @@ Hi
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<table>
<tr>
@@ -2903,7 +2903,7 @@ Hi
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]: /url "title"
[foo]
@@ -2916,7 +2916,7 @@ Hi
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" [foo]:
/url
'the title'
@@ -2931,7 +2931,7 @@ Hi
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[Foo*bar\]]:my_(url) 'title (with parens)'
[Foo*bar\]]
@@ -2944,7 +2944,7 @@ Hi
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[Foo bar]:
<my url>
'title'
@@ -2959,7 +2959,7 @@ Hi
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]: /url '
title
line1
@@ -2980,7 +2980,7 @@ line2
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]: /url 'title
with blank line'
@@ -2997,7 +2997,7 @@ with blank line'
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]:
/url
@@ -3011,7 +3011,7 @@ with blank line'
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]:
[foo]
@@ -3025,7 +3025,7 @@ with blank line'
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]: <>
[foo]
@@ -3038,7 +3038,7 @@ with blank line'
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]: <bar>(baz)
[foo]
@@ -3052,7 +3052,7 @@ with blank line'
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]: /url\bar\*baz "foo\"bar\baz"
[foo]
@@ -3065,7 +3065,7 @@ with blank line'
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]
[foo]: url
@@ -3078,7 +3078,7 @@ with blank line'
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]
[foo]: first
@@ -3092,7 +3092,7 @@ with blank line'
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[FOO]: /url
[Foo]
@@ -3105,7 +3105,7 @@ with blank line'
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[ΑΓΩ]: /φου
[αγω]
@@ -3118,7 +3118,7 @@ with blank line'
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]: /url
"###,
&danger
@@ -3128,7 +3128,7 @@ with blank line'
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[
foo
]: /url
@@ -3142,7 +3142,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]: /url "title" ok
"###,
&danger
@@ -3153,7 +3153,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]: /url
"title" ok
"###,
@@ -3165,7 +3165,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" [foo]: /url "title"
[foo]
@@ -3180,7 +3180,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"```
[foo]: /url
```
@@ -3197,7 +3197,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo
[bar]: /baz
@@ -3213,7 +3213,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# [Foo]
[foo]: /url
> bar
@@ -3229,7 +3229,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]: /url
bar
===
@@ -3244,7 +3244,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]: /url
===
[foo]
@@ -3258,7 +3258,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]: /foo-url "foo"
[bar]: /bar-url
"bar"
@@ -3278,7 +3278,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]
> [foo]: /url
@@ -3293,7 +3293,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"aaa
bbb
@@ -3307,7 +3307,7 @@ bbb
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"aaa
bbb
@@ -3325,7 +3325,7 @@ ddd</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"aaa
@@ -3340,7 +3340,7 @@ bbb
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" aaa
bbb
"###,
@@ -3353,7 +3353,7 @@ bbb</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"aaa
bbb
ccc
@@ -3368,7 +3368,7 @@ ccc</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" aaa
bbb
"###,
@@ -3381,7 +3381,7 @@ bbb</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" aaa
bbb
"###,
@@ -3395,7 +3395,7 @@ bbb
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"aaa
bbb
"###,
@@ -3408,7 +3408,7 @@ bbb</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"
aaa
@@ -3427,7 +3427,7 @@ aaa
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> # Foo
> bar
> baz
@@ -3444,7 +3444,7 @@ baz</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"># Foo
>bar
> baz
@@ -3461,7 +3461,7 @@ baz</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" > # Foo
> bar
> baz
@@ -3478,7 +3478,7 @@ baz</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" > # Foo
> bar
> baz
@@ -3494,7 +3494,7 @@ baz</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> # Foo
> bar
baz
@@ -3511,7 +3511,7 @@ baz</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> bar
baz
> foo
@@ -3528,7 +3528,7 @@ foo</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> foo
---
"###,
@@ -3543,7 +3543,7 @@ foo</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> - foo
- bar
"###,
@@ -3562,7 +3562,7 @@ foo</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> foo
bar
"###,
@@ -3579,7 +3579,7 @@ foo</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> ```
foo
```
@@ -3596,7 +3596,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> foo
- bar
"###,
@@ -3611,7 +3611,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###">
"###,
&danger
@@ -3623,7 +3623,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###">
>
>
@@ -3637,7 +3637,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###">
> foo
>
@@ -3652,7 +3652,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> foo
> bar
@@ -3670,7 +3670,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> foo
> bar
"###,
@@ -3685,7 +3685,7 @@ bar</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> foo
>
> bar
@@ -3701,7 +3701,7 @@ bar</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo
> bar
"###,
@@ -3716,7 +3716,7 @@ bar</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> aaa
***
> bbb
@@ -3735,7 +3735,7 @@ bar</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> bar
baz
"###,
@@ -3750,7 +3750,7 @@ baz</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> bar
baz
@@ -3766,7 +3766,7 @@ baz
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> bar
>
baz
@@ -3782,7 +3782,7 @@ baz
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> > > foo
bar
"###,
@@ -3801,7 +3801,7 @@ bar</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###">>> foo
> bar
>>baz
@@ -3822,7 +3822,7 @@ baz</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> code
> not code
@@ -3841,7 +3841,7 @@ baz</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"A paragraph
with two lines.
@@ -3863,7 +3863,7 @@ with two lines.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"1. A paragraph
with two lines.
@@ -3889,7 +3889,7 @@ with two lines.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- one
two
@@ -3905,7 +3905,7 @@ with two lines.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- one
two
@@ -3923,7 +3923,7 @@ with two lines.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" - one
two
@@ -3940,7 +3940,7 @@ with two lines.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" - one
two
@@ -3958,7 +3958,7 @@ with two lines.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" > > 1. one
>>
>> two
@@ -3980,7 +3980,7 @@ with two lines.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###">>- one
>>
> > two
@@ -4000,7 +4000,7 @@ with two lines.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"-one
2.two
@@ -4014,7 +4014,7 @@ with two lines.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- foo
@@ -4033,7 +4033,7 @@ with two lines.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"1. foo
```
@@ -4062,7 +4062,7 @@ with two lines.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- Foo
bar
@@ -4087,7 +4087,7 @@ baz
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"123456789. ok
"###,
&danger
@@ -4100,7 +4100,7 @@ baz
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"1234567890. not ok
"###,
&danger
@@ -4111,7 +4111,7 @@ baz
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"0. ok
"###,
&danger
@@ -4124,7 +4124,7 @@ baz
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"003. ok
"###,
&danger
@@ -4137,7 +4137,7 @@ baz
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"-1. not ok
"###,
&danger
@@ -4148,7 +4148,7 @@ baz
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- foo
bar
@@ -4167,7 +4167,7 @@ baz
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" 10. foo
bar
@@ -4186,7 +4186,7 @@ baz
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" indented code
paragraph
@@ -4205,7 +4205,7 @@ paragraph
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"1. indented code
paragraph
@@ -4228,7 +4228,7 @@ paragraph
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"1. indented code
paragraph
@@ -4251,7 +4251,7 @@ paragraph
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" foo
bar
@@ -4265,7 +4265,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- foo
bar
@@ -4281,7 +4281,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- foo
bar
@@ -4299,7 +4299,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"-
foo
-
@@ -4327,7 +4327,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"-
foo
"###,
@@ -4341,7 +4341,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"-
foo
@@ -4357,7 +4357,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- foo
-
- bar
@@ -4374,7 +4374,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- foo
-
- bar
@@ -4391,7 +4391,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"1. foo
2.
3. bar
@@ -4408,7 +4408,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*
"###,
&danger
@@ -4421,7 +4421,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo
*
@@ -4439,7 +4439,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" 1. A paragraph
with two lines.
@@ -4465,7 +4465,7 @@ with two lines.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" 1. A paragraph
with two lines.
@@ -4491,7 +4491,7 @@ with two lines.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" 1. A paragraph
with two lines.
@@ -4517,7 +4517,7 @@ with two lines.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" 1. A paragraph
with two lines.
@@ -4539,7 +4539,7 @@ with two lines.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" 1. A paragraph
with two lines.
@@ -4565,7 +4565,7 @@ with two lines.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###" 1. A paragraph
with two lines.
"###,
@@ -4580,7 +4580,7 @@ with two lines.</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> 1. > Blockquote
continued here.
"###,
@@ -4601,7 +4601,7 @@ continued here.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"> 1. > Blockquote
> continued here.
"###,
@@ -4622,7 +4622,7 @@ continued here.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- foo
- bar
- baz
@@ -4650,7 +4650,7 @@ continued here.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- foo
- bar
- baz
@@ -4669,7 +4669,7 @@ continued here.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"10) foo
- bar
"###,
@@ -4687,7 +4687,7 @@ continued here.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"10) foo
- bar
"###,
@@ -4704,7 +4704,7 @@ continued here.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- - foo
"###,
&danger
@@ -4721,7 +4721,7 @@ continued here.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"1. - 2. foo
"###,
&danger
@@ -4742,7 +4742,7 @@ continued here.</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- # Foo
- Bar
---
@@ -4763,7 +4763,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- foo
- bar
+ baz
@@ -4782,7 +4782,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"1. foo
2. bar
3) baz
@@ -4801,7 +4801,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo
- bar
- baz
@@ -4818,7 +4818,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"The number of windows in my house is
14. The number of doors is 6.
"###,
@@ -4831,7 +4831,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"The number of windows in my house is
1. The number of doors is 6.
"###,
@@ -4846,7 +4846,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- foo
- bar
@@ -4872,7 +4872,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- foo
- bar
- baz
@@ -4901,7 +4901,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- foo
- bar
@@ -4926,7 +4926,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- foo
notcode
@@ -4956,7 +4956,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- a
- b
- c
@@ -4981,7 +4981,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"1. a
2. b
@@ -5006,7 +5006,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- a
- b
- c
@@ -5027,7 +5027,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"1. a
2. b
@@ -5051,7 +5051,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- a
- b
@@ -5075,7 +5075,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"* a
*
@@ -5097,7 +5097,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- a
- b
@@ -5123,7 +5123,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- a
- b
@@ -5148,7 +5148,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- a
- ```
b
@@ -5174,7 +5174,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- a
- b
@@ -5199,7 +5199,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"* a
> b
>
@@ -5220,7 +5220,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- a
> b
```
@@ -5245,7 +5245,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- a
"###,
&danger
@@ -5258,7 +5258,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- a
- b
"###,
@@ -5276,7 +5276,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"1. ```
foo
```
@@ -5297,7 +5297,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"* foo
* bar
@@ -5319,7 +5319,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"- a
- b
- c
@@ -5351,7 +5351,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"`hi`lo`
"###,
&danger
@@ -5362,7 +5362,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"`foo`
"###,
&danger
@@ -5373,7 +5373,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"`` foo ` bar ``
"###,
&danger
@@ -5384,7 +5384,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"` `` `
"###,
&danger
@@ -5395,7 +5395,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"` `` `
"###,
&danger
@@ -5406,7 +5406,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"` a`
"###,
&danger
@@ -5417,7 +5417,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"` b `
"###,
&danger
@@ -5428,7 +5428,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"` `
` `
"###,
@@ -5441,7 +5441,7 @@ baz</li>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"``
foo
bar
@@ -5456,7 +5456,7 @@ baz
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"``
foo
``
@@ -5469,7 +5469,7 @@ foo
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"`foo bar
baz`
"###,
@@ -5481,7 +5481,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"`foo\`bar`
"###,
&danger
@@ -5492,7 +5492,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"``foo`bar``
"###,
&danger
@@ -5503,7 +5503,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"` foo `` bar `
"###,
&danger
@@ -5514,7 +5514,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*foo`*`
"###,
&danger
@@ -5525,7 +5525,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[not a `link](/foo`)
"###,
&danger
@@ -5536,7 +5536,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"`<a href="`">`
"###,
&danger
@@ -5547,7 +5547,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<a href="`">`
"###,
&danger
@@ -5558,7 +5558,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"`<http://foo.bar.`baz>`
"###,
&danger
@@ -5569,7 +5569,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<http://foo.bar.`baz>`
"###,
&danger
@@ -5580,7 +5580,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"```foo``
"###,
&danger
@@ -5591,7 +5591,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"`foo
"###,
&danger
@@ -5602,7 +5602,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"`foo``bar``
"###,
&danger
@@ -5613,7 +5613,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*foo bar*
"###,
&danger
@@ -5624,7 +5624,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"a * foo bar*
"###,
&danger
@@ -5635,7 +5635,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"a*"foo"*
"###,
&danger
@@ -5646,7 +5646,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"* a *
"###,
&danger
@@ -5657,7 +5657,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo*bar*
"###,
&danger
@@ -5668,7 +5668,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"5*6*78
"###,
&danger
@@ -5679,7 +5679,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"_foo bar_
"###,
&danger
@@ -5690,7 +5690,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"_ foo bar_
"###,
&danger
@@ -5701,7 +5701,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"a_"foo"_
"###,
&danger
@@ -5712,7 +5712,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo_bar_
"###,
&danger
@@ -5723,7 +5723,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"5_6_78
"###,
&danger
@@ -5734,7 +5734,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"пристаням_стремятся_
"###,
&danger
@@ -5745,7 +5745,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"aa_"bb"_cc
"###,
&danger
@@ -5756,7 +5756,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo-_(bar)_
"###,
&danger
@@ -5767,7 +5767,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"_foo*
"###,
&danger
@@ -5778,7 +5778,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*foo bar *
"###,
&danger
@@ -5789,7 +5789,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*foo bar
*
"###,
@@ -5802,7 +5802,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*(*foo)
"###,
&danger
@@ -5813,7 +5813,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*(*foo*)*
"###,
&danger
@@ -5824,7 +5824,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*foo*bar
"###,
&danger
@@ -5835,7 +5835,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"_foo bar _
"###,
&danger
@@ -5846,7 +5846,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"_(_foo)
"###,
&danger
@@ -5857,7 +5857,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"_(_foo_)_
"###,
&danger
@@ -5868,7 +5868,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"_foo_bar
"###,
&danger
@@ -5879,7 +5879,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"_пристаням_стремятся
"###,
&danger
@@ -5890,7 +5890,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"_foo_bar_baz_
"###,
&danger
@@ -5901,7 +5901,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"_(bar)_.
"###,
&danger
@@ -5912,7 +5912,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"**foo bar**
"###,
&danger
@@ -5923,7 +5923,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"** foo bar**
"###,
&danger
@@ -5934,7 +5934,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"a**"foo"**
"###,
&danger
@@ -5945,7 +5945,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo**bar**
"###,
&danger
@@ -5956,7 +5956,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"__foo bar__
"###,
&danger
@@ -5967,7 +5967,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"__ foo bar__
"###,
&danger
@@ -5978,7 +5978,7 @@ baz`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"__
foo bar__
"###,
@@ -5991,7 +5991,7 @@ foo bar__</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"a__"foo"__
"###,
&danger
@@ -6002,7 +6002,7 @@ foo bar__</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo__bar__
"###,
&danger
@@ -6013,7 +6013,7 @@ foo bar__</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"5__6__78
"###,
&danger
@@ -6024,7 +6024,7 @@ foo bar__</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"пристаням__стремятся__
"###,
&danger
@@ -6035,7 +6035,7 @@ foo bar__</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"__foo, __bar__, baz__
"###,
&danger
@@ -6046,7 +6046,7 @@ foo bar__</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo-__(bar)__
"###,
&danger
@@ -6057,7 +6057,7 @@ foo bar__</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"**foo bar **
"###,
&danger
@@ -6068,7 +6068,7 @@ foo bar__</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"**(**foo)
"###,
&danger
@@ -6079,7 +6079,7 @@ foo bar__</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*(**foo**)*
"###,
&danger
@@ -6090,7 +6090,7 @@ foo bar__</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"**Gomphocarpus (*Gomphocarpus physocarpus*, syn.
*Asclepias physocarpa*)**
"###,
@@ -6103,7 +6103,7 @@ foo bar__</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"**foo "*bar*" foo**
"###,
&danger
@@ -6114,7 +6114,7 @@ foo bar__</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"**foo**bar
"###,
&danger
@@ -6125,7 +6125,7 @@ foo bar__</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"__foo bar __
"###,
&danger
@@ -6136,7 +6136,7 @@ foo bar__</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"__(__foo)
"###,
&danger
@@ -6147,7 +6147,7 @@ foo bar__</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"_(__foo__)_
"###,
&danger
@@ -6158,7 +6158,7 @@ foo bar__</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"__foo__bar
"###,
&danger
@@ -6169,7 +6169,7 @@ foo bar__</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"__пристаням__стремятся
"###,
&danger
@@ -6180,7 +6180,7 @@ foo bar__</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"__foo__bar__baz__
"###,
&danger
@@ -6191,7 +6191,7 @@ foo bar__</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"__(bar)__.
"###,
&danger
@@ -6202,7 +6202,7 @@ foo bar__</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*foo [bar](/url)*
"###,
&danger
@@ -6213,7 +6213,7 @@ foo bar__</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*foo
bar*
"###,
@@ -6226,7 +6226,7 @@ bar</em></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"_foo __bar__ baz_
"###,
&danger
@@ -6237,7 +6237,7 @@ bar</em></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"_foo _bar_ baz_
"###,
&danger
@@ -6248,7 +6248,7 @@ bar</em></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"__foo_ bar_
"###,
&danger
@@ -6259,7 +6259,7 @@ bar</em></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*foo *bar**
"###,
&danger
@@ -6270,7 +6270,7 @@ bar</em></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*foo **bar** baz*
"###,
&danger
@@ -6281,7 +6281,7 @@ bar</em></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*foo**bar**baz*
"###,
&danger
@@ -6292,7 +6292,7 @@ bar</em></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*foo**bar*
"###,
&danger
@@ -6303,7 +6303,7 @@ bar</em></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"***foo** bar*
"###,
&danger
@@ -6314,7 +6314,7 @@ bar</em></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*foo **bar***
"###,
&danger
@@ -6325,7 +6325,7 @@ bar</em></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*foo**bar***
"###,
&danger
@@ -6336,7 +6336,7 @@ bar</em></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo***bar***baz
"###,
&danger
@@ -6347,7 +6347,7 @@ bar</em></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo******bar*********baz
"###,
&danger
@@ -6358,7 +6358,7 @@ bar</em></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*foo **bar *baz* bim** bop*
"###,
&danger
@@ -6369,7 +6369,7 @@ bar</em></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*foo [*bar*](/url)*
"###,
&danger
@@ -6380,7 +6380,7 @@ bar</em></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"** is not an empty emphasis
"###,
&danger
@@ -6391,7 +6391,7 @@ bar</em></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"**** is not an empty strong emphasis
"###,
&danger
@@ -6402,7 +6402,7 @@ bar</em></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"**foo [bar](/url)**
"###,
&danger
@@ -6413,7 +6413,7 @@ bar</em></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"**foo
bar**
"###,
@@ -6426,7 +6426,7 @@ bar</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"__foo _bar_ baz__
"###,
&danger
@@ -6437,7 +6437,7 @@ bar</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"__foo __bar__ baz__
"###,
&danger
@@ -6448,7 +6448,7 @@ bar</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"____foo__ bar__
"###,
&danger
@@ -6459,7 +6459,7 @@ bar</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"**foo **bar****
"###,
&danger
@@ -6470,7 +6470,7 @@ bar</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"**foo *bar* baz**
"###,
&danger
@@ -6481,7 +6481,7 @@ bar</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"**foo*bar*baz**
"###,
&danger
@@ -6492,7 +6492,7 @@ bar</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"***foo* bar**
"###,
&danger
@@ -6503,7 +6503,7 @@ bar</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"**foo *bar***
"###,
&danger
@@ -6514,7 +6514,7 @@ bar</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"**foo *bar **baz**
bim* bop**
"###,
@@ -6527,7 +6527,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"**foo [*bar*](/url)**
"###,
&danger
@@ -6538,7 +6538,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"__ is not an empty emphasis
"###,
&danger
@@ -6549,7 +6549,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"____ is not an empty strong emphasis
"###,
&danger
@@ -6560,7 +6560,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo ***
"###,
&danger
@@ -6571,7 +6571,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo *\**
"###,
&danger
@@ -6582,7 +6582,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo *_*
"###,
&danger
@@ -6593,7 +6593,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo *****
"###,
&danger
@@ -6604,7 +6604,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo **\***
"###,
&danger
@@ -6615,7 +6615,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo **_**
"###,
&danger
@@ -6626,7 +6626,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"**foo*
"###,
&danger
@@ -6637,7 +6637,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*foo**
"###,
&danger
@@ -6648,7 +6648,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"***foo**
"###,
&danger
@@ -6659,7 +6659,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"****foo*
"###,
&danger
@@ -6670,7 +6670,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"**foo***
"###,
&danger
@@ -6681,7 +6681,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*foo****
"###,
&danger
@@ -6692,7 +6692,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo ___
"###,
&danger
@@ -6703,7 +6703,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo _\__
"###,
&danger
@@ -6714,7 +6714,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo _*_
"###,
&danger
@@ -6725,7 +6725,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo _____
"###,
&danger
@@ -6736,7 +6736,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo __\___
"###,
&danger
@@ -6747,7 +6747,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo __*__
"###,
&danger
@@ -6758,7 +6758,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"__foo_
"###,
&danger
@@ -6769,7 +6769,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"_foo__
"###,
&danger
@@ -6780,7 +6780,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"___foo__
"###,
&danger
@@ -6791,7 +6791,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"____foo_
"###,
&danger
@@ -6802,7 +6802,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"__foo___
"###,
&danger
@@ -6813,7 +6813,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"_foo____
"###,
&danger
@@ -6824,7 +6824,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"**foo**
"###,
&danger
@@ -6835,7 +6835,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*_foo_*
"###,
&danger
@@ -6846,7 +6846,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"__foo__
"###,
&danger
@@ -6857,7 +6857,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"_*foo*_
"###,
&danger
@@ -6868,7 +6868,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"****foo****
"###,
&danger
@@ -6879,7 +6879,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"____foo____
"###,
&danger
@@ -6890,7 +6890,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"******foo******
"###,
&danger
@@ -6901,7 +6901,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"***foo***
"###,
&danger
@@ -6912,7 +6912,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"_____foo_____
"###,
&danger
@@ -6923,7 +6923,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*foo _bar* baz_
"###,
&danger
@@ -6934,7 +6934,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*foo __bar *baz bim__ bam*
"###,
&danger
@@ -6945,7 +6945,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"**foo **bar baz**
"###,
&danger
@@ -6956,7 +6956,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*foo *bar baz*
"###,
&danger
@@ -6967,7 +6967,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*[bar*](/url)
"###,
&danger
@@ -6978,7 +6978,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"_foo [bar_](/url)
"###,
&danger
@@ -6989,7 +6989,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*<img src="foo" title="*"/>
"###,
&danger
@@ -7000,7 +7000,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"**<a href="**">
"###,
&danger
@@ -7011,7 +7011,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"__<a href="__">
"###,
&danger
@@ -7022,7 +7022,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*a `*`*
"###,
&danger
@@ -7033,7 +7033,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"_a `_`_
"###,
&danger
@@ -7044,7 +7044,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"**a<http://foo.bar/?q=**>
"###,
&danger
@@ -7055,7 +7055,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"__a<http://foo.bar/?q=__>
"###,
&danger
@@ -7066,7 +7066,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link](/uri "title")
"###,
&danger
@@ -7077,7 +7077,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link](/uri)
"###,
&danger
@@ -7088,7 +7088,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[](./target.md)
"###,
&danger
@@ -7099,7 +7099,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link]()
"###,
&danger
@@ -7110,7 +7110,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link](<>)
"###,
&danger
@@ -7121,7 +7121,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[]()
"###,
&danger
@@ -7132,7 +7132,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link](/my uri)
"###,
&danger
@@ -7143,7 +7143,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link](</my uri>)
"###,
&danger
@@ -7154,7 +7154,7 @@ bim</em> bop</strong></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link](foo
bar)
"###,
@@ -7167,7 +7167,7 @@ bar)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link](<foo
bar>)
"###,
@@ -7180,7 +7180,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[a](<b)c>)
"###,
&danger
@@ -7191,7 +7191,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link](<foo\>)
"###,
&danger
@@ -7202,7 +7202,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[a](<b)c
[a](<b)c>
[a](<b>c)
@@ -7217,7 +7217,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link](\(foo\))
"###,
&danger
@@ -7228,7 +7228,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link](foo(and(bar)))
"###,
&danger
@@ -7239,7 +7239,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link](foo(and(bar))
"###,
&danger
@@ -7250,7 +7250,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link](foo\(and\(bar\))
"###,
&danger
@@ -7261,7 +7261,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link](<foo(and(bar)>)
"###,
&danger
@@ -7272,7 +7272,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link](foo\)\:)
"###,
&danger
@@ -7283,7 +7283,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link](#fragment)
[link](http://example.com#fragment)
@@ -7300,7 +7300,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link](foo\bar)
"###,
&danger
@@ -7311,7 +7311,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link](foo%20b&auml;)
"###,
&danger
@@ -7322,7 +7322,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link]("title")
"###,
&danger
@@ -7333,7 +7333,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link](/url "title")
[link](/url 'title')
[link](/url (title))
@@ -7348,7 +7348,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link](/url "title \"&quot;")
"###,
&danger
@@ -7359,7 +7359,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link](/url "title")
"###,
&danger
@@ -7370,7 +7370,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link](/url "title "and" title")
"###,
&danger
@@ -7381,7 +7381,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link](/url 'title "and" title')
"###,
&danger
@@ -7392,7 +7392,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link]( /uri
"title" )
"###,
@@ -7404,7 +7404,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link] (/uri)
"###,
&danger
@@ -7415,7 +7415,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link [foo [bar]]](/uri)
"###,
&danger
@@ -7426,7 +7426,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link] bar](/uri)
"###,
&danger
@@ -7437,7 +7437,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link [bar](/uri)
"###,
&danger
@@ -7448,7 +7448,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link \[bar](/uri)
"###,
&danger
@@ -7459,7 +7459,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link *foo **bar** `#`*](/uri)
"###,
&danger
@@ -7470,7 +7470,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[![moon](moon.jpg)](/uri)
"###,
&danger
@@ -7481,7 +7481,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo [bar](/uri)](/uri)
"###,
&danger
@@ -7492,7 +7492,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo *[bar [baz](/uri)](/uri)*](/uri)
"###,
&danger
@@ -7503,7 +7503,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"![[[foo](uri1)](uri2)](uri3)
"###,
&danger
@@ -7514,7 +7514,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*[foo*](/uri)
"###,
&danger
@@ -7525,7 +7525,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo *bar](baz*)
"###,
&danger
@@ -7536,7 +7536,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*foo [bar* baz]
"###,
&danger
@@ -7547,7 +7547,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo <bar attr="](baz)">
"###,
&danger
@@ -7558,7 +7558,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo`](/uri)`
"###,
&danger
@@ -7569,7 +7569,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo<http://example.com/?search=](uri)>
"###,
&danger
@@ -7580,7 +7580,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo][bar]
[bar]: /url "title"
@@ -7593,7 +7593,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link [foo [bar]]][ref]
[ref]: /uri
@@ -7606,7 +7606,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link \[bar][ref]
[ref]: /uri
@@ -7619,7 +7619,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[link *foo **bar** `#`*][ref]
[ref]: /uri
@@ -7632,7 +7632,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[![moon](moon.jpg)][ref]
[ref]: /uri
@@ -7645,7 +7645,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo [bar](/uri)][ref]
[ref]: /uri
@@ -7658,7 +7658,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo *bar [baz][ref]*][ref]
[ref]: /uri
@@ -7671,7 +7671,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*[foo*][ref]
[ref]: /uri
@@ -7684,7 +7684,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo *bar][ref]*
[ref]: /uri
@@ -7697,7 +7697,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo <bar attr="][ref]">
[ref]: /uri
@@ -7710,7 +7710,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo`][ref]`
[ref]: /uri
@@ -7723,7 +7723,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo<http://example.com/?search=][ref]>
[ref]: /uri
@@ -7736,7 +7736,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo][BaR]
[bar]: /url "title"
@@ -7749,7 +7749,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[ẞ]
[SS]: /url
@@ -7762,7 +7762,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[Foo
bar]: /url
@@ -7776,7 +7776,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo] [bar]
[bar]: /url "title"
@@ -7789,7 +7789,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]
[bar]
@@ -7804,7 +7804,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]: /url1
[foo]: /url2
@@ -7819,7 +7819,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[bar][foo\!]
[foo!]: /url
@@ -7832,7 +7832,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo][ref[]
[ref[]: /uri
@@ -7846,7 +7846,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo][ref[bar]]
[ref[bar]]: /uri
@@ -7860,7 +7860,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[[[foo]]]
[[[foo]]]: /url
@@ -7874,7 +7874,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo][ref\[]
[ref\[]: /uri
@@ -7887,7 +7887,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[bar\\]: /uri
[bar\\]
@@ -7900,7 +7900,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[]
[]: /uri
@@ -7914,7 +7914,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[
]
@@ -7932,7 +7932,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo][]
[foo]: /url "title"
@@ -7945,7 +7945,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[*foo* bar][]
[*foo* bar]: /url "title"
@@ -7958,7 +7958,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[Foo][]
[foo]: /url "title"
@@ -7971,7 +7971,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]
[]
@@ -7986,7 +7986,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]
[foo]: /url "title"
@@ -7999,7 +7999,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[*foo* bar]
[*foo* bar]: /url "title"
@@ -8012,7 +8012,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[[*foo* bar]]
[*foo* bar]: /url "title"
@@ -8025,7 +8025,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[[bar [foo]
[foo]: /url
@@ -8038,7 +8038,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[Foo]
[foo]: /url "title"
@@ -8051,7 +8051,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo] bar
[foo]: /url
@@ -8064,7 +8064,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"\[foo]
[foo]: /url "title"
@@ -8077,7 +8077,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo*]: /url
*[foo*]
@@ -8090,7 +8090,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo][bar]
[foo]: /url1
@@ -8104,7 +8104,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo][]
[foo]: /url1
@@ -8117,7 +8117,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo]()
[foo]: /url1
@@ -8130,7 +8130,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo](not a link)
[foo]: /url1
@@ -8143,7 +8143,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo][bar][baz]
[baz]: /url
@@ -8156,7 +8156,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo][bar][baz]
[baz]: /url1
@@ -8170,7 +8170,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[foo][bar][baz]
[baz]: /url1
@@ -8184,7 +8184,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"![foo](/url "title")
"###,
&danger
@@ -8195,7 +8195,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"![foo *bar*]
[foo *bar*]: train.jpg "train & tracks"
@@ -8208,7 +8208,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"![foo ![bar](/url)](/url2)
"###,
&danger
@@ -8219,7 +8219,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"![foo [bar](/url)](/url2)
"###,
&danger
@@ -8230,7 +8230,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"![foo *bar*][]
[foo *bar*]: train.jpg "train & tracks"
@@ -8243,7 +8243,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"![foo *bar*][foobar]
[FOOBAR]: train.jpg "train & tracks"
@@ -8256,7 +8256,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"![foo](train.jpg)
"###,
&danger
@@ -8267,7 +8267,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"My ![foo bar](/path/to/train.jpg "title" )
"###,
&danger
@@ -8278,7 +8278,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"![foo](<url>)
"###,
&danger
@@ -8289,7 +8289,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"![](/url)
"###,
&danger
@@ -8300,7 +8300,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"![foo][bar]
[bar]: /url
@@ -8313,7 +8313,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"![foo][bar]
[BAR]: /url
@@ -8326,7 +8326,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"![foo][]
[foo]: /url "title"
@@ -8339,7 +8339,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"![*foo* bar][]
[*foo* bar]: /url "title"
@@ -8352,7 +8352,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"![Foo][]
[foo]: /url "title"
@@ -8365,7 +8365,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"![foo]
[]
@@ -8380,7 +8380,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"![foo]
[foo]: /url "title"
@@ -8393,7 +8393,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"![*foo* bar]
[*foo* bar]: /url "title"
@@ -8406,7 +8406,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"![[foo]]
[[foo]]: /url "title"
@@ -8420,7 +8420,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"![Foo]
[foo]: /url "title"
@@ -8433,7 +8433,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"!\[foo]
[foo]: /url "title"
@@ -8446,7 +8446,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"\![foo]
[foo]: /url "title"
@@ -8459,7 +8459,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<http://foo.bar.baz>
"###,
&danger
@@ -8470,7 +8470,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<http://foo.bar.baz/test?q=hello&id=22&boolean>
"###,
&danger
@@ -8481,7 +8481,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<irc://foo.bar:2233/baz>
"###,
&danger
@@ -8492,7 +8492,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<MAILTO:FOO@BAR.BAZ>
"###,
&danger
@@ -8503,7 +8503,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<a+b+c:d>
"###,
&danger
@@ -8514,7 +8514,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<made-up-scheme://foo,bar>
"###,
&danger
@@ -8525,7 +8525,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<http://../>
"###,
&danger
@@ -8536,7 +8536,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<localhost:5001/foo>
"###,
&danger
@@ -8547,7 +8547,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<http://foo.bar/baz bim>
"###,
&danger
@@ -8558,7 +8558,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<http://example.com/\[\>
"###,
&danger
@@ -8569,7 +8569,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<foo@bar.example.com>
"###,
&danger
@@ -8580,7 +8580,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<foo+special@Bar.baz-bar0.com>
"###,
&danger
@@ -8591,7 +8591,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<foo\+@bar.example.com>
"###,
&danger
@@ -8602,7 +8602,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<>
"###,
&danger
@@ -8613,7 +8613,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"< http://foo.bar >
"###,
&danger
@@ -8624,7 +8624,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<m:abc>
"###,
&danger
@@ -8635,7 +8635,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<foo.bar.baz>
"###,
&danger
@@ -8646,7 +8646,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"http://example.com
"###,
&danger
@@ -8657,7 +8657,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo@bar.example.com
"###,
&danger
@@ -8668,7 +8668,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<a><bab><c2c>
"###,
&danger
@@ -8679,7 +8679,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<a/><b2/>
"###,
&danger
@@ -8690,7 +8690,7 @@ bar>)</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<a /><b2
data="foo" >
"###,
@@ -8703,7 +8703,7 @@ data="foo" ></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<a foo="bar" bam = 'baz <em>"</em>'
_boolean zoop:33=zoop:33 />
"###,
@@ -8716,7 +8716,7 @@ _boolean zoop:33=zoop:33 /></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo <responsive-image src="foo.jpg" />
"###,
&danger
@@ -8727,7 +8727,7 @@ _boolean zoop:33=zoop:33 /></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<33> <__>
"###,
&danger
@@ -8738,7 +8738,7 @@ _boolean zoop:33=zoop:33 /></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<a h*#ref="hi">
"###,
&danger
@@ -8749,7 +8749,7 @@ _boolean zoop:33=zoop:33 /></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<a href="hi'> <a href=hi'>
"###,
&danger
@@ -8760,7 +8760,7 @@ _boolean zoop:33=zoop:33 /></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"< a><
foo><bar/ >
<foo bar=baz
@@ -8777,7 +8777,7 @@ bim!bop /&gt;</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<a href='bar'title=title>
"###,
&danger
@@ -8788,7 +8788,7 @@ bim!bop /&gt;</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"</a></foo >
"###,
&danger
@@ -8799,7 +8799,7 @@ bim!bop /&gt;</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"</a href="foo">
"###,
&danger
@@ -8810,7 +8810,7 @@ bim!bop /&gt;</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo <!-- this is a
comment - with hyphen -->
"###,
@@ -8823,7 +8823,7 @@ comment - with hyphen --></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo <!-- not a comment -- two hyphens -->
"###,
&danger
@@ -8834,7 +8834,7 @@ comment - with hyphen --></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo <!--> foo -->
foo <!-- foo--->
@@ -8848,7 +8848,7 @@ foo <!-- foo--->
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo <?php echo $a; ?>
"###,
&danger
@@ -8859,7 +8859,7 @@ foo <!-- foo--->
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo <!ELEMENT br EMPTY>
"###,
&danger
@@ -8870,7 +8870,7 @@ foo <!-- foo--->
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo <![CDATA[>&<]]>
"###,
&danger
@@ -8881,7 +8881,7 @@ foo <!-- foo--->
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo <a href="&ouml;">
"###,
&danger
@@ -8892,7 +8892,7 @@ foo <!-- foo--->
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo <a href="\*">
"###,
&danger
@@ -8903,7 +8903,7 @@ foo <!-- foo--->
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<a href="\"">
"###,
&danger
@@ -8914,7 +8914,7 @@ foo <!-- foo--->
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo
baz
"###,
@@ -8927,7 +8927,7 @@ baz</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo\
baz
"###,
@@ -8940,7 +8940,7 @@ baz</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo
baz
"###,
@@ -8953,7 +8953,7 @@ baz</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo
bar
"###,
@@ -8966,7 +8966,7 @@ bar</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo\
bar
"###,
@@ -8979,7 +8979,7 @@ bar</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*foo
bar*
"###,
@@ -8992,7 +8992,7 @@ bar</em></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*foo\
bar*
"###,
@@ -9005,7 +9005,7 @@ bar</em></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"`code
span`
"###,
@@ -9017,7 +9017,7 @@ span`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"`code\
span`
"###,
@@ -9029,7 +9029,7 @@ span`
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<a href="foo
bar">
"###,
@@ -9042,7 +9042,7 @@ bar"></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"<a href="foo\
bar">
"###,
@@ -9055,7 +9055,7 @@ bar"></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo\
"###,
&danger
@@ -9066,7 +9066,7 @@ bar"></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo
"###,
&danger
@@ -9077,7 +9077,7 @@ bar"></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"### foo\
"###,
&danger
@@ -9088,7 +9088,7 @@ bar"></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"### foo
"###,
&danger
@@ -9099,7 +9099,7 @@ bar"></p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo
baz
"###,
@@ -9112,7 +9112,7 @@ baz</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"foo
baz
"###,
@@ -9125,7 +9125,7 @@ baz</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"hello $.;'there
"###,
&danger
@@ -9136,7 +9136,7 @@ baz</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Foo χρῆν
"###,
&danger
@@ -9147,7 +9147,7 @@ baz</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Multiple spaces
"###,
&danger
diff --git a/tests/definition.rs b/tests/definition.rs
index 376035a..c6923bc 100644
--- a/tests/definition.rs
+++ b/tests/definition.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{Definition, Node, Root},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
@@ -19,473 +19,473 @@ fn definition() -> Result<(), String> {
};
assert_eq!(
- micromark("[foo]: /url \"title\"\n\n[foo]"),
+ to_html("[foo]: /url \"title\"\n\n[foo]"),
"<p><a href=\"/url\" title=\"title\">foo</a></p>",
"should support link definitions"
);
assert_eq!(
- micromark("[foo]:\n\n/url\n\n[foo]"),
+ to_html("[foo]:\n\n/url\n\n[foo]"),
"<p>[foo]:</p>\n<p>/url</p>\n<p>[foo]</p>",
"should not support blank lines before destination"
);
assert_eq!(
- micromark(" [foo]: \n /url \n 'the title' \n\n[foo]"),
+ to_html(" [foo]: \n /url \n 'the title' \n\n[foo]"),
"<p><a href=\"/url\" title=\"the title\">foo</a></p>",
"should support whitespace and line endings in definitions"
);
assert_eq!(
- micromark("[a]:b 'c'\n\n[a]"),
+ to_html("[a]:b 'c'\n\n[a]"),
"<p><a href=\"b\" title=\"c\">a</a></p>",
"should support no whitespace after `:` in definitions"
);
assert_eq!(
- micromark("[Foo*bar\\]]:my_(url) 'title (with parens)'\n\n[Foo*bar\\]]"),
+ to_html("[Foo*bar\\]]:my_(url) 'title (with parens)'\n\n[Foo*bar\\]]"),
"<p><a href=\"my_(url)\" title=\"title (with parens)\">Foo*bar]</a></p>",
"should support complex definitions (1)"
);
assert_eq!(
- micromark("[Foo bar]:\n<my url>\n'title'\n\n[Foo bar]"),
+ to_html("[Foo bar]:\n<my url>\n'title'\n\n[Foo bar]"),
"<p><a href=\"my%20url\" title=\"title\">Foo bar</a></p>",
"should support complex definitions (2)"
);
assert_eq!(
- micromark("[foo]: /url '\ntitle\nline1\nline2\n'\n\n[foo]"),
+ to_html("[foo]: /url '\ntitle\nline1\nline2\n'\n\n[foo]"),
"<p><a href=\"/url\" title=\"\ntitle\nline1\nline2\n\">foo</a></p>",
"should support line endings in titles"
);
assert_eq!(
- micromark("[foo]: /url 'title\n\nwith blank line'\n\n[foo]"),
+ to_html("[foo]: /url 'title\n\nwith blank line'\n\n[foo]"),
"<p>[foo]: /url 'title</p>\n<p>with blank line'</p>\n<p>[foo]</p>",
"should not support blank lines in titles"
);
assert_eq!(
- micromark("[foo]:\n/url\n\n[foo]"),
+ to_html("[foo]:\n/url\n\n[foo]"),
"<p><a href=\"/url\">foo</a></p>",
"should support definitions w/o title"
);
assert_eq!(
- micromark("[foo]:\n\n[foo]"),
+ to_html("[foo]:\n\n[foo]"),
"<p>[foo]:</p>\n<p>[foo]</p>",
"should not support definitions w/o destination"
);
assert_eq!(
- micromark("[foo]: <>\n\n[foo]"),
+ to_html("[foo]: <>\n\n[foo]"),
"<p><a href=\"\">foo</a></p>",
"should support definitions w/ explicit empty destinations"
);
assert_eq!(
- micromark_with_options("[foo]: <bar>(baz)\n\n[foo]", &danger)?,
+ to_html_with_options("[foo]: <bar>(baz)\n\n[foo]", &danger)?,
"<p>[foo]: <bar>(baz)</p>\n<p>[foo]</p>",
"should not support definitions w/ no whitespace between destination and title"
);
assert_eq!(
- micromark("[foo]: /url\\bar\\*baz \"foo\\\"bar\\baz\"\n\n[foo]"),
+ to_html("[foo]: /url\\bar\\*baz \"foo\\\"bar\\baz\"\n\n[foo]"),
"<p><a href=\"/url%5Cbar*baz\" title=\"foo&quot;bar\\baz\">foo</a></p>",
"should support character escapes in destinations and titles"
);
assert_eq!(
- micromark("[foo]\n\n[foo]: url"),
+ to_html("[foo]\n\n[foo]: url"),
"<p><a href=\"url\">foo</a></p>\n",
"should support a link before a definition"
);
assert_eq!(
- micromark("[foo]: first\n[foo]: second\n\n[foo]"),
+ to_html("[foo]: first\n[foo]: second\n\n[foo]"),
"<p><a href=\"first\">foo</a></p>",
"should match w/ the first definition"
);
assert_eq!(
- micromark("[FOO]: /url\n\n[Foo]"),
+ to_html("[FOO]: /url\n\n[Foo]"),
"<p><a href=\"/url\">Foo</a></p>",
"should match w/ case-insensitive (1)"
);
assert_eq!(
- micromark("[ΑΓΩ]: /φου\n\n[αγω]"),
+ to_html("[ΑΓΩ]: /φου\n\n[αγω]"),
"<p><a href=\"/%CF%86%CE%BF%CF%85\">αγω</a></p>",
"should match w/ case-insensitive (2)"
);
assert_eq!(
- micromark("[ı]: a\n\n[I]"),
+ to_html("[ı]: a\n\n[I]"),
"<p><a href=\"a\">I</a></p>",
"should match w/ undotted turkish i (1)"
);
assert_eq!(
- micromark("[I]: a\n\n[ı]"),
+ to_html("[I]: a\n\n[ı]"),
"<p><a href=\"a\">ı</a></p>",
"should match w/ undotted turkish i (2)"
);
// Ref: <https://spec.commonmark.org/dingus/?text=%5Bi%5D%3A%20a%0A%0A%5Bİ%5D>
// GFM parses the same (last checked: 2022-07-11).
assert_eq!(
- micromark("[i]: a\n\n[İ]"),
+ to_html("[i]: a\n\n[İ]"),
"<p>[İ]</p>",
"should *not* match w/ dotted turkish i (1)"
);
// Ref: <https://spec.commonmark.org/dingus/?text=%5Bİ%5D%3A%20a%0A%0A%5Bi%5D>
// GFM parses the same (last checked: 2022-07-11).
assert_eq!(
- micromark("[İ]: a\n\n[i]"),
+ to_html("[İ]: a\n\n[i]"),
"<p>[i]</p>",
"should *not* match w/ dotted turkish i (2)"
);
assert_eq!(
- micromark("[foo]: /url"),
+ to_html("[foo]: /url"),
"",
"should not contribute anything w/o reference (1)"
);
assert_eq!(
- micromark("[\nfoo\n]: /url\nbar"),
+ to_html("[\nfoo\n]: /url\nbar"),
"<p>bar</p>",
"should not contribute anything w/o reference (2)"
);
assert_eq!(
- micromark("[foo]: /url \"title\" \n\n[foo]"),
+ to_html("[foo]: /url \"title\" \n\n[foo]"),
"<p><a href=\"/url\" title=\"title\">foo</a></p>",
"should support whitespace after title"
);
assert_eq!(
- micromark("[foo]: /url\n\"title\" \n\n[foo]"),
+ to_html("[foo]: /url\n\"title\" \n\n[foo]"),
"<p><a href=\"/url\" title=\"title\">foo</a></p>",
"should support whitespace after title on a separate line"
);
assert_eq!(
- micromark("[foo]: /url \"title\" ok"),
+ to_html("[foo]: /url \"title\" ok"),
"<p>[foo]: /url &quot;title&quot; ok</p>",
"should not support non-whitespace content after definitions (1)"
);
assert_eq!(
- micromark("[foo]: /url\n\"title\" ok"),
+ to_html("[foo]: /url\n\"title\" ok"),
"<p>&quot;title&quot; ok</p>",
"should not support non-whitespace content after definitions (2)"
);
assert_eq!(
- micromark(" [foo]: /url \"title\"\n\n[foo]"),
+ to_html(" [foo]: /url \"title\"\n\n[foo]"),
"<pre><code>[foo]: /url &quot;title&quot;\n</code></pre>\n<p>[foo]</p>",
"should prefer indented code over definitions"
);
assert_eq!(
- micromark("```\n[foo]: /url\n```\n\n[foo]"),
+ to_html("```\n[foo]: /url\n```\n\n[foo]"),
"<pre><code>[foo]: /url\n</code></pre>\n<p>[foo]</p>",
"should not support definitions in fenced code"
);
assert_eq!(
- micromark("Foo\n[bar]: /baz\n\n[bar]"),
+ to_html("Foo\n[bar]: /baz\n\n[bar]"),
"<p>Foo\n[bar]: /baz</p>\n<p>[bar]</p>",
"should not support definitions in paragraphs"
);
assert_eq!(
- micromark("# [Foo]\n[foo]: /url\n> bar"),
+ to_html("# [Foo]\n[foo]: /url\n> bar"),
"<h1><a href=\"/url\">Foo</a></h1>\n<blockquote>\n<p>bar</p>\n</blockquote>",
"should not support definitions in headings"
);
assert_eq!(
- micromark("[foo]: /url\nbar\n===\n[foo]"),
+ to_html("[foo]: /url\nbar\n===\n[foo]"),
"<h1>bar</h1>\n<p><a href=\"/url\">foo</a></p>",
"should support setext headings after definitions"
);
assert_eq!(
- micromark("[foo]: /url\n===\n[foo]"),
+ to_html("[foo]: /url\n===\n[foo]"),
"<p>===\n<a href=\"/url\">foo</a></p>",
"should not support setext heading underlines after definitions"
);
assert_eq!(
- micromark(
+ to_html(
"[foo]: /foo-url \"foo\"\n[bar]: /bar-url\n \"bar\"\n[baz]: /baz-url\n\n[foo],\n[bar],\n[baz]"),
"<p><a href=\"/foo-url\" title=\"foo\">foo</a>,\n<a href=\"/bar-url\" title=\"bar\">bar</a>,\n<a href=\"/baz-url\">baz</a></p>",
"should support definitions after definitions"
);
assert_eq!(
- micromark("> [foo]: /url\n\n[foo]"),
+ to_html("> [foo]: /url\n\n[foo]"),
"<blockquote>\n</blockquote>\n<p><a href=\"/url\">foo</a></p>",
"should support definitions in block quotes (1)"
);
assert_eq!(
- micromark("> [a]: <> 'b\n> c'"),
+ to_html("> [a]: <> 'b\n> c'"),
"<blockquote>\n</blockquote>",
"should support definitions in block quotes (2)"
);
assert_eq!(
- micromark("> [a]\n\n[a]: b (c\n)"),
+ to_html("> [a]\n\n[a]: b (c\n)"),
"<blockquote>\n<p><a href=\"b\" title=\"c\n\">a</a></p>\n</blockquote>\n",
"should support definitions in block quotes (3)"
);
// Extra
assert_eq!(
- micromark("[\\[\\+\\]]: example.com\n\nLink: [\\[\\+\\]]."),
+ to_html("[\\[\\+\\]]: example.com\n\nLink: [\\[\\+\\]]."),
"<p>Link: <a href=\"example.com\">[+]</a>.</p>",
"should match w/ character escapes"
);
assert_eq!(
- micromark("[x]: \\\"&#x20;\\(\\)\\\"\n\n[x]"),
+ to_html("[x]: \\\"&#x20;\\(\\)\\\"\n\n[x]"),
"<p><a href=\"%22%20()%22\">x</a></p>",
"should support character escapes & references in unenclosed destinations"
);
assert_eq!(
- micromark("[x]: <\\>&#x20;\\+\\>>\n\n[x]"),
+ to_html("[x]: <\\>&#x20;\\+\\>>\n\n[x]"),
"<p><a href=\"%3E%20+%3E\">x</a></p>",
"should support character escapes & references in enclosed destinations"
);
assert_eq!(
- micromark("[x]: <\n\n[x]"),
+ to_html("[x]: <\n\n[x]"),
"<p>[x]: &lt;</p>\n<p>[x]</p>",
"should not support a line ending at start of enclosed destination"
);
assert_eq!(
- micromark("[x]: <x\n\n[x]"),
+ to_html("[x]: <x\n\n[x]"),
"<p>[x]: &lt;x</p>\n<p>[x]</p>",
"should not support a line ending in enclosed destination"
);
assert_eq!(
- micromark("[x]: \u{000b}a\n\n[x]"),
+ to_html("[x]: \u{000b}a\n\n[x]"),
"<p>[x]: \u{000b}a</p>\n<p>[x]</p>",
"should not support ascii control characters at the start of destination"
);
assert_eq!(
- micromark("[x]: a\u{000b}b\n\n[x]"),
+ to_html("[x]: a\u{000b}b\n\n[x]"),
"<p>[x]: a\u{000b}b</p>\n<p>[x]</p>",
"should not support ascii control characters in destination"
);
assert_eq!(
- micromark("[x]: <\u{000b}a>\n\n[x]"),
+ to_html("[x]: <\u{000b}a>\n\n[x]"),
"<p><a href=\"%0Ba\">x</a></p>",
"should support ascii control characters at the start of enclosed destination"
);
assert_eq!(
- micromark("[x]: <a\u{000b}b>\n\n[x]"),
+ to_html("[x]: <a\u{000b}b>\n\n[x]"),
"<p><a href=\"a%0Bb\">x</a></p>",
"should support ascii control characters in enclosed destinations"
);
assert_eq!(
- micromark("[x]: a \"\\\"\"\n\n[x]"),
+ to_html("[x]: a \"\\\"\"\n\n[x]"),
"<p><a href=\"a\" title=\"&quot;\">x</a></p>",
"should support character escapes at the start of a title"
);
assert_eq!(
- micromark("[x]: a \"'\"\n\n[x]"),
+ to_html("[x]: a \"'\"\n\n[x]"),
"<p><a href=\"a\" title=\"'\">x</a></p>",
"should support double quoted titles"
);
assert_eq!(
- micromark("[x]: a '\"'\n\n[x]"),
+ to_html("[x]: a '\"'\n\n[x]"),
"<p><a href=\"a\" title=\"&quot;\">x</a></p>",
"should support single quoted titles"
);
assert_eq!(
- micromark("[x]: a (\"')\n\n[x]"),
+ to_html("[x]: a (\"')\n\n[x]"),
"<p><a href=\"a\" title=\"&quot;'\">x</a></p>",
"should support paren enclosed titles"
);
assert_eq!(
- micromark("[x]: a(()\n\n[x]"),
+ to_html("[x]: a(()\n\n[x]"),
"<p>[x]: a(()</p>\n<p>[x]</p>",
"should not support more opening than closing parens in the destination"
);
assert_eq!(
- micromark("[x]: a(())\n\n[x]"),
+ to_html("[x]: a(())\n\n[x]"),
"<p><a href=\"a(())\">x</a></p>",
"should support balanced opening and closing parens in the destination"
);
assert_eq!(
- micromark("[x]: a())\n\n[x]"),
+ to_html("[x]: a())\n\n[x]"),
"<p>[x]: a())</p>\n<p>[x]</p>",
"should not support more closing than opening parens in the destination"
);
assert_eq!(
- micromark("[x]: a \t\n\n[x]"),
+ to_html("[x]: a \t\n\n[x]"),
"<p><a href=\"a\">x</a></p>",
"should support trailing whitespace after a destination"
);
assert_eq!(
- micromark("[x]: a \"X\" \t\n\n[x]"),
+ to_html("[x]: a \"X\" \t\n\n[x]"),
"<p><a href=\"a\" title=\"X\">x</a></p>",
"should support trailing whitespace after a title"
);
assert_eq!(
- micromark("[&amp;&copy;&]: example.com/&amp;&copy;& \"&amp;&copy;&\"\n\n[&amp;&copy;&]"),
+ to_html("[&amp;&copy;&]: example.com/&amp;&copy;& \"&amp;&copy;&\"\n\n[&amp;&copy;&]"),
"<p><a href=\"example.com/&amp;%C2%A9&amp;\" title=\"&amp;©&amp;\">&amp;©&amp;</a></p>",
"should support character references in definitions"
);
assert_eq!(
- micromark("[x]:\nexample.com\n\n[x]"),
+ to_html("[x]:\nexample.com\n\n[x]"),
"<p><a href=\"example.com\">x</a></p>",
"should support a line ending before a destination"
);
assert_eq!(
- micromark("[x]: \t\nexample.com\n\n[x]"),
+ to_html("[x]: \t\nexample.com\n\n[x]"),
"<p><a href=\"example.com\">x</a></p>",
"should support whitespace before a destination"
);
// See: <https://github.com/commonmark/commonmark.js/issues/192>
assert_eq!(
- micromark("[x]: <> \"\"\n[][x]"),
+ to_html("[x]: <> \"\"\n[][x]"),
"<p><a href=\"\"></a></p>",
"should ignore an empty title"
);
assert_eq!(
- micromark_with_options("[a]\n\n[a]: <b<c>", &danger)?,
+ to_html_with_options("[a]\n\n[a]: <b<c>", &danger)?,
"<p>[a]</p>\n<p>[a]: &lt;b<c></p>",
"should not support a less than in an enclosed destination"
);
assert_eq!(
- micromark("[a]\n\n[a]: b(c"),
+ to_html("[a]\n\n[a]: b(c"),
"<p>[a]</p>\n<p>[a]: b(c</p>",
"should not support an extra left paren (`(`) in a raw destination"
);
assert_eq!(
- micromark("[a]\n\n[a]: b)c"),
+ to_html("[a]\n\n[a]: b)c"),
"<p>[a]</p>\n<p>[a]: b)c</p>",
"should not support an extra right paren (`)`) in a raw destination"
);
assert_eq!(
- micromark("[a]\n\n[a]: b)c"),
+ to_html("[a]\n\n[a]: b)c"),
"<p>[a]</p>\n<p>[a]: b)c</p>",
"should not support an extra right paren (`)`) in a raw destination"
);
assert_eq!(
- micromark("[a]\n\n[a]: a(1(2(3(4()))))b"),
+ to_html("[a]\n\n[a]: a(1(2(3(4()))))b"),
"<p><a href=\"a(1(2(3(4()))))b\">a</a></p>\n",
"should support 4 or more sets of parens in a raw destination (link resources don’t)"
);
assert_eq!(
- micromark("[a]\n\n[a]: aaa)"),
+ to_html("[a]\n\n[a]: aaa)"),
"<p>[a]</p>\n<p>[a]: aaa)</p>",
"should not support a final (unbalanced) right paren in a raw destination"
);
assert_eq!(
- micromark("[a]\n\n[a]: aaa) \"a\""),
+ to_html("[a]\n\n[a]: aaa) \"a\""),
"<p>[a]</p>\n<p>[a]: aaa) &quot;a&quot;</p>",
"should not support a final (unbalanced) right paren in a raw destination “before” a title"
);
assert_eq!(
- micromark(" [a]: b \"c\"\n [d]: e\n [f]: g \"h\"\n [i]: j\n\t[k]: l (m)\n\t n [k] o"),
+ to_html(" [a]: b \"c\"\n [d]: e\n [f]: g \"h\"\n [i]: j\n\t[k]: l (m)\n\t n [k] o"),
"<p>n <a href=\"l\" title=\"m\">k</a> o</p>",
"should support subsequent indented definitions"
);
assert_eq!(
- micromark("[a\n b]: c\n\n[a\n b]"),
+ to_html("[a\n b]: c\n\n[a\n b]"),
"<p><a href=\"c\">a\nb</a></p>",
"should support line prefixes in definition labels"
);
assert_eq!(
- micromark("[a]: )\n\n[a]"),
+ to_html("[a]: )\n\n[a]"),
"<p>[a]: )</p>\n<p>[a]</p>",
"should not support definitions w/ only a closing paren as a raw destination"
);
assert_eq!(
- micromark("[a]: )b\n\n[a]"),
+ to_html("[a]: )b\n\n[a]"),
"<p>[a]: )b</p>\n<p>[a]</p>",
"should not support definitions w/ closing paren + more text as a raw destination"
);
assert_eq!(
- micromark("[a]: b)\n\n[a]"),
+ to_html("[a]: b)\n\n[a]"),
"<p>[a]: b)</p>\n<p>[a]</p>",
"should not support definitions w/ text + a closing paren as a raw destination"
);
assert_eq!(
- micromark("[\na\n=\n]: b"),
+ to_html("[\na\n=\n]: b"),
"<h1>[\na</h1>\n<p>]: b</p>",
"should prefer setext headings over definition labels"
);
assert_eq!(
- micromark("[a]: b '\nc\n=\n'"),
+ to_html("[a]: b '\nc\n=\n'"),
"<h1>[a]: b '\nc</h1>\n<p>'</p>",
"should prefer setext headings over definition titles"
);
assert_eq!(
- micromark("[\n***\n]: b"),
+ to_html("[\n***\n]: b"),
"<p>[</p>\n<hr />\n<p>]: b</p>",
"should prefer thematic breaks over definition labels"
);
assert_eq!(
- micromark("[a]: b '\n***\n'"),
+ to_html("[a]: b '\n***\n'"),
"<p>[a]: b '</p>\n<hr />\n<p>'</p>",
"should prefer thematic breaks over definition titles"
);
assert_eq!(
- micromark("[\n```\n]: b"),
+ to_html("[\n```\n]: b"),
"<p>[</p>\n<pre><code>]: b\n</code></pre>\n",
"should prefer code (fenced) over definition labels"
);
assert_eq!(
- micromark("[a]: b '\n```\n'"),
+ to_html("[a]: b '\n```\n'"),
"<p>[a]: b '</p>\n<pre><code>'\n</code></pre>\n",
"should prefer code (fenced) over definition titles"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"[foo]: /url \"title\"",
&Options {
parse: ParseOptions {
@@ -503,7 +503,7 @@ fn definition() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("[a]: <b> 'c'", &ParseOptions::default())?,
+ to_mdast("[a]: <b> 'c'", &ParseOptions::default())?,
Node::Root(Root {
children: vec![Node::Definition(Definition {
url: "b".into(),
diff --git a/tests/frontmatter.rs b/tests/frontmatter.rs
index be17a7a..267b694 100644
--- a/tests/frontmatter.rs
+++ b/tests/frontmatter.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{Node, Root, Toml, Yaml},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
@@ -21,61 +21,61 @@ fn frontmatter() -> Result<(), String> {
};
assert_eq!(
- micromark("---\ntitle: Jupyter\n---"),
+ to_html("---\ntitle: Jupyter\n---"),
"<hr />\n<h2>title: Jupyter</h2>",
"should not support frontmatter by default"
);
assert_eq!(
- micromark_with_options("---\ntitle: Jupyter\n---", &frontmatter)?,
+ to_html_with_options("---\ntitle: Jupyter\n---", &frontmatter)?,
"",
"should support frontmatter (yaml)"
);
assert_eq!(
- micromark_with_options("+++\ntitle = \"Jupyter\"\n+++", &frontmatter)?,
+ to_html_with_options("+++\ntitle = \"Jupyter\"\n+++", &frontmatter)?,
"",
"should support frontmatter (toml)"
);
assert_eq!(
- micromark_with_options("---\n---", &frontmatter)?,
+ to_html_with_options("---\n---", &frontmatter)?,
"",
"should support empty frontmatter"
);
assert_eq!(
- micromark_with_options("---\n---\n## Neptune", &frontmatter)?,
+ to_html_with_options("---\n---\n## Neptune", &frontmatter)?,
"<h2>Neptune</h2>",
"should support content after frontmatter"
);
assert_eq!(
- micromark_with_options("## Neptune\n---\n---", &frontmatter)?,
+ to_html_with_options("## Neptune\n---\n---", &frontmatter)?,
"<h2>Neptune</h2>\n<hr />\n<hr />",
"should not support frontmatter after content"
);
assert_eq!(
- micromark_with_options("> ---\n> ---\n> ## Neptune", &frontmatter)?,
+ to_html_with_options("> ---\n> ---\n> ## Neptune", &frontmatter)?,
"<blockquote>\n<hr />\n<hr />\n<h2>Neptune</h2>\n</blockquote>",
"should not support frontmatter in a container"
);
assert_eq!(
- micromark_with_options("---", &frontmatter)?,
+ to_html_with_options("---", &frontmatter)?,
"<hr />",
"should not support just an opening fence"
);
assert_eq!(
- micromark_with_options("---\ntitle: Neptune", &frontmatter)?,
+ to_html_with_options("---\ntitle: Neptune", &frontmatter)?,
"<hr />\n<p>title: Neptune</p>",
"should not support a missing closing fence"
);
assert_eq!(
- micromark_to_mdast("---\na: b\n---", &frontmatter.parse)?,
+ to_mdast("---\na: b\n---", &frontmatter.parse)?,
Node::Root(Root {
children: vec![Node::Yaml(Yaml {
value: "a: b".into(),
@@ -87,7 +87,7 @@ fn frontmatter() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("+++\ntitle = \"Jupyter\"\n+++", &frontmatter.parse)?,
+ to_mdast("+++\ntitle = \"Jupyter\"\n+++", &frontmatter.parse)?,
Node::Root(Root {
children: vec![Node::Toml(Toml {
value: "title = \"Jupyter\"".into(),
diff --git a/tests/fuzz.rs b/tests/fuzz.rs
index 8233ebf..819edf6 100644
--- a/tests/fuzz.rs
+++ b/tests/fuzz.rs
@@ -1,13 +1,11 @@
-extern crate micromark;
-use micromark::{
- micromark, micromark_with_options, CompileOptions, Constructs, Options, ParseOptions,
-};
+extern crate markdown;
+use markdown::{to_html, to_html_with_options, CompileOptions, Constructs, Options, ParseOptions};
use pretty_assertions::assert_eq;
#[test]
fn fuzz() -> Result<(), String> {
assert_eq!(
- micromark("[\n~\na\n-\n\n"),
+ to_html("[\n~\na\n-\n\n"),
"<h2>[\n~\na</h2>\n",
"1: label, blank lines, and code"
);
@@ -15,7 +13,7 @@ fn fuzz() -> Result<(), String> {
// The first link is stopped by the `+` (so it’s `a@b.c`), but the next
// link overlaps it (`b.c+d@e.f`).
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"a@b.c+d@e.f",
&Options {
parse: ParseOptions {
@@ -33,13 +31,13 @@ fn fuzz() -> Result<(), String> {
);
assert_eq!(
- micromark(" x\n* "),
+ to_html(" x\n* "),
"<pre><code>x\n</code></pre>\n<ul>\n<li></li>\n</ul>",
"3-a: containers should not pierce into indented code"
);
assert_eq!(
- micromark(" a\n* b"),
+ to_html(" a\n* b"),
"<pre><code>a\n</code></pre>\n<ul>\n<li>\n<pre><code>b\n</code></pre>\n</li>\n</ul>",
"3-b: containers should not pierce into indented code"
);
diff --git a/tests/gfm_autolink_literal.rs b/tests/gfm_autolink_literal.rs
index c608533..cdeecd3 100644
--- a/tests/gfm_autolink_literal.rs
+++ b/tests/gfm_autolink_literal.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{Link, Node, Paragraph, Root, Text},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
@@ -18,181 +18,181 @@ fn gfm_autolink_literal() -> Result<(), String> {
};
assert_eq!(
- micromark("https://example.com"),
+ to_html("https://example.com"),
"<p>https://example.com</p>",
"should ignore protocol urls by default"
);
assert_eq!(
- micromark("www.example.com"),
+ to_html("www.example.com"),
"<p>www.example.com</p>",
"should ignore www urls by default"
);
assert_eq!(
- micromark("user@example.com"),
+ to_html("user@example.com"),
"<p>user@example.com</p>",
"should ignore email urls by default"
);
assert_eq!(
- micromark_with_options("https://example.com", &gfm)?,
+ to_html_with_options("https://example.com", &gfm)?,
"<p><a href=\"https://example.com\">https://example.com</a></p>",
"should support protocol urls if enabled"
);
assert_eq!(
- micromark_with_options("www.example.com", &gfm)?,
+ to_html_with_options("www.example.com", &gfm)?,
"<p><a href=\"http://www.example.com\">www.example.com</a></p>",
"should support www urls if enabled"
);
assert_eq!(
- micromark_with_options("user@example.com", &gfm)?,
+ to_html_with_options("user@example.com", &gfm)?,
"<p><a href=\"mailto:user@example.com\">user@example.com</a></p>",
"should support email urls if enabled"
);
assert_eq!(
- micromark_with_options("[https://example.com](xxx)", &gfm)?,
+ to_html_with_options("[https://example.com](xxx)", &gfm)?,
"<p><a href=\"xxx\">https://example.com</a></p>",
"should not link protocol urls in links"
);
assert_eq!(
- micromark_with_options("[www.example.com](xxx)", &gfm)?,
+ to_html_with_options("[www.example.com](xxx)", &gfm)?,
"<p><a href=\"xxx\">www.example.com</a></p>",
"should not link www urls in links"
);
assert_eq!(
- micromark_with_options("[user@example.com](xxx)", &gfm)?,
+ to_html_with_options("[user@example.com](xxx)", &gfm)?,
"<p><a href=\"xxx\">user@example.com</a></p>",
"should not link email urls in links"
);
assert_eq!(
- micromark_with_options("user@example.com", &gfm)?,
+ to_html_with_options("user@example.com", &gfm)?,
"<p><a href=\"mailto:user@example.com\">user@example.com</a></p>",
"should support a closing paren at TLD (email)"
);
assert_eq!(
- micromark_with_options("www.a.)", &gfm)?,
+ to_html_with_options("www.a.)", &gfm)?,
"<p><a href=\"http://www.a\">www.a</a>.)</p>",
"should support a closing paren at TLD (www)"
);
assert_eq!(
- micromark_with_options("www.a b", &gfm)?,
+ to_html_with_options("www.a b", &gfm)?,
"<p><a href=\"http://www.a\">www.a</a> b</p>",
"should support no TLD"
);
assert_eq!(
- micromark_with_options("www.a/b c", &gfm)?,
+ to_html_with_options("www.a/b c", &gfm)?,
"<p><a href=\"http://www.a/b\">www.a/b</a> c</p>",
"should support a path instead of TLD"
);
assert_eq!(
- micromark_with_options("www.�a", &gfm)?,
+ to_html_with_options("www.�a", &gfm)?,
"<p><a href=\"http://www.%EF%BF%BDa\">www.�a</a></p>",
"should support a replacement character in a domain"
);
assert_eq!(
- micromark_with_options("http://點看.com", &gfm)?,
+ to_html_with_options("http://點看.com", &gfm)?,
"<p><a href=\"http://%E9%BB%9E%E7%9C%8B.com\">http://點看.com</a></p>",
"should support non-ascii characters in a domain (http)"
);
assert_eq!(
- micromark_with_options("www.點看.com", &gfm)?,
+ to_html_with_options("www.點看.com", &gfm)?,
"<p><a href=\"http://www.%E9%BB%9E%E7%9C%8B.com\">www.點看.com</a></p>",
"should support non-ascii characters in a domain (www)"
);
assert_eq!(
- micromark_with_options("點看@example.com", &gfm)?,
+ to_html_with_options("點看@example.com", &gfm)?,
"<p>點看@example.com</p>",
"should *not* support non-ascii characters in atext (email)"
);
assert_eq!(
- micromark_with_options("example@點看.com", &gfm)?,
+ to_html_with_options("example@點看.com", &gfm)?,
"<p>example@點看.com</p>",
"should *not* support non-ascii characters in a domain (email)"
);
assert_eq!(
- micromark_with_options("www.a.com/點看", &gfm)?,
+ to_html_with_options("www.a.com/點看", &gfm)?,
"<p><a href=\"http://www.a.com/%E9%BB%9E%E7%9C%8B\">www.a.com/點看</a></p>",
"should support non-ascii characters in a path"
);
assert_eq!(
- micromark_with_options("www.-a.b", &gfm)?,
+ to_html_with_options("www.-a.b", &gfm)?,
"<p><a href=\"http://www.-a.b\">www.-a.b</a></p>",
"should support a dash to start a domain"
);
assert_eq!(
- micromark_with_options("www.$", &gfm)?,
+ to_html_with_options("www.$", &gfm)?,
"<p><a href=\"http://www.$\">www.$</a></p>",
"should support a dollar as a domain name"
);
assert_eq!(
- micromark_with_options("www.a..b.c", &gfm)?,
+ to_html_with_options("www.a..b.c", &gfm)?,
"<p><a href=\"http://www.a..b.c\">www.a..b.c</a></p>",
"should support adjacent dots in a domain name"
);
assert_eq!(
- micromark_with_options("www.a&a;", &gfm)?,
+ to_html_with_options("www.a&a;", &gfm)?,
"<p><a href=\"http://www.a\">www.a</a>&amp;a;</p>",
"should support named character references in domains"
);
assert_eq!(
- micromark_with_options("https://a.bc/d/e/).", &gfm)?,
+ to_html_with_options("https://a.bc/d/e/).", &gfm)?,
"<p><a href=\"https://a.bc/d/e/\">https://a.bc/d/e/</a>).</p>",
"should support a closing paren and period after a path"
);
assert_eq!(
- micromark_with_options("https://a.bc/d/e/.)", &gfm)?,
+ to_html_with_options("https://a.bc/d/e/.)", &gfm)?,
"<p><a href=\"https://a.bc/d/e/\">https://a.bc/d/e/</a>.)</p>",
"should support a period and closing paren after a path"
);
assert_eq!(
- micromark_with_options("https://a.bc).", &gfm)?,
+ to_html_with_options("https://a.bc).", &gfm)?,
"<p><a href=\"https://a.bc\">https://a.bc</a>).</p>",
"should support a closing paren and period after a domain"
);
assert_eq!(
- micromark_with_options("https://a.bc.)", &gfm)?,
+ to_html_with_options("https://a.bc.)", &gfm)?,
"<p><a href=\"https://a.bc\">https://a.bc</a>.)</p>",
"should support a period and closing paren after a domain"
);
assert_eq!(
- micromark_with_options("https://a.bc).d", &gfm)?,
+ to_html_with_options("https://a.bc).d", &gfm)?,
"<p><a href=\"https://a.bc).d\">https://a.bc).d</a></p>",
"should support a closing paren and period in a path"
);
assert_eq!(
- micromark_with_options("https://a.bc.)d", &gfm)?,
+ to_html_with_options("https://a.bc.)d", &gfm)?,
"<p><a href=\"https://a.bc.)d\">https://a.bc.)d</a></p>",
"should support a period and closing paren in a path"
);
assert_eq!(
- micromark_with_options("https://a.bc/))d", &gfm)?,
+ to_html_with_options("https://a.bc/))d", &gfm)?,
"<p><a href=\"https://a.bc/))d\">https://a.bc/))d</a></p>",
"should support two closing parens in a path"
);
assert_eq!(
- micromark_with_options("ftp://a/b/c.txt", &gfm)?,
+ to_html_with_options("ftp://a/b/c.txt", &gfm)?,
"<p>ftp://a/b/c.txt</p>",
"should not support ftp links"
);
@@ -201,25 +201,25 @@ fn gfm_autolink_literal() -> Result<(), String> {
// Fixing it would mean deviating from `cmark-gfm`:
// Source: <https://github.com/github/cmark-gfm/blob/ef1cfcb/extensions/autolink.c#L156>.
// assert_eq!(
- // micromark_with_options(",www.example.com", &gfm)?,
+ // to_html_with_options(",www.example.com", &gfm)?,
// "<p>,<a href=\"http://www.example.com\">www.example.com</a></p>",
// "should support www links after Unicode punctuation",
// );
assert_eq!(
- micromark_with_options(",https://example.com", &gfm)?,
+ to_html_with_options(",https://example.com", &gfm)?,
"<p>,<a href=\"https://example.com\">https://example.com</a></p>",
"should support http links after Unicode punctuation"
);
assert_eq!(
- micromark_with_options(",example@example.com", &gfm)?,
+ to_html_with_options(",example@example.com", &gfm)?,
"<p>,<a href=\"mailto:example@example.com\">example@example.com</a></p>",
"should support email links after Unicode punctuation"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"http&#x3A;//user:password@host:port/path?key=value#fragment",
&gfm
)?,
@@ -228,13 +228,13 @@ fn gfm_autolink_literal() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("http://example.com/ab<cd", &gfm)?,
+ to_html_with_options("http://example.com/ab<cd", &gfm)?,
"<p><a href=\"http://example.com/ab\">http://example.com/ab</a>&lt;cd</p>",
"should stop domains/paths at `<`"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"
mailto:scyther@pokemon.com
@@ -277,7 +277,7 @@ Email me at:scyther@pokemon.com"###,
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"
a www.example.com&xxx;b c
@@ -326,7 +326,7 @@ a www.example.com& b
// Note: this deviates from GFM, as <https://github.com/github/cmark-gfm/issues/278> is fixed.
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"
[ www.example.com
@@ -371,7 +371,7 @@ a www.example.com& b
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"
www.example.com/?=a(b)cccccc
@@ -422,7 +422,7 @@ www.example.com/?q=a(business)))
// Here, the following issues are fixed:
// - <https://github.com/github/cmark-gfm/issues/280>
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"
# Literal autolinks
@@ -611,7 +611,7 @@ Can contain an underscore followed by a period: aaa@a.b_.c
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"H0.
[https://a.com&copy;b
@@ -673,7 +673,7 @@ H5.
);
assert_eq!(
- micromark_with_options(r###"Image start.
+ to_html_with_options(r###"Image start.
![https://a.com
@@ -755,7 +755,7 @@ Autolink literal after image.
);
assert_eq!(
- micromark_with_options(r###"Link start.
+ to_html_with_options(r###"Link start.
[https://a.com
@@ -927,7 +927,7 @@ Autolink literal after link.
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# “character reference”
www.a&b (space)
@@ -1040,7 +1040,7 @@ www.a&b~
);
assert_eq!(
- micromark_with_options(r###"# “character reference”
+ to_html_with_options(r###"# “character reference”
www.a&#35 (space)
@@ -1150,7 +1150,7 @@ www.a&#35~
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"a@0.0
a@0.b
@@ -1203,7 +1203,7 @@ react@0.0.0-experimental-aae83a4b9
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# httpshhh? (2)
http://a (space)
@@ -1316,7 +1316,7 @@ http://a~
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# httpshhh? (1)
http:// (space)
@@ -1429,7 +1429,7 @@ http://~
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# httpshhh? (4)
http://a/b (space)
@@ -1542,7 +1542,7 @@ http://a/b~
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# httpshhh? (3)
http://a/ (space)
@@ -1655,7 +1655,7 @@ http://a/~
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[www.example.com/a&copy;](#)
www.example.com/a&copy;
@@ -1681,7 +1681,7 @@ www.example.com/a\.
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# “character reference”
www.a/b&c (space)
@@ -1794,7 +1794,7 @@ www.a/b&c~
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# “character reference”
www.a/b&#35 (space)
@@ -1907,7 +1907,7 @@ www.a/b&#35~
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"In autolink literal path or link end?
[https://a.com/d]()
@@ -1978,7 +1978,7 @@ www.a.com#d]()
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Last non-markdown ASCII whitespace (FF): noreply@example.com, http://example.com, https://example.com, www.example.com
Last non-whitespace ASCII control (US): noreply@example.com, http://example.com, https://example.com, www.example.com
@@ -2052,7 +2052,7 @@ Some more non-ascii: 🤷‍noreply@example.com, 🤷‍http://example.com, 🤷
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# HTTP
https://a.b can start after EOF
@@ -2179,7 +2179,7 @@ github.com: !<a href="mailto:a@b.c">a@b.c</a>, &quot;<a href="mailto:a@b.c">a@b.
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# wwwtf 2?
www.a (space)
@@ -2292,7 +2292,7 @@ www.a~
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# wwwtf 5?
www.a. (space)
@@ -2405,7 +2405,7 @@ www.a.~
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# wwwtf?
www. (space)
@@ -2518,7 +2518,7 @@ www.~
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# wwwtf? (4)
www.a/b (space)
@@ -2631,7 +2631,7 @@ www.a/b~
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# wwwtf? (3)
www.a/ (space)
@@ -2744,7 +2744,7 @@ www.a/~
);
assert_eq!(
- micromark_to_mdast(
+ to_mdast(
"a https://alpha.com b bravo@charlie.com c www.delta.com d xmpp:echo@foxtrot.com e mailto:golf@hotel.com f.",
&gfm.parse
)?,
diff --git a/tests/gfm_footnote.rs b/tests/gfm_footnote.rs
index 4b2be52..3464193 100644
--- a/tests/gfm_footnote.rs
+++ b/tests/gfm_footnote.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{FootnoteDefinition, FootnoteReference, Node, Paragraph, Root, Text},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
@@ -18,13 +18,13 @@ fn gfm_footnote() -> Result<(), String> {
};
assert_eq!(
- micromark("A call.[^a]\n\n[^a]: whatevs"),
+ to_html("A call.[^a]\n\n[^a]: whatevs"),
"<p>A call.<a href=\"whatevs\">^a</a></p>\n",
"should ignore footnotes by default"
);
assert_eq!(
- micromark_with_options("A call.[^a]\n\n[^a]: whatevs", &gfm)?,
+ to_html_with_options("A call.[^a]\n\n[^a]: whatevs", &gfm)?,
"<p>A call.<sup><a href=\"#user-content-fn-a\" id=\"user-content-fnref-a\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup></p>
<section data-footnotes=\"\" class=\"footnotes\"><h2 id=\"footnote-label\" class=\"sr-only\">Footnotes</h2>
<ol>
@@ -38,7 +38,7 @@ fn gfm_footnote() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"Noot.[^a]\n\n[^a]: dingen",
&Options {
parse: ParseOptions {
@@ -65,7 +65,7 @@ fn gfm_footnote() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"[^a]\n\n[^a]: b",
&Options {
parse: ParseOptions {
@@ -91,7 +91,7 @@ fn gfm_footnote() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"[^a]\n\n[^a]: b",
&Options {
parse: ParseOptions {
@@ -117,7 +117,7 @@ fn gfm_footnote() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"[^a]\n\n[^a]: b",
&Options {
parse: ParseOptions {
@@ -143,19 +143,19 @@ fn gfm_footnote() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("A paragraph.\n\n[^a]: whatevs", &gfm)?,
+ to_html_with_options("A paragraph.\n\n[^a]: whatevs", &gfm)?,
"<p>A paragraph.</p>\n",
"should ignore definitions w/o calls"
);
assert_eq!(
- micromark_with_options("a[^b]", &gfm)?,
+ to_html_with_options("a[^b]", &gfm)?,
"<p>a[^b]</p>",
"should ignore calls w/o definitions"
);
assert_eq!(
- micromark_with_options("a[^b]\n\n[^b]: c\n[^b]: d", &gfm)?,
+ to_html_with_options("a[^b]\n\n[^b]: c\n[^b]: d", &gfm)?,
"<p>a<sup><a href=\"#user-content-fn-b\" id=\"user-content-fnref-b\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup></p>
<section data-footnotes=\"\" class=\"footnotes\"><h2 id=\"footnote-label\" class=\"sr-only\">Footnotes</h2>
<ol>
@@ -169,7 +169,7 @@ fn gfm_footnote() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a[^b], c[^b]\n\n[^b]: d", &gfm)?,
+ to_html_with_options("a[^b], c[^b]\n\n[^b]: d", &gfm)?,
"<p>a<sup><a href=\"#user-content-fn-b\" id=\"user-content-fnref-b\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup>, c<sup><a href=\"#user-content-fn-b\" id=\"user-content-fnref-b-2\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup></p>
<section data-footnotes=\"\" class=\"footnotes\"><h2 id=\"footnote-label\" class=\"sr-only\">Footnotes</h2>
<ol>
@@ -183,32 +183,32 @@ fn gfm_footnote() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("![^a](b)", &gfm)?,
+ to_html_with_options("![^a](b)", &gfm)?,
"<p>!<a href=\"b\">^a</a></p>",
"should not support images starting w/ `^` (but see it as a link?!, 1)"
);
assert_eq!(
- micromark_with_options("![^a][b]\n\n[b]: c", &gfm)?,
+ to_html_with_options("![^a][b]\n\n[b]: c", &gfm)?,
"<p>!<a href=\"c\">^a</a></p>\n",
"should not support images starting w/ `^` (but see it as a link?!, 2)"
);
assert_eq!(
- micromark_with_options("[^]()", &gfm)?,
+ to_html_with_options("[^]()", &gfm)?,
"<p><a href=\"\">^</a></p>",
"should support an empty link with caret"
);
assert_eq!(
- micromark_with_options("![^]()", &gfm)?,
+ to_html_with_options("![^]()", &gfm)?,
"<p>!<a href=\"\">^</a></p>",
"should support an empty image with caret (as link)"
);
// <https://github.com/github/cmark-gfm/issues/239>
assert_eq!(
- micromark_with_options("Call.[^a\\+b].\n\n[^a\\+b]: y", &gfm)?,
+ to_html_with_options("Call.[^a\\+b].\n\n[^a\\+b]: y", &gfm)?,
"<p>Call.<sup><a href=\"#user-content-fn-a%5C+b\" id=\"user-content-fnref-a%5C+b\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup>.</p>
<section data-footnotes=\"\" class=\"footnotes\"><h2 id=\"footnote-label\" class=\"sr-only\">Footnotes</h2>
<ol>
@@ -222,7 +222,7 @@ fn gfm_footnote() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("Call.[^a&copy;b].\n\n[^a&copy;b]: y", &gfm)?,
+ to_html_with_options("Call.[^a&copy;b].\n\n[^a&copy;b]: y", &gfm)?,
"<p>Call.<sup><a href=\"#user-content-fn-a&amp;copy;b\" id=\"user-content-fnref-a&amp;copy;b\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup>.</p>
<section data-footnotes=\"\" class=\"footnotes\"><h2 id=\"footnote-label\" class=\"sr-only\">Footnotes</h2>
<ol>
@@ -238,7 +238,7 @@ fn gfm_footnote() -> Result<(), String> {
// <https://github.com/github/cmark-gfm/issues/239>
// <https://github.com/github/cmark-gfm/issues/240>
assert_eq!(
- micromark_with_options("Call.[^a\\]b].\n\n[^a\\]b]: y", &gfm)?,
+ to_html_with_options("Call.[^a\\]b].\n\n[^a\\]b]: y", &gfm)?,
"<p>Call.<sup><a href=\"#user-content-fn-a%5C%5Db\" id=\"user-content-fnref-a%5C%5Db\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup>.</p>
<section data-footnotes=\"\" class=\"footnotes\"><h2 id=\"footnote-label\" class=\"sr-only\">Footnotes</h2>
<ol>
@@ -252,7 +252,7 @@ fn gfm_footnote() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("Call.[^a&#91;b].\n\n[^a&#91;b]: y", &gfm)?,
+ to_html_with_options("Call.[^a&#91;b].\n\n[^a&#91;b]: y", &gfm)?,
"<p>Call.<sup><a href=\"#user-content-fn-a&amp;#91;b\" id=\"user-content-fnref-a&amp;#91;b\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup>.</p>
<section data-footnotes=\"\" class=\"footnotes\"><h2 id=\"footnote-label\" class=\"sr-only\">Footnotes</h2>
<ol>
@@ -266,19 +266,19 @@ fn gfm_footnote() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("Call.[^a\\+b].\n\n[^a+b]: y", &gfm)?,
+ to_html_with_options("Call.[^a\\+b].\n\n[^a+b]: y", &gfm)?,
"<p>Call.[^a+b].</p>\n",
"should match calls to definitions on the source of the label, not on resolved escapes"
);
assert_eq!(
- micromark_with_options("Call.[^a&#91;b].\n\n[^a\\[b]: y", &gfm)?,
+ to_html_with_options("Call.[^a&#91;b].\n\n[^a\\[b]: y", &gfm)?,
"<p>Call.[^a[b].</p>\n",
"should match calls to definitions on the source of the label, not on resolved references"
);
assert_eq!(
- micromark_with_options("[^1].\n\n[^1]: a\nb", &gfm)?,
+ to_html_with_options("[^1].\n\n[^1]: a\nb", &gfm)?,
"<p><sup><a href=\"#user-content-fn-1\" id=\"user-content-fnref-1\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup>.</p>
<section data-footnotes=\"\" class=\"footnotes\"><h2 id=\"footnote-label\" class=\"sr-only\">Footnotes</h2>
<ol>
@@ -293,7 +293,7 @@ b <a href=\"#user-content-fnref-1\" data-footnote-backref=\"\" aria-label=\"Back
);
assert_eq!(
- micromark_with_options("[^1].\n\n> [^1]: a\nb", &gfm)?,
+ to_html_with_options("[^1].\n\n> [^1]: a\nb", &gfm)?,
"<p><sup><a href=\"#user-content-fn-1\" id=\"user-content-fnref-1\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup>.</p>
<blockquote>
</blockquote>
@@ -310,7 +310,7 @@ b <a href=\"#user-content-fnref-1\" data-footnote-backref=\"\" aria-label=\"Back
);
assert_eq!(
- micromark_with_options("[^1].\n\n> [^1]: a\n> b", &gfm)?,
+ to_html_with_options("[^1].\n\n> [^1]: a\n> b", &gfm)?,
"<p><sup><a href=\"#user-content-fn-1\" id=\"user-content-fnref-1\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup>.</p>
<blockquote>
</blockquote>
@@ -327,7 +327,7 @@ b <a href=\"#user-content-fnref-1\" data-footnote-backref=\"\" aria-label=\"Back
);
assert_eq!(
- micromark_with_options("[^1].\n\n[^1]: a\n\n > b", &gfm)?,
+ to_html_with_options("[^1].\n\n[^1]: a\n\n > b", &gfm)?,
"<p><sup><a href=\"#user-content-fn-1\" id=\"user-content-fnref-1\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup>.</p>
<section data-footnotes=\"\" class=\"footnotes\"><h2 id=\"footnote-label\" class=\"sr-only\">Footnotes</h2>
<ol>
@@ -348,7 +348,7 @@ b <a href=\"#user-content-fnref-1\" data-footnote-backref=\"\" aria-label=\"Back
let max = "x".repeat(999);
assert_eq!(
- micromark_with_options(format!("Call.[^{}].\n\n[^{}]: y", max, max).as_str(), &gfm)?,
+ to_html_with_options(format!("Call.[^{}].\n\n[^{}]: y", max, max).as_str(), &gfm)?,
format!("<p>Call.<sup><a href=\"#user-content-fn-{}\" id=\"user-content-fnref-{}\" data-footnote-ref=\"\" aria-describedby=\"footnote-label\">1</a></sup>.</p>
<section data-footnotes=\"\" class=\"footnotes\"><h2 id=\"footnote-label\" class=\"sr-only\">Footnotes</h2>
<ol>
@@ -362,7 +362,7 @@ b <a href=\"#user-content-fnref-1\" data-footnote-backref=\"\" aria-label=\"Back
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
format!("Call.[^a{}].\n\n[^a{}]: y", max, max).as_str(),
&gfm
)?,
@@ -371,7 +371,7 @@ b <a href=\"#user-content-fnref-1\" data-footnote-backref=\"\" aria-label=\"Back
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"a![i](#)
a\![i](#)
a![i][]
@@ -402,13 +402,13 @@ a!<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref=
);
assert_eq!(
- micromark_with_options("a![^1]", &gfm)?,
+ to_html_with_options("a![^1]", &gfm)?,
"<p>a![^1]</p>",
"should match bang/caret interplay (undefined) like GitHub"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"a![^1]
[^1]: b
@@ -428,7 +428,7 @@ a!<sup><a href="#user-content-fn-1" id="user-content-fnref-1" data-footnote-ref=
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Calls may not be empty: [^].
Calls cannot contain whitespace only: [^ ].
@@ -481,7 +481,7 @@ even another caret.</p>
// See: <https://github.com/github/cmark-gfm/issues/282>
// Here line endings don’t make text disappear.
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[^a]: # b
[^c d]: # e
@@ -545,7 +545,7 @@ j], [^ l], [^m ]</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[^*emphasis*]
[^**strong**]
@@ -624,7 +624,7 @@ j], [^ l], [^m ]</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Call[^1][^2][^3][^4]
> [^1]: Defined in a block quote.
@@ -669,7 +669,7 @@ j], [^ l], [^m ]</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[^1][^2][^3][^4]
[^1]: Paragraph
@@ -731,7 +731,7 @@ j], [^ l], [^m ]</p>
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Call[^1][^2][^3][^4][^5].
[^1]:
@@ -781,7 +781,7 @@ Lazy!
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Note![^0][^1][^2][^3][^4][^5][^6][^7][^8][^9][^10]
[^0]: alpha
@@ -875,7 +875,7 @@ indented delta <a href="#user-content-fnref-2" data-footnote-backref="" aria-lab
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Call[^1][^1]
[^1]: Recursion[^1][^1]
@@ -895,7 +895,7 @@ indented delta <a href="#user-content-fnref-2" data-footnote-backref="" aria-lab
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Call[^1]
[^1]: a
@@ -923,7 +923,7 @@ indented delta <a href="#user-content-fnref-2" data-footnote-backref="" aria-lab
// CommonMark has mechanisms in place to prevent links in links.
// These mechanisms are in place here too.
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"*emphasis[^1]*
**strong[^2]**
@@ -972,7 +972,7 @@ indented delta <a href="#user-content-fnref-2" data-footnote-backref="" aria-lab
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"What are these![^1], ![^2][], and ![this][^3].
[^1]: a
@@ -1002,7 +1002,7 @@ indented delta <a href="#user-content-fnref-2" data-footnote-backref="" aria-lab
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[^0][^1][^2][^3][^4][^5]
[^0]: Paragraph
@@ -1067,7 +1067,7 @@ indented delta <a href="#user-content-fnref-2" data-footnote-backref="" aria-lab
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"What are these[^1], [^2][], and [this][^3].
[^1]: a
@@ -1097,7 +1097,7 @@ indented delta <a href="#user-content-fnref-2" data-footnote-backref="" aria-lab
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[^1][^2][^3][^4]
[^1]: Paragraph
@@ -1159,7 +1159,7 @@ indented delta <a href="#user-content-fnref-2" data-footnote-backref="" aria-lab
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[^1][^2][^3][^4]
[^1]: Paragraph
@@ -1228,7 +1228,7 @@ more code
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Note![^1][^2][^3][^4]
- [^1]: Paragraph
@@ -1266,7 +1266,7 @@ more code
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[^1][^2][^3][^4]
[^1]: Paragraph
@@ -1320,7 +1320,7 @@ more code
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"[^1][^2][^3][^4]
[^1]: Paragraph
@@ -1380,7 +1380,7 @@ more code
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Here is a footnote reference,[^1] and another.[^longnote]
[^1]: Here is the footnote.
@@ -1426,7 +1426,7 @@ multi-paragraph list items. <a href="#user-content-fnref-longnote" data-footnote
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Call[^1][^2][^3][^4][^5][^6][^7][^8][^9][^10][^11][^12].
[^1]: 5
@@ -1520,7 +1520,7 @@ multi-paragraph list items. <a href="#user-content-fnref-longnote" data-footnote
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Call[^1][^2][^3][^4][^5][^6][^7][^8][^9].
[^1]: a
@@ -1609,7 +1609,7 @@ multi-paragraph list items. <a href="#user-content-fnref-longnote" data-footnote
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"Here is a short reference,[1], a collapsed one,[2][], and a full [one][3].
[1]: a
@@ -1626,7 +1626,7 @@ multi-paragraph list items. <a href="#user-content-fnref-longnote" data-footnote
);
assert_eq!(
- micromark_to_mdast("[^a]: b\n\tc\n\nd [^a] e.", &gfm.parse)?,
+ to_mdast("[^a]: b\n\tc\n\nd [^a] e.", &gfm.parse)?,
Node::Root(Root {
children: vec![
Node::FootnoteDefinition(FootnoteDefinition {
diff --git a/tests/gfm_strikethrough.rs b/tests/gfm_strikethrough.rs
index 6109814..980f1e9 100644
--- a/tests/gfm_strikethrough.rs
+++ b/tests/gfm_strikethrough.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{Delete, Node, Paragraph, Root, Text},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
@@ -18,61 +18,61 @@ fn gfm_strikethrough() -> Result<(), String> {
};
assert_eq!(
- micromark("a ~b~ c"),
+ to_html("a ~b~ c"),
"<p>a ~b~ c</p>",
"should ignore strikethrough by default"
);
assert_eq!(
- micromark_with_options("a ~b~", &gfm)?,
+ to_html_with_options("a ~b~", &gfm)?,
"<p>a <del>b</del></p>",
"should support strikethrough w/ one tilde"
);
assert_eq!(
- micromark_with_options("a ~~b~~", &gfm)?,
+ to_html_with_options("a ~~b~~", &gfm)?,
"<p>a <del>b</del></p>",
"should support strikethrough w/ two tildes"
);
assert_eq!(
- micromark_with_options("a ~~~b~~~", &gfm)?,
+ to_html_with_options("a ~~~b~~~", &gfm)?,
"<p>a ~~~b~~~</p>",
"should not support strikethrough w/ three tildes"
);
assert_eq!(
- micromark_with_options("a \\~~~b~~ c", &gfm)?,
+ to_html_with_options("a \\~~~b~~ c", &gfm)?,
"<p>a ~<del>b</del> c</p>",
"should support strikethrough after an escaped tilde"
);
assert_eq!(
- micromark_with_options("a ~~b ~~c~~ d~~ e", &gfm)?,
+ to_html_with_options("a ~~b ~~c~~ d~~ e", &gfm)?,
"<p>a <del>b <del>c</del> d</del> e</p>",
"should support nested strikethrough"
);
assert_eq!(
- micromark_with_options("a ~-1~ b", &gfm)?,
+ to_html_with_options("a ~-1~ b", &gfm)?,
"<p>a <del>-1</del> b</p>",
"should open if preceded by whitespace and followed by punctuation"
);
assert_eq!(
- micromark_with_options("a ~b.~ c", &gfm)?,
+ to_html_with_options("a ~b.~ c", &gfm)?,
"<p>a <del>b.</del> c</p>",
"should close if preceded by punctuation and followed by whitespace"
);
assert_eq!(
- micromark_with_options("~b.~.", &gfm)?,
+ to_html_with_options("~b.~.", &gfm)?,
"<p><del>b.</del>.</p>",
"should close if preceded and followed by punctuation"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"
# Balanced
@@ -165,7 +165,7 @@ a ~~two b two~~ c one~ d
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"
# Flank
@@ -222,7 +222,7 @@ a ~~twoLeft b ~~twoLeft c ~~twoLeft d
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"
# Interlpay
@@ -368,7 +368,7 @@ u ~**xxx**~ zzz
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"a ~b~ ~~c~~ d",
&Options {
parse: ParseOptions {
@@ -384,7 +384,7 @@ u ~**xxx**~ zzz
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"a ~b~ ~~c~~ d",
&Options {
parse: ParseOptions {
@@ -400,7 +400,7 @@ u ~**xxx**~ zzz
);
assert_eq!(
- micromark_to_mdast("a ~~alpha~~ b.", &gfm.parse)?,
+ to_mdast("a ~~alpha~~ b.", &gfm.parse)?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![
diff --git a/tests/gfm_table.rs b/tests/gfm_table.rs
index 8e871f6..d824355 100644
--- a/tests/gfm_table.rs
+++ b/tests/gfm_table.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{AlignKind, InlineCode, Node, Root, Table, TableCell, TableRow, Text},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
@@ -18,193 +18,193 @@ fn gfm_table() -> Result<(), String> {
};
assert_eq!(
- micromark("| a |\n| - |\n| b |"),
+ to_html("| a |\n| - |\n| b |"),
"<p>| a |\n| - |\n| b |</p>",
"should ignore tables by default"
);
assert_eq!(
- micromark_with_options("| a |\n| - |\n| b |", &gfm)?,
+ to_html_with_options("| a |\n| - |\n| b |", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>b</td>\n</tr>\n</tbody>\n</table>",
"should support tables"
);
assert_eq!(
- micromark_with_options("| a |", &gfm)?,
+ to_html_with_options("| a |", &gfm)?,
"<p>| a |</p>",
"should not support a table w/ the head row ending in an eof (1)"
);
assert_eq!(
- micromark_with_options("| a", &gfm)?,
+ to_html_with_options("| a", &gfm)?,
"<p>| a</p>",
"should not support a table w/ the head row ending in an eof (2)"
);
assert_eq!(
- micromark_with_options("a |", &gfm)?,
+ to_html_with_options("a |", &gfm)?,
"<p>a |</p>",
"should not support a table w/ the head row ending in an eof (3)"
);
assert_eq!(
- micromark_with_options("| a |\n| - |", &gfm)?,
+ to_html_with_options("| a |\n| - |", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>",
"should support a table w/ a delimiter row ending in an eof (1)"
);
assert_eq!(
- micromark_with_options("| a\n| -", &gfm)?,
+ to_html_with_options("| a\n| -", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>",
"should support a table w/ a delimiter row ending in an eof (2)"
);
assert_eq!(
- micromark_with_options("| a |\n| - |\n| b |", &gfm)?,
+ to_html_with_options("| a |\n| - |\n| b |", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>b</td>\n</tr>\n</tbody>\n</table>",
"should support a table w/ a body row ending in an eof (1)"
);
assert_eq!(
- micromark_with_options("| a\n| -\n| b", &gfm)?,
+ to_html_with_options("| a\n| -\n| b", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>b</td>\n</tr>\n</tbody>\n</table>",
"should support a table w/ a body row ending in an eof (2)"
);
assert_eq!(
- micromark_with_options("a|b\n-|-\nc|d", &gfm)?,
+ to_html_with_options("a|b\n-|-\nc|d", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n<th>b</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>c</td>\n<td>d</td>\n</tr>\n</tbody>\n</table>",
"should support a table w/ a body row ending in an eof (3)"
);
assert_eq!(
- micromark_with_options("| a \n| -\t\n| b | ", &gfm)?,
+ to_html_with_options("| a \n| -\t\n| b | ", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>b</td>\n</tr>\n</tbody>\n</table>",
"should support rows w/ trailing whitespace (1)"
);
assert_eq!(
- micromark_with_options("| a | \n| - |", &gfm)?,
+ to_html_with_options("| a | \n| - |", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>",
"should support rows w/ trailing whitespace (2)"
);
assert_eq!(
- micromark_with_options("| a |\n| - | ", &gfm)?,
+ to_html_with_options("| a |\n| - | ", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>",
"should support rows w/ trailing whitespace (3)"
);
assert_eq!(
- micromark_with_options("| a |\n| - |\n| b | ", &gfm)?,
+ to_html_with_options("| a |\n| - |\n| b | ", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>b</td>\n</tr>\n</tbody>\n</table>",
"should support rows w/ trailing whitespace (4)"
);
assert_eq!(
- micromark_with_options("||a|\n|-|-|", &gfm)?,
+ to_html_with_options("||a|\n|-|-|", &gfm)?,
"<table>\n<thead>\n<tr>\n<th></th>\n<th>a</th>\n</tr>\n</thead>\n</table>",
"should support empty first header cells"
);
assert_eq!(
- micromark_with_options("|a||\n|-|-|", &gfm)?,
+ to_html_with_options("|a||\n|-|-|", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n<th></th>\n</tr>\n</thead>\n</table>",
"should support empty last header cells"
);
assert_eq!(
- micromark_with_options("a||b\n-|-|-", &gfm)?,
+ to_html_with_options("a||b\n-|-|-", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n<th></th>\n<th>b</th>\n</tr>\n</thead>\n</table>",
"should support empty header cells"
);
assert_eq!(
- micromark_with_options("|a|b|\n|-|-|\n||c|", &gfm)?,
+ to_html_with_options("|a|b|\n|-|-|\n||c|", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n<th>b</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td></td>\n<td>c</td>\n</tr>\n</tbody>\n</table>",
"should support empty first body cells"
);
assert_eq!(
- micromark_with_options("|a|b|\n|-|-|\n|c||", &gfm)?,
+ to_html_with_options("|a|b|\n|-|-|\n|c||", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n<th>b</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>c</td>\n<td></td>\n</tr>\n</tbody>\n</table>",
"should support empty last body cells"
);
assert_eq!(
- micromark_with_options("a|b|c\n-|-|-\nd||e", &gfm)?,
+ to_html_with_options("a|b|c\n-|-|-\nd||e", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n<th>b</th>\n<th>c</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>d</td>\n<td></td>\n<td>e</td>\n</tr>\n</tbody>\n</table>",
"should support empty body cells"
);
assert_eq!(
- micromark_with_options("| a |\n| - |\n- b", &gfm)?,
+ to_html_with_options("| a |\n| - |\n- b", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>\n<ul>\n<li>b</li>\n</ul>",
"should support a list after a table"
);
assert_eq!(
- micromark_with_options("> | a |\n| - |", &gfm)?,
+ to_html_with_options("> | a |\n| - |", &gfm)?,
"<blockquote>\n<p>| a |\n| - |</p>\n</blockquote>",
"should not support a lazy delimiter row (1)"
);
assert_eq!(
- micromark_with_options("> a\n> | b |\n| - |", &gfm)?,
+ to_html_with_options("> a\n> | b |\n| - |", &gfm)?,
"<blockquote>\n<p>a\n| b |\n| - |</p>\n</blockquote>",
"should not support a lazy delimiter row (2)"
);
assert_eq!(
- micromark_with_options("| a |\n> | - |", &gfm)?,
+ to_html_with_options("| a |\n> | - |", &gfm)?,
"<p>| a |</p>\n<blockquote>\n<p>| - |</p>\n</blockquote>",
"should not support a piercing delimiter row"
);
assert_eq!(
- micromark_with_options("> a\n> | b |\n|-", &gfm)?,
+ to_html_with_options("> a\n> | b |\n|-", &gfm)?,
"<blockquote>\n<p>a\n| b |\n|-</p>\n</blockquote>",
"should not support a lazy body row (2)"
);
assert_eq!(
- micromark_with_options("> | a |\n> | - |\n| b |", &gfm)?,
+ to_html_with_options("> | a |\n> | - |\n| b |", &gfm)?,
"<blockquote>\n<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>\n</blockquote>\n<p>| b |</p>",
"should not support a lazy body row (1)"
);
assert_eq!(
- micromark_with_options("> a\n> | b |\n> | - |\n| c |", &gfm)?,
+ to_html_with_options("> a\n> | b |\n> | - |\n| c |", &gfm)?,
"<blockquote>\n<p>a</p>\n<table>\n<thead>\n<tr>\n<th>b</th>\n</tr>\n</thead>\n</table>\n</blockquote>\n<p>| c |</p>",
"should not support a lazy body row (2)"
);
assert_eq!(
- micromark_with_options("> | A |\n> | - |\n> | 1 |\n| 2 |", &gfm)?,
+ to_html_with_options("> | A |\n> | - |\n> | 1 |\n| 2 |", &gfm)?,
"<blockquote>\n<table>\n<thead>\n<tr>\n<th>A</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>1</td>\n</tr>\n</tbody>\n</table>\n</blockquote>\n<p>| 2 |</p>",
"should not support a lazy body row (3)"
);
assert_eq!(
- micromark_with_options(" - d\n - e", &gfm)?,
- micromark(" - d\n - e"),
+ to_html_with_options(" - d\n - e", &gfm)?,
+ to_html(" - d\n - e"),
"should not change how lists and lazyness work"
);
assert_eq!(
- micromark_with_options("| a |\n | - |", &gfm)?,
+ to_html_with_options("| a |\n | - |", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>",
"should form a table if the delimiter row is indented w/ 3 spaces"
);
assert_eq!(
- micromark_with_options("| a |\n | - |", &gfm)?,
+ to_html_with_options("| a |\n | - |", &gfm)?,
"<p>| a |\n| - |</p>",
"should not form a table if the delimiter row is indented w/ 4 spaces"
);
assert_eq!(
- micromark_with_options("| a |\n | - |", &Options {
+ to_html_with_options("| a |\n | - |", &Options {
parse: ParseOptions {
constructs: Constructs {
code_indented: false,
@@ -219,31 +219,31 @@ fn gfm_table() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("| a |\n| - |\n> block quote?", &gfm)?,
+ to_html_with_options("| a |\n| - |\n> block quote?", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>\n<blockquote>\n<p>block quote?</p>\n</blockquote>",
"should be interrupted by a block quote"
);
assert_eq!(
- micromark_with_options("| a |\n| - |\n>", &gfm)?,
+ to_html_with_options("| a |\n| - |\n>", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>\n<blockquote>\n</blockquote>",
"should be interrupted by a block quote (empty)"
);
assert_eq!(
- micromark_with_options("| a |\n| - |\n- list?", &gfm)?,
+ to_html_with_options("| a |\n| - |\n- list?", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>\n<ul>\n<li>list?</li>\n</ul>",
"should be interrupted by a list"
);
assert_eq!(
- micromark_with_options("| a |\n| - |\n-", &gfm)?,
+ to_html_with_options("| a |\n| - |\n-", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>\n<ul>\n<li></li>\n</ul>",
"should be interrupted by a list (empty)"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"| a |\n| - |\n<!-- HTML? -->",
&Options {
parse: ParseOptions {
@@ -262,7 +262,7 @@ fn gfm_table() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("| a |\n| - |\n\tcode?", &Options {
+ to_html_with_options("| a |\n| - |\n\tcode?", &Options {
parse: ParseOptions {
constructs: Constructs::gfm(),
..ParseOptions::default()
@@ -278,7 +278,7 @@ fn gfm_table() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("| a |\n| - |\n```js\ncode?", &Options {
+ to_html_with_options("| a |\n| - |\n```js\ncode?", &Options {
parse: ParseOptions {
constructs: Constructs::gfm(),
..ParseOptions::default()
@@ -294,7 +294,7 @@ fn gfm_table() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"| a |\n| - |\n***",
&Options {
parse: ParseOptions {
@@ -313,73 +313,73 @@ fn gfm_table() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("| a |\n| - |\n# heading?", &gfm)?,
+ to_html_with_options("| a |\n| - |\n# heading?", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>\n<h1>heading?</h1>",
"should be interrupted by a heading (ATX)"
);
assert_eq!(
- micromark_with_options("| a |\n| - |\nheading\n=", &gfm)?,
+ to_html_with_options("| a |\n| - |\nheading\n=", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>heading</td>\n</tr>\n<tr>\n<td>=</td>\n</tr>\n</tbody>\n</table>",
"should *not* be interrupted by a heading (setext)"
);
assert_eq!(
- micromark_with_options("| a |\n| - |\nheading\n---", &gfm)?,
+ to_html_with_options("| a |\n| - |\nheading\n---", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>heading</td>\n</tr>\n</tbody>\n</table>\n<hr />",
"should *not* be interrupted by a heading (setext), but interrupt if the underline is also a thematic break"
);
assert_eq!(
- micromark_with_options("| a |\n| - |\nheading\n-", &gfm)?,
+ to_html_with_options("| a |\n| - |\nheading\n-", &gfm)?,
"<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>heading</td>\n</tr>\n</tbody>\n</table>\n<ul>\n<li></li>\n</ul>",
"should *not* be interrupted by a heading (setext), but interrupt if the underline is also an empty list item bullet"
);
assert_eq!(
- micromark_with_options("a\nb\n-:", &gfm)?,
+ to_html_with_options("a\nb\n-:", &gfm)?,
"<p>a</p>\n<table>\n<thead>\n<tr>\n<th align=\"right\">b</th>\n</tr>\n</thead>\n</table>",
"should support a single head row"
);
assert_eq!(
- micromark_with_options("> | a |\n> | - |", &gfm)?,
+ to_html_with_options("> | a |\n> | - |", &gfm)?,
"<blockquote>\n<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>\n</blockquote>",
"should support a table in a container"
);
assert_eq!(
- micromark_with_options("> | a |\n| - |", &gfm)?,
+ to_html_with_options("> | a |\n| - |", &gfm)?,
"<blockquote>\n<p>| a |\n| - |</p>\n</blockquote>",
"should not support a lazy delimiter row if the head row is in a container"
);
assert_eq!(
- micromark_with_options("| a |\n> | - |", &gfm)?,
+ to_html_with_options("| a |\n> | - |", &gfm)?,
"<p>| a |</p>\n<blockquote>\n<p>| - |</p>\n</blockquote>",
"should not support a “piercing” container for the delimiter row, if the head row was not in that container"
);
assert_eq!(
- micromark_with_options("> | a |\n> | - |\n| c |", &gfm)?,
+ to_html_with_options("> | a |\n> | - |\n| c |", &gfm)?,
"<blockquote>\n<table>\n<thead>\n<tr>\n<th>a</th>\n</tr>\n</thead>\n</table>\n</blockquote>\n<p>| c |</p>",
"should not support a lazy body row if the head row and delimiter row are in a container"
);
assert_eq!(
- micromark_with_options("> | a |\n| - |\n> | c |", &gfm)?,
+ to_html_with_options("> | a |\n| - |\n> | c |", &gfm)?,
"<blockquote>\n<p>| a |\n| - |\n| c |</p>\n</blockquote>",
"should not support a lazy delimiter row if the head row and a further body row are in a container"
);
assert_eq!(
- micromark_with_options("[\na\n:-\n]: b", &gfm)?,
+ to_html_with_options("[\na\n:-\n]: b", &gfm)?,
"<p>[</p>\n<table>\n<thead>\n<tr>\n<th align=\"left\">a</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td align=\"left\">]: b</td>\n</tr>\n</tbody>\n</table>",
"should prefer GFM tables over definitions"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# Align
## An empty initial cell
@@ -569,7 +569,7 @@ a
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# Tables
| a | b | c |
@@ -634,7 +634,7 @@ a
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# Tables in things
## In lists
@@ -828,7 +828,7 @@ a
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"| a |
| - |
| - |
@@ -856,7 +856,7 @@ a
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# Examples from GFM
## A
@@ -1036,7 +1036,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# Grave accents
## Grave accent in cell
@@ -1172,7 +1172,7 @@ bar
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# Code
## Indented delimiter row
@@ -1227,7 +1227,7 @@ a
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"## Blank line
a
@@ -1725,7 +1725,7 @@ b
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# Loose
## Loose
@@ -1784,7 +1784,7 @@ a
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"# Some more escapes
| Head |
@@ -1832,7 +1832,7 @@ normal escape: <a href="https://github.com/github/cmark-gfm/issues/277">https://
);
assert_eq!(
- micromark_to_mdast(
+ to_mdast(
"| none | left | right | center |\n| - | :- | -: | :-: |\n| a |\n| b | c | d | e | f |",
&gfm.parse
)?,
@@ -1937,7 +1937,7 @@ normal escape: <a href="https://github.com/github/cmark-gfm/issues/277">https://
);
assert_eq!(
- micromark_to_mdast("| `a\\|b` |\n| - |", &gfm.parse)?,
+ to_mdast("| `a\\|b` |\n| - |", &gfm.parse)?,
Node::Root(Root {
children: vec![Node::Table(Table {
align: vec![AlignKind::None,],
diff --git a/tests/gfm_tagfilter.rs b/tests/gfm_tagfilter.rs
index 9321d01..d808374 100644
--- a/tests/gfm_tagfilter.rs
+++ b/tests/gfm_tagfilter.rs
@@ -1,11 +1,11 @@
-extern crate micromark;
-use micromark::{micromark_with_options, CompileOptions, Options};
+extern crate markdown;
+use markdown::{to_html_with_options, CompileOptions, Options};
use pretty_assertions::assert_eq;
#[test]
fn gfm_tagfilter() -> Result<(), String> {
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"<iframe>",
&Options {
compile: CompileOptions {
@@ -20,7 +20,7 @@ fn gfm_tagfilter() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"a <i>\n<script>",
&Options {
compile: CompileOptions {
@@ -35,7 +35,7 @@ fn gfm_tagfilter() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"<iframe>",
&Options {
compile: CompileOptions {
@@ -51,7 +51,7 @@ fn gfm_tagfilter() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
r###"
<title>
diff --git a/tests/gfm_task_list_item.rs b/tests/gfm_task_list_item.rs
index 18ae1dd..0ef6ea3 100644
--- a/tests/gfm_task_list_item.rs
+++ b/tests/gfm_task_list_item.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{List, ListItem, Node, Paragraph, Root, Text},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
@@ -18,37 +18,37 @@ fn gfm_task_list_item() -> Result<(), String> {
};
assert_eq!(
- micromark("* [x] y."),
+ to_html("* [x] y."),
"<ul>\n<li>[x] y.</li>\n</ul>",
"should ignore task list item checks by default"
);
assert_eq!(
- micromark_with_options("* [x] y.", &gfm)?,
+ to_html_with_options("* [x] y.", &gfm)?,
"<ul>\n<li><input type=\"checkbox\" disabled=\"\" checked=\"\" /> y.</li>\n</ul>",
"should support task list item checks"
);
assert_eq!(
- micromark_with_options("* [ ] z.", &gfm)?,
+ to_html_with_options("* [ ] z.", &gfm)?,
"<ul>\n<li><input type=\"checkbox\" disabled=\"\" /> z.</li>\n</ul>",
"should support unchecked task list item checks"
);
assert_eq!(
- micromark_with_options("*\n [x]", &gfm)?,
+ to_html_with_options("*\n [x]", &gfm)?,
"<ul>\n<li>[x]</li>\n</ul>",
"should not support laziness (1)"
);
assert_eq!(
- micromark_with_options("*\n[x]", &gfm)?,
+ to_html_with_options("*\n[x]", &gfm)?,
"<ul>\n<li></li>\n</ul>\n<p>[x]</p>",
"should not support laziness (2)"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
&r###"
* [ ] foo
* [x] bar
@@ -249,7 +249,7 @@ Text.</li>
);
assert_eq!(
- micromark_to_mdast("* [x] a\n* [ ] b\n* c", &gfm.parse)?,
+ to_mdast("* [x] a\n* [ ] b\n* c", &gfm.parse)?,
Node::Root(Root {
children: vec![Node::List(List {
ordered: false,
diff --git a/tests/hard_break_escape.rs b/tests/hard_break_escape.rs
index 9f17f10..44fe6ca 100644
--- a/tests/hard_break_escape.rs
+++ b/tests/hard_break_escape.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{Break, Node, Paragraph, Root, Text},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
@@ -10,43 +10,43 @@ use pretty_assertions::assert_eq;
#[test]
fn hard_break_escape() -> Result<(), String> {
assert_eq!(
- micromark("foo\\\nbaz"),
+ to_html("foo\\\nbaz"),
"<p>foo<br />\nbaz</p>",
"should support a backslash to form a hard break"
);
assert_eq!(
- micromark("foo\\\n bar"),
+ to_html("foo\\\n bar"),
"<p>foo<br />\nbar</p>",
"should support leading spaces after an escape hard break"
);
assert_eq!(
- micromark("*foo\\\nbar*"),
+ to_html("*foo\\\nbar*"),
"<p><em>foo<br />\nbar</em></p>",
"should support escape hard breaks in emphasis"
);
assert_eq!(
- micromark("``code\\\ntext``"),
+ to_html("``code\\\ntext``"),
"<p><code>code\\ text</code></p>",
"should not support escape hard breaks in code"
);
assert_eq!(
- micromark("foo\\"),
+ to_html("foo\\"),
"<p>foo\\</p>",
"should not support escape hard breaks at the end of a paragraph"
);
assert_eq!(
- micromark("### foo\\"),
+ to_html("### foo\\"),
"<h3>foo\\</h3>",
"should not support escape hard breaks at the end of a heading"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"a\\\nb",
&Options {
parse: ParseOptions {
@@ -64,7 +64,7 @@ fn hard_break_escape() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("a\\\nb.", &ParseOptions::default())?,
+ to_mdast("a\\\nb.", &ParseOptions::default())?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![
diff --git a/tests/hard_break_trailing.rs b/tests/hard_break_trailing.rs
index c724c85..78f5550 100644
--- a/tests/hard_break_trailing.rs
+++ b/tests/hard_break_trailing.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{Break, Node, Paragraph, Root, Text},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
@@ -10,109 +10,109 @@ use pretty_assertions::assert_eq;
#[test]
fn hard_break_trailing() -> Result<(), String> {
assert_eq!(
- micromark("foo \nbaz"),
+ to_html("foo \nbaz"),
"<p>foo<br />\nbaz</p>",
"should support two trailing spaces to form a hard break"
);
assert_eq!(
- micromark("foo \nbaz"),
+ to_html("foo \nbaz"),
"<p>foo<br />\nbaz</p>",
"should support multiple trailing spaces"
);
assert_eq!(
- micromark("foo \n bar"),
+ to_html("foo \n bar"),
"<p>foo<br />\nbar</p>",
"should support leading spaces after a trailing hard break"
);
assert_eq!(
- micromark("*foo \nbar*"),
+ to_html("*foo \nbar*"),
"<p><em>foo<br />\nbar</em></p>",
"should support trailing hard breaks in emphasis"
);
assert_eq!(
- micromark("`code \ntext`"),
+ to_html("`code \ntext`"),
"<p><code>code text</code></p>",
"should not support trailing hard breaks in code"
);
assert_eq!(
- micromark("foo "),
+ to_html("foo "),
"<p>foo</p>",
"should not support trailing hard breaks at the end of a paragraph"
);
assert_eq!(
- micromark("### foo "),
+ to_html("### foo "),
"<h3>foo</h3>",
"should not support trailing hard breaks at the end of a heading"
);
assert_eq!(
- micromark("aaa \t\nbb"),
+ to_html("aaa \t\nbb"),
"<p>aaa\nbb</p>",
"should support a mixed line suffix (1)"
);
assert_eq!(
- micromark("aaa\t \nbb"),
+ to_html("aaa\t \nbb"),
"<p>aaa\nbb</p>",
"should support a mixed line suffix (2)"
);
assert_eq!(
- micromark("aaa \t \nbb"),
+ to_html("aaa \t \nbb"),
"<p>aaa\nbb</p>",
"should support a mixed line suffix (3)"
);
assert_eq!(
- micromark("aaa\0 \nbb"),
+ to_html("aaa\0 \nbb"),
"<p>aaa�<br />\nbb</p>",
"should support a hard break after a replacement character"
);
assert_eq!(
- micromark("aaa\0\t\nbb"),
+ to_html("aaa\0\t\nbb"),
"<p>aaa�\nbb</p>",
"should support a line suffix after a replacement character"
);
assert_eq!(
- micromark("*a* \nbb"),
+ to_html("*a* \nbb"),
"<p><em>a</em><br />\nbb</p>",
"should support a hard break after a span"
);
assert_eq!(
- micromark("*a*\t\nbb"),
+ to_html("*a*\t\nbb"),
"<p><em>a</em>\nbb</p>",
"should support a line suffix after a span"
);
assert_eq!(
- micromark("*a* \t\nbb"),
+ to_html("*a* \t\nbb"),
"<p><em>a</em>\nbb</p>",
"should support a mixed line suffix after a span (1)"
);
assert_eq!(
- micromark("*a*\t \nbb"),
+ to_html("*a*\t \nbb"),
"<p><em>a</em>\nbb</p>",
"should support a mixed line suffix after a span (2)"
);
assert_eq!(
- micromark("*a* \t \nbb"),
+ to_html("*a* \t \nbb"),
"<p><em>a</em>\nbb</p>",
"should support a mixed line suffix after a span (3)"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"a \nb",
&Options {
parse: ParseOptions {
@@ -130,7 +130,7 @@ fn hard_break_trailing() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("a \nb.", &ParseOptions::default())?,
+ to_mdast("a \nb.", &ParseOptions::default())?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![
diff --git a/tests/heading_atx.rs b/tests/heading_atx.rs
index 736c50a..089c2c7 100644
--- a/tests/heading_atx.rs
+++ b/tests/heading_atx.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{Heading, Node, Root, Text},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
@@ -10,205 +10,205 @@ use pretty_assertions::assert_eq;
#[test]
fn heading_atx() -> Result<(), String> {
assert_eq!(
- micromark("# foo"),
+ to_html("# foo"),
"<h1>foo</h1>",
"should support a heading w/ rank 1"
);
assert_eq!(
- micromark("## foo"),
+ to_html("## foo"),
"<h2>foo</h2>",
"should support a heading w/ rank 2"
);
assert_eq!(
- micromark("### foo"),
+ to_html("### foo"),
"<h3>foo</h3>",
"should support a heading w/ rank 3"
);
assert_eq!(
- micromark("#### foo"),
+ to_html("#### foo"),
"<h4>foo</h4>",
"should support a heading w/ rank 4"
);
assert_eq!(
- micromark("##### foo"),
+ to_html("##### foo"),
"<h5>foo</h5>",
"should support a heading w/ rank 5"
);
assert_eq!(
- micromark("###### foo"),
+ to_html("###### foo"),
"<h6>foo</h6>",
"should support a heading w/ rank 6"
);
assert_eq!(
- micromark("####### foo"),
+ to_html("####### foo"),
"<p>####### foo</p>",
"should not support a heading w/ rank 7"
);
assert_eq!(
- micromark("#5 bolt"),
+ to_html("#5 bolt"),
"<p>#5 bolt</p>",
"should not support a heading for a number sign not followed by whitespace (1)"
);
assert_eq!(
- micromark("#hashtag"),
+ to_html("#hashtag"),
"<p>#hashtag</p>",
"should not support a heading for a number sign not followed by whitespace (2)"
);
assert_eq!(
- micromark("\\## foo"),
+ to_html("\\## foo"),
"<p>## foo</p>",
"should not support a heading for an escaped number sign"
);
assert_eq!(
- micromark("# foo *bar* \\*baz\\*"),
+ to_html("# foo *bar* \\*baz\\*"),
"<h1>foo <em>bar</em> *baz*</h1>",
"should support text content in headings"
);
assert_eq!(
- micromark("# foo "),
+ to_html("# foo "),
"<h1>foo</h1>",
"should support arbitrary initial and final whitespace"
);
assert_eq!(
- micromark(" ### foo"),
+ to_html(" ### foo"),
"<h3>foo</h3>",
"should support an initial space"
);
assert_eq!(
- micromark(" ## foo"),
+ to_html(" ## foo"),
"<h2>foo</h2>",
"should support two initial spaces"
);
assert_eq!(
- micromark(" # foo"),
+ to_html(" # foo"),
"<h1>foo</h1>",
"should support three initial spaces"
);
assert_eq!(
- micromark(" # foo"),
+ to_html(" # foo"),
"<pre><code># foo\n</code></pre>",
"should not support four initial spaces"
);
assert_eq!(
- micromark("foo\n # bar"),
+ to_html("foo\n # bar"),
"<p>foo\n# bar</p>",
"should not support four initial spaces when interrupting"
);
assert_eq!(
- micromark("## foo ##"),
+ to_html("## foo ##"),
"<h2>foo</h2>",
"should support a closing sequence (1)"
);
assert_eq!(
- micromark(" ### bar ###"),
+ to_html(" ### bar ###"),
"<h3>bar</h3>",
"should support a closing sequence (2)"
);
assert_eq!(
- micromark("# foo ##################################"),
+ to_html("# foo ##################################"),
"<h1>foo</h1>",
"should support a closing sequence w/ an arbitrary number of number signs (1)"
);
assert_eq!(
- micromark("##### foo ##"),
+ to_html("##### foo ##"),
"<h5>foo</h5>",
"should support a closing sequence w/ an arbitrary number of number signs (2)"
);
assert_eq!(
- micromark("### foo ### "),
+ to_html("### foo ### "),
"<h3>foo</h3>",
"should support trailing whitespace after a closing sequence"
);
assert_eq!(
- micromark("### foo ### b"),
+ to_html("### foo ### b"),
"<h3>foo ### b</h3>",
"should not support other content after a closing sequence"
);
assert_eq!(
- micromark("# foo#"),
+ to_html("# foo#"),
"<h1>foo#</h1>",
"should not support a closing sequence w/o whitespace before it"
);
assert_eq!(
- micromark("### foo \\###"),
+ to_html("### foo \\###"),
"<h3>foo ###</h3>",
"should not support an “escaped” closing sequence (1)"
);
assert_eq!(
- micromark("## foo #\\##"),
+ to_html("## foo #\\##"),
"<h2>foo ###</h2>",
"should not support an “escaped” closing sequence (2)"
);
assert_eq!(
- micromark("# foo \\#"),
+ to_html("# foo \\#"),
"<h1>foo #</h1>",
"should not support an “escaped” closing sequence (3)"
);
assert_eq!(
- micromark("****\n## foo\n****"),
+ to_html("****\n## foo\n****"),
"<hr />\n<h2>foo</h2>\n<hr />",
"should support atx headings when not surrounded by blank lines"
);
assert_eq!(
- micromark("Foo bar\n# baz\nBar foo"),
+ to_html("Foo bar\n# baz\nBar foo"),
"<p>Foo bar</p>\n<h1>baz</h1>\n<p>Bar foo</p>",
"should support atx headings interrupting paragraphs"
);
assert_eq!(
- micromark("## \n#\n### ###"),
+ to_html("## \n#\n### ###"),
"<h2></h2>\n<h1></h1>\n<h3></h3>",
"should support empty atx headings (1)"
);
assert_eq!(
- micromark("#\na\n# b"),
+ to_html("#\na\n# b"),
"<h1></h1>\n<p>a</p>\n<h1>b</h1>",
"should support empty atx headings (2)"
);
assert_eq!(
- micromark("> #\na"),
+ to_html("> #\na"),
"<blockquote>\n<h1></h1>\n</blockquote>\n<p>a</p>",
"should not support lazyness (1)"
);
assert_eq!(
- micromark("> a\n#"),
+ to_html("> a\n#"),
"<blockquote>\n<p>a</p>\n</blockquote>\n<h1></h1>",
"should not support lazyness (2)"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"# a",
&Options {
parse: ParseOptions {
@@ -226,7 +226,7 @@ fn heading_atx() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("## alpha #", &ParseOptions::default())?,
+ to_mdast("## alpha #", &ParseOptions::default())?,
Node::Root(Root {
children: vec![Node::Heading(Heading {
depth: 2,
diff --git a/tests/heading_setext.rs b/tests/heading_setext.rs
index 6f0e572..ec8b056 100644
--- a/tests/heading_setext.rs
+++ b/tests/heading_setext.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{Heading, Node, Root, Text},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
@@ -10,272 +10,272 @@ use pretty_assertions::assert_eq;
#[test]
fn heading_setext() -> Result<(), String> {
assert_eq!(
- micromark("Foo *bar*\n========="),
+ to_html("Foo *bar*\n========="),
"<h1>Foo <em>bar</em></h1>",
"should support a heading w/ an equals to (rank of 1)"
);
assert_eq!(
- micromark("Foo *bar*\n---------"),
+ to_html("Foo *bar*\n---------"),
"<h2>Foo <em>bar</em></h2>",
"should support a heading w/ a dash (rank of 2)"
);
assert_eq!(
- micromark("Foo *bar\nbaz*\n===="),
+ to_html("Foo *bar\nbaz*\n===="),
"<h1>Foo <em>bar\nbaz</em></h1>",
"should support line endings in setext headings"
);
assert_eq!(
- micromark(" Foo *bar\nbaz*\t\n===="),
+ to_html(" Foo *bar\nbaz*\t\n===="),
"<h1>Foo <em>bar\nbaz</em></h1>",
"should not include initial and final whitespace around content"
);
assert_eq!(
- micromark("Foo\n-------------------------"),
+ to_html("Foo\n-------------------------"),
"<h2>Foo</h2>",
"should support long underlines"
);
assert_eq!(
- micromark("Foo\n="),
+ to_html("Foo\n="),
"<h1>Foo</h1>",
"should support short underlines"
);
assert_eq!(
- micromark(" Foo\n ==="),
+ to_html(" Foo\n ==="),
"<h1>Foo</h1>",
"should support indented content w/ 1 space"
);
assert_eq!(
- micromark(" Foo\n---"),
+ to_html(" Foo\n---"),
"<h2>Foo</h2>",
"should support indented content w/ 2 spaces"
);
assert_eq!(
- micromark(" Foo\n---"),
+ to_html(" Foo\n---"),
"<h2>Foo</h2>",
"should support indented content w/ 3 spaces"
);
assert_eq!(
- micromark(" Foo\n ---"),
+ to_html(" Foo\n ---"),
"<pre><code>Foo\n---\n</code></pre>",
"should not support too much indented content (1)"
);
assert_eq!(
- micromark(" Foo\n---"),
+ to_html(" Foo\n---"),
"<pre><code>Foo\n</code></pre>\n<hr />",
"should not support too much indented content (2)"
);
assert_eq!(
- micromark("Foo\n ---- "),
+ to_html("Foo\n ---- "),
"<h2>Foo</h2>",
"should support initial and final whitespace around the underline"
);
assert_eq!(
- micromark("Foo\n ="),
+ to_html("Foo\n ="),
"<h1>Foo</h1>",
"should support whitespace before underline"
);
assert_eq!(
- micromark("Foo\n ="),
+ to_html("Foo\n ="),
"<p>Foo\n=</p>",
"should not support too much whitespace before underline (1)"
);
assert_eq!(
- micromark("Foo\n\t="),
+ to_html("Foo\n\t="),
"<p>Foo\n=</p>",
"should not support too much whitespace before underline (2)"
);
assert_eq!(
- micromark("Foo\n= ="),
+ to_html("Foo\n= ="),
"<p>Foo\n= =</p>",
"should not support whitespace in the underline (1)"
);
assert_eq!(
- micromark("Foo\n--- -"),
+ to_html("Foo\n--- -"),
"<p>Foo</p>\n<hr />",
"should not support whitespace in the underline (2)"
);
assert_eq!(
- micromark("Foo \n-----"),
+ to_html("Foo \n-----"),
"<h2>Foo</h2>",
"should not support a hard break w/ spaces at the end"
);
assert_eq!(
- micromark("Foo\\\n-----"),
+ to_html("Foo\\\n-----"),
"<h2>Foo\\</h2>",
"should not support a hard break w/ backslash at the end"
);
assert_eq!(
- micromark("`Foo\n----\n`"),
+ to_html("`Foo\n----\n`"),
"<h2>`Foo</h2>\n<p>`</p>",
"should precede over inline constructs (1)"
);
assert_eq!(
- micromark("<a title=\"a lot\n---\nof dashes\"/>"),
+ to_html("<a title=\"a lot\n---\nof dashes\"/>"),
"<h2>&lt;a title=&quot;a lot</h2>\n<p>of dashes&quot;/&gt;</p>",
"should precede over inline constructs (2)"
);
assert_eq!(
- micromark("> Foo\n---"),
+ to_html("> Foo\n---"),
"<blockquote>\n<p>Foo</p>\n</blockquote>\n<hr />",
"should not allow underline to be lazy (1)"
);
assert_eq!(
- micromark("> foo\nbar\n==="),
+ to_html("> foo\nbar\n==="),
"<blockquote>\n<p>foo\nbar\n===</p>\n</blockquote>",
"should not allow underline to be lazy (2)"
);
assert_eq!(
- micromark("- Foo\n---"),
+ to_html("- Foo\n---"),
"<ul>\n<li>Foo</li>\n</ul>\n<hr />",
"should not allow underline to be lazy (3)"
);
assert_eq!(
- micromark("Foo\nBar\n---"),
+ to_html("Foo\nBar\n---"),
"<h2>Foo\nBar</h2>",
"should support line endings in setext headings"
);
assert_eq!(
- micromark("---\nFoo\n---\nBar\n---\nBaz"),
+ to_html("---\nFoo\n---\nBar\n---\nBaz"),
"<hr />\n<h2>Foo</h2>\n<h2>Bar</h2>\n<p>Baz</p>",
"should support adjacent setext headings"
);
assert_eq!(
- micromark("\n===="),
+ to_html("\n===="),
"<p>====</p>",
"should not support empty setext headings"
);
assert_eq!(
- micromark("---\n---"),
+ to_html("---\n---"),
"<hr />\n<hr />",
"should prefer other constructs over setext headings (1)"
);
assert_eq!(
- micromark("- foo\n-----"),
+ to_html("- foo\n-----"),
"<ul>\n<li>foo</li>\n</ul>\n<hr />",
"should prefer other constructs over setext headings (2)"
);
assert_eq!(
- micromark(" foo\n---"),
+ to_html(" foo\n---"),
"<pre><code>foo\n</code></pre>\n<hr />",
"should prefer other constructs over setext headings (3)"
);
assert_eq!(
- micromark("> foo\n-----"),
+ to_html("> foo\n-----"),
"<blockquote>\n<p>foo</p>\n</blockquote>\n<hr />",
"should prefer other constructs over setext headings (4)"
);
assert_eq!(
- micromark("\\> foo\n------"),
+ to_html("\\> foo\n------"),
"<h2>&gt; foo</h2>",
"should support starting w/ character escapes"
);
assert_eq!(
- micromark("Foo\nbar\n---\nbaz"),
+ to_html("Foo\nbar\n---\nbaz"),
"<h2>Foo\nbar</h2>\n<p>baz</p>",
"paragraph and heading interplay (1)"
);
assert_eq!(
- micromark("Foo\n\nbar\n---\nbaz"),
+ to_html("Foo\n\nbar\n---\nbaz"),
"<p>Foo</p>\n<h2>bar</h2>\n<p>baz</p>",
"paragraph and heading interplay (2)"
);
assert_eq!(
- micromark("Foo\nbar\n\n---\n\nbaz"),
+ to_html("Foo\nbar\n\n---\n\nbaz"),
"<p>Foo\nbar</p>\n<hr />\n<p>baz</p>",
"paragraph and heading interplay (3)"
);
assert_eq!(
- micromark("Foo\nbar\n* * *\nbaz"),
+ to_html("Foo\nbar\n* * *\nbaz"),
"<p>Foo\nbar</p>\n<hr />\n<p>baz</p>",
"paragraph and heading interplay (4)"
);
assert_eq!(
- micromark("Foo\nbar\n\\---\nbaz"),
+ to_html("Foo\nbar\n\\---\nbaz"),
"<p>Foo\nbar\n---\nbaz</p>",
"paragraph and heading interplay (5)"
);
// Extra:
assert_eq!(
- micromark("Foo \nbar\n-----"),
+ to_html("Foo \nbar\n-----"),
"<h2>Foo<br />\nbar</h2>",
"should support a hard break w/ spaces in between"
);
assert_eq!(
- micromark("Foo\\\nbar\n-----"),
+ to_html("Foo\\\nbar\n-----"),
"<h2>Foo<br />\nbar</h2>",
"should support a hard break w/ backslash in between"
);
assert_eq!(
- micromark("a\n-\nb"),
+ to_html("a\n-\nb"),
"<h2>a</h2>\n<p>b</p>",
"should prefer a setext heading over an interrupting list"
);
assert_eq!(
- micromark("> ===\na"),
+ to_html("> ===\na"),
"<blockquote>\n<p>===\na</p>\n</blockquote>",
"should not support lazyness (1)"
);
assert_eq!(
- micromark("> a\n==="),
+ to_html("> a\n==="),
"<blockquote>\n<p>a\n===</p>\n</blockquote>",
"should not support lazyness (2)"
);
assert_eq!(
- micromark("a\n- ==="),
+ to_html("a\n- ==="),
"<p>a</p>\n<ul>\n<li>===</li>\n</ul>",
"should not support piercing (1)"
);
assert_eq!(
- micromark("a\n* ---"),
+ to_html("a\n* ---"),
"<p>a</p>\n<ul>\n<li>\n<hr />\n</li>\n</ul>",
"should not support piercing (2)"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"a\n-",
&Options {
parse: ParseOptions {
@@ -293,7 +293,7 @@ fn heading_setext() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("alpha\nbravo\n==", &ParseOptions::default())?,
+ to_mdast("alpha\nbravo\n==", &ParseOptions::default())?,
Node::Root(Root {
children: vec![Node::Heading(Heading {
depth: 1,
diff --git a/tests/html_flow.rs b/tests/html_flow.rs
index adeebf6..546cb13 100644
--- a/tests/html_flow.rs
+++ b/tests/html_flow.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{Html, Node, Root},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
@@ -19,19 +19,19 @@ fn html_flow() -> Result<(), String> {
};
assert_eq!(
- micromark("<!-- asd -->"),
+ to_html("<!-- asd -->"),
"&lt;!-- asd --&gt;",
"should support a heading w/ rank 1"
);
assert_eq!(
- micromark_with_options("<!-- asd -->", &danger)?,
+ to_html_with_options("<!-- asd -->", &danger)?,
"<!-- asd -->",
"should support a heading w/ rank 1"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"<x>",
&Options {
parse: ParseOptions {
@@ -49,7 +49,7 @@ fn html_flow() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("<div>\nstuff\n</div>", &ParseOptions::default())?,
+ to_mdast("<div>\nstuff\n</div>", &ParseOptions::default())?,
Node::Root(Root {
children: vec![Node::Html(Html {
value: "<div>\nstuff\n</div>".into(),
@@ -75,7 +75,7 @@ fn html_flow_1_raw() -> Result<(), String> {
};
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"<pre language=\"haskell\"><code>
import Text.HTML.TagSoup
@@ -96,7 +96,7 @@ main = print $ parseTags tags
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"<script type=\"text/javascript\">
// JavaScript example
@@ -115,7 +115,7 @@ document.getElementById(\"demo\").innerHTML = \"Hello JavaScript!\";
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"<style
type=\"text/css\">
h1 {color:red;}
@@ -136,92 +136,92 @@ p {color:blue;}
);
assert_eq!(
- micromark_with_options("<style\n type=\"text/css\">\n\nfoo", &danger)?,
+ to_html_with_options("<style\n type=\"text/css\">\n\nfoo", &danger)?,
"<style\n type=\"text/css\">\n\nfoo",
"should support raw tags w/o ending"
);
assert_eq!(
- micromark_with_options("<style>p{color:red;}</style>\n*foo*", &danger)?,
+ to_html_with_options("<style>p{color:red;}</style>\n*foo*", &danger)?,
"<style>p{color:red;}</style>\n<p><em>foo</em></p>",
"should support raw tags w/ start and end on a single line"
);
assert_eq!(
- micromark_with_options("<script>\nfoo\n</script>1. *bar*", &danger)?,
+ to_html_with_options("<script>\nfoo\n</script>1. *bar*", &danger)?,
"<script>\nfoo\n</script>1. *bar*",
"should support raw tags w/ more data on ending line"
);
assert_eq!(
- micromark_with_options("<script", &danger)?,
+ to_html_with_options("<script", &danger)?,
"<script",
"should support an eof directly after a raw tag name"
);
assert_eq!(
- micromark_with_options("</script\nmore", &danger)?,
+ to_html_with_options("</script\nmore", &danger)?,
"<p>&lt;/script\nmore</p>",
"should not support a raw closing tag"
);
assert_eq!(
- micromark_with_options("<script/", &danger)?,
+ to_html_with_options("<script/", &danger)?,
"<p>&lt;script/</p>",
"should not support an eof after a self-closing slash"
);
assert_eq!(
- micromark_with_options("<script/\n*asd*", &danger)?,
+ to_html_with_options("<script/\n*asd*", &danger)?,
"<p>&lt;script/\n<em>asd</em></p>",
"should not support a line ending after a self-closing slash"
);
assert_eq!(
- micromark_with_options("<script/>", &danger)?,
+ to_html_with_options("<script/>", &danger)?,
"<script/>",
"should support an eof after a self-closing tag"
);
assert_eq!(
- micromark_with_options("<script/>\na", &danger)?,
+ to_html_with_options("<script/>\na", &danger)?,
"<script/>\na",
"should support a line ending after a self-closing tag"
);
assert_eq!(
- micromark_with_options("<script/>a", &danger)?,
+ to_html_with_options("<script/>a", &danger)?,
"<p><script/>a</p>",
"should not support other characters after a self-closing tag"
);
assert_eq!(
- micromark_with_options("<script>a", &danger)?,
+ to_html_with_options("<script>a", &danger)?,
"<script>a",
"should support other characters after a raw opening tag"
);
// Extra.
assert_eq!(
- micromark_with_options("Foo\n<script", &danger)?,
+ to_html_with_options("Foo\n<script", &danger)?,
"<p>Foo</p>\n<script",
"should support interrupting paragraphs w/ raw tags"
);
assert_eq!(
- micromark_with_options("<script>\n \n \n</script>", &danger)?,
+ to_html_with_options("<script>\n \n \n</script>", &danger)?,
"<script>\n \n \n</script>",
"should support blank lines in raw"
);
assert_eq!(
- micromark_with_options("> <script>\na", &danger)?,
+ to_html_with_options("> <script>\na", &danger)?,
"<blockquote>\n<script>\n</blockquote>\n<p>a</p>",
"should not support lazyness (1)"
);
assert_eq!(
- micromark_with_options("> a\n<script>", &danger)?,
+ to_html_with_options("> a\n<script>", &danger)?,
"<blockquote>\n<p>a</p>\n</blockquote>\n<script>",
"should not support lazyness (2)"
);
@@ -241,96 +241,96 @@ fn html_flow_2_comment() -> Result<(), String> {
};
assert_eq!(
- micromark_with_options("<!-- Foo\n\nbar\n baz -->\nokay", &danger)?,
+ to_html_with_options("<!-- Foo\n\nbar\n baz -->\nokay", &danger)?,
"<!-- Foo\n\nbar\n baz -->\n<p>okay</p>",
"should support comments (type 2)"
);
assert_eq!(
- micromark_with_options("<!-- foo -->*bar*\n*baz*", &danger)?,
+ to_html_with_options("<!-- foo -->*bar*\n*baz*", &danger)?,
"<!-- foo -->*bar*\n<p><em>baz</em></p>",
"should support comments w/ start and end on a single line"
);
assert_eq!(
- micromark_with_options("<!-asd-->", &danger)?,
+ to_html_with_options("<!-asd-->", &danger)?,
"<p>&lt;!-asd--&gt;</p>",
"should not support a single dash to start comments"
);
assert_eq!(
- micromark_with_options("<!-->", &danger)?,
+ to_html_with_options("<!-->", &danger)?,
"<!-->",
"should support comments where the start dashes are the end dashes (1)"
);
assert_eq!(
- micromark_with_options("<!--->", &danger)?,
+ to_html_with_options("<!--->", &danger)?,
"<!--->",
"should support comments where the start dashes are the end dashes (2)"
);
assert_eq!(
- micromark_with_options("<!---->", &danger)?,
+ to_html_with_options("<!---->", &danger)?,
"<!---->",
"should support empty comments"
);
// If the `\"` is encoded, we’re in text. If it remains, we’re in HTML.
assert_eq!(
- micromark_with_options("<!--\n->\n\"", &danger)?,
+ to_html_with_options("<!--\n->\n\"", &danger)?,
"<!--\n->\n\"",
"should not end a comment at one dash (`->`)"
);
assert_eq!(
- micromark_with_options("<!--\n-->\n\"", &danger)?,
+ to_html_with_options("<!--\n-->\n\"", &danger)?,
"<!--\n-->\n<p>&quot;</p>",
"should end a comment at two dashes (`-->`)"
);
assert_eq!(
- micromark_with_options("<!--\n--->\n\"", &danger)?,
+ to_html_with_options("<!--\n--->\n\"", &danger)?,
"<!--\n--->\n<p>&quot;</p>",
"should end a comment at three dashes (`--->`)"
);
assert_eq!(
- micromark_with_options("<!--\n---->\n\"", &danger)?,
+ to_html_with_options("<!--\n---->\n\"", &danger)?,
"<!--\n---->\n<p>&quot;</p>",
"should end a comment at four dashes (`---->`)"
);
assert_eq!(
- micromark_with_options(" <!-- foo -->", &danger)?,
+ to_html_with_options(" <!-- foo -->", &danger)?,
" <!-- foo -->",
"should support comments w/ indent"
);
assert_eq!(
- micromark_with_options(" <!-- foo -->", &danger)?,
+ to_html_with_options(" <!-- foo -->", &danger)?,
"<pre><code>&lt;!-- foo --&gt;\n</code></pre>",
"should not support comments w/ a 4 character indent"
);
// Extra.
assert_eq!(
- micromark_with_options("Foo\n<!--", &danger)?,
+ to_html_with_options("Foo\n<!--", &danger)?,
"<p>Foo</p>\n<!--",
"should support interrupting paragraphs w/ comments"
);
assert_eq!(
- micromark_with_options("<!--\n \n \n-->", &danger)?,
+ to_html_with_options("<!--\n \n \n-->", &danger)?,
"<!--\n \n \n-->",
"should support blank lines in comments"
);
assert_eq!(
- micromark_with_options("> <!--\na", &danger)?,
+ to_html_with_options("> <!--\na", &danger)?,
"<blockquote>\n<!--\n</blockquote>\n<p>a</p>",
"should not support lazyness (1)"
);
assert_eq!(
- micromark_with_options("> a\n<!--", &danger)?,
+ to_html_with_options("> a\n<!--", &danger)?,
"<blockquote>\n<p>a</p>\n</blockquote>\n<!--",
"should not support lazyness (2)"
);
@@ -350,44 +350,44 @@ fn html_flow_3_instruction() -> Result<(), String> {
};
assert_eq!(
- micromark_with_options("<?php\n\n echo \">\";\n\n?>\nokay", &danger)?,
+ to_html_with_options("<?php\n\n echo \">\";\n\n?>\nokay", &danger)?,
"<?php\n\n echo \">\";\n\n?>\n<p>okay</p>",
"should support instructions (type 3)"
);
assert_eq!(
- micromark_with_options("<?>", &danger)?,
+ to_html_with_options("<?>", &danger)?,
"<?>",
"should support empty instructions where the `?` is part of both the start and the end"
);
assert_eq!(
- micromark_with_options("<??>", &danger)?,
+ to_html_with_options("<??>", &danger)?,
"<??>",
"should support empty instructions"
);
// Extra.
assert_eq!(
- micromark_with_options("Foo\n<?", &danger)?,
+ to_html_with_options("Foo\n<?", &danger)?,
"<p>Foo</p>\n<?",
"should support interrupting paragraphs w/ instructions"
);
assert_eq!(
- micromark_with_options("<?\n \n \n?>", &danger)?,
+ to_html_with_options("<?\n \n \n?>", &danger)?,
"<?\n \n \n?>",
"should support blank lines in instructions"
);
assert_eq!(
- micromark_with_options("> <?\na", &danger)?,
+ to_html_with_options("> <?\na", &danger)?,
"<blockquote>\n<?\n</blockquote>\n<p>a</p>",
"should not support lazyness (1)"
);
assert_eq!(
- micromark_with_options("> a\n<?", &danger)?,
+ to_html_with_options("> a\n<?", &danger)?,
"<blockquote>\n<p>a</p>\n</blockquote>\n<?",
"should not support lazyness (2)"
);
@@ -407,32 +407,32 @@ fn html_flow_4_declaration() -> Result<(), String> {
};
assert_eq!(
- micromark_with_options("<!DOCTYPE html>", &danger)?,
+ to_html_with_options("<!DOCTYPE html>", &danger)?,
"<!DOCTYPE html>",
"should support declarations (type 4)"
);
assert_eq!(
- micromark_with_options("<!123>", &danger)?,
+ to_html_with_options("<!123>", &danger)?,
"<p>&lt;!123&gt;</p>",
"should not support declarations that start w/o an alpha"
);
assert_eq!(
- micromark_with_options("<!>", &danger)?,
+ to_html_with_options("<!>", &danger)?,
"<p>&lt;!&gt;</p>",
"should not support declarations w/o an identifier"
);
assert_eq!(
- micromark_with_options("<!a>", &danger)?,
+ to_html_with_options("<!a>", &danger)?,
"<!a>",
"should support declarations w/o a single alpha as identifier"
);
// Extra.
assert_eq!(
- micromark_with_options("Foo\n<!d", &danger)?,
+ to_html_with_options("Foo\n<!d", &danger)?,
"<p>Foo</p>\n<!d",
"should support interrupting paragraphs w/ declarations"
);
@@ -440,19 +440,19 @@ fn html_flow_4_declaration() -> Result<(), String> {
// Note about the lower letter:
// <https://github.com/commonmark/commonmark-spec/pull/621>
assert_eq!(
- micromark_with_options("<!a\n \n \n>", &danger)?,
+ to_html_with_options("<!a\n \n \n>", &danger)?,
"<!a\n \n \n>",
"should support blank lines in declarations"
);
assert_eq!(
- micromark_with_options("> <!a\nb", &danger)?,
+ to_html_with_options("> <!a\nb", &danger)?,
"<blockquote>\n<!a\n</blockquote>\n<p>b</p>",
"should not support lazyness (1)"
);
assert_eq!(
- micromark_with_options("> a\n<!b", &danger)?,
+ to_html_with_options("> a\n<!b", &danger)?,
"<blockquote>\n<p>a</p>\n</blockquote>\n<!b",
"should not support lazyness (2)"
);
@@ -472,7 +472,7 @@ fn html_flow_5_cdata() -> Result<(), String> {
};
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"<![CDATA[\nfunction matchwo(a,b)\n{\n if (a < b && a < 0) then {\n return 1;\n\n } else {\n\n return 0;\n }\n}\n]]>\nokay",
&danger
)?,
@@ -481,26 +481,26 @@ fn html_flow_5_cdata() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("<![CDATA[]]>", &danger)?,
+ to_html_with_options("<![CDATA[]]>", &danger)?,
"<![CDATA[]]>",
"should support empty cdata"
);
assert_eq!(
- micromark_with_options("<![CDATA]]>", &danger)?,
+ to_html_with_options("<![CDATA]]>", &danger)?,
"<p>&lt;![CDATA]]&gt;</p>",
"should not support cdata w/ a missing `[`"
);
assert_eq!(
- micromark_with_options("<![CDATA[]]]>", &danger)?,
+ to_html_with_options("<![CDATA[]]]>", &danger)?,
"<![CDATA[]]]>",
"should support cdata w/ a single `]` as content"
);
// Extra.
assert_eq!(
- micromark_with_options("Foo\n<![CDATA[", &danger)?,
+ to_html_with_options("Foo\n<![CDATA[", &danger)?,
"<p>Foo</p>\n<![CDATA[",
"should support interrupting paragraphs w/ cdata"
);
@@ -508,25 +508,25 @@ fn html_flow_5_cdata() -> Result<(), String> {
// Note: cmjs parses this differently.
// See: <https://github.com/commonmark/commonmark.js/issues/193>
assert_eq!(
- micromark_with_options("<![cdata[]]>", &danger)?,
+ to_html_with_options("<![cdata[]]>", &danger)?,
"<p>&lt;![cdata[]]&gt;</p>",
"should not support lowercase cdata"
);
assert_eq!(
- micromark_with_options("<![CDATA[\n \n \n]]>", &danger)?,
+ to_html_with_options("<![CDATA[\n \n \n]]>", &danger)?,
"<![CDATA[\n \n \n]]>",
"should support blank lines in cdata"
);
assert_eq!(
- micromark_with_options("> <![CDATA[\na", &danger)?,
+ to_html_with_options("> <![CDATA[\na", &danger)?,
"<blockquote>\n<![CDATA[\n</blockquote>\n<p>a</p>",
"should not support lazyness (1)"
);
assert_eq!(
- micromark_with_options("> a\n<![CDATA[", &danger)?,
+ to_html_with_options("> a\n<![CDATA[", &danger)?,
"<blockquote>\n<p>a</p>\n</blockquote>\n<![CDATA[",
"should not support lazyness (2)"
);
@@ -546,7 +546,7 @@ fn html_flow_6_basic() -> Result<(), String> {
};
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"<table><tr><td>\n<pre>\n**Hello**,\n\n_world_.\n</pre>\n</td></tr></table>",
&danger
)?,
@@ -555,7 +555,7 @@ fn html_flow_6_basic() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"<table>
<tr>
<td>
@@ -579,127 +579,127 @@ okay.",
);
assert_eq!(
- micromark_with_options(" <div>\n *hello*\n <foo><a>", &danger)?,
+ to_html_with_options(" <div>\n *hello*\n <foo><a>", &danger)?,
" <div>\n *hello*\n <foo><a>",
"should support html of type 6 (2)"
);
assert_eq!(
- micromark_with_options("</div>\n*foo*", &danger)?,
+ to_html_with_options("</div>\n*foo*", &danger)?,
"</div>\n*foo*",
"should support html starting w/ a closing tag"
);
assert_eq!(
- micromark_with_options("<DIV CLASS=\"foo\">\n\n*Markdown*\n\n</DIV>", &danger)?,
+ to_html_with_options("<DIV CLASS=\"foo\">\n\n*Markdown*\n\n</DIV>", &danger)?,
"<DIV CLASS=\"foo\">\n<p><em>Markdown</em></p>\n</DIV>",
"should support html w/ markdown in between"
);
assert_eq!(
- micromark_with_options("<div id=\"foo\"\n class=\"bar\">\n</div>", &danger)?,
+ to_html_with_options("<div id=\"foo\"\n class=\"bar\">\n</div>", &danger)?,
"<div id=\"foo\"\n class=\"bar\">\n</div>",
"should support html w/ line endings (1)"
);
assert_eq!(
- micromark_with_options("<div id=\"foo\" class=\"bar\n baz\">\n</div>", &danger)?,
+ to_html_with_options("<div id=\"foo\" class=\"bar\n baz\">\n</div>", &danger)?,
"<div id=\"foo\" class=\"bar\n baz\">\n</div>",
"should support html w/ line endings (2)"
);
assert_eq!(
- micromark_with_options("<div>\n*foo*\n\n*bar*", &danger)?,
+ to_html_with_options("<div>\n*foo*\n\n*bar*", &danger)?,
"<div>\n*foo*\n<p><em>bar</em></p>",
"should support an unclosed html element"
);
assert_eq!(
- micromark_with_options("<div id=\"foo\"\n*hi*", &danger)?,
+ to_html_with_options("<div id=\"foo\"\n*hi*", &danger)?,
"<div id=\"foo\"\n*hi*",
"should support garbage html (1)"
);
assert_eq!(
- micromark_with_options("<div class\nfoo", &danger)?,
+ to_html_with_options("<div class\nfoo", &danger)?,
"<div class\nfoo",
"should support garbage html (2)"
);
assert_eq!(
- micromark_with_options("<div *???-&&&-<---\n*foo*", &danger)?,
+ to_html_with_options("<div *???-&&&-<---\n*foo*", &danger)?,
"<div *???-&&&-<---\n*foo*",
"should support garbage html (3)"
);
assert_eq!(
- micromark_with_options("<div><a href=\"bar\">*foo*</a></div>", &danger)?,
+ to_html_with_options("<div><a href=\"bar\">*foo*</a></div>", &danger)?,
"<div><a href=\"bar\">*foo*</a></div>",
"should support other tags in the opening (1)"
);
assert_eq!(
- micromark_with_options("<table><tr><td>\nfoo\n</td></tr></table>", &danger)?,
+ to_html_with_options("<table><tr><td>\nfoo\n</td></tr></table>", &danger)?,
"<table><tr><td>\nfoo\n</td></tr></table>",
"should support other tags in the opening (2)"
);
assert_eq!(
- micromark_with_options("<div></div>\n``` c\nint x = 33;\n```", &danger)?,
+ to_html_with_options("<div></div>\n``` c\nint x = 33;\n```", &danger)?,
"<div></div>\n``` c\nint x = 33;\n```",
"should include everything ’till a blank line"
);
assert_eq!(
- micromark_with_options("> <div>\n> foo\n\nbar", &danger)?,
+ to_html_with_options("> <div>\n> foo\n\nbar", &danger)?,
"<blockquote>\n<div>\nfoo\n</blockquote>\n<p>bar</p>",
"should support basic tags w/o ending in containers (1)"
);
assert_eq!(
- micromark_with_options("- <div>\n- foo", &danger)?,
+ to_html_with_options("- <div>\n- foo", &danger)?,
"<ul>\n<li>\n<div>\n</li>\n<li>foo</li>\n</ul>",
"should support basic tags w/o ending in containers (2)"
);
assert_eq!(
- micromark_with_options(" <div>", &danger)?,
+ to_html_with_options(" <div>", &danger)?,
" <div>",
"should support basic tags w/ indent"
);
assert_eq!(
- micromark_with_options(" <div>", &danger)?,
+ to_html_with_options(" <div>", &danger)?,
"<pre><code>&lt;div&gt;\n</code></pre>",
"should not support basic tags w/ a 4 character indent"
);
assert_eq!(
- micromark_with_options("Foo\n<div>\nbar\n</div>", &danger)?,
+ to_html_with_options("Foo\n<div>\nbar\n</div>", &danger)?,
"<p>Foo</p>\n<div>\nbar\n</div>",
"should support interrupting paragraphs w/ basic tags"
);
assert_eq!(
- micromark_with_options("<div>\nbar\n</div>\n*foo*", &danger)?,
+ to_html_with_options("<div>\nbar\n</div>\n*foo*", &danger)?,
"<div>\nbar\n</div>\n*foo*",
"should require a blank line to end"
);
assert_eq!(
- micromark_with_options("<div>\n\n*Emphasized* text.\n\n</div>", &danger)?,
+ to_html_with_options("<div>\n\n*Emphasized* text.\n\n</div>", &danger)?,
"<div>\n<p><em>Emphasized</em> text.</p>\n</div>",
"should support interleaving w/ blank lines"
);
assert_eq!(
- micromark_with_options("<div>\n*Emphasized* text.\n</div>", &danger)?,
+ to_html_with_options("<div>\n*Emphasized* text.\n</div>", &danger)?,
"<div>\n*Emphasized* text.\n</div>",
"should not support interleaving w/o blank lines"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"<table>\n\n<tr>\n\n<td>\nHi\n</td>\n\n</tr>\n\n</table>",
&danger
)?,
@@ -708,7 +708,7 @@ okay.",
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"<table>
<tr>
@@ -734,86 +734,86 @@ okay.",
);
assert_eq!(
- micromark_with_options("</1>", &danger)?,
+ to_html_with_options("</1>", &danger)?,
"<p>&lt;/1&gt;</p>",
"should not support basic tags w/ an incorrect name start character"
);
assert_eq!(
- micromark_with_options("<div", &danger)?,
+ to_html_with_options("<div", &danger)?,
"<div",
"should support an eof directly after a basic tag name"
);
assert_eq!(
- micromark_with_options("<div\n", &danger)?,
+ to_html_with_options("<div\n", &danger)?,
"<div\n",
"should support a line ending directly after a tag name"
);
assert_eq!(
- micromark_with_options("<div ", &danger)?,
+ to_html_with_options("<div ", &danger)?,
"<div ",
"should support an eof after a space directly after a tag name"
);
assert_eq!(
- micromark_with_options("<div/", &danger)?,
+ to_html_with_options("<div/", &danger)?,
"<p>&lt;div/</p>",
"should not support an eof directly after a self-closing slash"
);
assert_eq!(
- micromark_with_options("<div/\n*asd*", &danger)?,
+ to_html_with_options("<div/\n*asd*", &danger)?,
"<p>&lt;div/\n<em>asd</em></p>",
"should not support a line ending after a self-closing slash"
);
assert_eq!(
- micromark_with_options("<div/>", &danger)?,
+ to_html_with_options("<div/>", &danger)?,
"<div/>",
"should support an eof after a self-closing tag"
);
assert_eq!(
- micromark_with_options("<div/>\na", &danger)?,
+ to_html_with_options("<div/>\na", &danger)?,
"<div/>\na",
"should support a line ending after a self-closing tag"
);
assert_eq!(
- micromark_with_options("<div/>a", &danger)?,
+ to_html_with_options("<div/>a", &danger)?,
"<div/>a",
"should support another character after a self-closing tag"
);
assert_eq!(
- micromark_with_options("<div>a", &danger)?,
+ to_html_with_options("<div>a", &danger)?,
"<div>a",
"should support another character after a basic opening tag"
);
// Extra.
assert_eq!(
- micromark_with_options("Foo\n<div/>", &danger)?,
+ to_html_with_options("Foo\n<div/>", &danger)?,
"<p>Foo</p>\n<div/>",
"should support interrupting paragraphs w/ self-closing basic tags"
);
assert_eq!(
- micromark_with_options("<div\n \n \n>", &danger)?,
+ to_html_with_options("<div\n \n \n>", &danger)?,
"<div\n<blockquote>\n</blockquote>",
"should not support blank lines in basic"
);
assert_eq!(
- micromark_with_options("> <div\na", &danger)?,
+ to_html_with_options("> <div\na", &danger)?,
"<blockquote>\n<div\n</blockquote>\n<p>a</p>",
"should not support lazyness (1)"
);
assert_eq!(
- micromark_with_options("> a\n<div", &danger)?,
+ to_html_with_options("> a\n<div", &danger)?,
"<blockquote>\n<p>a</p>\n</blockquote>\n<div",
"should not support lazyness (2)"
);
@@ -833,301 +833,301 @@ fn html_flow_7_complete() -> Result<(), String> {
};
assert_eq!(
- micromark_with_options("<a href=\"foo\">\n*bar*\n</a>", &danger)?,
+ to_html_with_options("<a href=\"foo\">\n*bar*\n</a>", &danger)?,
"<a href=\"foo\">\n*bar*\n</a>",
"should support complete tags (type 7)"
);
assert_eq!(
- micromark_with_options("<Warning>\n*bar*\n</Warning>", &danger)?,
+ to_html_with_options("<Warning>\n*bar*\n</Warning>", &danger)?,
"<Warning>\n*bar*\n</Warning>",
"should support non-html tag names"
);
assert_eq!(
- micromark_with_options("<i class=\"foo\">\n*bar*\n</i>", &danger)?,
+ to_html_with_options("<i class=\"foo\">\n*bar*\n</i>", &danger)?,
"<i class=\"foo\">\n*bar*\n</i>",
"should support non-“block” html tag names (1)"
);
assert_eq!(
- micromark_with_options("<del>\n*foo*\n</del>", &danger)?,
+ to_html_with_options("<del>\n*foo*\n</del>", &danger)?,
"<del>\n*foo*\n</del>",
"should support non-“block” html tag names (2)"
);
assert_eq!(
- micromark_with_options("</ins>\n*bar*", &danger)?,
+ to_html_with_options("</ins>\n*bar*", &danger)?,
"</ins>\n*bar*",
"should support closing tags"
);
assert_eq!(
- micromark_with_options("<del>\n\n*foo*\n\n</del>", &danger)?,
+ to_html_with_options("<del>\n\n*foo*\n\n</del>", &danger)?,
"<del>\n<p><em>foo</em></p>\n</del>",
"should support interleaving"
);
assert_eq!(
- micromark_with_options("<del>*foo*</del>", &danger)?,
+ to_html_with_options("<del>*foo*</del>", &danger)?,
"<p><del><em>foo</em></del></p>",
"should not support interleaving w/o blank lines"
);
assert_eq!(
- micromark_with_options("<div>\n \nasd", &danger)?,
+ to_html_with_options("<div>\n \nasd", &danger)?,
"<div>\n<p>asd</p>",
"should support interleaving w/ whitespace-only blank lines"
);
assert_eq!(
- micromark_with_options("Foo\n<a href=\"bar\">\nbaz", &danger)?,
+ to_html_with_options("Foo\n<a href=\"bar\">\nbaz", &danger)?,
"<p>Foo\n<a href=\"bar\">\nbaz</p>",
"should not support interrupting paragraphs w/ complete tags"
);
assert_eq!(
- micromark_with_options("<x", &danger)?,
+ to_html_with_options("<x", &danger)?,
"<p>&lt;x</p>",
"should not support an eof directly after a tag name"
);
assert_eq!(
- micromark_with_options("<x/", &danger)?,
+ to_html_with_options("<x/", &danger)?,
"<p>&lt;x/</p>",
"should not support an eof directly after a self-closing slash"
);
assert_eq!(
- micromark_with_options("<x\n", &danger)?,
+ to_html_with_options("<x\n", &danger)?,
"<p>&lt;x</p>\n",
"should not support a line ending directly after a tag name"
);
assert_eq!(
- micromark_with_options("<x ", &danger)?,
+ to_html_with_options("<x ", &danger)?,
"<p>&lt;x</p>",
"should not support an eof after a space directly after a tag name"
);
assert_eq!(
- micromark_with_options("<x/", &danger)?,
+ to_html_with_options("<x/", &danger)?,
"<p>&lt;x/</p>",
"should not support an eof directly after a self-closing slash"
);
assert_eq!(
- micromark_with_options("<x/\n*asd*", &danger)?,
+ to_html_with_options("<x/\n*asd*", &danger)?,
"<p>&lt;x/\n<em>asd</em></p>",
"should not support a line ending after a self-closing slash"
);
assert_eq!(
- micromark_with_options("<x/>", &danger)?,
+ to_html_with_options("<x/>", &danger)?,
"<x/>",
"should support an eof after a self-closing tag"
);
assert_eq!(
- micromark_with_options("<x/>\na", &danger)?,
+ to_html_with_options("<x/>\na", &danger)?,
"<x/>\na",
"should support a line ending after a self-closing tag"
);
assert_eq!(
- micromark_with_options("<x/>a", &danger)?,
+ to_html_with_options("<x/>a", &danger)?,
"<p><x/>a</p>",
"should not support another character after a self-closing tag"
);
assert_eq!(
- micromark_with_options("<x>a", &danger)?,
+ to_html_with_options("<x>a", &danger)?,
"<p><x>a</p>",
"should not support another character after an opening tag"
);
assert_eq!(
- micromark_with_options("<x y>", &danger)?,
+ to_html_with_options("<x y>", &danger)?,
"<x y>",
"should support boolean attributes in a complete tag"
);
assert_eq!(
- micromark_with_options("<x\ny>", &danger)?,
+ to_html_with_options("<x\ny>", &danger)?,
"<p><x\ny></p>",
"should not support a line ending before an attribute name"
);
assert_eq!(
- micromark_with_options("<x\n y>", &danger)?,
+ to_html_with_options("<x\n y>", &danger)?,
"<p><x\ny></p>",
"should not support a line ending w/ whitespace before an attribute name"
);
assert_eq!(
- micromark_with_options("<x\n \ny>", &danger)?,
+ to_html_with_options("<x\n \ny>", &danger)?,
"<p>&lt;x</p>\n<p>y&gt;</p>",
"should not support a line ending w/ whitespace and another line ending before an attribute name"
);
assert_eq!(
- micromark_with_options("<x y\nz>", &danger)?,
+ to_html_with_options("<x y\nz>", &danger)?,
"<p><x y\nz></p>",
"should not support a line ending between attribute names"
);
assert_eq!(
- micromark_with_options("<x y z>", &danger)?,
+ to_html_with_options("<x y z>", &danger)?,
"<x y z>",
"should support whitespace between attribute names"
);
assert_eq!(
- micromark_with_options("<x:y>", &danger)?,
+ to_html_with_options("<x:y>", &danger)?,
"<p>&lt;x:y&gt;</p>",
"should not support a colon in a tag name"
);
assert_eq!(
- micromark_with_options("<x_y>", &danger)?,
+ to_html_with_options("<x_y>", &danger)?,
"<p>&lt;x_y&gt;</p>",
"should not support an underscore in a tag name"
);
assert_eq!(
- micromark_with_options("<x.y>", &danger)?,
+ to_html_with_options("<x.y>", &danger)?,
"<p>&lt;x.y&gt;</p>",
"should not support a dot in a tag name"
);
assert_eq!(
- micromark_with_options("<x :y>", &danger)?,
+ to_html_with_options("<x :y>", &danger)?,
"<x :y>",
"should support a colon to start an attribute name"
);
assert_eq!(
- micromark_with_options("<x _y>", &danger)?,
+ to_html_with_options("<x _y>", &danger)?,
"<x _y>",
"should support an underscore to start an attribute name"
);
assert_eq!(
- micromark_with_options("<x .y>", &danger)?,
+ to_html_with_options("<x .y>", &danger)?,
"<p>&lt;x .y&gt;</p>",
"should not support a dot to start an attribute name"
);
assert_eq!(
- micromark_with_options("<x y:>", &danger)?,
+ to_html_with_options("<x y:>", &danger)?,
"<x y:>",
"should support a colon to end an attribute name"
);
assert_eq!(
- micromark_with_options("<x y_>", &danger)?,
+ to_html_with_options("<x y_>", &danger)?,
"<x y_>",
"should support an underscore to end an attribute name"
);
assert_eq!(
- micromark_with_options("<x y.>", &danger)?,
+ to_html_with_options("<x y.>", &danger)?,
"<x y.>",
"should support a dot to end an attribute name"
);
assert_eq!(
- micromark_with_options("<x y123>", &danger)?,
+ to_html_with_options("<x y123>", &danger)?,
"<x y123>",
"should support numbers to end an attribute name"
);
assert_eq!(
- micromark_with_options("<x data->", &danger)?,
+ to_html_with_options("<x data->", &danger)?,
"<x data->",
"should support a dash to end an attribute name"
);
assert_eq!(
- micromark_with_options("<x y=>", &danger)?,
+ to_html_with_options("<x y=>", &danger)?,
"<p>&lt;x y=&gt;</p>",
"should not upport an initializer w/o a value"
);
assert_eq!(
- micromark_with_options("<x y==>", &danger)?,
+ to_html_with_options("<x y==>", &danger)?,
"<p>&lt;x y==&gt;</p>",
"should not support an equals to as an initializer"
);
assert_eq!(
- micromark_with_options("<x y=z>", &danger)?,
+ to_html_with_options("<x y=z>", &danger)?,
"<x y=z>",
"should support a single character as an unquoted attribute value"
);
assert_eq!(
- micromark_with_options("<x y=\"\">", &danger)?,
+ to_html_with_options("<x y=\"\">", &danger)?,
"<x y=\"\">",
"should support an empty double quoted attribute value"
);
assert_eq!(
- micromark_with_options("<x y=\"\">", &danger)?,
+ to_html_with_options("<x y=\"\">", &danger)?,
"<x y=\"\">",
"should support an empty single quoted attribute value"
);
assert_eq!(
- micromark_with_options("<x y=\"\n\">", &danger)?,
+ to_html_with_options("<x y=\"\n\">", &danger)?,
"<p><x y=\"\n\"></p>",
"should not support a line ending in a double quoted attribute value"
);
assert_eq!(
- micromark_with_options("<x y=\"\n\">", &danger)?,
+ to_html_with_options("<x y=\"\n\">", &danger)?,
"<p><x y=\"\n\"></p>",
"should not support a line ending in a single quoted attribute value"
);
assert_eq!(
- micromark_with_options("<w x=y\nz>", &danger)?,
+ to_html_with_options("<w x=y\nz>", &danger)?,
"<p><w x=y\nz></p>",
"should not support a line ending in/after an unquoted attribute value"
);
assert_eq!(
- micromark_with_options("<w x=y\"z>", &danger)?,
+ to_html_with_options("<w x=y\"z>", &danger)?,
"<p>&lt;w x=y&quot;z&gt;</p>",
"should not support a double quote in/after an unquoted attribute value"
);
assert_eq!(
- micromark_with_options("<w x=y'z>", &danger)?,
+ to_html_with_options("<w x=y'z>", &danger)?,
"<p>&lt;w x=y'z&gt;</p>",
"should not support a single quote in/after an unquoted attribute value"
);
assert_eq!(
- micromark_with_options("<x y=\"\"z>", &danger)?,
+ to_html_with_options("<x y=\"\"z>", &danger)?,
"<p>&lt;x y=&quot;&quot;z&gt;</p>",
"should not support an attribute after a double quoted attribute value"
);
assert_eq!(
- micromark_with_options("<x>\n \n \n>", &danger)?,
+ to_html_with_options("<x>\n \n \n>", &danger)?,
"<x>\n<blockquote>\n</blockquote>",
"should not support blank lines in complete"
);
assert_eq!(
- micromark_with_options("> <a>\n*bar*", &danger)?,
+ to_html_with_options("> <a>\n*bar*", &danger)?,
"<blockquote>\n<a>\n</blockquote>\n<p><em>bar</em></p>",
"should not support lazyness (1)"
);
assert_eq!(
- micromark_with_options("> a\n<a>", &danger)?,
+ to_html_with_options("> a\n<a>", &danger)?,
"<blockquote>\n<p>a</p>\n</blockquote>\n<a>",
"should not support lazyness (2)"
);
diff --git a/tests/html_text.rs b/tests/html_text.rs
index 2bdd79d..5537d3d 100644
--- a/tests/html_text.rs
+++ b/tests/html_text.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{Html, Node, Paragraph, Root, Text},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
@@ -19,31 +19,31 @@ fn html_text() -> Result<(), String> {
};
assert_eq!(
- micromark("a <b> c"),
+ to_html("a <b> c"),
"<p>a &lt;b&gt; c</p>",
"should encode dangerous html by default"
);
assert_eq!(
- micromark_with_options("<a><bab><c2c>", &danger)?,
+ to_html_with_options("<a><bab><c2c>", &danger)?,
"<p><a><bab><c2c></p>",
"should support opening tags"
);
assert_eq!(
- micromark_with_options("<a/><b2/>", &danger)?,
+ to_html_with_options("<a/><b2/>", &danger)?,
"<p><a/><b2/></p>",
"should support self-closing tags"
);
assert_eq!(
- micromark_with_options("<a /><b2\ndata=\"foo\" >", &danger)?,
+ to_html_with_options("<a /><b2\ndata=\"foo\" >", &danger)?,
"<p><a /><b2\ndata=\"foo\" ></p>",
"should support whitespace in tags"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"<a foo=\"bar\" bam = 'baz <em>\"</em>'\n_boolean zoop:33=zoop:33 />",
&danger
)?,
@@ -52,164 +52,164 @@ fn html_text() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("Foo <responsive-image src=\"foo.jpg\" />", &danger)?,
+ to_html_with_options("Foo <responsive-image src=\"foo.jpg\" />", &danger)?,
"<p>Foo <responsive-image src=\"foo.jpg\" /></p>",
"should support non-html tags"
);
assert_eq!(
- micromark_with_options("<33> <__>", &danger)?,
+ to_html_with_options("<33> <__>", &danger)?,
"<p>&lt;33&gt; &lt;__&gt;</p>",
"should not support nonconforming tag names"
);
assert_eq!(
- micromark_with_options("<a h*#ref=\"hi\">", &danger)?,
+ to_html_with_options("<a h*#ref=\"hi\">", &danger)?,
"<p>&lt;a h*#ref=&quot;hi&quot;&gt;</p>",
"should not support nonconforming attribute names"
);
assert_eq!(
- micromark_with_options("<a href=\"hi'> <a href=hi'>", &danger)?,
+ to_html_with_options("<a href=\"hi'> <a href=hi'>", &danger)?,
"<p>&lt;a href=&quot;hi'&gt; &lt;a href=hi'&gt;</p>",
"should not support nonconforming attribute values"
);
assert_eq!(
- micromark_with_options("< a><\nfoo><bar/ >\n<foo bar=baz\nbim!bop />", &danger)?,
+ to_html_with_options("< a><\nfoo><bar/ >\n<foo bar=baz\nbim!bop />", &danger)?,
"<p>&lt; a&gt;&lt;\nfoo&gt;&lt;bar/ &gt;\n&lt;foo bar=baz\nbim!bop /&gt;</p>",
"should not support nonconforming whitespace"
);
assert_eq!(
- micromark_with_options("<a href='bar'title=title>", &danger)?,
+ to_html_with_options("<a href='bar'title=title>", &danger)?,
"<p>&lt;a href='bar'title=title&gt;</p>",
"should not support missing whitespace"
);
assert_eq!(
- micromark_with_options("</a></foo >", &danger)?,
+ to_html_with_options("</a></foo >", &danger)?,
"<p></a></foo ></p>",
"should support closing tags"
);
assert_eq!(
- micromark_with_options("</a href=\"foo\">", &danger)?,
+ to_html_with_options("</a href=\"foo\">", &danger)?,
"<p>&lt;/a href=&quot;foo&quot;&gt;</p>",
"should not support closing tags w/ attributes"
);
assert_eq!(
- micromark_with_options("foo <!-- this is a\ncomment - with hyphen -->", &danger)?,
+ to_html_with_options("foo <!-- this is a\ncomment - with hyphen -->", &danger)?,
"<p>foo <!-- this is a\ncomment - with hyphen --></p>",
"should support comments"
);
assert_eq!(
- micromark_with_options("foo <!-- not a comment -- two hyphens -->", &danger)?,
+ to_html_with_options("foo <!-- not a comment -- two hyphens -->", &danger)?,
"<p>foo &lt;!-- not a comment -- two hyphens --&gt;</p>",
"should not support comments w/ two dashes inside"
);
assert_eq!(
- micromark_with_options("foo <!--> foo -->", &danger)?,
+ to_html_with_options("foo <!--> foo -->", &danger)?,
"<p>foo &lt;!--&gt; foo --&gt;</p>",
"should not support nonconforming comments (1)"
);
assert_eq!(
- micromark_with_options("foo <!-- foo--->", &danger)?,
+ to_html_with_options("foo <!-- foo--->", &danger)?,
"<p>foo &lt;!-- foo---&gt;</p>",
"should not support nonconforming comments (2)"
);
assert_eq!(
- micromark_with_options("foo <?php echo $a; ?>", &danger)?,
+ to_html_with_options("foo <?php echo $a; ?>", &danger)?,
"<p>foo <?php echo $a; ?></p>",
"should support instructions"
);
assert_eq!(
- micromark_with_options("foo <!ELEMENT br EMPTY>", &danger)?,
+ to_html_with_options("foo <!ELEMENT br EMPTY>", &danger)?,
"<p>foo <!ELEMENT br EMPTY></p>",
"should support declarations"
);
assert_eq!(
- micromark_with_options("foo <![CDATA[>&<]]>", &danger)?,
+ to_html_with_options("foo <![CDATA[>&<]]>", &danger)?,
"<p>foo <![CDATA[>&<]]></p>",
"should support cdata"
);
assert_eq!(
- micromark_with_options("foo <a href=\"&ouml;\">", &danger)?,
+ to_html_with_options("foo <a href=\"&ouml;\">", &danger)?,
"<p>foo <a href=\"&ouml;\"></p>",
"should support (ignore) character references"
);
assert_eq!(
- micromark_with_options("foo <a href=\"\\*\">", &danger)?,
+ to_html_with_options("foo <a href=\"\\*\">", &danger)?,
"<p>foo <a href=\"\\*\"></p>",
"should not support character escapes (1)"
);
assert_eq!(
- micromark_with_options("<a href=\"\\\"\">", &danger)?,
+ to_html_with_options("<a href=\"\\\"\">", &danger)?,
"<p>&lt;a href=&quot;&quot;&quot;&gt;</p>",
"should not support character escapes (2)"
);
// Extra:
assert_eq!(
- micromark_with_options("foo <!1>", &danger)?,
+ to_html_with_options("foo <!1>", &danger)?,
"<p>foo &lt;!1&gt;</p>",
"should not support non-comment, non-cdata, and non-named declaration"
);
assert_eq!(
- micromark_with_options("foo <!-not enough!-->", &danger)?,
+ to_html_with_options("foo <!-not enough!-->", &danger)?,
"<p>foo &lt;!-not enough!--&gt;</p>",
"should not support comments w/ not enough dashes"
);
assert_eq!(
- micromark_with_options("foo <!---ok-->", &danger)?,
+ to_html_with_options("foo <!---ok-->", &danger)?,
"<p>foo <!---ok--></p>",
"should support comments that start w/ a dash, if it’s not followed by a greater than"
);
assert_eq!(
- micromark_with_options("foo <!--->", &danger)?,
+ to_html_with_options("foo <!--->", &danger)?,
"<p>foo &lt;!---&gt;</p>",
"should not support comments that start w/ `->`"
);
assert_eq!(
- micromark_with_options("foo <!-- -> -->", &danger)?,
+ to_html_with_options("foo <!-- -> -->", &danger)?,
"<p>foo <!-- -> --></p>",
"should support `->` in a comment"
);
assert_eq!(
- micromark_with_options("foo <!--", &danger)?,
+ to_html_with_options("foo <!--", &danger)?,
"<p>foo &lt;!--</p>",
"should not support eof in a comment (1)"
);
assert_eq!(
- micromark_with_options("foo <!--a", &danger)?,
+ to_html_with_options("foo <!--a", &danger)?,
"<p>foo &lt;!--a</p>",
"should not support eof in a comment (2)"
);
assert_eq!(
- micromark_with_options("foo <!--a-", &danger)?,
+ to_html_with_options("foo <!--a-", &danger)?,
"<p>foo &lt;!--a-</p>",
"should not support eof in a comment (3)"
);
assert_eq!(
- micromark_with_options("foo <!--a--", &danger)?,
+ to_html_with_options("foo <!--a--", &danger)?,
"<p>foo &lt;!--a--</p>",
"should not support eof in a comment (4)"
);
@@ -217,204 +217,204 @@ fn html_text() -> Result<(), String> {
// Note: cmjs parses this differently.
// See: <https://github.com/commonmark/commonmark.js/issues/193>
assert_eq!(
- micromark_with_options("foo <![cdata[]]>", &danger)?,
+ to_html_with_options("foo <![cdata[]]>", &danger)?,
"<p>foo &lt;![cdata[]]&gt;</p>",
"should not support lowercase “cdata”"
);
assert_eq!(
- micromark_with_options("foo <![CDATA", &danger)?,
+ to_html_with_options("foo <![CDATA", &danger)?,
"<p>foo &lt;![CDATA</p>",
"should not support eof in a CDATA (1)"
);
assert_eq!(
- micromark_with_options("foo <![CDATA[", &danger)?,
+ to_html_with_options("foo <![CDATA[", &danger)?,
"<p>foo &lt;![CDATA[</p>",
"should not support eof in a CDATA (2)"
);
assert_eq!(
- micromark_with_options("foo <![CDATA[]", &danger)?,
+ to_html_with_options("foo <![CDATA[]", &danger)?,
"<p>foo &lt;![CDATA[]</p>",
"should not support eof in a CDATA (3)"
);
assert_eq!(
- micromark_with_options("foo <![CDATA[]]", &danger)?,
+ to_html_with_options("foo <![CDATA[]]", &danger)?,
"<p>foo &lt;![CDATA[]]</p>",
"should not support eof in a CDATA (4)"
);
assert_eq!(
- micromark_with_options("foo <![CDATA[asd", &danger)?,
+ to_html_with_options("foo <![CDATA[asd", &danger)?,
"<p>foo &lt;![CDATA[asd</p>",
"should not support eof in a CDATA (5)"
);
assert_eq!(
- micromark_with_options("foo <![CDATA[]]]]>", &danger)?,
+ to_html_with_options("foo <![CDATA[]]]]>", &danger)?,
"<p>foo <![CDATA[]]]]></p>",
"should support end-like constructs in CDATA"
);
assert_eq!(
- micromark_with_options("foo <!doctype", &danger)?,
+ to_html_with_options("foo <!doctype", &danger)?,
"<p>foo &lt;!doctype</p>",
"should not support eof in declarations"
);
assert_eq!(
- micromark_with_options("foo <?php", &danger)?,
+ to_html_with_options("foo <?php", &danger)?,
"<p>foo &lt;?php</p>",
"should not support eof in instructions (1)"
);
assert_eq!(
- micromark_with_options("foo <?php?", &danger)?,
+ to_html_with_options("foo <?php?", &danger)?,
"<p>foo &lt;?php?</p>",
"should not support eof in instructions (2)"
);
assert_eq!(
- micromark_with_options("foo <???>", &danger)?,
+ to_html_with_options("foo <???>", &danger)?,
"<p>foo <???></p>",
"should support question marks in instructions"
);
assert_eq!(
- micromark_with_options("foo </3>", &danger)?,
+ to_html_with_options("foo </3>", &danger)?,
"<p>foo &lt;/3&gt;</p>",
"should not support closing tags that don’t start w/ alphas"
);
assert_eq!(
- micromark_with_options("foo </a->", &danger)?,
+ to_html_with_options("foo </a->", &danger)?,
"<p>foo </a-></p>",
"should support dashes in closing tags"
);
assert_eq!(
- micromark_with_options("foo </a >", &danger)?,
+ to_html_with_options("foo </a >", &danger)?,
"<p>foo </a ></p>",
"should support whitespace after closing tag names"
);
assert_eq!(
- micromark_with_options("foo </a!>", &danger)?,
+ to_html_with_options("foo </a!>", &danger)?,
"<p>foo &lt;/a!&gt;</p>",
"should not support other characters after closing tag names"
);
assert_eq!(
- micromark_with_options("foo <a->", &danger)?,
+ to_html_with_options("foo <a->", &danger)?,
"<p>foo <a-></p>",
"should support dashes in opening tags"
);
assert_eq!(
- micromark_with_options("foo <a >", &danger)?,
+ to_html_with_options("foo <a >", &danger)?,
"<p>foo <a ></p>",
"should support whitespace after opening tag names"
);
assert_eq!(
- micromark_with_options("foo <a!>", &danger)?,
+ to_html_with_options("foo <a!>", &danger)?,
"<p>foo &lt;a!&gt;</p>",
"should not support other characters after opening tag names"
);
assert_eq!(
- micromark_with_options("foo <a !>", &danger)?,
+ to_html_with_options("foo <a !>", &danger)?,
"<p>foo &lt;a !&gt;</p>",
"should not support other characters in opening tags (1)"
);
assert_eq!(
- micromark_with_options("foo <a b!>", &danger)?,
+ to_html_with_options("foo <a b!>", &danger)?,
"<p>foo &lt;a b!&gt;</p>",
"should not support other characters in opening tags (2)"
);
assert_eq!(
- micromark_with_options("foo <a b/>", &danger)?,
+ to_html_with_options("foo <a b/>", &danger)?,
"<p>foo <a b/></p>",
"should support a self-closing slash after an attribute name"
);
assert_eq!(
- micromark_with_options("foo <a b>", &danger)?,
+ to_html_with_options("foo <a b>", &danger)?,
"<p>foo <a b></p>",
"should support a greater than after an attribute name"
);
assert_eq!(
- micromark_with_options("foo <a b=<>", &danger)?,
+ to_html_with_options("foo <a b=<>", &danger)?,
"<p>foo &lt;a b=&lt;&gt;</p>",
"should not support less than to start an unquoted attribute value"
);
assert_eq!(
- micromark_with_options("foo <a b=>>", &danger)?,
+ to_html_with_options("foo <a b=>>", &danger)?,
"<p>foo &lt;a b=&gt;&gt;</p>",
"should not support greater than to start an unquoted attribute value"
);
assert_eq!(
- micromark_with_options("foo <a b==>", &danger)?,
+ to_html_with_options("foo <a b==>", &danger)?,
"<p>foo &lt;a b==&gt;</p>",
"should not support equals to to start an unquoted attribute value"
);
assert_eq!(
- micromark_with_options("foo <a b=`>", &danger)?,
+ to_html_with_options("foo <a b=`>", &danger)?,
"<p>foo &lt;a b=`&gt;</p>",
"should not support grave accent to start an unquoted attribute value"
);
assert_eq!(
- micromark_with_options("foo <a b=\"asd", &danger)?,
+ to_html_with_options("foo <a b=\"asd", &danger)?,
"<p>foo &lt;a b=&quot;asd</p>",
"should not support eof in double quoted attribute value"
);
assert_eq!(
- micromark_with_options("foo <a b='asd", &danger)?,
+ to_html_with_options("foo <a b='asd", &danger)?,
"<p>foo &lt;a b='asd</p>",
"should not support eof in single quoted attribute value"
);
assert_eq!(
- micromark_with_options("foo <a b=asd", &danger)?,
+ to_html_with_options("foo <a b=asd", &danger)?,
"<p>foo &lt;a b=asd</p>",
"should not support eof in unquoted attribute value"
);
assert_eq!(
- micromark_with_options("foo <a b=\nasd>", &danger)?,
+ to_html_with_options("foo <a b=\nasd>", &danger)?,
"<p>foo <a b=\nasd></p>",
"should support an eol before an attribute value"
);
assert_eq!(
-micromark_with_options("<x> a", &danger)?,
+to_html_with_options("<x> a", &danger)?,
"<p><x> a</p>",
"should support starting a line w/ a tag if followed by anything other than an eol (after optional space/tabs)"
);
assert_eq!(
- micromark_with_options("<span foo=", &danger)?,
+ to_html_with_options("<span foo=", &danger)?,
"<p>&lt;span foo=</p>",
"should support an EOF before an attribute value"
);
assert_eq!(
- micromark_with_options("a <!b\nc>", &danger)?,
+ to_html_with_options("a <!b\nc>", &danger)?,
"<p>a <!b\nc></p>",
"should support an EOL in a declaration"
);
assert_eq!(
- micromark_with_options("a <![CDATA[\n]]>", &danger)?,
+ to_html_with_options("a <![CDATA[\n]]>", &danger)?,
"<p>a <![CDATA[\n]]></p>",
"should support an EOL in cdata"
);
@@ -422,13 +422,13 @@ micromark_with_options("<x> a", &danger)?,
// Note: cmjs parses this differently.
// See: <https://github.com/commonmark/commonmark.js/issues/196>
assert_eq!(
- micromark_with_options("a <?\n?>", &danger)?,
+ to_html_with_options("a <?\n?>", &danger)?,
"<p>a <?\n?></p>",
"should support an EOL in an instruction"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"a <x>",
&Options {
parse: ParseOptions {
@@ -446,7 +446,7 @@ micromark_with_options("<x> a", &danger)?,
);
assert_eq!(
- micromark_to_mdast("alpha <i>bravo</b> charlie.", &ParseOptions::default())?,
+ to_mdast("alpha <i>bravo</b> charlie.", &ParseOptions::default())?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![
diff --git a/tests/image.rs b/tests/image.rs
index 7b58e6d..3d53032 100644
--- a/tests/image.rs
+++ b/tests/image.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{Definition, Image, ImageReference, Node, Paragraph, ReferenceKind, Root, Text},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
@@ -10,181 +10,181 @@ use pretty_assertions::assert_eq;
#[test]
fn image() -> Result<(), String> {
assert_eq!(
- micromark("[link](/uri \"title\")"),
+ to_html("[link](/uri \"title\")"),
"<p><a href=\"/uri\" title=\"title\">link</a></p>",
"should support links"
);
assert_eq!(
- micromark("![foo](/url \"title\")"),
+ to_html("![foo](/url \"title\")"),
"<p><img src=\"/url\" alt=\"foo\" title=\"title\" /></p>",
"should support image w/ resource"
);
assert_eq!(
- micromark("[foo *bar*]: train.jpg \"train & tracks\"\n\n![foo *bar*]"),
+ to_html("[foo *bar*]: train.jpg \"train & tracks\"\n\n![foo *bar*]"),
"<p><img src=\"train.jpg\" alt=\"foo bar\" title=\"train &amp; tracks\" /></p>",
"should support image as shortcut reference"
);
assert_eq!(
- micromark("![foo ![bar](/url)](/url2)"),
+ to_html("![foo ![bar](/url)](/url2)"),
"<p><img src=\"/url2\" alt=\"foo bar\" /></p>",
"should “support” images in images"
);
assert_eq!(
- micromark("![foo [bar](/url)](/url2)"),
+ to_html("![foo [bar](/url)](/url2)"),
"<p><img src=\"/url2\" alt=\"foo bar\" /></p>",
"should “support” links in images"
);
assert_eq!(
- micromark("[foo *bar*]: train.jpg \"train & tracks\"\n\n![foo *bar*][]"),
+ to_html("[foo *bar*]: train.jpg \"train & tracks\"\n\n![foo *bar*][]"),
"<p><img src=\"train.jpg\" alt=\"foo bar\" title=\"train &amp; tracks\" /></p>",
"should support “content” in images"
);
assert_eq!(
- micromark("[FOOBAR]: train.jpg \"train & tracks\"\n\n![foo *bar*][foobar]"),
+ to_html("[FOOBAR]: train.jpg \"train & tracks\"\n\n![foo *bar*][foobar]"),
"<p><img src=\"train.jpg\" alt=\"foo bar\" title=\"train &amp; tracks\" /></p>",
"should support “content” in images"
);
assert_eq!(
- micromark("![foo](train.jpg)"),
+ to_html("![foo](train.jpg)"),
"<p><img src=\"train.jpg\" alt=\"foo\" /></p>",
"should support images w/o title"
);
assert_eq!(
- micromark("My ![foo bar](/path/to/train.jpg \"title\" )"),
+ to_html("My ![foo bar](/path/to/train.jpg \"title\" )"),
"<p>My <img src=\"/path/to/train.jpg\" alt=\"foo bar\" title=\"title\" /></p>",
"should support images w/ lots of whitespace"
);
assert_eq!(
- micromark("![foo](<url>)"),
+ to_html("![foo](<url>)"),
"<p><img src=\"url\" alt=\"foo\" /></p>",
"should support images w/ enclosed destinations"
);
assert_eq!(
- micromark("![](/url)"),
+ to_html("![](/url)"),
"<p><img src=\"/url\" alt=\"\" /></p>",
"should support images w/ empty labels"
);
assert_eq!(
- micromark("[bar]: /url\n\n![foo][bar]"),
+ to_html("[bar]: /url\n\n![foo][bar]"),
"<p><img src=\"/url\" alt=\"foo\" /></p>",
"should support full references (1)"
);
assert_eq!(
- micromark("[BAR]: /url\n\n![foo][bar]"),
+ to_html("[BAR]: /url\n\n![foo][bar]"),
"<p><img src=\"/url\" alt=\"foo\" /></p>",
"should support full references (2)"
);
assert_eq!(
- micromark("[foo]: /url \"title\"\n\n![foo][]"),
+ to_html("[foo]: /url \"title\"\n\n![foo][]"),
"<p><img src=\"/url\" alt=\"foo\" title=\"title\" /></p>",
"should support collapsed references (1)"
);
assert_eq!(
- micromark("[*foo* bar]: /url \"title\"\n\n![*foo* bar][]"),
+ to_html("[*foo* bar]: /url \"title\"\n\n![*foo* bar][]"),
"<p><img src=\"/url\" alt=\"foo bar\" title=\"title\" /></p>",
"should support collapsed references (2)"
);
assert_eq!(
- micromark("[foo]: /url \"title\"\n\n![Foo][]"),
+ to_html("[foo]: /url \"title\"\n\n![Foo][]"),
"<p><img src=\"/url\" alt=\"Foo\" title=\"title\" /></p>",
"should support case-insensitive labels"
);
assert_eq!(
- micromark("[foo]: /url \"title\"\n\n![foo] \n[]"),
+ to_html("[foo]: /url \"title\"\n\n![foo] \n[]"),
"<p><img src=\"/url\" alt=\"foo\" title=\"title\" />\n[]</p>",
"should not support whitespace between sets of brackets"
);
assert_eq!(
- micromark("[foo]: /url \"title\"\n\n![foo]"),
+ to_html("[foo]: /url \"title\"\n\n![foo]"),
"<p><img src=\"/url\" alt=\"foo\" title=\"title\" /></p>",
"should support shortcut references (1)"
);
assert_eq!(
- micromark("[*foo* bar]: /url \"title\"\n\n![*foo* bar]"),
+ to_html("[*foo* bar]: /url \"title\"\n\n![*foo* bar]"),
"<p><img src=\"/url\" alt=\"foo bar\" title=\"title\" /></p>",
"should support shortcut references (2)"
);
assert_eq!(
- micromark("[[foo]]: /url \"title\"\n\n![[foo]]"),
+ to_html("[[foo]]: /url \"title\"\n\n![[foo]]"),
"<p>[[foo]]: /url &quot;title&quot;</p>\n<p>![[foo]]</p>",
"should not support link labels w/ unescaped brackets"
);
assert_eq!(
- micromark("[foo]: /url \"title\"\n\n![Foo]"),
+ to_html("[foo]: /url \"title\"\n\n![Foo]"),
"<p><img src=\"/url\" alt=\"Foo\" title=\"title\" /></p>",
"should support case-insensitive label matching"
);
assert_eq!(
- micromark("[foo]: /url \"title\"\n\n!\\[foo]"),
+ to_html("[foo]: /url \"title\"\n\n!\\[foo]"),
"<p>![foo]</p>",
"should “support” an escaped bracket instead of an image"
);
assert_eq!(
- micromark("[foo]: /url \"title\"\n\n\\![foo]"),
+ to_html("[foo]: /url \"title\"\n\n\\![foo]"),
"<p>!<a href=\"/url\" title=\"title\">foo</a></p>",
"should support an escaped bang instead of an image, but still have a link"
);
// Extra
assert_eq!(
- micromark("![foo]()"),
+ to_html("![foo]()"),
"<p><img src=\"\" alt=\"foo\" /></p>",
"should support images w/o destination"
);
assert_eq!(
- micromark("![foo](<>)"),
+ to_html("![foo](<>)"),
"<p><img src=\"\" alt=\"foo\" /></p>",
"should support images w/ explicit empty destination"
);
assert_eq!(
- micromark("![](example.png)"),
+ to_html("![](example.png)"),
"<p><img src=\"example.png\" alt=\"\" /></p>",
"should support images w/o alt"
);
assert_eq!(
- micromark("![alpha](bravo.png \"\")"),
+ to_html("![alpha](bravo.png \"\")"),
"<p><img src=\"bravo.png\" alt=\"alpha\" /></p>",
"should support images w/ empty title (1)"
);
assert_eq!(
- micromark("![alpha](bravo.png '')"),
+ to_html("![alpha](bravo.png '')"),
"<p><img src=\"bravo.png\" alt=\"alpha\" /></p>",
"should support images w/ empty title (2)"
);
assert_eq!(
- micromark("![alpha](bravo.png ())"),
+ to_html("![alpha](bravo.png ())"),
"<p><img src=\"bravo.png\" alt=\"alpha\" /></p>",
"should support images w/ empty title (3)"
);
assert_eq!(
- micromark("![&amp;&copy;&](example.com/&amp;&copy;& \"&amp;&copy;&\")"),
+ to_html("![&amp;&copy;&](example.com/&amp;&copy;& \"&amp;&copy;&\")"),
"<p><img src=\"example.com/&amp;%C2%A9&amp;\" alt=\"&amp;©&amp;\" title=\"&amp;©&amp;\" /></p>",
"should support character references in images"
);
@@ -192,13 +192,13 @@ fn image() -> Result<(), String> {
// Extra
// See: <https://github.com/commonmark/commonmark.js/issues/192>
assert_eq!(
- micromark("![](<> \"\")"),
+ to_html("![](<> \"\")"),
"<p><img src=\"\" alt=\"\" /></p>",
"should ignore an empty title"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"![x]()",
&Options {
parse: ParseOptions {
@@ -216,13 +216,13 @@ fn image() -> Result<(), String> {
);
assert_eq!(
- micromark("![](javascript:alert(1))"),
+ to_html("![](javascript:alert(1))"),
"<p><img src=\"\" alt=\"\" /></p>",
"should ignore non-http protocols by default"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"![](javascript:alert(1))",
&Options {
compile: CompileOptions {
@@ -237,7 +237,7 @@ fn image() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast(
+ to_mdast(
"a ![alpha]() b ![bravo](charlie 'delta') c.",
&ParseOptions::default()
)?,
@@ -277,7 +277,7 @@ fn image() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast(
+ to_mdast(
"[x]: y\n\na ![x] b ![x][] c ![d][x] e.",
&ParseOptions::default()
)?,
diff --git a/tests/link_reference.rs b/tests/link_reference.rs
index 5e00dab..3769fbc 100644
--- a/tests/link_reference.rs
+++ b/tests/link_reference.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{Definition, LinkReference, Node, Paragraph, ReferenceKind, Root, Text},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
@@ -19,277 +19,277 @@ fn link_reference() -> Result<(), String> {
};
assert_eq!(
- micromark("[bar]: /url \"title\"\n\n[foo][bar]"),
+ to_html("[bar]: /url \"title\"\n\n[foo][bar]"),
"<p><a href=\"/url\" title=\"title\">foo</a></p>",
"should support link references"
);
assert_eq!(
- micromark("[ref]: /uri\n\n[link [foo [bar]]][ref]"),
+ to_html("[ref]: /uri\n\n[link [foo [bar]]][ref]"),
"<p><a href=\"/uri\">link [foo [bar]]</a></p>",
"should support balanced brackets in link references"
);
assert_eq!(
- micromark("[ref]: /uri\n\n[link \\[bar][ref]"),
+ to_html("[ref]: /uri\n\n[link \\[bar][ref]"),
"<p><a href=\"/uri\">link [bar</a></p>",
"should support escaped brackets in link references"
);
assert_eq!(
- micromark("[ref]: /uri\n\n[link *foo **bar** `#`*][ref]"),
+ to_html("[ref]: /uri\n\n[link *foo **bar** `#`*][ref]"),
"<p><a href=\"/uri\">link <em>foo <strong>bar</strong> <code>#</code></em></a></p>",
"should support content in link references"
);
assert_eq!(
- micromark("[ref]: /uri\n\n[![moon](moon.jpg)][ref]"),
+ to_html("[ref]: /uri\n\n[![moon](moon.jpg)][ref]"),
"<p><a href=\"/uri\"><img src=\"moon.jpg\" alt=\"moon\" /></a></p>",
"should support images in link references"
);
assert_eq!(
- micromark("[ref]: /uri\n\n[foo [bar](/uri)][ref]"),
+ to_html("[ref]: /uri\n\n[foo [bar](/uri)][ref]"),
"<p>[foo <a href=\"/uri\">bar</a>]<a href=\"/uri\">ref</a></p>",
"should not support links in link references"
);
assert_eq!(
- micromark("[ref]: /uri\n\n[foo *bar [baz][ref]*][ref]"),
+ to_html("[ref]: /uri\n\n[foo *bar [baz][ref]*][ref]"),
"<p>[foo <em>bar <a href=\"/uri\">baz</a></em>]<a href=\"/uri\">ref</a></p>",
"should not support deep links in link references"
);
assert_eq!(
- micromark("[ref]: /uri\n\n*[foo*][ref]"),
+ to_html("[ref]: /uri\n\n*[foo*][ref]"),
"<p>*<a href=\"/uri\">foo*</a></p>",
"should prefer link references over emphasis (1)"
);
assert_eq!(
- micromark("[ref]: /uri\n\n[foo *bar][ref]"),
+ to_html("[ref]: /uri\n\n[foo *bar][ref]"),
"<p><a href=\"/uri\">foo *bar</a></p>",
"should prefer link references over emphasis (2)"
);
assert_eq!(
- micromark_with_options("[ref]: /uri\n\n[foo <bar attr=\"][ref]\">", &danger)?,
+ to_html_with_options("[ref]: /uri\n\n[foo <bar attr=\"][ref]\">", &danger)?,
"<p>[foo <bar attr=\"][ref]\"></p>",
"should prefer HTML over link references"
);
assert_eq!(
- micromark("[ref]: /uri\n\n[foo`][ref]`"),
+ to_html("[ref]: /uri\n\n[foo`][ref]`"),
"<p>[foo<code>][ref]</code></p>",
"should prefer code over link references"
);
assert_eq!(
- micromark("[ref]: /uri\n\n[foo<http://example.com/?search=][ref]>"),
+ to_html("[ref]: /uri\n\n[foo<http://example.com/?search=][ref]>"),
"<p>[foo<a href=\"http://example.com/?search=%5D%5Bref%5D\">http://example.com/?search=][ref]</a></p>",
"should prefer autolinks over link references"
);
assert_eq!(
- micromark("[bar]: /url \"title\"\n\n[foo][BaR]"),
+ to_html("[bar]: /url \"title\"\n\n[foo][BaR]"),
"<p><a href=\"/url\" title=\"title\">foo</a></p>",
"should match references to definitions case-insensitively"
);
assert_eq!(
- micromark("[ТОЛПОЙ]: /url\n\n[Толпой][Толпой] is a Russian word."),
+ to_html("[ТОЛПОЙ]: /url\n\n[Толпой][Толпой] is a Russian word."),
"<p><a href=\"/url\">Толпой</a> is a Russian word.</p>",
"should match references to definitions w/ unicode case-folding"
);
assert_eq!(
- micromark("[Foo\n bar]: /url\n\n[Baz][Foo bar]"),
+ to_html("[Foo\n bar]: /url\n\n[Baz][Foo bar]"),
"<p><a href=\"/url\">Baz</a></p>",
"should match references to definitions w/ collapsing"
);
assert_eq!(
- micromark("[bar]: /url \"title\"\n\n[foo] [bar]"),
+ to_html("[bar]: /url \"title\"\n\n[foo] [bar]"),
"<p>[foo] <a href=\"/url\" title=\"title\">bar</a></p>",
"should not support whitespace between label and reference (1)"
);
assert_eq!(
- micromark("[bar]: /url \"title\"\n\n[foo]\n[bar]"),
+ to_html("[bar]: /url \"title\"\n\n[foo]\n[bar]"),
"<p>[foo]\n<a href=\"/url\" title=\"title\">bar</a></p>",
"should not support whitespace between label and reference (2)"
);
assert_eq!(
- micromark("[foo]: /url1\n\n[foo]: /url2\n\n[bar][foo]"),
+ to_html("[foo]: /url1\n\n[foo]: /url2\n\n[bar][foo]"),
"<p><a href=\"/url1\">bar</a></p>",
"should prefer earlier definitions"
);
assert_eq!(
- micromark("[foo!]: /url\n\n[bar][foo\\!]"),
+ to_html("[foo!]: /url\n\n[bar][foo\\!]"),
"<p>[bar][foo!]</p>",
"should not match references to definitions w/ escapes"
);
assert_eq!(
- micromark("[ref[]: /uri\n\n[foo][ref[]"),
+ to_html("[ref[]: /uri\n\n[foo][ref[]"),
"<p>[ref[]: /uri</p>\n<p>[foo][ref[]</p>",
"should not support references w/ brackets (1)"
);
assert_eq!(
- micromark("[ref[bar]]: /uri\n\n[foo][ref[bar]]"),
+ to_html("[ref[bar]]: /uri\n\n[foo][ref[bar]]"),
"<p>[ref[bar]]: /uri</p>\n<p>[foo][ref[bar]]</p>",
"should not support references w/ brackets (2)"
);
assert_eq!(
- micromark("[[[foo]]]: /url\n\n[[[foo]]]"),
+ to_html("[[[foo]]]: /url\n\n[[[foo]]]"),
"<p>[[[foo]]]: /url</p>\n<p>[[[foo]]]</p>",
"should not support references w/ brackets (3)"
);
assert_eq!(
- micromark("[ref\\[]: /uri\n\n[foo][ref\\[]"),
+ to_html("[ref\\[]: /uri\n\n[foo][ref\\[]"),
"<p><a href=\"/uri\">foo</a></p>",
"should match references to definitions w/ matching escapes"
);
assert_eq!(
- micromark("[bar\\\\]: /uri\n\n[bar\\\\]"),
+ to_html("[bar\\\\]: /uri\n\n[bar\\\\]"),
"<p><a href=\"/uri\">bar\\</a></p>",
"should support escapes"
);
assert_eq!(
- micromark("[]: /uri\n\n[]"),
+ to_html("[]: /uri\n\n[]"),
"<p>[]: /uri</p>\n<p>[]</p>",
"should not support empty references"
);
assert_eq!(
- micromark("[\n ]: /uri\n\n[\n ]"),
+ to_html("[\n ]: /uri\n\n[\n ]"),
"<p>[\n]: /uri</p>\n<p>[\n]</p>",
"should not support blank references"
);
assert_eq!(
- micromark("[foo]: /url \"title\"\n\n[foo][]"),
+ to_html("[foo]: /url \"title\"\n\n[foo][]"),
"<p><a href=\"/url\" title=\"title\">foo</a></p>",
"should support collaped references"
);
assert_eq!(
- micromark("[*foo* bar]: /url \"title\"\n\n[*foo* bar][]"),
+ to_html("[*foo* bar]: /url \"title\"\n\n[*foo* bar][]"),
"<p><a href=\"/url\" title=\"title\"><em>foo</em> bar</a></p>",
"should support content in collaped references"
);
assert_eq!(
- micromark("[foo]: /url \"title\"\n\n[Foo][]"),
+ to_html("[foo]: /url \"title\"\n\n[Foo][]"),
"<p><a href=\"/url\" title=\"title\">Foo</a></p>",
"should match references to definitions case-insensitively"
);
assert_eq!(
- micromark("[foo]: /url \"title\"\n\n[foo] \n[]"),
+ to_html("[foo]: /url \"title\"\n\n[foo] \n[]"),
"<p><a href=\"/url\" title=\"title\">foo</a>\n[]</p>",
"should not support whitespace between label and collaped reference"
);
assert_eq!(
- micromark("[foo]: /url \"title\"\n\n[foo]"),
+ to_html("[foo]: /url \"title\"\n\n[foo]"),
"<p><a href=\"/url\" title=\"title\">foo</a></p>",
"should support shortcut references"
);
assert_eq!(
- micromark("[*foo* bar]: /url \"title\"\n\n[*foo* bar]"),
+ to_html("[*foo* bar]: /url \"title\"\n\n[*foo* bar]"),
"<p><a href=\"/url\" title=\"title\"><em>foo</em> bar</a></p>",
"should support content in shortcut references (1)"
);
assert_eq!(
- micromark("[*foo* bar]: /url \"title\"\n\n[[*foo* bar]]"),
+ to_html("[*foo* bar]: /url \"title\"\n\n[[*foo* bar]]"),
"<p>[<a href=\"/url\" title=\"title\"><em>foo</em> bar</a>]</p>",
"should support content in shortcut references (2)"
);
assert_eq!(
- micromark("[foo]: /url\n\n[[bar [foo]"),
+ to_html("[foo]: /url\n\n[[bar [foo]"),
"<p>[[bar <a href=\"/url\">foo</a></p>",
"should support content in shortcut references (3)"
);
assert_eq!(
- micromark("[foo]: /url \"title\"\n\n[Foo]"),
+ to_html("[foo]: /url \"title\"\n\n[Foo]"),
"<p><a href=\"/url\" title=\"title\">Foo</a></p>",
"should match shortcut references to definitions case-insensitively"
);
assert_eq!(
- micromark("[foo]: /url\n\n[foo] bar"),
+ to_html("[foo]: /url\n\n[foo] bar"),
"<p><a href=\"/url\">foo</a> bar</p>",
"should support whitespace after a shortcut reference"
);
assert_eq!(
- micromark("[foo]: /url \"title\"\n\n\\[foo]"),
+ to_html("[foo]: /url \"title\"\n\n\\[foo]"),
"<p>[foo]</p>",
"should “support” an escaped shortcut reference"
);
assert_eq!(
- micromark("[foo*]: /url\n\n*[foo*]"),
+ to_html("[foo*]: /url\n\n*[foo*]"),
"<p>*<a href=\"/url\">foo*</a></p>",
"should prefer shortcut references over emphasis"
);
assert_eq!(
- micromark("[foo]: /url1\n[bar]: /url2\n\n[foo][bar]"),
+ to_html("[foo]: /url1\n[bar]: /url2\n\n[foo][bar]"),
"<p><a href=\"/url2\">foo</a></p>",
"should prefer full references over shortcut references"
);
assert_eq!(
- micromark("[foo]: /url1\n\n[foo][]"),
+ to_html("[foo]: /url1\n\n[foo][]"),
"<p><a href=\"/url1\">foo</a></p>",
"should prefer collapsed references over shortcut references"
);
assert_eq!(
- micromark("[foo]: /url\n\n[foo]()"),
+ to_html("[foo]: /url\n\n[foo]()"),
"<p><a href=\"\">foo</a></p>",
"should prefer resources over shortcut references (1)"
);
assert_eq!(
- micromark("[foo]: /url \"title\"\n\n[foo]()"),
+ to_html("[foo]: /url \"title\"\n\n[foo]()"),
"<p><a href=\"\">foo</a></p>",
"should prefer resources over shortcut references (2)"
);
assert_eq!(
- micromark("[foo]: /url1\n\n[foo](not a link)"),
+ to_html("[foo]: /url1\n\n[foo](not a link)"),
"<p><a href=\"/url1\">foo</a>(not a link)</p>",
"should support shortcut references when followed by nonconforming resources"
);
assert_eq!(
- micromark("[baz]: /url\n\n[foo][bar][baz]"),
+ to_html("[baz]: /url\n\n[foo][bar][baz]"),
"<p>[foo]<a href=\"/url\">bar</a></p>",
"stable/unstable (1)"
);
assert_eq!(
- micromark("[baz]: /url1\n[bar]: /url2\n\n[foo][bar][baz]"),
+ to_html("[baz]: /url1\n[bar]: /url2\n\n[foo][bar][baz]"),
"<p><a href=\"/url2\">foo</a><a href=\"/url1\">baz</a></p>",
"stable/unstable (2)"
);
assert_eq!(
- micromark("[baz]: /url1\n[foo]: /url2\n\n[foo][bar][baz]"),
+ to_html("[baz]: /url1\n[foo]: /url2\n\n[foo][bar][baz]"),
"<p>[foo]<a href=\"/url1\">bar</a></p>",
"stable/unstable (3)"
);
@@ -298,52 +298,50 @@ fn link_reference() -> Result<(), String> {
// This matches most implimentations, but is not strictly according to spec.
// See: <https://github.com/commonmark/commonmark-spec/issues/653>
assert_eq!(
- micromark("[x]: /url\n\n[x][ ], [x][\t], [x][\n], [x][]"),
+ to_html("[x]: /url\n\n[x][ ], [x][\t], [x][\n], [x][]"),
"<p>[x][ ], [x][\t], [x][\n], <a href=\"/url\">x</a></p>",
"should not support whitespace-only full references"
);
// See also: <https://github.com/commonmark/commonmark-spec/issues/616>
assert_eq!(
- micromark("[+]: example.com\n[\\;]: example.com\n\nWill it link? [\\+], [;]"),
+ to_html("[+]: example.com\n[\\;]: example.com\n\nWill it link? [\\+], [;]"),
"<p>Will it link? [+], [;]</p>",
"should not support mismatched character escapes in shortcuts"
);
assert_eq!(
- micromark("[©]: example.com\n[&amp;]: example.com\n\nWill it link? [&copy;], [&]"),
+ to_html("[©]: example.com\n[&amp;]: example.com\n\nWill it link? [&copy;], [&]"),
"<p>Will it link? [©], [&amp;]</p>",
"should not support mismatched character references in shortcuts"
);
assert_eq!(
- micromark("[+]: example.com\n[\\;]: example.com\n\nWill it link? [\\+][], [;][]"),
+ to_html("[+]: example.com\n[\\;]: example.com\n\nWill it link? [\\+][], [;][]"),
"<p>Will it link? [+][], [;][]</p>",
"should not support mismatched character escapes in collapsed"
);
assert_eq!(
- micromark("[©]: example.com\n[&amp;]: example.com\n\nWill it link? [&copy;][], [&][]"),
+ to_html("[©]: example.com\n[&amp;]: example.com\n\nWill it link? [&copy;][], [&][]"),
"<p>Will it link? [©][], [&amp;][]</p>",
"should not support mismatched character references in collapsed"
);
assert_eq!(
- micromark("[+]: example.com\n[\\;]: example.com\n\nWill it link? [a][ \\+ ], [b][ ; ]"),
+ to_html("[+]: example.com\n[\\;]: example.com\n\nWill it link? [a][ \\+ ], [b][ ; ]"),
"<p>Will it link? [a][ + ], [b][ ; ]</p>",
"should not support mismatched character escapes in fulls"
);
assert_eq!(
- micromark(
- "[©]: example.com\n[&amp;]: example.com\n\nWill it link? [a][ &copy; ], [b][ & ]"
- ),
+ to_html("[©]: example.com\n[&amp;]: example.com\n\nWill it link? [a][ &copy; ], [b][ & ]"),
"<p>Will it link? [a][ © ], [b][ &amp; ]</p>",
"should not support mismatched character references in fulls"
);
assert_eq!(
- micromark(
+ to_html(
"[*f*][]
[&semi;][]
[\\;][]
@@ -375,25 +373,25 @@ fn link_reference() -> Result<(), String> {
let max = "x".repeat(999);
assert_eq!(
- micromark(format!("[{}]: a\n[y][{}]", max, max).as_str()),
+ to_html(format!("[{}]: a\n[y][{}]", max, max).as_str()),
"<p><a href=\"a\">y</a></p>",
"should support 999 characters in a reference"
);
assert_eq!(
- micromark(format!("[{}x]: a\n[y][{}x]", max, max).as_str()),
+ to_html(format!("[{}x]: a\n[y][{}x]", max, max).as_str()),
format!("<p>[{}x]: a\n[y][{}x]</p>", max, max),
"should not support 1000 characters in a reference"
);
assert_eq!(
- micromark("[x] missing-colon\n\nWill it link? [x]"),
+ to_html("[x] missing-colon\n\nWill it link? [x]"),
"<p>[x] missing-colon</p>\n<p>Will it link? [x]</p>",
"should not fail on a missing colon in a definition"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"[x]()",
&Options {
parse: ParseOptions {
@@ -411,7 +409,7 @@ fn link_reference() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"[x]()",
&Options {
parse: ParseOptions {
@@ -429,7 +427,7 @@ fn link_reference() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast(
+ to_mdast(
"[x]: y\n\na [x] b [x][] c [d][x] e.",
&ParseOptions::default()
)?,
diff --git a/tests/link_resource.rs b/tests/link_resource.rs
index 4554d86..5f9cddc 100644
--- a/tests/link_resource.rs
+++ b/tests/link_resource.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{Link, Node, Paragraph, Root, Text},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Options, ParseOptions,
};
@@ -19,455 +19,455 @@ fn link_resource() -> Result<(), String> {
};
assert_eq!(
- micromark("[link](/uri \"title\")"),
+ to_html("[link](/uri \"title\")"),
"<p><a href=\"/uri\" title=\"title\">link</a></p>",
"should support links"
);
assert_eq!(
- micromark("[link](/uri)"),
+ to_html("[link](/uri)"),
"<p><a href=\"/uri\">link</a></p>",
"should support links w/o title"
);
assert_eq!(
- micromark("[link]()"),
+ to_html("[link]()"),
"<p><a href=\"\">link</a></p>",
"should support links w/o destination"
);
assert_eq!(
- micromark("[link](<>)"),
+ to_html("[link](<>)"),
"<p><a href=\"\">link</a></p>",
"should support links w/ empty enclosed destination"
);
assert_eq!(
- micromark("[link](/my uri)"),
+ to_html("[link](/my uri)"),
"<p>[link](/my uri)</p>",
"should not support links w/ spaces in destination"
);
assert_eq!(
- micromark("[link](</my uri>)"),
+ to_html("[link](</my uri>)"),
"<p><a href=\"/my%20uri\">link</a></p>",
"should support links w/ spaces in enclosed destination"
);
assert_eq!(
- micromark("[link](foo\nbar)"),
+ to_html("[link](foo\nbar)"),
"<p>[link](foo\nbar)</p>",
"should not support links w/ line endings in destination"
);
assert_eq!(
- micromark_with_options("[link](<foo\nbar>)", &danger)?,
+ to_html_with_options("[link](<foo\nbar>)", &danger)?,
"<p>[link](<foo\nbar>)</p>",
"should not support links w/ line endings in enclosed destination"
);
assert_eq!(
- micromark("[a](<b)c>)"),
+ to_html("[a](<b)c>)"),
"<p><a href=\"b)c\">a</a></p>",
"should support links w/ closing parens in destination"
);
assert_eq!(
- micromark("[link](<foo\\>)"),
+ to_html("[link](<foo\\>)"),
"<p>[link](&lt;foo&gt;)</p>",
"should not support links w/ enclosed destinations w/o end"
);
assert_eq!(
- micromark_with_options("[a](<b)c\n[a](<b)c>\n[a](<b>c)", &danger)?,
+ to_html_with_options("[a](<b)c\n[a](<b)c>\n[a](<b>c)", &danger)?,
"<p>[a](&lt;b)c\n[a](&lt;b)c&gt;\n[a](<b>c)</p>",
"should not support links w/ unmatched enclosed destinations"
);
assert_eq!(
- micromark("[link](\\(foo\\))"),
+ to_html("[link](\\(foo\\))"),
"<p><a href=\"(foo)\">link</a></p>",
"should support links w/ destinations w/ escaped parens"
);
assert_eq!(
- micromark("[link](foo(and(bar)))"),
+ to_html("[link](foo(and(bar)))"),
"<p><a href=\"foo(and(bar))\">link</a></p>",
"should support links w/ destinations w/ balanced parens"
);
assert_eq!(
- micromark("[link](foo\\(and\\(bar\\))"),
+ to_html("[link](foo\\(and\\(bar\\))"),
"<p><a href=\"foo(and(bar)\">link</a></p>",
"should support links w/ destinations w/ escaped parens"
);
assert_eq!(
- micromark("[link](<foo(and(bar)>)"),
+ to_html("[link](<foo(and(bar)>)"),
"<p><a href=\"foo(and(bar)\">link</a></p>",
"should support links w/ enclosed destinations w/ parens"
);
assert_eq!(
- micromark_with_options("[link](foo\\)\\:)", &danger)?,
+ to_html_with_options("[link](foo\\)\\:)", &danger)?,
"<p><a href=\"foo):\">link</a></p>",
"should support links w/ escapes in destinations"
);
assert_eq!(
- micromark("[link](#fragment)"),
+ to_html("[link](#fragment)"),
"<p><a href=\"#fragment\">link</a></p>",
"should support links w/ destinations to fragments"
);
assert_eq!(
- micromark("[link](http://example.com#fragment)"),
+ to_html("[link](http://example.com#fragment)"),
"<p><a href=\"http://example.com#fragment\">link</a></p>",
"should support links w/ destinations to URLs w/ fragments"
);
assert_eq!(
- micromark("[link](http://example.com?foo=3#frag)"),
+ to_html("[link](http://example.com?foo=3#frag)"),
"<p><a href=\"http://example.com?foo=3#frag\">link</a></p>",
"should support links w/ destinations to URLs w/ search and fragments"
);
assert_eq!(
- micromark("[link](foo\\bar)"),
+ to_html("[link](foo\\bar)"),
"<p><a href=\"foo%5Cbar\">link</a></p>",
"should not support non-punctuation character escapes in links"
);
assert_eq!(
- micromark("[link](foo%20b&auml;)"),
+ to_html("[link](foo%20b&auml;)"),
"<p><a href=\"foo%20b%C3%A4\">link</a></p>",
"should support character references in links"
);
assert_eq!(
- micromark("[link](\"title\")"),
+ to_html("[link](\"title\")"),
"<p><a href=\"%22title%22\">link</a></p>",
"should not support links w/ only a title"
);
assert_eq!(
- micromark("[link](/url \"title\")"),
+ to_html("[link](/url \"title\")"),
"<p><a href=\"/url\" title=\"title\">link</a></p>",
"should support titles w/ double quotes"
);
assert_eq!(
- micromark("[link](/url 'title')"),
+ to_html("[link](/url 'title')"),
"<p><a href=\"/url\" title=\"title\">link</a></p>",
"should support titles w/ single quotes"
);
assert_eq!(
- micromark("[link](/url (title))"),
+ to_html("[link](/url (title))"),
"<p><a href=\"/url\" title=\"title\">link</a></p>",
"should support titles w/ parens"
);
assert_eq!(
- micromark("[link](/url \"title \\\"&quot;\")"),
+ to_html("[link](/url \"title \\\"&quot;\")"),
"<p><a href=\"/url\" title=\"title &quot;&quot;\">link</a></p>",
"should support character references and escapes in titles"
);
assert_eq!(
- micromark("[link](/url \"title\")"),
+ to_html("[link](/url \"title\")"),
"<p><a href=\"/url%C2%A0%22title%22\">link</a></p>",
"should not support unicode whitespace between destination and title"
);
assert_eq!(
- micromark("[link](/url \"title \"and\" title\")"),
+ to_html("[link](/url \"title \"and\" title\")"),
"<p>[link](/url &quot;title &quot;and&quot; title&quot;)</p>",
"should not support nested balanced quotes in title"
);
assert_eq!(
- micromark("[link](/url 'title \"and\" title')"),
+ to_html("[link](/url 'title \"and\" title')"),
"<p><a href=\"/url\" title=\"title &quot;and&quot; title\">link</a></p>",
"should support the other quotes in titles"
);
assert_eq!(
- micromark("[link]( /uri\n \"title\" )"),
+ to_html("[link]( /uri\n \"title\" )"),
"<p><a href=\"/uri\" title=\"title\">link</a></p>",
"should support whitespace around destination and title (1)"
);
assert_eq!(
- micromark("[link](\t\n/uri \"title\")"),
+ to_html("[link](\t\n/uri \"title\")"),
"<p><a href=\"/uri\" title=\"title\">link</a></p>",
"should support whitespace around destination and title (2)"
);
assert_eq!(
- micromark("[link](/uri \"title\"\t\n)"),
+ to_html("[link](/uri \"title\"\t\n)"),
"<p><a href=\"/uri\" title=\"title\">link</a></p>",
"should support whitespace around destination and title (3)"
);
assert_eq!(
- micromark("[link] (/uri)"),
+ to_html("[link] (/uri)"),
"<p>[link] (/uri)</p>",
"should not support whitespace between label and resource"
);
assert_eq!(
- micromark("[link [foo [bar]]](/uri)"),
+ to_html("[link [foo [bar]]](/uri)"),
"<p><a href=\"/uri\">link [foo [bar]]</a></p>",
"should support balanced brackets"
);
assert_eq!(
- micromark("[link] bar](/uri)"),
+ to_html("[link] bar](/uri)"),
"<p>[link] bar](/uri)</p>",
"should not support unbalanced brackets (1)"
);
assert_eq!(
- micromark("[link [bar](/uri)"),
+ to_html("[link [bar](/uri)"),
"<p>[link <a href=\"/uri\">bar</a></p>",
"should not support unbalanced brackets (2)"
);
assert_eq!(
- micromark("[link \\[bar](/uri)"),
+ to_html("[link \\[bar](/uri)"),
"<p><a href=\"/uri\">link [bar</a></p>",
"should support characer escapes"
);
assert_eq!(
- micromark("[link *foo **bar** `#`*](/uri)"),
+ to_html("[link *foo **bar** `#`*](/uri)"),
"<p><a href=\"/uri\">link <em>foo <strong>bar</strong> <code>#</code></em></a></p>",
"should support content"
);
assert_eq!(
- micromark("[![moon](moon.jpg)](/uri)"),
+ to_html("[![moon](moon.jpg)](/uri)"),
"<p><a href=\"/uri\"><img src=\"moon.jpg\" alt=\"moon\" /></a></p>",
"should support an image as content"
);
assert_eq!(
- micromark("[foo [bar](/uri)](/uri)"),
+ to_html("[foo [bar](/uri)](/uri)"),
"<p>[foo <a href=\"/uri\">bar</a>](/uri)</p>",
"should not support links in links (1)"
);
assert_eq!(
- micromark("[foo *[bar [baz](/uri)](/uri)*](/uri)"),
+ to_html("[foo *[bar [baz](/uri)](/uri)*](/uri)"),
"<p>[foo <em>[bar <a href=\"/uri\">baz</a>](/uri)</em>](/uri)</p>",
"should not support links in links (2)"
);
assert_eq!(
- micromark("![[[foo](uri1)](uri2)](uri3)"),
+ to_html("![[[foo](uri1)](uri2)](uri3)"),
"<p><img src=\"uri3\" alt=\"[foo](uri2)\" /></p>",
"should not support links in links (3)"
);
assert_eq!(
- micromark("*[foo*](/uri)"),
+ to_html("*[foo*](/uri)"),
"<p>*<a href=\"/uri\">foo*</a></p>",
"should prefer links over emphasis (1)"
);
assert_eq!(
- micromark("[foo *bar](baz*)"),
+ to_html("[foo *bar](baz*)"),
"<p><a href=\"baz*\">foo *bar</a></p>",
"should prefer links over emphasis (2)"
);
assert_eq!(
- micromark_with_options("[foo <bar attr=\"](baz)\">", &danger)?,
+ to_html_with_options("[foo <bar attr=\"](baz)\">", &danger)?,
"<p>[foo <bar attr=\"](baz)\"></p>",
"should prefer HTML over links"
);
assert_eq!(
- micromark("[foo`](/uri)`"),
+ to_html("[foo`](/uri)`"),
"<p>[foo<code>](/uri)</code></p>",
"should prefer code over links"
);
assert_eq!(
- micromark("[foo<http://example.com/?search=](uri)>"),
+ to_html("[foo<http://example.com/?search=](uri)>"),
"<p>[foo<a href=\"http://example.com/?search=%5D(uri)\">http://example.com/?search=](uri)</a></p>",
"should prefer autolinks over links"
);
assert_eq!(
- micromark("[foo<http://example.com/?search=](uri)>"),
+ to_html("[foo<http://example.com/?search=](uri)>"),
"<p>[foo<a href=\"http://example.com/?search=%5D(uri)\">http://example.com/?search=](uri)</a></p>",
"should prefer autolinks over links"
);
// Extra
assert_eq!(
- micromark("[]()"),
+ to_html("[]()"),
"<p><a href=\"\"></a></p>",
"should support an empty link"
);
// See: <https://github.com/commonmark/commonmark.js/issues/192>
assert_eq!(
- micromark("[](<> \"\")"),
+ to_html("[](<> \"\")"),
"<p><a href=\"\"></a></p>",
"should ignore an empty title"
);
assert_eq!(
- micromark_with_options("[a](<b>\"c\")", &danger)?,
+ to_html_with_options("[a](<b>\"c\")", &danger)?,
"<p>[a](<b>&quot;c&quot;)</p>",
"should require whitespace between enclosed destination and title"
);
assert_eq!(
- micromark("[](<"),
+ to_html("[](<"),
"<p>[](&lt;</p>",
"should not support an unclosed enclosed destination"
);
assert_eq!(
- micromark("[]("),
+ to_html("[]("),
"<p>[](</p>",
"should not support an unclosed destination"
);
assert_eq!(
- micromark("[](\\<)"),
+ to_html("[](\\<)"),
"<p><a href=\"%3C\"></a></p>",
"should support unenclosed link destination starting w/ escapes"
);
assert_eq!(
- micromark("[](<\\<>)"),
+ to_html("[](<\\<>)"),
"<p><a href=\"%3C\"></a></p>",
"should support enclosed link destination starting w/ escapes"
);
assert_eq!(
- micromark("[](\\"),
+ to_html("[](\\"),
"<p>[](\\</p>",
"should not support unenclosed link destination starting w/ an incorrect escape"
);
assert_eq!(
- micromark("[](<\\"),
+ to_html("[](<\\"),
"<p>[](&lt;\\</p>",
"should not support enclosed link destination starting w/ an incorrect escape"
);
assert_eq!(
- micromark("[](a \""),
+ to_html("[](a \""),
"<p>[](a &quot;</p>",
"should not support an eof in a link title (1)"
);
assert_eq!(
- micromark("[](a '"),
+ to_html("[](a '"),
"<p>[](a '</p>",
"should not support an eof in a link title (2)"
);
assert_eq!(
- micromark("[](a ("),
+ to_html("[](a ("),
"<p>[](a (</p>",
"should not support an eof in a link title (3)"
);
assert_eq!(
- micromark("[](a \"\\"),
+ to_html("[](a \"\\"),
"<p>[](a &quot;\\</p>",
"should not support an eof in a link title escape (1)"
);
assert_eq!(
- micromark("[](a '\\"),
+ to_html("[](a '\\"),
"<p>[](a '\\</p>",
"should not support an eof in a link title escape (2)"
);
assert_eq!(
- micromark("[](a (\\"),
+ to_html("[](a (\\"),
"<p>[](a (\\</p>",
"should not support an eof in a link title escape (3)"
);
assert_eq!(
- micromark("[](a \"\\\"\")"),
+ to_html("[](a \"\\\"\")"),
"<p><a href=\"a\" title=\"&quot;\"></a></p>",
"should support a character escape to start a link title (1)"
);
assert_eq!(
- micromark("[](a '\\'')"),
+ to_html("[](a '\\'')"),
"<p><a href=\"a\" title=\"\'\"></a></p>",
"should support a character escape to start a link title (2)"
);
assert_eq!(
- micromark("[](a (\\)))"),
+ to_html("[](a (\\)))"),
"<p><a href=\"a\" title=\")\"></a></p>",
"should support a character escape to start a link title (3)"
);
assert_eq!(
- micromark("[&amp;&copy;&](example.com/&amp;&copy;& \"&amp;&copy;&\")"),
+ to_html("[&amp;&copy;&](example.com/&amp;&copy;& \"&amp;&copy;&\")"),
"<p><a href=\"example.com/&amp;%C2%A9&amp;\" title=\"&amp;©&amp;\">&amp;©&amp;</a></p>",
"should support character references in links"
);
assert_eq!(
- micromark("[a](1())"),
+ to_html("[a](1())"),
"<p><a href=\"1()\">a</a></p>",
"should support 1 set of parens"
);
assert_eq!(
- micromark("[a](1(2()))"),
+ to_html("[a](1(2()))"),
"<p><a href=\"1(2())\">a</a></p>",
"should support 2 sets of parens"
);
assert_eq!(
- micromark(
+ to_html(
"[a](1(2(3(4(5(6(7(8(9(10(11(12(13(14(15(16(17(18(19(20(21(22(23(24(25(26(27(28(29(30(31(32()))))))))))))))))))))))))))))))))"),
"<p><a href=\"1(2(3(4(5(6(7(8(9(10(11(12(13(14(15(16(17(18(19(20(21(22(23(24(25(26(27(28(29(30(31(32())))))))))))))))))))))))))))))))\">a</a></p>",
"should support 32 sets of parens"
);
assert_eq!(
- micromark(
+ to_html(
"[a](1(2(3(4(5(6(7(8(9(10(11(12(13(14(15(16(17(18(19(20(21(22(23(24(25(26(27(28(29(30(31(32(33())))))))))))))))))))))))))))))))))"),
"<p>[a](1(2(3(4(5(6(7(8(9(10(11(12(13(14(15(16(17(18(19(20(21(22(23(24(25(26(27(28(29(30(31(32(33())))))))))))))))))))))))))))))))))</p>",
"should not support 33 or more sets of parens"
);
assert_eq!(
- micromark("[a](b \"\n c\")"),
+ to_html("[a](b \"\n c\")"),
"<p><a href=\"b\" title=\"\nc\">a</a></p>",
"should support an eol at the start of a title"
);
assert_eq!(
- micromark("[a](b( \"c\")"),
+ to_html("[a](b( \"c\")"),
"<p>[a](b( &quot;c&quot;)</p>",
"should not support whitespace when unbalanced in a raw destination"
);
assert_eq!(
- micromark("[a](\0)"),
+ to_html("[a](\0)"),
"<p><a href=\"%EF%BF%BD\">a</a></p>",
"should support a single NUL character as a link resource"
);
assert_eq!(
- micromark_to_mdast(
+ to_mdast(
"a [alpha]() b [bravo](charlie 'delta') c.",
&ParseOptions::default()
)?,
diff --git a/tests/list.rs b/tests/list.rs
index 88b7e52..476361e 100644
--- a/tests/list.rs
+++ b/tests/list.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{List, ListItem, Node, Paragraph, Root, Text},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
@@ -19,561 +19,561 @@ fn list() -> Result<(), String> {
};
assert_eq!(
- micromark(
+ to_html(
"A paragraph\nwith two lines.\n\n indented code\n\n> A block quote."),
"<p>A paragraph\nwith two lines.</p>\n<pre><code>indented code\n</code></pre>\n<blockquote>\n<p>A block quote.</p>\n</blockquote>",
"should support documents"
);
assert_eq!(
- micromark("1. a\n b.\n\n c\n\n > d."),
+ to_html("1. a\n b.\n\n c\n\n > d."),
"<ol>\n<li>\n<p>a\nb.</p>\n<pre><code>c\n</code></pre>\n<blockquote>\n<p>d.</p>\n</blockquote>\n</li>\n</ol>",
"should support documents in list items"
);
assert_eq!(
- micromark("- one\n\n two"),
+ to_html("- one\n\n two"),
"<ul>\n<li>one</li>\n</ul>\n<p>two</p>",
"should not support 1 space for a two-character list prefix"
);
assert_eq!(
- micromark("- a\n\n b"),
+ to_html("- a\n\n b"),
"<ul>\n<li>\n<p>a</p>\n<p>b</p>\n</li>\n</ul>",
"should support blank lines in list items"
);
assert_eq!(
- micromark(" - one\n\n two"),
+ to_html(" - one\n\n two"),
"<ul>\n<li>one</li>\n</ul>\n<pre><code> two\n</code></pre>",
"should support indented code after lists"
);
assert_eq!(
- micromark(" > > 1. one\n>>\n>> two"),
+ to_html(" > > 1. one\n>>\n>> two"),
"<blockquote>\n<blockquote>\n<ol>\n<li>\n<p>one</p>\n<p>two</p>\n</li>\n</ol>\n</blockquote>\n</blockquote>",
"should support proper indent mixed w/ block quotes (1)"
);
assert_eq!(
- micromark(">>- one\n>>\n > > two"),
+ to_html(">>- one\n>>\n > > two"),
"<blockquote>\n<blockquote>\n<ul>\n<li>one</li>\n</ul>\n<p>two</p>\n</blockquote>\n</blockquote>",
"should support proper indent mixed w/ block quotes (2)"
);
assert_eq!(
- micromark("-one\n\n2.two"),
+ to_html("-one\n\n2.two"),
"<p>-one</p>\n<p>2.two</p>",
"should not support a missing space after marker"
);
assert_eq!(
- micromark("- foo\n\n\n bar"),
+ to_html("- foo\n\n\n bar"),
"<ul>\n<li>\n<p>foo</p>\n<p>bar</p>\n</li>\n</ul>",
"should support multiple blank lines between items"
);
assert_eq!(
- micromark("1. foo\n\n ```\n bar\n ```\n\n baz\n\n > bam"),
+ to_html("1. foo\n\n ```\n bar\n ```\n\n baz\n\n > bam"),
"<ol>\n<li>\n<p>foo</p>\n<pre><code>bar\n</code></pre>\n<p>baz</p>\n<blockquote>\n<p>bam</p>\n</blockquote>\n</li>\n</ol>",
"should support flow in items"
);
assert_eq!(
- micromark("- Foo\n\n bar\n\n\n baz"),
+ to_html("- Foo\n\n bar\n\n\n baz"),
"<ul>\n<li>\n<p>Foo</p>\n<pre><code>bar\n\n\nbaz\n</code></pre>\n</li>\n</ul>",
"should support blank lines in indented code in items"
);
assert_eq!(
- micromark("123456789. ok"),
+ to_html("123456789. ok"),
"<ol start=\"123456789\">\n<li>ok</li>\n</ol>",
"should support start on the first list item"
);
assert_eq!(
- micromark("1234567890. not ok"),
+ to_html("1234567890. not ok"),
"<p>1234567890. not ok</p>",
"should not support ordered item values over 10 digits"
);
assert_eq!(
- micromark("0. ok"),
+ to_html("0. ok"),
"<ol start=\"0\">\n<li>ok</li>\n</ol>",
"should support ordered item values of `0`"
);
assert_eq!(
- micromark("003. ok"),
+ to_html("003. ok"),
"<ol start=\"3\">\n<li>ok</li>\n</ol>",
"should support ordered item values starting w/ `0`s"
);
assert_eq!(
- micromark("-1. not ok"),
+ to_html("-1. not ok"),
"<p>-1. not ok</p>",
"should not support “negative” ordered item values"
);
assert_eq!(
- micromark("- foo\n\n bar"),
+ to_html("- foo\n\n bar"),
"<ul>\n<li>\n<p>foo</p>\n<pre><code>bar\n</code></pre>\n</li>\n</ul>",
"should support indented code in list items (1)"
);
assert_eq!(
- micromark(" 10. foo\n\n bar"),
+ to_html(" 10. foo\n\n bar"),
"<ol start=\"10\">\n<li>\n<p>foo</p>\n<pre><code>bar\n</code></pre>\n</li>\n</ol>",
"should support indented code in list items (2)"
);
assert_eq!(
- micromark(" indented code\n\nparagraph\n\n more code"),
+ to_html(" indented code\n\nparagraph\n\n more code"),
"<pre><code>indented code\n</code></pre>\n<p>paragraph</p>\n<pre><code>more code\n</code></pre>",
"should support indented code in list items (3)"
);
assert_eq!(
- micromark("1. indented code\n\n paragraph\n\n more code"),
+ to_html("1. indented code\n\n paragraph\n\n more code"),
"<ol>\n<li>\n<pre><code>indented code\n</code></pre>\n<p>paragraph</p>\n<pre><code>more code\n</code></pre>\n</li>\n</ol>",
"should support indented code in list items (4)"
);
assert_eq!(
- micromark("1. indented code\n\n paragraph\n\n more code"),
+ to_html("1. indented code\n\n paragraph\n\n more code"),
"<ol>\n<li>\n<pre><code> indented code\n</code></pre>\n<p>paragraph</p>\n<pre><code>more code\n</code></pre>\n</li>\n</ol>",
"should support indented code in list items (5)"
);
assert_eq!(
- micromark(" foo\n\nbar"),
+ to_html(" foo\n\nbar"),
"<p>foo</p>\n<p>bar</p>",
"should support indented code in list items (6)"
);
assert_eq!(
- micromark("- foo\n\n bar"),
+ to_html("- foo\n\n bar"),
"<ul>\n<li>foo</li>\n</ul>\n<p>bar</p>",
"should support indented code in list items (7)"
);
assert_eq!(
- micromark("- foo\n\n bar"),
+ to_html("- foo\n\n bar"),
"<ul>\n<li>\n<p>foo</p>\n<p>bar</p>\n</li>\n</ul>",
"should support indented code in list items (8)"
);
assert_eq!(
- micromark("-\n foo\n-\n ```\n bar\n ```\n-\n baz"),
+ to_html("-\n foo\n-\n ```\n bar\n ```\n-\n baz"),
"<ul>\n<li>foo</li>\n<li>\n<pre><code>bar\n</code></pre>\n</li>\n<li>\n<pre><code>baz\n</code></pre>\n</li>\n</ul>",
"should support blank first lines (1)"
);
assert_eq!(
- micromark("- \n foo"),
+ to_html("- \n foo"),
"<ul>\n<li>foo</li>\n</ul>",
"should support blank first lines (2)"
);
assert_eq!(
- micromark("-\n\n foo"),
+ to_html("-\n\n foo"),
"<ul>\n<li></li>\n</ul>\n<p>foo</p>",
"should support empty only items"
);
assert_eq!(
- micromark("- foo\n-\n- bar"),
+ to_html("- foo\n-\n- bar"),
"<ul>\n<li>foo</li>\n<li></li>\n<li>bar</li>\n</ul>",
"should support empty continued items"
);
assert_eq!(
- micromark("- foo\n- \n- bar"),
+ to_html("- foo\n- \n- bar"),
"<ul>\n<li>foo</li>\n<li></li>\n<li>bar</li>\n</ul>",
"should support blank continued items"
);
assert_eq!(
- micromark("1. foo\n2.\n3. bar"),
+ to_html("1. foo\n2.\n3. bar"),
"<ol>\n<li>foo</li>\n<li></li>\n<li>bar</li>\n</ol>",
"should support empty continued items (ordered)"
);
assert_eq!(
- micromark("*"),
+ to_html("*"),
"<ul>\n<li></li>\n</ul>",
"should support a single empty item"
);
assert_eq!(
- micromark("foo\n*\n\nfoo\n1."),
+ to_html("foo\n*\n\nfoo\n1."),
"<p>foo\n*</p>\n<p>foo\n1.</p>",
"should not support empty items to interrupt paragraphs"
);
assert_eq!(
- micromark(
+ to_html(
" 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote."),
"<ol>\n<li>\n<p>A paragraph\nwith two lines.</p>\n<pre><code>indented code\n</code></pre>\n<blockquote>\n<p>A block quote.</p>\n</blockquote>\n</li>\n</ol>",
"should support indenting w/ 1 space"
);
assert_eq!(
- micromark(
+ to_html(
" 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote."),
"<ol>\n<li>\n<p>A paragraph\nwith two lines.</p>\n<pre><code>indented code\n</code></pre>\n<blockquote>\n<p>A block quote.</p>\n</blockquote>\n</li>\n</ol>",
"should support indenting w/ 2 spaces"
);
assert_eq!(
- micromark(
+ to_html(
" 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote."),
"<ol>\n<li>\n<p>A paragraph\nwith two lines.</p>\n<pre><code>indented code\n</code></pre>\n<blockquote>\n<p>A block quote.</p>\n</blockquote>\n</li>\n</ol>",
"should support indenting w/ 3 spaces"
);
assert_eq!(
- micromark(
+ to_html(
" 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote."),
"<pre><code>1. A paragraph\n with two lines.\n\n indented code\n\n &gt; A block quote.\n</code></pre>",
"should not support indenting w/ 4 spaces"
);
assert_eq!(
- micromark(
+ to_html(
" 1. A paragraph\nwith two lines.\n\n indented code\n\n > A block quote."),
"<ol>\n<li>\n<p>A paragraph\nwith two lines.</p>\n<pre><code>indented code\n</code></pre>\n<blockquote>\n<p>A block quote.</p>\n</blockquote>\n</li>\n</ol>",
"should support lazy lines"
);
assert_eq!(
- micromark(" 1. A paragraph\n with two lines."),
+ to_html(" 1. A paragraph\n with two lines."),
"<ol>\n<li>A paragraph\nwith two lines.</li>\n</ol>",
"should support partially lazy lines"
);
assert_eq!(
- micromark("> 1. > Blockquote\ncontinued here."),
+ to_html("> 1. > Blockquote\ncontinued here."),
"<blockquote>\n<ol>\n<li>\n<blockquote>\n<p>Blockquote\ncontinued here.</p>\n</blockquote>\n</li>\n</ol>\n</blockquote>",
"should support lazy lines combined w/ other containers"
);
assert_eq!(
- micromark("> 1. > Blockquote\n> continued here."),
+ to_html("> 1. > Blockquote\n> continued here."),
"<blockquote>\n<ol>\n<li>\n<blockquote>\n<p>Blockquote\ncontinued here.</p>\n</blockquote>\n</li>\n</ol>\n</blockquote>",
"should support partially continued, partially lazy lines combined w/ other containers"
);
assert_eq!(
- micromark("- [\na"),
+ to_html("- [\na"),
"<ul>\n<li>[\na</li>\n</ul>",
"should support lazy, definition-like lines"
);
assert_eq!(
- micromark("- [a]: b\nc"),
+ to_html("- [a]: b\nc"),
"<ul>\n<li>c</li>\n</ul>",
"should support a definition, followed by a lazy paragraph"
);
assert_eq!(
- micromark("- foo\n - bar\n - baz\n - boo"),
+ to_html("- foo\n - bar\n - baz\n - boo"),
"<ul>\n<li>foo\n<ul>\n<li>bar\n<ul>\n<li>baz\n<ul>\n<li>boo</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>",
"should support sublists w/ enough spaces (1)"
);
assert_eq!(
- micromark("- foo\n - bar\n - baz\n - boo"),
+ to_html("- foo\n - bar\n - baz\n - boo"),
"<ul>\n<li>foo</li>\n<li>bar</li>\n<li>baz</li>\n<li>boo</li>\n</ul>",
"should not support sublists w/ too few spaces"
);
assert_eq!(
- micromark("10) foo\n - bar"),
+ to_html("10) foo\n - bar"),
"<ol start=\"10\">\n<li>foo\n<ul>\n<li>bar</li>\n</ul>\n</li>\n</ol>",
"should support sublists w/ enough spaces (2)"
);
assert_eq!(
- micromark("10) foo\n - bar"),
+ to_html("10) foo\n - bar"),
"<ol start=\"10\">\n<li>foo</li>\n</ol>\n<ul>\n<li>bar</li>\n</ul>",
"should not support sublists w/ too few spaces (2)"
);
assert_eq!(
- micromark("- - foo"),
+ to_html("- - foo"),
"<ul>\n<li>\n<ul>\n<li>foo</li>\n</ul>\n</li>\n</ul>",
"should support sublists (1)"
);
assert_eq!(
- micromark("1. - 2. foo"),
+ to_html("1. - 2. foo"),
"<ol>\n<li>\n<ul>\n<li>\n<ol start=\"2\">\n<li>foo</li>\n</ol>\n</li>\n</ul>\n</li>\n</ol>",
"should support sublists (2)"
);
assert_eq!(
- micromark("- # Foo\n- Bar\n ---\n baz"),
+ to_html("- # Foo\n- Bar\n ---\n baz"),
"<ul>\n<li>\n<h1>Foo</h1>\n</li>\n<li>\n<h2>Bar</h2>\nbaz</li>\n</ul>",
"should support headings in list items"
);
assert_eq!(
- micromark("- foo\n- bar\n+ baz"),
+ to_html("- foo\n- bar\n+ baz"),
"<ul>\n<li>foo</li>\n<li>bar</li>\n</ul>\n<ul>\n<li>baz</li>\n</ul>",
"should support a new list by changing the marker (unordered)"
);
assert_eq!(
- micromark("1. foo\n2. bar\n3) baz"),
+ to_html("1. foo\n2. bar\n3) baz"),
"<ol>\n<li>foo</li>\n<li>bar</li>\n</ol>\n<ol start=\"3\">\n<li>baz</li>\n</ol>",
"should support a new list by changing the marker (ordered)"
);
assert_eq!(
- micromark("Foo\n- bar\n- baz"),
+ to_html("Foo\n- bar\n- baz"),
"<p>Foo</p>\n<ul>\n<li>bar</li>\n<li>baz</li>\n</ul>",
"should support interrupting a paragraph"
);
assert_eq!(
- micromark("a\n2. b"),
+ to_html("a\n2. b"),
"<p>a\n2. b</p>",
"should not support interrupting a paragraph with a non-1 numbered item"
);
assert_eq!(
- micromark("\n2. a"),
+ to_html("\n2. a"),
"<ol start=\"2\">\n<li>a</li>\n</ol>",
"should “interrupt” a blank line (1)"
);
assert_eq!(
- micromark("a\n\n2. b"),
+ to_html("a\n\n2. b"),
"<p>a</p>\n<ol start=\"2\">\n<li>b</li>\n</ol>",
"should “interrupt” a blank line (2)"
);
assert_eq!(
- micromark("a\n1. b"),
+ to_html("a\n1. b"),
"<p>a</p>\n<ol>\n<li>b</li>\n</ol>",
"should support interrupting a paragraph with a 1 numbered item"
);
assert_eq!(
- micromark("- foo\n\n- bar\n\n\n- baz"),
+ to_html("- foo\n\n- bar\n\n\n- baz"),
"<ul>\n<li>\n<p>foo</p>\n</li>\n<li>\n<p>bar</p>\n</li>\n<li>\n<p>baz</p>\n</li>\n</ul>",
"should support blank lines between items (1)"
);
assert_eq!(
- micromark("- foo\n - bar\n - baz\n\n\n bim"),
+ to_html("- foo\n - bar\n - baz\n\n\n bim"),
"<ul>\n<li>foo\n<ul>\n<li>bar\n<ul>\n<li>\n<p>baz</p>\n<p>bim</p>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>",
"should support blank lines between items (2)"
);
assert_eq!(
- micromark_with_options("- foo\n- bar\n\n<!-- -->\n\n- baz\n- bim", &danger)?,
+ to_html_with_options("- foo\n- bar\n\n<!-- -->\n\n- baz\n- bim", &danger)?,
"<ul>\n<li>foo</li>\n<li>bar</li>\n</ul>\n<!-- -->\n<ul>\n<li>baz</li>\n<li>bim</li>\n</ul>",
"should support HTML comments between lists"
);
assert_eq!(
- micromark_with_options("- foo\n\n notcode\n\n- foo\n\n<!-- -->\n\n code", &danger)?,
+ to_html_with_options("- foo\n\n notcode\n\n- foo\n\n<!-- -->\n\n code", &danger)?,
"<ul>\n<li>\n<p>foo</p>\n<p>notcode</p>\n</li>\n<li>\n<p>foo</p>\n</li>\n</ul>\n<!-- -->\n<pre><code>code\n</code></pre>",
"should support HTML comments between lists and indented code"
);
assert_eq!(
- micromark("- a\n - b\n - c\n - d\n - e\n - f\n- g"),
+ to_html("- a\n - b\n - c\n - d\n - e\n - f\n- g"),
"<ul>\n<li>a</li>\n<li>b</li>\n<li>c</li>\n<li>d</li>\n<li>e</li>\n<li>f</li>\n<li>g</li>\n</ul>",
"should not support lists in lists w/ too few spaces (1)"
);
assert_eq!(
- micromark("1. a\n\n 2. b\n\n 3. c"),
+ to_html("1. a\n\n 2. b\n\n 3. c"),
"<ol>\n<li>\n<p>a</p>\n</li>\n<li>\n<p>b</p>\n</li>\n<li>\n<p>c</p>\n</li>\n</ol>",
"should not support lists in lists w/ too few spaces (2)"
);
assert_eq!(
- micromark("- a\n - b\n - c\n - d\n - e"),
+ to_html("- a\n - b\n - c\n - d\n - e"),
"<ul>\n<li>a</li>\n<li>b</li>\n<li>c</li>\n<li>d\n- e</li>\n</ul>",
"should not support lists in lists w/ too few spaces (3)"
);
assert_eq!(
- micromark("1. a\n\n 2. b\n\n 3. c"),
+ to_html("1. a\n\n 2. b\n\n 3. c"),
"<ol>\n<li>\n<p>a</p>\n</li>\n<li>\n<p>b</p>\n</li>\n</ol>\n<pre><code>3. c\n</code></pre>",
"should not support lists in lists w/ too few spaces (3)"
);
assert_eq!(
- micromark("- a\n- b\n\n- c"),
+ to_html("- a\n- b\n\n- c"),
"<ul>\n<li>\n<p>a</p>\n</li>\n<li>\n<p>b</p>\n</li>\n<li>\n<p>c</p>\n</li>\n</ul>",
"should support loose lists w/ a blank line between (1)"
);
assert_eq!(
- micromark("* a\n*\n\n* c"),
+ to_html("* a\n*\n\n* c"),
"<ul>\n<li>\n<p>a</p>\n</li>\n<li></li>\n<li>\n<p>c</p>\n</li>\n</ul>",
"should support loose lists w/ a blank line between (2)"
);
assert_eq!(
- micromark("- a\n- b\n\n c\n- d"),
+ to_html("- a\n- b\n\n c\n- d"),
"<ul>\n<li>\n<p>a</p>\n</li>\n<li>\n<p>b</p>\n<p>c</p>\n</li>\n<li>\n<p>d</p>\n</li>\n</ul>",
"should support loose lists w/ a blank line in an item (1)"
);
assert_eq!(
- micromark("- a\n- b\n\n [ref]: /url\n- d"),
+ to_html("- a\n- b\n\n [ref]: /url\n- d"),
"<ul>\n<li>\n<p>a</p>\n</li>\n<li>\n<p>b</p>\n</li>\n<li>\n<p>d</p>\n</li>\n</ul>",
"should support loose lists w/ a blank line in an item (2)"
);
assert_eq!(
- micromark("- a\n- ```\n b\n\n\n ```\n- c"),
+ to_html("- a\n- ```\n b\n\n\n ```\n- c"),
"<ul>\n<li>a</li>\n<li>\n<pre><code>b\n\n\n</code></pre>\n</li>\n<li>c</li>\n</ul>",
"should support tight lists w/ a blank line in fenced code"
);
assert_eq!(
- micromark("- a\n - b\n\n c\n- d"),
+ to_html("- a\n - b\n\n c\n- d"),
"<ul>\n<li>a\n<ul>\n<li>\n<p>b</p>\n<p>c</p>\n</li>\n</ul>\n</li>\n<li>d</li>\n</ul>",
"should support tight lists w/ a blank line in a sublist"
);
assert_eq!(
- micromark("* a\n > b\n >\n* c"),
+ to_html("* a\n > b\n >\n* c"),
"<ul>\n<li>a\n<blockquote>\n<p>b</p>\n</blockquote>\n</li>\n<li>c</li>\n</ul>",
"should support tight lists w/ a blank line in a block quote"
);
assert_eq!(
- micromark("- a\n > b\n ```\n c\n ```\n- d"),
+ to_html("- a\n > b\n ```\n c\n ```\n- d"),
"<ul>\n<li>a\n<blockquote>\n<p>b</p>\n</blockquote>\n<pre><code>c\n</code></pre>\n</li>\n<li>d</li>\n</ul>",
"should support tight lists w/ flow w/o blank line"
);
assert_eq!(
- micromark("- a"),
+ to_html("- a"),
"<ul>\n<li>a</li>\n</ul>",
"should support tight lists w/ a single content"
);
assert_eq!(
- micromark("- a\n - b"),
+ to_html("- a\n - b"),
"<ul>\n<li>a\n<ul>\n<li>b</li>\n</ul>\n</li>\n</ul>",
"should support tight lists w/ a sublist"
);
assert_eq!(
- micromark("1. ```\n foo\n ```\n\n bar"),
+ to_html("1. ```\n foo\n ```\n\n bar"),
"<ol>\n<li>\n<pre><code>foo\n</code></pre>\n<p>bar</p>\n</li>\n</ol>",
"should support loose lists w/ a blank line in an item"
);
assert_eq!(
- micromark("* foo\n * bar\n\n baz"),
+ to_html("* foo\n * bar\n\n baz"),
"<ul>\n<li>\n<p>foo</p>\n<ul>\n<li>bar</li>\n</ul>\n<p>baz</p>\n</li>\n</ul>",
"should support loose lists w/ tight sublists (1)"
);
assert_eq!(
- micromark("- a\n - b\n - c\n\n- d\n - e\n - f"),
+ to_html("- a\n - b\n - c\n\n- d\n - e\n - f"),
"<ul>\n<li>\n<p>a</p>\n<ul>\n<li>b</li>\n<li>c</li>\n</ul>\n</li>\n<li>\n<p>d</p>\n<ul>\n<li>e</li>\n<li>f</li>\n</ul>\n</li>\n</ul>",
"should support loose lists w/ tight sublists (2)"
);
// Extra.
assert_eq!(
- micromark("* a\n*\n\n \n\t\n* b"),
+ to_html("* a\n*\n\n \n\t\n* b"),
"<ul>\n<li>\n<p>a</p>\n</li>\n<li></li>\n<li>\n<p>b</p>\n</li>\n</ul>",
"should support continued list items after an empty list item w/ many blank lines"
);
assert_eq!(
- micromark("*\n ~~~p\n\n ~~~"),
+ to_html("*\n ~~~p\n\n ~~~"),
"<ul>\n<li>\n<pre><code class=\"language-p\">\n</code></pre>\n</li>\n</ul>",
"should support blank lines in code after an initial blank line"
);
assert_eq!(
- micromark(
+ to_html(
"* a tight item that ends with an html element: `x`\n\nParagraph"),
"<ul>\n<li>a tight item that ends with an html element: <code>x</code></li>\n</ul>\n<p>Paragraph</p>",
"should ignore line endings after tight items ending in tags"
);
assert_eq!(
- micromark("* foo\n\n*\n\n* bar"),
+ to_html("* foo\n\n*\n\n* bar"),
"<ul>\n<li>\n<p>foo</p>\n</li>\n<li></li>\n<li>\n<p>bar</p>\n</li>\n</ul>",
"should support empty items in a spread list"
);
assert_eq!(
- micromark("- ```\n\n ```"),
+ to_html("- ```\n\n ```"),
"<ul>\n<li>\n<pre><code>\n</code></pre>\n</li>\n</ul>",
"should remove indent of code (fenced) in list (0 space)"
);
assert_eq!(
- micromark("- ```\n \n ```"),
+ to_html("- ```\n \n ```"),
"<ul>\n<li>\n<pre><code>\n</code></pre>\n</li>\n</ul>",
"should remove indent of code (fenced) in list (1 space)"
);
assert_eq!(
- micromark("- ```\n \n ```"),
+ to_html("- ```\n \n ```"),
"<ul>\n<li>\n<pre><code>\n</code></pre>\n</li>\n</ul>",
"should remove indent of code (fenced) in list (2 spaces)"
);
assert_eq!(
- micromark("- ```\n \n ```"),
+ to_html("- ```\n \n ```"),
"<ul>\n<li>\n<pre><code> \n</code></pre>\n</li>\n</ul>",
"should remove indent of code (fenced) in list (3 spaces)"
);
assert_eq!(
- micromark("- ```\n \n ```"),
+ to_html("- ```\n \n ```"),
"<ul>\n<li>\n<pre><code> \n</code></pre>\n</li>\n</ul>",
"should remove indent of code (fenced) in list (4 spaces)"
);
assert_eq!(
- micromark("- ```\n\t\n ```"),
+ to_html("- ```\n\t\n ```"),
"<ul>\n<li>\n<pre><code> \n</code></pre>\n</li>\n</ul>",
"should remove indent of code (fenced) in list (1 tab)"
);
assert_eq!(
- micromark("- +\n-"),
+ to_html("- +\n-"),
"<ul>\n<li>\n<ul>\n<li></li>\n</ul>\n</li>\n<li></li>\n</ul>",
"should support complex nested and empty lists (1)"
);
assert_eq!(
- micromark("- 1.\n-"),
+ to_html("- 1.\n-"),
"<ul>\n<li>\n<ol>\n<li></li>\n</ol>\n</li>\n<li></li>\n</ul>",
"should support complex nested and empty lists (2)"
);
assert_eq!(
- micromark("* - +\n* -"),
+ to_html("* - +\n* -"),
"<ul>\n<li>\n<ul>\n<li>\n<ul>\n<li></li>\n</ul>\n</li>\n</ul>\n</li>\n<li>\n<ul>\n<li></li>\n</ul>\n</li>\n</ul>",
"should support complex nested and empty lists (3)"
);
assert_eq!(
- micromark_with_options("* a\n\n<!---->\n\n* b", &danger)?,
+ to_html_with_options("* a\n\n<!---->\n\n* b", &danger)?,
"<ul>\n<li>a</li>\n</ul>\n<!---->\n<ul>\n<li>b</li>\n</ul>",
"should support the common list breaking comment method"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"- one\n\n two",
&Options {
parse: ParseOptions {
@@ -591,7 +591,7 @@ fn list() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("* a", &ParseOptions::default())?,
+ to_mdast("* a", &ParseOptions::default())?,
Node::Root(Root {
children: vec![Node::List(List {
ordered: false,
@@ -617,7 +617,7 @@ fn list() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("3. a", &ParseOptions::default())?,
+ to_mdast("3. a", &ParseOptions::default())?,
Node::Root(Root {
children: vec![Node::List(List {
ordered: true,
@@ -643,7 +643,7 @@ fn list() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("* a\n\n b\n* c", &ParseOptions::default())?,
+ to_mdast("* a\n\n b\n* c", &ParseOptions::default())?,
Node::Root(Root {
children: vec![Node::List(List {
ordered: false,
diff --git a/tests/math_flow.rs b/tests/math_flow.rs
index 1cf0f65..b3ce669 100644
--- a/tests/math_flow.rs
+++ b/tests/math_flow.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{Math, Node, Root},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
@@ -22,242 +22,242 @@ fn math_flow() -> Result<(), String> {
};
assert_eq!(
- micromark("$$\na\n$$"),
+ to_html("$$\na\n$$"),
"<p>$$\na\n$$</p>",
"should not support math (flow) by default"
);
assert_eq!(
- micromark_with_options("$$\na\n$$", &math)?,
+ to_html_with_options("$$\na\n$$", &math)?,
"<pre><code class=\"language-math math-display\">a\n</code></pre>",
"should support math (flow) if enabled"
);
assert_eq!(
- micromark_with_options("$$\n<\n >\n$$", &math)?,
+ to_html_with_options("$$\n<\n >\n$$", &math)?,
"<pre><code class=\"language-math math-display\">&lt;\n &gt;\n</code></pre>",
"should support math (flow)"
);
assert_eq!(
- micromark_with_options("$\nfoo\n$", &math)?,
+ to_html_with_options("$\nfoo\n$", &math)?,
"<p><code class=\"language-math math-inline\">foo</code></p>",
"should not support math (flow) w/ less than two markers"
);
assert_eq!(
- micromark_with_options("$$$\naaa\n$$\n$$$$", &math)?,
+ to_html_with_options("$$$\naaa\n$$\n$$$$", &math)?,
"<pre><code class=\"language-math math-display\">aaa\n$$\n</code></pre>",
"should support a closing sequence longer, but not shorter than, the opening"
);
assert_eq!(
- micromark_with_options("$$", &math)?,
+ to_html_with_options("$$", &math)?,
"<pre><code class=\"language-math math-display\"></code></pre>\n",
"should support an eof right after an opening sequence"
);
assert_eq!(
- micromark_with_options("$$$\n\n$$\naaa\n", &math)?,
+ to_html_with_options("$$$\n\n$$\naaa\n", &math)?,
"<pre><code class=\"language-math math-display\">\n$$\naaa\n</code></pre>\n",
"should support an eof somewhere in content"
);
assert_eq!(
- micromark_with_options("> $$\n> aaa\n\nbbb", &math)?,
+ to_html_with_options("> $$\n> aaa\n\nbbb", &math)?,
"<blockquote>\n<pre><code class=\"language-math math-display\">aaa\n</code></pre>\n</blockquote>\n<p>bbb</p>",
"should support no closing sequence in a block quote"
);
assert_eq!(
- micromark_with_options("$$\n\n \n$$", &math)?,
+ to_html_with_options("$$\n\n \n$$", &math)?,
"<pre><code class=\"language-math math-display\">\n \n</code></pre>",
"should support blank lines in math (flow)"
);
assert_eq!(
- micromark_with_options("$$\n$$", &math)?,
+ to_html_with_options("$$\n$$", &math)?,
"<pre><code class=\"language-math math-display\"></code></pre>",
"should support empty math (flow)"
);
assert_eq!(
- micromark_with_options(" $$\n aaa\naaa\n$$", &math)?,
+ to_html_with_options(" $$\n aaa\naaa\n$$", &math)?,
"<pre><code class=\"language-math math-display\">aaa\naaa\n</code></pre>",
"should remove up to one space from the content if the opening sequence is indented w/ 1 space"
);
assert_eq!(
- micromark_with_options(" $$\naaa\n aaa\naaa\n $$", &math)?,
+ to_html_with_options(" $$\naaa\n aaa\naaa\n $$", &math)?,
"<pre><code class=\"language-math math-display\">aaa\naaa\naaa\n</code></pre>",
"should remove up to two space from the content if the opening sequence is indented w/ 2 spaces"
);
assert_eq!(
- micromark_with_options(" $$\n aaa\n aaa\n aaa\n $$", &math)?,
+ to_html_with_options(" $$\n aaa\n aaa\n aaa\n $$", &math)?,
"<pre><code class=\"language-math math-display\">aaa\n aaa\naaa\n</code></pre>",
"should remove up to three space from the content if the opening sequence is indented w/ 3 spaces"
);
assert_eq!(
- micromark_with_options(" $$\n aaa\n $$", &math)?,
+ to_html_with_options(" $$\n aaa\n $$", &math)?,
"<pre><code>$$\naaa\n$$\n</code></pre>",
"should not support indenteding the opening sequence w/ 4 spaces"
);
assert_eq!(
- micromark_with_options("$$\naaa\n $$", &math)?,
+ to_html_with_options("$$\naaa\n $$", &math)?,
"<pre><code class=\"language-math math-display\">aaa\n</code></pre>",
"should support an indented closing sequence"
);
assert_eq!(
- micromark_with_options(" $$\naaa\n $$", &math)?,
+ to_html_with_options(" $$\naaa\n $$", &math)?,
"<pre><code class=\"language-math math-display\">aaa\n</code></pre>",
"should support a differently indented closing sequence than the opening sequence"
);
assert_eq!(
- micromark_with_options("$$\naaa\n $$\n", &math)?,
+ to_html_with_options("$$\naaa\n $$\n", &math)?,
"<pre><code class=\"language-math math-display\">aaa\n $$\n</code></pre>\n",
"should not support an indented closing sequence w/ 4 spaces"
);
assert_eq!(
- micromark_with_options("$$ $$\naaa", &math)?,
+ to_html_with_options("$$ $$\naaa", &math)?,
"<p><code class=\"language-math math-inline\"> </code>\naaa</p>",
"should not support dollars in the opening fence after the opening sequence"
);
assert_eq!(
- micromark_with_options("$$$\naaa\n$$$ $$\n", &math)?,
+ to_html_with_options("$$$\naaa\n$$$ $$\n", &math)?,
"<pre><code class=\"language-math math-display\">aaa\n$$$ $$\n</code></pre>\n",
"should not support spaces in the closing sequence"
);
assert_eq!(
- micromark_with_options("foo\n$$\nbar\n$$\nbaz", &math)?,
+ to_html_with_options("foo\n$$\nbar\n$$\nbaz", &math)?,
"<p>foo</p>\n<pre><code class=\"language-math math-display\">bar\n</code></pre>\n<p>baz</p>",
"should support interrupting paragraphs"
);
assert_eq!(
- micromark_with_options("foo\n---\n$$\nbar\n$$\n# baz", &math)?,
+ to_html_with_options("foo\n---\n$$\nbar\n$$\n# baz", &math)?,
"<h2>foo</h2>\n<pre><code class=\"language-math math-display\">bar\n</code></pre>\n<h1>baz</h1>",
"should support interrupting other content"
);
assert_eq!(
- micromark_with_options("$$ruby\ndef foo(x)\n return 3\nend\n$$", &math)?,
+ to_html_with_options("$$ruby\ndef foo(x)\n return 3\nend\n$$", &math)?,
"<pre><code class=\"language-math math-display\">def foo(x)\n return 3\nend\n</code></pre>",
"should not support an “info” string (1)"
);
assert_eq!(
- micromark_with_options("$$$;\n$$$", &math)?,
+ to_html_with_options("$$$;\n$$$", &math)?,
"<pre><code class=\"language-math math-display\"></code></pre>",
"should not support an “info” string (2)"
);
assert_eq!(
- micromark_with_options("$$ ruby startline=3 `%@#`\ndef foo(x)\n return 3\nend\n$$$$", &math)?,
+ to_html_with_options("$$ ruby startline=3 `%@#`\ndef foo(x)\n return 3\nend\n$$$$", &math)?,
"<pre><code class=\"language-math math-display\">def foo(x)\n return 3\nend\n</code></pre>",
"should not support an “info” string (3)"
);
assert_eq!(
- micromark_with_options("$$ aa $$\nfoo", &math)?,
+ to_html_with_options("$$ aa $$\nfoo", &math)?,
"<p><code class=\"language-math math-inline\">aa</code>\nfoo</p>",
"should not support dollars in the meta string"
);
assert_eq!(
- micromark_with_options("$$\n$$ aaa\n$$", &math)?,
+ to_html_with_options("$$\n$$ aaa\n$$", &math)?,
"<pre><code class=\"language-math math-display\">$$ aaa\n</code></pre>",
"should not support meta string on closing sequences"
);
// Our own:
assert_eq!(
- micromark_with_options("$$ ", &math)?,
+ to_html_with_options("$$ ", &math)?,
"<pre><code class=\"language-math math-display\"></code></pre>\n",
"should support an eof after whitespace, after the start fence sequence"
);
assert_eq!(
- micromark_with_options("$$ js\nalert(1)\n$$", &math)?,
+ to_html_with_options("$$ js\nalert(1)\n$$", &math)?,
"<pre><code class=\"language-math math-display\">alert(1)\n</code></pre>",
"should support whitespace between the sequence and the meta string"
);
assert_eq!(
- micromark_with_options("$$js", &math)?,
+ to_html_with_options("$$js", &math)?,
"<pre><code class=\"language-math math-display\"></code></pre>\n",
"should support an eof after the meta string"
);
assert_eq!(
- micromark_with_options("$$ js \nalert(1)\n$$", &math)?,
+ to_html_with_options("$$ js \nalert(1)\n$$", &math)?,
"<pre><code class=\"language-math math-display\">alert(1)\n</code></pre>",
"should support whitespace after the meta string"
);
assert_eq!(
- micromark_with_options("$$\n ", &math)?,
+ to_html_with_options("$$\n ", &math)?,
"<pre><code class=\"language-math math-display\"> \n</code></pre>\n",
"should support an eof after whitespace in content"
);
assert_eq!(
- micromark_with_options(" $$\n ", &math)?,
+ to_html_with_options(" $$\n ", &math)?,
"<pre><code class=\"language-math math-display\"></code></pre>\n",
"should support an eof in the prefix, in content"
);
assert_eq!(
- micromark_with_options("$$j\\+s&copy;", &math)?,
+ to_html_with_options("$$j\\+s&copy;", &math)?,
"<pre><code class=\"language-math math-display\"></code></pre>\n",
"should support character escapes and character references in meta strings"
);
assert_eq!(
- micromark_with_options("$$a\\&b\0c", &math)?,
+ to_html_with_options("$$a\\&b\0c", &math)?,
"<pre><code class=\"language-math math-display\"></code></pre>\n",
"should support dangerous characters in meta strings"
);
assert_eq!(
- micromark_with_options(" $$\naaa\n $$", &math)?,
+ to_html_with_options(" $$\naaa\n $$", &math)?,
"<pre><code class=\"language-math math-display\">aaa\n $$\n</code></pre>\n",
"should not support a closing sequence w/ too much indent, regardless of opening sequence (1)"
);
assert_eq!(
- micromark_with_options("> $$\n>\n>\n>\n\na", &math)?,
+ to_html_with_options("> $$\n>\n>\n>\n\na", &math)?,
"<blockquote>\n<pre><code class=\"language-math math-display\">\n\n\n</code></pre>\n</blockquote>\n<p>a</p>",
"should not support a closing sequence w/ too much indent, regardless of opening sequence (2)"
);
assert_eq!(
- micromark_with_options("> $$a\nb", &math)?,
+ to_html_with_options("> $$a\nb", &math)?,
"<blockquote>\n<pre><code class=\"language-math math-display\"></code></pre>\n</blockquote>\n<p>b</p>",
"should not support lazyness (1)"
);
assert_eq!(
- micromark_with_options("> a\n$$b", &math)?,
+ to_html_with_options("> a\n$$b", &math)?,
"<blockquote>\n<p>a</p>\n</blockquote>\n<pre><code class=\"language-math math-display\"></code></pre>\n",
"should not support lazyness (2)"
);
assert_eq!(
- micromark_with_options("> $$a\n$$", &math)?,
+ to_html_with_options("> $$a\n$$", &math)?,
"<blockquote>\n<pre><code class=\"language-math math-display\"></code></pre>\n</blockquote>\n<pre><code class=\"language-math math-display\"></code></pre>\n",
"should not support lazyness (3)"
);
assert_eq!(
- micromark_to_mdast("$$extra\nabc\ndef\n$$", &math.parse)?,
+ to_mdast("$$extra\nabc\ndef\n$$", &math.parse)?,
Node::Root(Root {
children: vec![Node::Math(Math {
meta: Some("extra".into()),
diff --git a/tests/math_text.rs b/tests/math_text.rs
index b4d64f8..892690b 100644
--- a/tests/math_text.rs
+++ b/tests/math_text.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{InlineMath, Node, Paragraph, Root, Text},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
CompileOptions, Constructs, Options, ParseOptions,
};
@@ -22,19 +22,19 @@ fn math_text() -> Result<(), String> {
};
assert_eq!(
- micromark("$a$"),
+ to_html("$a$"),
"<p>$a$</p>",
"should not support math (text) by default"
);
assert_eq!(
- micromark_with_options("$foo$ $$bar$$", &math)?,
+ to_html_with_options("$foo$ $$bar$$", &math)?,
"<p><code class=\"language-math math-inline\">foo</code> <code class=\"language-math math-inline\">bar</code></p>",
"should support math (text) if enabled"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"$foo$ $$bar$$",
&Options {
parse: ParseOptions {
@@ -54,97 +54,97 @@ fn math_text() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("$$ foo $ bar $$", &math)?,
+ to_html_with_options("$$ foo $ bar $$", &math)?,
"<p><code class=\"language-math math-inline\">foo $ bar</code></p>",
"should support math (text) w/ more dollars"
);
assert_eq!(
- micromark_with_options("$ $$ $", &math)?,
+ to_html_with_options("$ $$ $", &math)?,
"<p><code class=\"language-math math-inline\">$$</code></p>",
"should support math (text) w/ fences inside, and padding"
);
assert_eq!(
- micromark_with_options("$ $$ $", &math)?,
+ to_html_with_options("$ $$ $", &math)?,
"<p><code class=\"language-math math-inline\"> $$ </code></p>",
"should support math (text) w/ extra padding"
);
assert_eq!(
- micromark_with_options("$ a$", &math)?,
+ to_html_with_options("$ a$", &math)?,
"<p><code class=\"language-math math-inline\"> a</code></p>",
"should support math (text) w/ unbalanced padding"
);
assert_eq!(
- micromark_with_options("$\u{a0}b\u{a0}$", &math)?,
+ to_html_with_options("$\u{a0}b\u{a0}$", &math)?,
"<p><code class=\"language-math math-inline\">\u{a0}b\u{a0}</code></p>",
"should support math (text) w/ non-padding whitespace"
);
assert_eq!(
- micromark_with_options("$ $\n$ $", &math)?,
+ to_html_with_options("$ $\n$ $", &math)?,
"<p><code class=\"language-math math-inline\"> </code>\n<code class=\"language-math math-inline\"> </code></p>",
"should support math (text) w/o data"
);
assert_eq!(
- micromark_with_options("$\nfoo\nbar \nbaz\n$", &math)?,
+ to_html_with_options("$\nfoo\nbar \nbaz\n$", &math)?,
"<p><code class=\"language-math math-inline\">foo bar baz</code></p>",
"should support math (text) w/o line endings (1)"
);
assert_eq!(
- micromark_with_options("$\nfoo \n$", &math)?,
+ to_html_with_options("$\nfoo \n$", &math)?,
"<p><code class=\"language-math math-inline\">foo </code></p>",
"should support math (text) w/o line endings (2)"
);
assert_eq!(
- micromark_with_options("$foo bar \nbaz$", &math)?,
+ to_html_with_options("$foo bar \nbaz$", &math)?,
"<p><code class=\"language-math math-inline\">foo bar baz</code></p>",
"should not support whitespace collapsing"
);
assert_eq!(
- micromark_with_options("$foo\\$bar$", &math)?,
+ to_html_with_options("$foo\\$bar$", &math)?,
"<p><code class=\"language-math math-inline\">foo\\</code>bar$</p>",
"should not support character escapes"
);
assert_eq!(
- micromark_with_options("$$foo$bar$$", &math)?,
+ to_html_with_options("$$foo$bar$$", &math)?,
"<p><code class=\"language-math math-inline\">foo$bar</code></p>",
"should support more dollars"
);
assert_eq!(
- micromark_with_options("$ foo $$ bar $", &math)?,
+ to_html_with_options("$ foo $$ bar $", &math)?,
"<p><code class=\"language-math math-inline\">foo $$ bar</code></p>",
"should support less dollars"
);
assert_eq!(
- micromark_with_options("*foo$*$", &math)?,
+ to_html_with_options("*foo$*$", &math)?,
"<p>*foo<code class=\"language-math math-inline\">*</code></p>",
"should precede over emphasis"
);
assert_eq!(
- micromark_with_options("[not a $link](/foo$)", &math)?,
+ to_html_with_options("[not a $link](/foo$)", &math)?,
"<p>[not a <code class=\"language-math math-inline\">link](/foo</code>)</p>",
"should precede over links"
);
assert_eq!(
- micromark_with_options("$<a href=\"$\">$", &math)?,
+ to_html_with_options("$<a href=\"$\">$", &math)?,
"<p><code class=\"language-math math-inline\">&lt;a href=&quot;</code>&quot;&gt;$</p>",
"should have same precedence as HTML (1)"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"<a href=\"$\">$",
&Options {
parse: ParseOptions {
@@ -167,49 +167,49 @@ fn math_text() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("$<http://foo.bar.$baz>$", &math)?,
+ to_html_with_options("$<http://foo.bar.$baz>$", &math)?,
"<p><code class=\"language-math math-inline\">&lt;http://foo.bar.</code>baz&gt;$</p>",
"should have same precedence as autolinks (1)"
);
assert_eq!(
- micromark_with_options("<http://foo.bar.$baz>$", &math)?,
+ to_html_with_options("<http://foo.bar.$baz>$", &math)?,
"<p><a href=\"http://foo.bar.$baz\">http://foo.bar.$baz</a>$</p>",
"should have same precedence as autolinks (2)"
);
assert_eq!(
- micromark_with_options("$$$foo$$", &math)?,
+ to_html_with_options("$$$foo$$", &math)?,
"<p>$$$foo$$</p>",
"should not support more dollars before a fence"
);
assert_eq!(
- micromark_with_options("$foo", &math)?,
+ to_html_with_options("$foo", &math)?,
"<p>$foo</p>",
"should not support no closing fence (1)"
);
assert_eq!(
- micromark_with_options("$foo$$bar$$", &math)?,
+ to_html_with_options("$foo$$bar$$", &math)?,
"<p>$foo<code class=\"language-math math-inline\">bar</code></p>",
"should not support no closing fence (2)"
);
assert_eq!(
- micromark_with_options("$foo\t\tbar$", &math)?,
+ to_html_with_options("$foo\t\tbar$", &math)?,
"<p><code class=\"language-math math-inline\">foo\t\tbar</code></p>",
"should support tabs in code"
);
assert_eq!(
- micromark_with_options("\\$$x$", &math)?,
+ to_html_with_options("\\$$x$", &math)?,
"<p>$<code class=\"language-math math-inline\">x</code></p>",
"should support an escaped initial dollar"
);
assert_eq!(
- micromark_to_mdast("a $alpha$ b.", &math.parse)?,
+ to_mdast("a $alpha$ b.", &math.parse)?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![
diff --git a/tests/mdx_esm.rs b/tests/mdx_esm.rs
index f6c2b4d..4d96b09 100644
--- a/tests/mdx_esm.rs
+++ b/tests/mdx_esm.rs
@@ -1,8 +1,8 @@
-extern crate micromark;
+extern crate markdown;
mod test_utils;
-use micromark::{
+use markdown::{
mdast::{MdxjsEsm, Node, Root},
- micromark_to_mdast, micromark_with_options,
+ to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
@@ -22,103 +22,103 @@ fn mdx_esm() -> Result<(), String> {
};
assert_eq!(
- micromark_with_options("import a from 'b'\n\nc", &swc)?,
+ to_html_with_options("import a from 'b'\n\nc", &swc)?,
"<p>c</p>",
"should support an import"
);
assert_eq!(
- micromark_with_options("export default a\n\nb", &swc)?,
+ to_html_with_options("export default a\n\nb", &swc)?,
"<p>b</p>",
"should support an export"
);
assert_eq!(
- micromark_with_options("impossible", &swc)?,
+ to_html_with_options("impossible", &swc)?,
"<p>impossible</p>",
"should not support other keywords (`impossible`)"
);
assert_eq!(
- micromark_with_options("exporting", &swc)?,
+ to_html_with_options("exporting", &swc)?,
"<p>exporting</p>",
"should not support other keywords (`exporting`)"
);
assert_eq!(
- micromark_with_options("import.", &swc)?,
+ to_html_with_options("import.", &swc)?,
"<p>import.</p>",
"should not support a non-whitespace after the keyword"
);
assert_eq!(
- micromark_with_options("import('a')", &swc)?,
+ to_html_with_options("import('a')", &swc)?,
"<p>import('a')</p>",
"should not support a non-whitespace after the keyword (import-as-a-function)"
);
assert_eq!(
- micromark_with_options(" import a from 'b'\n export default c", &swc)?,
+ to_html_with_options(" import a from 'b'\n export default c", &swc)?,
"<p>import a from 'b'\nexport default c</p>",
"should not support an indent"
);
assert_eq!(
- micromark_with_options("- import a from 'b'\n> export default c", &swc)?,
+ to_html_with_options("- import a from 'b'\n> export default c", &swc)?,
"<ul>\n<li>import a from 'b'</li>\n</ul>\n<blockquote>\n<p>export default c</p>\n</blockquote>",
"should not support keywords in containers"
);
assert_eq!(
- micromark_with_options("import a from 'b'\nexport default c", &swc)?,
+ to_html_with_options("import a from 'b'\nexport default c", &swc)?,
"",
"should support imports and exports in the same “block”"
);
assert_eq!(
- micromark_with_options("import a from 'b'\n\nexport default c", &swc)?,
+ to_html_with_options("import a from 'b'\n\nexport default c", &swc)?,
"",
"should support imports and exports in separate “blocks”"
);
assert_eq!(
- micromark_with_options("a\n\nimport a from 'b'\n\nb\n\nexport default c", &swc)?,
+ to_html_with_options("a\n\nimport a from 'b'\n\nb\n\nexport default c", &swc)?,
"<p>a</p>\n<p>b</p>\n",
"should support imports and exports in between other constructs"
);
assert_eq!(
- micromark_with_options("a\nimport a from 'b'\n\nb\nexport default c", &swc)?,
+ to_html_with_options("a\nimport a from 'b'\n\nb\nexport default c", &swc)?,
"<p>a\nimport a from 'b'</p>\n<p>b\nexport default c</p>",
"should not support import/exports when interrupting paragraphs"
);
assert_eq!(
- micromark_with_options("import a", &swc).err().unwrap(),
+ to_html_with_options("import a", &swc).err().unwrap(),
"1:9: Could not parse esm with swc: Expected ',', got '<eof>'",
"should crash on invalid import/exports (1)"
);
assert_eq!(
- micromark_with_options("import 1/1", &swc).err().unwrap(),
+ to_html_with_options("import 1/1", &swc).err().unwrap(),
"1:8: Could not parse esm with swc: Expected 'from', got 'numeric literal (1, 1)'",
"should crash on invalid import/exports (2)"
);
assert_eq!(
- micromark_with_options("export {\n a\n} from 'b'\n\nc", &swc)?,
+ to_html_with_options("export {\n a\n} from 'b'\n\nc", &swc)?,
"<p>c</p>",
"should support line endings in import/exports"
);
assert_eq!(
- micromark_with_options("export {\n\n a\n\n} from 'b'\n\nc", &swc)?,
+ to_html_with_options("export {\n\n a\n\n} from 'b'\n\nc", &swc)?,
"<p>c</p>",
"should support blank lines in import/exports"
);
assert_eq!(
- micromark_with_options("import a from 'b'\n*md*?", &swc)
+ to_html_with_options("import a from 'b'\n*md*?", &swc)
.err()
.unwrap(),
"2:6: Could not parse esm with swc: Unexpected token `?`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, ` for template literal, (, or an identifier",
@@ -126,13 +126,13 @@ fn mdx_esm() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("export var a = 1\n// b\n/* c */\n\nd", &swc)?,
+ to_html_with_options("export var a = 1\n// b\n/* c */\n\nd", &swc)?,
"<p>d</p>",
"should support comments in “blocks”"
);
assert_eq!(
- micromark_with_options("export var a = 1\nvar b\n\nc", &swc)
+ to_html_with_options("export var a = 1\nvar b\n\nc", &swc)
.err()
.unwrap(),
"2:1: Unexpected statement in code: only import/exports are supported",
@@ -140,7 +140,7 @@ fn mdx_esm() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("import ('a')\n\nb", &swc)
+ to_html_with_options("import ('a')\n\nb", &swc)
.err()
.unwrap(),
"1:1: Unexpected statement in code: only import/exports are supported",
@@ -148,43 +148,43 @@ fn mdx_esm() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("import a from 'b'\nexport {a}\n\nc", &swc)?,
+ to_html_with_options("import a from 'b'\nexport {a}\n\nc", &swc)?,
"<p>c</p>",
"should support a reexport from another import"
);
assert_eq!(
- micromark_with_options("import a from 'b';\nexport {a};\n\nc", &swc)?,
+ to_html_with_options("import a from 'b';\nexport {a};\n\nc", &swc)?,
"<p>c</p>",
"should support a reexport from another import w/ semicolons"
);
assert_eq!(
- micromark_with_options("import a from 'b'\nexport {a as default}\n\nc", &swc)?,
+ to_html_with_options("import a from 'b'\nexport {a as default}\n\nc", &swc)?,
"<p>c</p>",
"should support a reexport default from another import"
);
assert_eq!(
- micromark_with_options("export var a = () => <b />", &swc)?,
+ to_html_with_options("export var a = () => <b />", &swc)?,
"",
"should support JSX by default"
);
assert_eq!(
- micromark_with_options("export {a}\n", &swc)?,
+ to_html_with_options("export {a}\n", &swc)?,
"",
"should support EOF after EOL"
);
assert_eq!(
- micromark_with_options("import a from 'b'\n\nexport {a}\n\nc", &swc)?,
+ to_html_with_options("import a from 'b'\n\nexport {a}\n\nc", &swc)?,
"<p>c</p>",
"should support a reexport from another esm block (1)"
);
assert_eq!(
- micromark_with_options("import a from 'b'\n\nexport {a}\n\n# c", &swc)?,
+ to_html_with_options("import a from 'b'\n\nexport {a}\n\n# c", &swc)?,
"<h1>c</h1>",
"should support a reexport from another esm block (2)"
);
@@ -201,7 +201,7 @@ fn mdx_esm() -> Result<(), String> {
for case in cases {
assert_eq!(
- micromark_with_options(case.1, &swc)?,
+ to_html_with_options(case.1, &swc)?,
"",
"should support imports: {}",
case.0
@@ -238,7 +238,7 @@ fn mdx_esm() -> Result<(), String> {
for case in cases {
assert_eq!(
- micromark_with_options(case.1, &swc)?,
+ to_html_with_options(case.1, &swc)?,
"",
"should support exports: {}",
case.0
@@ -246,7 +246,7 @@ fn mdx_esm() -> Result<(), String> {
}
assert_eq!(
- micromark_to_mdast("import a from 'b'\nexport {a}", &swc.parse)?,
+ to_mdast("import a from 'b'\nexport {a}", &swc.parse)?,
Node::Root(Root {
children: vec![Node::MdxjsEsm(MdxjsEsm {
value: "import a from 'b'\nexport {a}".into(),
diff --git a/tests/mdx_expression_flow.rs b/tests/mdx_expression_flow.rs
index 8217c94..b181ef7 100644
--- a/tests/mdx_expression_flow.rs
+++ b/tests/mdx_expression_flow.rs
@@ -1,8 +1,8 @@
-extern crate micromark;
+extern crate markdown;
mod test_utils;
-use micromark::{
+use markdown::{
mdast::{MdxFlowExpression, Node, Root},
- micromark_to_mdast, micromark_with_options,
+ to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
@@ -20,49 +20,49 @@ fn mdx_expression_flow_agnostic() -> Result<(), String> {
};
assert_eq!(
- micromark_with_options("{a}", &mdx)?,
+ to_html_with_options("{a}", &mdx)?,
"",
"should support an expression"
);
assert_eq!(
- micromark_with_options("{}", &mdx)?,
+ to_html_with_options("{}", &mdx)?,
"",
"should support an empty expression"
);
assert_eq!(
- micromark_with_options("{a", &mdx).err().unwrap(),
+ to_html_with_options("{a", &mdx).err().unwrap(),
"1:3: Unexpected end of file in expression, expected a corresponding closing brace for `{`",
"should crash if no closing brace is found (1)"
);
assert_eq!(
- micromark_with_options("{b { c }", &mdx).err().unwrap(),
+ to_html_with_options("{b { c }", &mdx).err().unwrap(),
"1:9: Unexpected end of file in expression, expected a corresponding closing brace for `{`",
"should crash if no closing brace is found (2)"
);
assert_eq!(
- micromark_with_options("{\n}\na", &mdx)?,
+ to_html_with_options("{\n}\na", &mdx)?,
"<p>a</p>",
"should support a line ending in an expression"
);
assert_eq!(
- micromark_with_options("{ a } \t\nb", &mdx)?,
+ to_html_with_options("{ a } \t\nb", &mdx)?,
"<p>b</p>",
"should support expressions followed by spaces"
);
assert_eq!(
- micromark_with_options(" { a }\nb", &mdx)?,
+ to_html_with_options(" { a }\nb", &mdx)?,
"<p>b</p>",
"should support expressions preceded by spaces"
);
assert_eq!(
- micromark_with_options("> {a\nb}", &mdx)
+ to_html_with_options("> {a\nb}", &mdx)
.err()
.unwrap(),
"2:1: Unexpected lazy line in expression in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc",
@@ -70,19 +70,19 @@ fn mdx_expression_flow_agnostic() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("> a\n{b}", &mdx)?,
+ to_html_with_options("> a\n{b}", &mdx)?,
"<blockquote>\n<p>a</p>\n</blockquote>\n",
"should not support lazyness (2)"
);
assert_eq!(
- micromark_with_options("> {a}\nb", &mdx)?,
+ to_html_with_options("> {a}\nb", &mdx)?,
"<blockquote>\n</blockquote>\n<p>b</p>",
"should not support lazyness (3)"
);
assert_eq!(
- micromark_with_options("> {\n> a\nb}", &mdx)
+ to_html_with_options("> {\n> a\nb}", &mdx)
.err()
.unwrap(),
"3:1: Unexpected lazy line in expression in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc",
@@ -90,7 +90,7 @@ fn mdx_expression_flow_agnostic() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("{alpha +\nbravo}", &mdx.parse)?,
+ to_mdast("{alpha +\nbravo}", &mdx.parse)?,
Node::Root(Root {
children: vec![Node::MdxFlowExpression(MdxFlowExpression {
value: "alpha +\nbravo".into(),
@@ -118,61 +118,61 @@ fn mdx_expression_flow_gnostic() -> Result<(), String> {
};
assert_eq!(
- micromark_with_options("{a}", &swc)?,
+ to_html_with_options("{a}", &swc)?,
"",
"should support an expression"
);
assert_eq!(
- micromark_with_options("{}", &swc)?,
+ to_html_with_options("{}", &swc)?,
"",
"should support an empty expression"
);
assert_eq!(
- micromark_with_options("{a", &swc).err().unwrap(),
+ to_html_with_options("{a", &swc).err().unwrap(),
"1:3: Unexpected end of file in expression, expected a corresponding closing brace for `{`",
"should crash if no closing brace is found (1)"
);
assert_eq!(
- micromark_with_options("{b { c }", &swc).err().unwrap(),
+ to_html_with_options("{b { c }", &swc).err().unwrap(),
"1:4: Could not parse expression with swc: Unexpected content after expression",
"should crash if no closing brace is found (2)"
);
assert_eq!(
- micromark_with_options("{\n}\na", &swc)?,
+ to_html_with_options("{\n}\na", &swc)?,
"<p>a</p>",
"should support a line ending in an expression"
);
assert_eq!(
- micromark_with_options("{ a } \t\nb", &swc)?,
+ to_html_with_options("{ a } \t\nb", &swc)?,
"<p>b</p>",
"should support expressions followed by spaces"
);
assert_eq!(
- micromark_with_options(" { a }\nb", &swc)?,
+ to_html_with_options(" { a }\nb", &swc)?,
"<p>b</p>",
"should support expressions preceded by spaces"
);
assert_eq!(
- micromark_with_options(" {`\n a\n `}", &swc)?,
+ to_html_with_options(" {`\n a\n `}", &swc)?,
"",
"should support indented expressions"
);
assert_eq!(
- micromark_with_options("a{(b)}c", &swc)?,
+ to_html_with_options("a{(b)}c", &swc)?,
"<p>ac</p>",
"should support expressions padded w/ parens"
);
assert_eq!(
- micromark_with_options("a{/* b */ ( (c) /* d */ + (e) )}f", &swc)?,
+ to_html_with_options("a{/* b */ ( (c) /* d */ + (e) )}f", &swc)?,
"<p>af</p>",
"should support expressions padded w/ parens and comments"
);
@@ -193,47 +193,43 @@ fn mdx_expression_spread() -> Result<(), String> {
};
assert_eq!(
- micromark_with_options("<a {...b} />", &swc)?,
+ to_html_with_options("<a {...b} />", &swc)?,
"",
"should support spreads for attribute expression"
);
assert_eq!(
- micromark_with_options("<a {b} />", &swc).err().unwrap(),
+ to_html_with_options("<a {b} />", &swc).err().unwrap(),
"1:5: Expected a single spread value, such as `...x`",
"should crash if not a spread"
);
assert_eq!(
- micromark_with_options("<a {...?} />", &swc).err().unwrap(),
+ to_html_with_options("<a {...?} />", &swc).err().unwrap(),
"1:13: Could not parse expression with swc: Unexpected token `?`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, ` for template literal, (, or an identifier",
"should crash on an incorrect spread"
);
assert_eq!(
- micromark_with_options("<a {...b,c} d>", &swc)
- .err()
- .unwrap(),
+ to_html_with_options("<a {...b,c} d>", &swc).err().unwrap(),
"1:5: Expected a single spread value, such as `...x`",
"should crash if a spread and other things"
);
assert_eq!(
- micromark_with_options("<a {} />", &swc).err().unwrap(),
+ to_html_with_options("<a {} />", &swc).err().unwrap(),
"1:5: Expected a single spread value, such as `...x`",
"should crash on an empty spread"
);
assert_eq!(
- micromark_with_options("<a {a=b} />", &swc).err().unwrap(),
+ to_html_with_options("<a {a=b} />", &swc).err().unwrap(),
"1:12: Could not parse expression with swc: assignment property is invalid syntax",
"should crash if not an identifier"
);
assert_eq!(
- micromark_with_options("<a {/* b */} />", &swc)
- .err()
- .unwrap(),
+ to_html_with_options("<a {/* b */} />", &swc).err().unwrap(),
"1:5: Expected a single spread value, such as `...x`",
"should crash on a comment spread"
);
diff --git a/tests/mdx_expression_text.rs b/tests/mdx_expression_text.rs
index e0f1f3f..61f5170 100644
--- a/tests/mdx_expression_text.rs
+++ b/tests/mdx_expression_text.rs
@@ -1,8 +1,8 @@
-extern crate micromark;
+extern crate markdown;
mod test_utils;
-use micromark::{
+use markdown::{
mdast::{MdxTextExpression, Node, Paragraph, Root, Text},
- micromark_to_mdast, micromark_with_options,
+ to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
@@ -22,123 +22,121 @@ fn mdx_expression_text_gnostic_core() -> Result<(), String> {
};
assert_eq!(
- micromark_with_options("a {} b", &swc)?,
+ to_html_with_options("a {} b", &swc)?,
"<p>a b</p>",
"should support an empty expression (1)"
);
assert_eq!(
- micromark_with_options("a { \t\r\n} b", &swc)?,
+ to_html_with_options("a { \t\r\n} b", &swc)?,
"<p>a b</p>",
"should support an empty expression (2)"
);
assert_eq!(
- micromark_with_options("a {/**/} b", &swc)?,
+ to_html_with_options("a {/**/} b", &swc)?,
"<p>a b</p>",
"should support a multiline comment (1)"
);
assert_eq!(
- micromark_with_options("a { /*\n*/\t} b", &swc)?,
+ to_html_with_options("a { /*\n*/\t} b", &swc)?,
"<p>a b</p>",
"should support a multiline comment (2)"
);
assert_eq!(
- micromark_with_options("a {/*b*//*c*/} d", &swc)?,
+ to_html_with_options("a {/*b*//*c*/} d", &swc)?,
"<p>a d</p>",
"should support a multiline comment (3)"
);
assert_eq!(
- micromark_with_options("a {b/*c*/} d", &swc)?,
+ to_html_with_options("a {b/*c*/} d", &swc)?,
"<p>a d</p>",
"should support a multiline comment (4)"
);
assert_eq!(
- micromark_with_options("a {/*b*/c} d", &swc)?,
+ to_html_with_options("a {/*b*/c} d", &swc)?,
"<p>a d</p>",
"should support a multiline comment (4)"
);
assert_eq!(
- micromark_with_options("a {//} b", &swc).err().unwrap(),
+ to_html_with_options("a {//} b", &swc).err().unwrap(),
"1:4: Could not parse expression with swc: Unexpected eof",
"should crash on an incorrect line comment (1)"
);
assert_eq!(
- micromark_with_options("a { // b } c", &swc).err().unwrap(),
+ to_html_with_options("a { // b } c", &swc).err().unwrap(),
"1:4: Could not parse expression with swc: Unexpected eof",
"should crash on an incorrect line comment (2)"
);
assert_eq!(
- micromark_with_options("a {//\n} b", &swc)?,
+ to_html_with_options("a {//\n} b", &swc)?,
"<p>a b</p>",
"should support a line comment followed by a line ending"
);
assert_eq!(
- micromark_with_options("a {// b\nd} d", &swc)?,
+ to_html_with_options("a {// b\nd} d", &swc)?,
"<p>a d</p>",
"should support a line comment followed by a line ending and an expression"
);
assert_eq!(
- micromark_with_options("a {b// c\n} d", &swc)?,
+ to_html_with_options("a {b// c\n} d", &swc)?,
"<p>a d</p>",
"should support an expression followed by a line comment and a line ending"
);
assert_eq!(
- micromark_with_options("a {/*b*/ // c\n} d", &swc)?,
+ to_html_with_options("a {/*b*/ // c\n} d", &swc)?,
"<p>a d</p>",
"should support comments (1)"
);
assert_eq!(
- micromark_with_options("a {b.c} d", &swc)?,
+ to_html_with_options("a {b.c} d", &swc)?,
"<p>a d</p>",
"should support expression statements (1)"
);
assert_eq!(
- micromark_with_options("a {1 + 1} b", &swc)?,
+ to_html_with_options("a {1 + 1} b", &swc)?,
"<p>a b</p>",
"should support expression statements (2)"
);
assert_eq!(
- micromark_with_options("a {function () {}} b", &swc)?,
+ to_html_with_options("a {function () {}} b", &swc)?,
"<p>a b</p>",
"should support expression statements (3)"
);
assert_eq!(
- micromark_with_options("a {var b = \"c\"} d", &swc).err().unwrap(),
+ to_html_with_options("a {var b = \"c\"} d", &swc).err().unwrap(),
"1:4: Could not parse expression with swc: Unexpected token `var`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, ` for template literal, (, or an identifier",
"should crash on non-expressions"
);
assert_eq!(
- micromark_with_options("> a {\n> b} c", &swc)?,
+ to_html_with_options("> a {\n> b} c", &swc)?,
"<blockquote>\n<p>a c</p>\n</blockquote>",
"should support expressions in containers"
);
assert_eq!(
- micromark_with_options("> a {\n> b<} c", &swc)
- .err()
- .unwrap(),
+ to_html_with_options("> a {\n> b<} c", &swc).err().unwrap(),
"2:8: Could not parse expression with swc: Unexpected eof",
"should crash on incorrect expressions in containers (1)"
);
assert_eq!(
- micromark_with_options("> a {\n> b\n> c} d", &swc)
+ to_html_with_options("> a {\n> b\n> c} d", &swc)
.err()
.unwrap(),
"3:3: Could not parse expression with swc: Unexpected content after expression",
@@ -159,25 +157,25 @@ fn mdx_expression_text_agnostic() -> Result<(), String> {
};
assert_eq!(
- micromark_with_options("a {b} c", &mdx)?,
+ to_html_with_options("a {b} c", &mdx)?,
"<p>a c</p>",
"should support an expression"
);
assert_eq!(
- micromark_with_options("a {} b", &mdx)?,
+ to_html_with_options("a {} b", &mdx)?,
"<p>a b</p>",
"should support an empty expression"
);
assert_eq!(
- micromark_with_options("a {b c", &mdx).err().unwrap(),
+ to_html_with_options("a {b c", &mdx).err().unwrap(),
"1:7: Unexpected end of file in expression, expected a corresponding closing brace for `{`",
"should crash if no closing brace is found (1)"
);
assert_eq!(
- micromark_with_options("a {b { c } d", &mdx)
+ to_html_with_options("a {b { c } d", &mdx)
.err()
.unwrap(),
"1:13: Unexpected end of file in expression, expected a corresponding closing brace for `{`",
@@ -185,25 +183,25 @@ fn mdx_expression_text_agnostic() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a {\n} b", &mdx)?,
+ to_html_with_options("a {\n} b", &mdx)?,
"<p>a b</p>",
"should support a line ending in an expression"
);
assert_eq!(
- micromark_with_options("a } b", &mdx)?,
+ to_html_with_options("a } b", &mdx)?,
"<p>a } b</p>",
"should support just a closing brace"
);
assert_eq!(
- micromark_with_options("{ a } b", &mdx)?,
+ to_html_with_options("{ a } b", &mdx)?,
"<p> b</p>",
"should support expressions as the first thing when following by other things"
);
assert_eq!(
- micromark_to_mdast("a {alpha} b.", &mdx.parse)?,
+ to_mdast("a {alpha} b.", &mdx.parse)?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![
@@ -244,61 +242,61 @@ fn mdx_expression_text_gnostic() -> Result<(), String> {
};
assert_eq!(
- micromark_with_options("a {b} c", &swc)?,
+ to_html_with_options("a {b} c", &swc)?,
"<p>a c</p>",
"should support an expression"
);
assert_eq!(
- micromark_with_options("a {??} b", &swc).err().unwrap(),
+ to_html_with_options("a {??} b", &swc).err().unwrap(),
"1:9: Could not parse expression with swc: Unexpected eof",
"should crash on an incorrect expression"
);
assert_eq!(
- micromark_with_options("a {} b", &swc)?,
+ to_html_with_options("a {} b", &swc)?,
"<p>a b</p>",
"should support an empty expression"
);
assert_eq!(
- micromark_with_options("a {b c", &swc).err().unwrap(),
+ to_html_with_options("a {b c", &swc).err().unwrap(),
"1:7: Unexpected end of file in expression, expected a corresponding closing brace for `{`",
"should crash if no closing brace is found (1)"
);
assert_eq!(
- micromark_with_options("a {b { c } d", &swc).err().unwrap(),
+ to_html_with_options("a {b { c } d", &swc).err().unwrap(),
"1:6: Could not parse expression with swc: Unexpected content after expression",
"should crash if no closing brace is found (2)"
);
assert_eq!(
- micromark_with_options("a {\n} b", &swc)?,
+ to_html_with_options("a {\n} b", &swc)?,
"<p>a b</p>",
"should support a line ending in an expression"
);
assert_eq!(
- micromark_with_options("a } b", &swc)?,
+ to_html_with_options("a } b", &swc)?,
"<p>a } b</p>",
"should support just a closing brace"
);
assert_eq!(
- micromark_with_options("{ a } b", &swc)?,
+ to_html_with_options("{ a } b", &swc)?,
"<p> b</p>",
"should support expressions as the first thing when following by other things"
);
assert_eq!(
- micromark_with_options("a { /* { */ } b", &swc)?,
+ to_html_with_options("a { /* { */ } b", &swc)?,
"<p>a b</p>",
"should support an unbalanced opening brace (if JS permits)"
);
assert_eq!(
- micromark_with_options("a { /* } */ } b", &swc)?,
+ to_html_with_options("a { /* } */ } b", &swc)?,
"<p>a b</p>",
"should support an unbalanced closing brace (if JS permits)"
);
diff --git a/tests/mdx_jsx_flow.rs b/tests/mdx_jsx_flow.rs
index 5216c82..031d1fd 100644
--- a/tests/mdx_jsx_flow.rs
+++ b/tests/mdx_jsx_flow.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{List, ListItem, MdxJsxFlowElement, Node, Paragraph, Root, Text},
- micromark_to_mdast, micromark_with_options,
+ to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
@@ -18,31 +18,31 @@ fn mdx_jsx_flow_agnostic() -> Result<(), String> {
};
assert_eq!(
- micromark_with_options("<a />", &mdx)?,
+ to_html_with_options("<a />", &mdx)?,
"",
"should support a self-closing element"
);
assert_eq!(
- micromark_with_options("<a></a>", &mdx)?,
+ to_html_with_options("<a></a>", &mdx)?,
"",
"should support a closed element"
);
assert_eq!(
- micromark_with_options("<a>\nb\n</a>", &mdx)?,
+ to_html_with_options("<a>\nb\n</a>", &mdx)?,
"<p>b</p>\n",
"should support an element w/ content"
);
assert_eq!(
- micromark_with_options("<a>\n- b\n</a>", &mdx)?,
+ to_html_with_options("<a>\n- b\n</a>", &mdx)?,
"<ul>\n<li>b</li>\n</ul>\n",
"should support an element w/ containers as content"
);
assert_eq!(
- micromark_with_options("<a b c:d e=\"\" f={/* g */} {...h} />", &mdx)?,
+ to_html_with_options("<a b c:d e=\"\" f={/* g */} {...h} />", &mdx)?,
"",
"should support attributes"
);
@@ -63,43 +63,43 @@ fn mdx_jsx_flow_essence() -> Result<(), String> {
};
assert_eq!(
- micromark_with_options("<a />", &mdx)?,
+ to_html_with_options("<a />", &mdx)?,
"",
"should support an element"
);
assert_eq!(
- micromark_with_options("<a>\n- b\n</a>", &mdx)?,
+ to_html_with_options("<a>\n- b\n</a>", &mdx)?,
"<ul>\n<li>b</li>\n</ul>\n",
"should support an element around a container"
);
assert_eq!(
- micromark_with_options("<x\n y\n> \nb\n </x>", &mdx)?,
+ to_html_with_options("<x\n y\n> \nb\n </x>", &mdx)?,
"<p>b</p>\n",
"should support a dangling `>` in a tag (not a block quote)"
);
assert_eq!(
- micromark_with_options("<a> \nb\n </a>", &mdx)?,
+ to_html_with_options("<a> \nb\n </a>", &mdx)?,
"<p>b</p>\n",
"should support trailing initial and final whitespace around tags"
);
assert_eq!(
- micromark_with_options("<a> <b>\t\nc\n </b> </a>", &mdx)?,
+ to_html_with_options("<a> <b>\t\nc\n </b> </a>", &mdx)?,
"<p>c</p>\n",
"should support tags after tags"
);
assert_eq!(
- micromark_with_options("> <X\n/>", &mdx).err().unwrap(),
+ to_html_with_options("> <X\n/>", &mdx).err().unwrap(),
"2:1: Unexpected lazy line in jsx in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc",
"should not support lazy flow (1)"
);
assert_eq!(
- micromark_with_options("> a\n> <X\n/>", &mdx)
+ to_html_with_options("> a\n> <X\n/>", &mdx)
.err()
.unwrap(),
"3:1: Unexpected lazy line in jsx in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc",
@@ -107,7 +107,7 @@ fn mdx_jsx_flow_essence() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("> <a b='\nc'/>", &mdx)
+ to_html_with_options("> <a b='\nc'/>", &mdx)
.err()
.unwrap(),
"2:1: Unexpected lazy line in jsx in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc",
@@ -115,7 +115,7 @@ fn mdx_jsx_flow_essence() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("> <a b='c\n'/>", &mdx)
+ to_html_with_options("> <a b='c\n'/>", &mdx)
.err()
.unwrap(),
"2:1: Unexpected lazy line in jsx in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc",
@@ -123,7 +123,7 @@ fn mdx_jsx_flow_essence() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("> <a b='c\nd'/>", &mdx)
+ to_html_with_options("> <a b='c\nd'/>", &mdx)
.err()
.unwrap(),
"2:1: Unexpected lazy line in jsx in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc",
@@ -131,7 +131,7 @@ fn mdx_jsx_flow_essence() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("> <a b={c\nd}/>", &mdx)
+ to_html_with_options("> <a b={c\nd}/>", &mdx)
.err()
.unwrap(),
"2:1: Unexpected lazy line in expression in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc",
@@ -139,7 +139,7 @@ fn mdx_jsx_flow_essence() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("> <a {b\nc}/>", &mdx)
+ to_html_with_options("> <a {b\nc}/>", &mdx)
.err()
.unwrap(),
"2:1: Unexpected lazy line in expression in container, expected line to be prefixed with `>` when in a block quote, whitespace when in a list, etc",
@@ -147,13 +147,13 @@ fn mdx_jsx_flow_essence() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("> a\n<X />", &mdx)?,
+ to_html_with_options("> a\n<X />", &mdx)?,
"<blockquote>\n<p>a</p>\n</blockquote>\n",
"should not support lazy flow (7)"
);
assert_eq!(
- micromark_to_mdast("<>\n * a\n</>", &mdx.parse)?,
+ to_mdast("<>\n * a\n</>", &mdx.parse)?,
Node::Root(Root {
children: vec![Node::MdxJsxFlowElement(MdxJsxFlowElement {
name: None,
diff --git a/tests/mdx_jsx_text.rs b/tests/mdx_jsx_text.rs
index cf0201e..2d1ec0a 100644
--- a/tests/mdx_jsx_text.rs
+++ b/tests/mdx_jsx_text.rs
@@ -1,11 +1,11 @@
-extern crate micromark;
+extern crate markdown;
mod test_utils;
-use micromark::{
+use markdown::{
mdast::{
AttributeContent, AttributeValue, Emphasis, MdxJsxAttribute, MdxJsxTextElement, Node,
Paragraph, Root, Text,
},
- micromark_to_mdast, micromark_with_options,
+ to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
@@ -23,37 +23,37 @@ fn mdx_jsx_text_core() -> Result<(), String> {
};
assert_eq!(
- micromark_with_options("a <b> c", &mdx)?,
+ to_html_with_options("a <b> c", &mdx)?,
"<p>a c</p>",
"should support mdx jsx (text) if enabled"
);
assert_eq!(
- micromark_with_options("a <b/> c.", &mdx)?,
+ to_html_with_options("a <b/> c.", &mdx)?,
"<p>a c.</p>",
"should support a self-closing element"
);
assert_eq!(
- micromark_with_options("a <b></b> c.", &mdx)?,
+ to_html_with_options("a <b></b> c.", &mdx)?,
"<p>a c.</p>",
"should support a closed element"
);
assert_eq!(
- micromark_with_options("a <></> c.", &mdx)?,
+ to_html_with_options("a <></> c.", &mdx)?,
"<p>a c.</p>",
"should support fragments"
);
assert_eq!(
- micromark_with_options("a <b>*b*</b> c.", &mdx)?,
+ to_html_with_options("a <b>*b*</b> c.", &mdx)?,
"<p>a <em>b</em> c.</p>",
"should support markdown inside elements"
);
assert_eq!(
- micromark_to_mdast("a <b /> c.", &mdx.parse)?,
+ to_mdast("a <b /> c.", &mdx.parse)?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![
@@ -80,7 +80,7 @@ fn mdx_jsx_text_core() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("a <b>*c*</b> d.", &mdx.parse)?,
+ to_mdast("a <b>*c*</b> d.", &mdx.parse)?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![
@@ -117,7 +117,7 @@ fn mdx_jsx_text_core() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("<a:b />.", &mdx.parse)?,
+ to_mdast("<a:b />.", &mdx.parse)?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![
@@ -140,7 +140,7 @@ fn mdx_jsx_text_core() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("<a.b.c />.", &mdx.parse)?,
+ to_mdast("<a.b.c />.", &mdx.parse)?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![
@@ -163,7 +163,7 @@ fn mdx_jsx_text_core() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("<a {...b} />.", &mdx.parse)?,
+ to_mdast("<a {...b} />.", &mdx.parse)?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![
@@ -186,7 +186,7 @@ fn mdx_jsx_text_core() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("<a b c:d />.", &mdx.parse)?,
+ to_mdast("<a b c:d />.", &mdx.parse)?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![
@@ -218,7 +218,7 @@ fn mdx_jsx_text_core() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("<a b='c' d=\"e\" f={g} />.", &mdx.parse)?,
+ to_mdast("<a b='c' d=\"e\" f={g} />.", &mdx.parse)?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![
@@ -254,7 +254,7 @@ fn mdx_jsx_text_core() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("<a b='&nbsp; &amp; &copy; &AElig; &Dcaron; &frac34; &HilbertSpace; &DifferentialD; &ClockwiseContourIntegral; &ngE;' />.", &mdx.parse)?,
+ to_mdast("<a b='&nbsp; &amp; &copy; &AElig; &Dcaron; &frac34; &HilbertSpace; &DifferentialD; &ClockwiseContourIntegral; &ngE;' />.", &mdx.parse)?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![
@@ -282,7 +282,7 @@ fn mdx_jsx_text_core() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast(
+ to_mdast(
"<a b='&#35; &#1234; &#992; &#0;' c='&#X22; &#XD06; &#xcab;' />.",
&mdx.parse
)?,
@@ -317,7 +317,7 @@ fn mdx_jsx_text_core() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("<a b='&nbsp &x; &#; &#x; &#987654321; &#abcdef0; &ThisIsNotDefined; &hi?;' />.", &mdx.parse)?,
+ to_mdast("<a b='&nbsp &x; &#; &#x; &#987654321; &#abcdef0; &ThisIsNotDefined; &hi?;' />.", &mdx.parse)?,
Node::Root(Root {
children: vec![Node::Paragraph(Paragraph {
children: vec![
@@ -345,7 +345,7 @@ fn mdx_jsx_text_core() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("a </b> c", &mdx.parse)
+ to_mdast("a </b> c", &mdx.parse)
.err()
.unwrap(),
"1:4: Unexpected closing slash `/` in tag, expected an open tag first (mdx-jsx:unexpected-closing-slash)",
@@ -353,7 +353,7 @@ fn mdx_jsx_text_core() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("a <b> c </b/> d", &mdx.parse)
+ to_mdast("a <b> c </b/> d", &mdx.parse)
.err()
.unwrap(),
"1:12: Unexpected self-closing slash `/` in closing tag, expected the end of the tag (mdx-jsx:unexpected-self-closing-slash)",
@@ -361,7 +361,7 @@ fn mdx_jsx_text_core() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("a <b> c </b d> e", &mdx.parse)
+ to_mdast("a <b> c </b d> e", &mdx.parse)
.err()
.unwrap(),
"1:13: Unexpected attribute in closing tag, expected the end of the tag (mdx-jsx:unexpected-attribute)",
@@ -369,7 +369,7 @@ fn mdx_jsx_text_core() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("a <>b</c> d", &mdx.parse)
+ to_mdast("a <>b</c> d", &mdx.parse)
.err()
.unwrap(),
"1:6: Unexpected closing tag `</c>`, expected corresponding closing tag for `<>` (1:3) (mdx-jsx:end-tag-mismatch)",
@@ -377,7 +377,7 @@ fn mdx_jsx_text_core() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("a <b>c</> d", &mdx.parse)
+ to_mdast("a <b>c</> d", &mdx.parse)
.err()
.unwrap(),
"1:7: Unexpected closing tag `</>`, expected corresponding closing tag for `<b>` (1:3) (mdx-jsx:end-tag-mismatch)",
@@ -385,26 +385,26 @@ fn mdx_jsx_text_core() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("*a <b>c* d</b>.", &mdx.parse).err().unwrap(),
+ to_mdast("*a <b>c* d</b>.", &mdx.parse).err().unwrap(),
"1:9: Expected a closing tag for `<b>` (1:4) before the end of `Emphasis` (mdx-jsx:end-tag-mismatch)",
"should crash when building the ast on mismatched interleaving (1)"
);
assert_eq!(
- micromark_to_mdast("<a>b *c</a> d*.", &mdx.parse).err().unwrap(),
+ to_mdast("<a>b *c</a> d*.", &mdx.parse).err().unwrap(),
"1:8: Expected the closing tag `</a>` either before the start of `Emphasis` (1:6), or another opening tag after that start (mdx-jsx:end-tag-mismatch)",
"should crash when building the ast on mismatched interleaving (2)"
);
assert_eq!(
- micromark_to_mdast("a <b>.", &mdx.parse).err().unwrap(),
+ to_mdast("a <b>.", &mdx.parse).err().unwrap(),
"1:7: Expected a closing tag for `<b>` (1:3) before the end of `Paragraph` (mdx-jsx:end-tag-mismatch)",
"should crash when building the ast on mismatched interleaving (3)"
);
// Note: this is flow, not text.
assert_eq!(
- micromark_to_mdast("<a>", &mdx.parse).err().unwrap(),
+ to_mdast("<a>", &mdx.parse).err().unwrap(),
"1:4: Expected a closing tag for `<a>` (1:1) (mdx-jsx:end-tag-mismatch)",
"should crash when building the ast on mismatched interleaving (4)"
);
@@ -423,31 +423,31 @@ fn mdx_jsx_text_agnosic() -> Result<(), String> {
};
assert_eq!(
- micromark_with_options("a <b /> c", &mdx)?,
+ to_html_with_options("a <b /> c", &mdx)?,
"<p>a c</p>",
"should support a self-closing element"
);
assert_eq!(
- micromark_with_options("a <b> c </b> d", &mdx)?,
+ to_html_with_options("a <b> c </b> d", &mdx)?,
"<p>a c d</p>",
"should support a closed element"
);
assert_eq!(
- micromark_with_options("a <b> c", &mdx)?,
+ to_html_with_options("a <b> c", &mdx)?,
"<p>a c</p>",
"should support an unclosed element"
);
assert_eq!(
- micromark_with_options("a <b {1 + 1} /> c", &mdx)?,
+ to_html_with_options("a <b {1 + 1} /> c", &mdx)?,
"<p>a c</p>",
"should support an attribute expression"
);
assert_eq!(
- micromark_with_options("a <b c={1 + 1} /> d", &mdx)?,
+ to_html_with_options("a <b c={1 + 1} /> d", &mdx)?,
"<p>a d</p>",
"should support an attribute value expression"
);
@@ -468,57 +468,55 @@ fn mdx_jsx_text_gnostic() -> Result<(), String> {
};
assert_eq!(
- micromark_with_options("a <b /> c", &swc)?,
+ to_html_with_options("a <b /> c", &swc)?,
"<p>a c</p>",
"should support a self-closing element"
);
assert_eq!(
- micromark_with_options("a <b> c </b> d", &swc)?,
+ to_html_with_options("a <b> c </b> d", &swc)?,
"<p>a c d</p>",
"should support a closed element"
);
assert_eq!(
- micromark_with_options("a <b> c", &swc)?,
+ to_html_with_options("a <b> c", &swc)?,
"<p>a c</p>",
"should support an unclosed element"
);
assert_eq!(
- micromark_with_options("a <b {...c} /> d", &swc)?,
+ to_html_with_options("a <b {...c} /> d", &swc)?,
"<p>a d</p>",
"should support an attribute expression"
);
assert_eq!(
- micromark_with_options("a <b {...{c: 1, d: Infinity, e: false}} /> f", &swc)?,
+ to_html_with_options("a <b {...{c: 1, d: Infinity, e: false}} /> f", &swc)?,
"<p>a f</p>",
"should support more complex attribute expression (1)"
);
assert_eq!(
- micromark_with_options("a <b {...[1, Infinity, false]} /> d", &swc)?,
+ to_html_with_options("a <b {...[1, Infinity, false]} /> d", &swc)?,
"<p>a d</p>",
"should support more complex attribute expression (2)"
);
assert_eq!(
- micromark_with_options("a <b c={1 + 1} /> d", &swc)?,
+ to_html_with_options("a <b c={1 + 1} /> d", &swc)?,
"<p>a d</p>",
"should support an attribute value expression"
);
assert_eq!(
- micromark_with_options("a <b c={} /> d", &swc)
- .err()
- .unwrap(),
+ to_html_with_options("a <b c={} /> d", &swc).err().unwrap(),
"1:15: Could not parse expression with swc: Unexpected eof",
"should crash on an empty attribute value expression"
);
assert_eq!(
- micromark_with_options("a <b {1 + 1} /> c", &swc)
+ to_html_with_options("a <b {1 + 1} /> c", &swc)
.err()
.unwrap(),
"1:18: Could not parse expression with swc: Expected ',', got '}'",
@@ -526,7 +524,7 @@ fn mdx_jsx_text_gnostic() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <b c={?} /> d", &swc)
+ to_html_with_options("a <b c={?} /> d", &swc)
.err()
.unwrap(),
"1:16: Could not parse expression with swc: Unexpected token `?`. Expected this, import, async, function, [ for array literal, { for object literal, @ for decorator, function, class, null, true, false, number, bigint, string, regexp, ` for template literal, (, or an identifier",
@@ -534,7 +532,7 @@ fn mdx_jsx_text_gnostic() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <b {?} /> c", &swc)
+ to_html_with_options("a <b {?} /> c", &swc)
.err()
.unwrap(),
"1:14: Could not parse expression with swc: Unexpected token `?`. Expected identifier, string literal, numeric literal or [ for the computed key",
@@ -542,7 +540,7 @@ fn mdx_jsx_text_gnostic() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <b{c=d}={}/> f", &swc)
+ to_html_with_options("a <b{c=d}={}/> f", &swc)
.err()
.unwrap(),
"1:6: Expected a single spread value, such as `...x`",
@@ -550,7 +548,7 @@ fn mdx_jsx_text_gnostic() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <b c={(2)} d={<e />} /> f", &swc)?,
+ to_html_with_options("a <b c={(2)} d={<e />} /> f", &swc)?,
"<p>a f</p>",
"should support parenthesized expressions"
);
@@ -569,31 +567,31 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
};
assert_eq!(
- micromark_with_options("a <b> c", &mdx)?,
+ to_html_with_options("a <b> c", &mdx)?,
"<p>a c</p>",
"should support an unclosed element"
);
assert_eq!(
- micromark_with_options("a <> c", &mdx)?,
+ to_html_with_options("a <> c", &mdx)?,
"<p>a c</p>",
"should support an unclosed fragment"
);
assert_eq!(
- micromark_with_options("a < \t>b</>", &mdx)?,
+ to_html_with_options("a < \t>b</>", &mdx)?,
"<p>a &lt; \t&gt;b</p>",
"should *not* support whitespace in the opening tag (fragment)"
);
assert_eq!(
- micromark_with_options("a < \nb\t>b</b>", &mdx)?,
+ to_html_with_options("a < \nb\t>b</b>", &mdx)?,
"<p>a &lt;\nb\t&gt;b</p>",
"should *not* support whitespace in the opening tag (named)"
);
assert_eq!(
- micromark_with_options("a <!> b", &mdx)
+ to_html_with_options("a <!> b", &mdx)
.err()
.unwrap(),
"1:4: Unexpected character `!` (U+0021) before name, expected a character that can start a name, such as a letter, `$`, or `_` (note: to create a comment in MDX, use `{/* text */}`)",
@@ -601,7 +599,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a </(> b.", &mdx)
+ to_html_with_options("a </(> b.", &mdx)
.err()
.unwrap(),
"1:5: Unexpected character `(` (U+0028) before name, expected a character that can start a name, such as a letter, `$`, or `_`",
@@ -609,13 +607,13 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <π /> b.", &mdx)?,
+ to_html_with_options("a <π /> b.", &mdx)?,
"<p>a b.</p>",
"should support non-ascii identifier start characters"
);
assert_eq!(
- micromark_with_options("a <© /> b.", &mdx)
+ to_html_with_options("a <© /> b.", &mdx)
.err()
.unwrap(),
"1:4: Unexpected character U+00A9 before name, expected a character that can start a name, such as a letter, `$`, or `_`",
@@ -623,7 +621,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <!--b-->", &mdx)
+ to_html_with_options("a <!--b-->", &mdx)
.err()
.unwrap(),
"1:4: Unexpected character `!` (U+0021) before name, expected a character that can start a name, such as a letter, `$`, or `_` (note: to create a comment in MDX, use `{/* text */}`)",
@@ -631,7 +629,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <// b\nc/>", &mdx)
+ to_html_with_options("a <// b\nc/>", &mdx)
.err()
.unwrap(),
"1:5: Unexpected character `/` (U+002F) before name, expected a character that can start a name, such as a letter, `$`, or `_` (note: JS comments in JSX tags are not supported in MDX)",
@@ -639,7 +637,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <b// c\nd/>", &mdx)
+ to_html_with_options("a <b// c\nd/>", &mdx)
.err()
.unwrap(),
"1:6: Unexpected character `/` (U+002F) after self-closing slash, expected `>` to end the tag (note: JS comments in JSX tags are not supported in MDX)",
@@ -647,7 +645,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a </*b*/c>", &mdx)
+ to_html_with_options("a </*b*/c>", &mdx)
.err()
.unwrap(),
"1:5: Unexpected character `*` (U+002A) before name, expected a character that can start a name, such as a letter, `$`, or `_`",
@@ -655,7 +653,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <b/*c*/>", &mdx)
+ to_html_with_options("a <b/*c*/>", &mdx)
.err()
.unwrap(),
"1:6: Unexpected character `*` (U+002A) after self-closing slash, expected `>` to end the tag",
@@ -663,13 +661,13 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <a\u{200C}b /> b.", &mdx)?,
+ to_html_with_options("a <a\u{200C}b /> b.", &mdx)?,
"<p>a b.</p>",
"should support non-ascii identifier continuation characters"
);
assert_eq!(
- micromark_with_options("a <a¬ /> b.", &mdx)
+ to_html_with_options("a <a¬ /> b.", &mdx)
.err()
.unwrap(),
"1:5: Unexpected character U+00AC in name, expected a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag",
@@ -677,7 +675,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <b@c.d>", &mdx)
+ to_html_with_options("a <b@c.d>", &mdx)
.err()
.unwrap(),
"1:5: Unexpected character `@` (U+0040) in name, expected a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag (note: to create a link in MDX, use `[text](url)`)",
@@ -685,13 +683,13 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <a-->b</a-->.", &mdx)?,
+ to_html_with_options("a <a-->b</a-->.", &mdx)?,
"<p>a b.</p>",
"should support dashes in names"
);
assert_eq!(
- micromark_with_options("a <a?> c.", &mdx)
+ to_html_with_options("a <a?> c.", &mdx)
.err()
.unwrap(),
"1:5: Unexpected character `?` (U+003F) in name, expected a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag",
@@ -699,13 +697,13 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <abc . def.ghi>b</abc.def . ghi>.", &mdx)?,
+ to_html_with_options("a <abc . def.ghi>b</abc.def . ghi>.", &mdx)?,
"<p>a b.</p>",
"should support dots in names for method names"
);
assert_eq!(
- micromark_with_options("a <b.c@d.e>", &mdx)
+ to_html_with_options("a <b.c@d.e>", &mdx)
.err()
.unwrap(),
"1:7: Unexpected character `@` (U+0040) in member name, expected a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag (note: to create a link in MDX, use `[text](url)`)",
@@ -713,13 +711,13 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <svg: rect>b</ svg :rect>.", &mdx)?,
+ to_html_with_options("a <svg: rect>b</ svg :rect>.", &mdx)?,
"<p>a b.</p>",
"should support colons in names for local names"
);
assert_eq!(
- micromark_with_options("a <a:+> c.", &mdx)
+ to_html_with_options("a <a:+> c.", &mdx)
.err()
.unwrap(),
"1:6: Unexpected character `+` (U+002B) before local name, expected a character that can start a name, such as a letter, `$`, or `_` (note: to create a link in MDX, use `[text](url)`)",
@@ -727,7 +725,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <http://example.com>", &mdx)
+ to_html_with_options("a <http://example.com>", &mdx)
.err()
.unwrap(),
"1:9: Unexpected character `/` (U+002F) before local name, expected a character that can start a name, such as a letter, `$`, or `_` (note: to create a link in MDX, use `[text](url)`)",
@@ -735,7 +733,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <http: >", &mdx)
+ to_html_with_options("a <http: >", &mdx)
.err()
.unwrap(),
"1:10: Unexpected character `>` (U+003E) before local name, expected a character that can start a name, such as a letter, `$`, or `_`",
@@ -743,7 +741,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <a:b|> c.", &mdx)
+ to_html_with_options("a <a:b|> c.", &mdx)
.err()
.unwrap(),
"1:7: Unexpected character `|` (U+007C) in local name, expected a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag",
@@ -751,7 +749,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <a..> c.", &mdx)
+ to_html_with_options("a <a..> c.", &mdx)
.err()
.unwrap(),
"1:6: Unexpected character `.` (U+002E) before member name, expected a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag",
@@ -759,7 +757,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <a.b,> c.", &mdx)
+ to_html_with_options("a <a.b,> c.", &mdx)
.err()
.unwrap(),
"1:7: Unexpected character `,` (U+002C) in member name, expected a name character such as letters, digits, `$`, or `_`; whitespace before attributes; or the end of the tag",
@@ -767,7 +765,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <a:b .> c.", &mdx)
+ to_html_with_options("a <a:b .> c.", &mdx)
.err()
.unwrap(),
"1:8: Unexpected character `.` (U+002E) after local name, expected a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag",
@@ -775,7 +773,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <a.b :> c.", &mdx)
+ to_html_with_options("a <a.b :> c.", &mdx)
.err()
.unwrap(),
"1:8: Unexpected character `:` (U+003A) after member name, expected a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag",
@@ -783,7 +781,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <a => c.", &mdx)
+ to_html_with_options("a <a => c.", &mdx)
.err()
.unwrap(),
"1:6: Unexpected character `=` (U+003D) after name, expected a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag",
@@ -791,61 +789,61 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <b {...props} {...rest}>c</b>.", &mdx)?,
+ to_html_with_options("a <b {...props} {...rest}>c</b>.", &mdx)?,
"<p>a c.</p>",
"should support attribute expressions"
);
assert_eq!(
- micromark_with_options("a <b {...{\"a\": \"b\"}}>c</b>.", &mdx)?,
+ to_html_with_options("a <b {...{\"a\": \"b\"}}>c</b>.", &mdx)?,
"<p>a c.</p>",
"should support nested balanced braces in attribute expressions"
);
assert_eq!(
- micromark_with_options("<a{...b}/>.", &mdx)?,
+ to_html_with_options("<a{...b}/>.", &mdx)?,
"<p>.</p>",
"should support attribute expressions directly after a name"
);
assert_eq!(
- micromark_with_options("<a.b{...c}/>.", &mdx)?,
+ to_html_with_options("<a.b{...c}/>.", &mdx)?,
"<p>.</p>",
"should support attribute expressions directly after a member name"
);
assert_eq!(
- micromark_with_options("<a:b{...c}/>.", &mdx)?,
+ to_html_with_options("<a:b{...c}/>.", &mdx)?,
"<p>.</p>",
"should support attribute expressions directly after a local name"
);
assert_eq!(
- micromark_with_options("a <b c{...d}/>.", &mdx)?,
+ to_html_with_options("a <b c{...d}/>.", &mdx)?,
"<p>a .</p>",
"should support attribute expressions directly after boolean attributes"
);
assert_eq!(
- micromark_with_options("a <b c:d{...e}/>.", &mdx)?,
+ to_html_with_options("a <b c:d{...e}/>.", &mdx)?,
"<p>a .</p>",
"should support attribute expressions directly after boolean qualified attributes"
);
assert_eq!(
- micromark_with_options("a <b a {...props} b>c</b>.", &mdx)?,
+ to_html_with_options("a <b a {...props} b>c</b>.", &mdx)?,
"<p>a c.</p>",
"should support attribute expressions and normal attributes"
);
assert_eq!(
- micromark_with_options("a <b c d=\"d\"\t\tefg=\"e\">c</b>.", &mdx)?,
+ to_html_with_options("a <b c d=\"d\"\t\tefg=\"e\">c</b>.", &mdx)?,
"<p>a c.</p>",
"should support attributes"
);
assert_eq!(
- micromark_with_options("a <b {...p}~>c</b>.", &mdx)
+ to_html_with_options("a <b {...p}~>c</b>.", &mdx)
.err()
.unwrap(),
"1:12: Unexpected character `~` (U+007E) before attribute name, expected a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag",
@@ -853,7 +851,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <b {...", &mdx)
+ to_html_with_options("a <b {...", &mdx)
.err()
.unwrap(),
"1:10: Unexpected end of file in expression, expected a corresponding closing brace for `{`",
@@ -861,7 +859,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <a b@> c.", &mdx)
+ to_html_with_options("a <a b@> c.", &mdx)
.err()
.unwrap(),
"1:7: Unexpected character `@` (U+0040) in attribute name, expected an attribute name character such as letters, digits, `$`, or `_`; `=` to initialize a value; whitespace before attributes; or the end of the tag",
@@ -869,19 +867,19 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <b xml :\tlang\n= \"de-CH\" foo:bar>c</b>.", &mdx)?,
+ to_html_with_options("a <b xml :\tlang\n= \"de-CH\" foo:bar>c</b>.", &mdx)?,
"<p>a c.</p>",
"should support prefixed attributes"
);
assert_eq!(
- micromark_with_options("a <b a b : c d : e = \"f\" g/>.", &mdx)?,
+ to_html_with_options("a <b a b : c d : e = \"f\" g/>.", &mdx)?,
"<p>a .</p>",
"should support prefixed and normal attributes"
);
assert_eq!(
- micromark_with_options("a <a b 1> c.", &mdx)
+ to_html_with_options("a <a b 1> c.", &mdx)
.err()
.unwrap(),
"1:8: Unexpected character `1` (U+0031) after attribute name, expected a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag",
@@ -889,7 +887,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <a b:#> c.", &mdx)
+ to_html_with_options("a <a b:#> c.", &mdx)
.err()
.unwrap(),
"1:8: Unexpected character `#` (U+0023) before local attribute name, expected a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag",
@@ -897,7 +895,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <a b:c%> c.", &mdx)
+ to_html_with_options("a <a b:c%> c.", &mdx)
.err()
.unwrap(),
"1:9: Unexpected character `%` (U+0025) in local attribute name, expected an attribute name character such as letters, digits, `$`, or `_`; `=` to initialize a value; whitespace before attributes; or the end of the tag",
@@ -905,7 +903,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <a b:c ^> c.", &mdx)
+ to_html_with_options("a <a b:c ^> c.", &mdx)
.err()
.unwrap(),
"1:10: Unexpected character `^` (U+005E) after local attribute name, expected a character that can start an attribute name, such as a letter, `$`, or `_`; `=` to initialize a value; or the end of the tag",
@@ -913,19 +911,19 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <b c={1 + 1}>c</b>.", &mdx)?,
+ to_html_with_options("a <b c={1 + 1}>c</b>.", &mdx)?,
"<p>a c.</p>",
"should support attribute value expressions"
);
assert_eq!(
- micromark_with_options("a <b c={1 + ({a: 1}).a}>c</b>.", &mdx)?,
+ to_html_with_options("a <b c={1 + ({a: 1}).a}>c</b>.", &mdx)?,
"<p>a c.</p>",
"should support nested balanced braces in attribute value expressions"
);
assert_eq!(
- micromark_with_options("a <a b=``> c.", &mdx)
+ to_html_with_options("a <a b=``> c.", &mdx)
.err()
.unwrap(),
"1:8: Unexpected character `` ` `` (U+0060) before attribute value, expected a character that can start an attribute value, such as `\"`, `'`, or `{`",
@@ -933,7 +931,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <a b=<c />> d.", &mdx)
+ to_html_with_options("a <a b=<c />> d.", &mdx)
.err()
.unwrap(),
"1:8: Unexpected character `<` (U+003C) before attribute value, expected a character that can start an attribute value, such as `\"`, `'`, or `{` (note: to use an element or fragment as a prop value in MDX, use `{<element />}`)",
@@ -941,7 +939,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <a b=\"> c.", &mdx)
+ to_html_with_options("a <a b=\"> c.", &mdx)
.err()
.unwrap(),
"1:13: Unexpected end of file in attribute value, expected a corresponding closing quote `\"` (U+0022)",
@@ -949,7 +947,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <a b=\"> c.", &mdx)
+ to_html_with_options("a <a b=\"> c.", &mdx)
.err()
.unwrap(),
"1:13: Unexpected end of file in attribute value, expected a corresponding closing quote `\"` (U+0022)",
@@ -957,7 +955,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <a b={> c.", &mdx)
+ to_html_with_options("a <a b={> c.", &mdx)
.err()
.unwrap(),
"1:13: Unexpected end of file in expression, expected a corresponding closing brace for `{`",
@@ -965,7 +963,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("a <a b=\"\"*> c.", &mdx)
+ to_html_with_options("a <a b=\"\"*> c.", &mdx)
.err()
.unwrap(),
"1:10: Unexpected character `*` (U+002A) before attribute name, expected a character that can start an attribute name, such as a letter, `$`, or `_`; whitespace before attributes; or the end of the tag",
@@ -973,19 +971,19 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("<a b=\"\"c/>.", &mdx)?,
+ to_html_with_options("<a b=\"\"c/>.", &mdx)?,
"<p>.</p>",
"should support an attribute directly after a value"
);
assert_eq!(
- micromark_with_options("<a{...b}c/>.", &mdx)?,
+ to_html_with_options("<a{...b}c/>.", &mdx)?,
"<p>.</p>",
"should support an attribute directly after an attribute expression"
);
assert_eq!(
- micromark_with_options("a <a/b> c.", &mdx)
+ to_html_with_options("a <a/b> c.", &mdx)
.err()
.unwrap(),
"1:6: Unexpected character `b` (U+0062) after self-closing slash, expected `>` to end the tag",
@@ -993,101 +991,101 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("<a/ \t>.", &mdx)?,
+ to_html_with_options("<a/ \t>.", &mdx)?,
"<p>.</p>",
"should support whitespace directly after closing slash"
);
assert_eq!(
- micromark_with_options("a > c.", &mdx).err(),
+ to_html_with_options("a > c.", &mdx).err(),
None,
"should *not* crash on closing angle in text"
);
assert_eq!(
- micromark_with_options("a <>`<`</> c.", &mdx).err(),
+ to_html_with_options("a <>`<`</> c.", &mdx).err(),
None,
"should *not* crash on opening angle in tick code in an element"
);
assert_eq!(
- micromark_with_options("a <>`` ``` ``</>", &mdx).err(),
+ to_html_with_options("a <>`` ``` ``</>", &mdx).err(),
None,
"should *not* crash on ticks in tick code in an element"
);
assert_eq!(
- micromark_with_options("a </> c.", &mdx)?,
+ to_html_with_options("a </> c.", &mdx)?,
"<p>a c.</p>",
"should support a closing tag w/o open elements"
);
assert_eq!(
- micromark_with_options("a <></b>", &mdx)?,
+ to_html_with_options("a <></b>", &mdx)?,
"<p>a </p>",
"should support mismatched tags (1)"
);
assert_eq!(
- micromark_with_options("a <b></>", &mdx)?,
+ to_html_with_options("a <b></>", &mdx)?,
"<p>a </p>",
"should support mismatched tags (2)"
);
assert_eq!(
- micromark_with_options("a <a.b></a>", &mdx)?,
+ to_html_with_options("a <a.b></a>", &mdx)?,
"<p>a </p>",
"should support mismatched tags (3)"
);
assert_eq!(
- micromark_with_options("a <a></a.b>", &mdx)?,
+ to_html_with_options("a <a></a.b>", &mdx)?,
"<p>a </p>",
"should support mismatched tags (4)"
);
assert_eq!(
- micromark_with_options("a <a.b></a.c>", &mdx)?,
+ to_html_with_options("a <a.b></a.c>", &mdx)?,
"<p>a </p>",
"should support mismatched tags (5)"
);
assert_eq!(
- micromark_with_options("a <a:b></a>", &mdx)?,
+ to_html_with_options("a <a:b></a>", &mdx)?,
"<p>a </p>",
"should support mismatched tags (6)"
);
assert_eq!(
- micromark_with_options("a <a></a:b>", &mdx)?,
+ to_html_with_options("a <a></a:b>", &mdx)?,
"<p>a </p>",
"should support mismatched tags (7)"
);
assert_eq!(
- micromark_with_options("a <a:b></a:c>", &mdx)?,
+ to_html_with_options("a <a:b></a:c>", &mdx)?,
"<p>a </p>",
"should support mismatched tags (8)"
);
assert_eq!(
- micromark_with_options("a <a:b></a.b>", &mdx)?,
+ to_html_with_options("a <a:b></a.b>", &mdx)?,
"<p>a </p>",
"should support mismatched tags (9)"
);
assert_eq!(
- micromark_with_options("a <a>b</a/>", &mdx)?,
+ to_html_with_options("a <a>b</a/>", &mdx)?,
"<p>a b</p>",
"should support a closing self-closing tag"
);
assert_eq!(
- micromark_with_options("a <a>b</a b>", &mdx)?,
+ to_html_with_options("a <a>b</a b>", &mdx)?,
"<p>a b</p>",
"should support a closing tag w/ attributes"
);
assert_eq!(
- micromark_with_options("a <>b <>c</> d</>.", &mdx)?,
+ to_html_with_options("a <>b <>c</> d</>.", &mdx)?,
"<p>a b c d.</p>",
"should support nested tags"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"<x y=\"Character references can be used: &quot;, &apos;, &lt;, &gt;, &#x7B;, and &#x7D;, they can be named, decimal, or hexadecimal: &copy; &#8800; &#x1D306;\" />.",
&mdx
)?,
@@ -1096,7 +1094,7 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"<x>Character references can be used: &quot;, &apos;, &lt;, &gt;, &#x7B;, and &#x7D;, they can be named, decimal, or hexadecimal: &copy; &#8800; &#x1D306;</x>.",
&mdx
)?,
@@ -1105,97 +1103,97 @@ fn mdx_jsx_text_complete() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options("<x />.", &mdx)?,
+ to_html_with_options("<x />.", &mdx)?,
"<p>.</p>",
"should support as text if the closing tag is not the last thing"
);
assert_eq!(
- micromark_with_options("a <x />", &mdx)?,
+ to_html_with_options("a <x />", &mdx)?,
"<p>a </p>",
"should support as text if the opening is not the first thing"
);
assert_eq!(
- micromark_with_options("a *open <b> close* </b> c.", &mdx)?,
+ to_html_with_options("a *open <b> close* </b> c.", &mdx)?,
"<p>a <em>open close</em> c.</p>",
"should not care about precedence between attention (emphasis)"
);
assert_eq!(
- micromark_with_options("a **open <b> close** </b> c.", &mdx)?,
+ to_html_with_options("a **open <b> close** </b> c.", &mdx)?,
"<p>a <strong>open close</strong> c.</p>",
"should not care about precedence between attention (strong)"
);
assert_eq!(
- micromark_with_options("a [open <b> close](c) </b> d.", &mdx)?,
+ to_html_with_options("a [open <b> close](c) </b> d.", &mdx)?,
"<p>a <a href=\"c\">open close</a> d.</p>",
"should not care about precedence between label (link)"
);
assert_eq!(
- micromark_with_options("a ![open <b> close](c) </b> d.", &mdx)?,
+ to_html_with_options("a ![open <b> close](c) </b> d.", &mdx)?,
"<p>a <img src=\"c\" alt=\"open close\" /> d.</p>",
"should not care about precedence between label (image)"
);
assert_eq!(
- micromark_with_options("> a <b>\n> c </b> d.", &mdx)?,
+ to_html_with_options("> a <b>\n> c </b> d.", &mdx)?,
"<blockquote>\n<p>a \nc d.</p>\n</blockquote>",
"should support line endings in elements"
);
assert_eq!(
- micromark_with_options("> a <b c=\"d\ne\" /> f", &mdx)?,
+ to_html_with_options("> a <b c=\"d\ne\" /> f", &mdx)?,
"<blockquote>\n<p>a f</p>\n</blockquote>",
"should support line endings in attribute values"
);
assert_eq!(
- micromark_with_options("> a <b c={d\ne} /> f", &mdx)?,
+ to_html_with_options("> a <b c={d\ne} /> f", &mdx)?,
"<blockquote>\n<p>a f</p>\n</blockquote>",
"should support line endings in attribute value expressions"
);
assert_eq!(
- micromark_with_options("> a <b {c\nd} /> e", &mdx)?,
+ to_html_with_options("> a <b {c\nd} /> e", &mdx)?,
"<blockquote>\n<p>a e</p>\n</blockquote>",
"should support line endings in attribute expressions"
);
assert_eq!(
- micromark_with_options("> a <b\n/> c", &mdx)?,
+ to_html_with_options("> a <b\n/> c", &mdx)?,
"<blockquote>\n<p>a c</p>\n</blockquote>",
"should support lazy text (1)"
);
assert_eq!(
- micromark_with_options("> a <b c='\nd'/> e", &mdx)?,
+ to_html_with_options("> a <b c='\nd'/> e", &mdx)?,
"<blockquote>\n<p>a e</p>\n</blockquote>",
"should support lazy text (2)"
);
assert_eq!(
- micromark_with_options("> a <b c='d\n'/> e", &mdx)?,
+ to_html_with_options("> a <b c='d\n'/> e", &mdx)?,
"<blockquote>\n<p>a e</p>\n</blockquote>",
"should support lazy text (3)"
);
assert_eq!(
- micromark_with_options("> a <b c='d\ne'/> f", &mdx)?,
+ to_html_with_options("> a <b c='d\ne'/> f", &mdx)?,
"<blockquote>\n<p>a f</p>\n</blockquote>",
"should support lazy text (4)"
);
assert_eq!(
- micromark_with_options("> a <b c={d\ne}/> f", &mdx)?,
+ to_html_with_options("> a <b c={d\ne}/> f", &mdx)?,
"<blockquote>\n<p>a f</p>\n</blockquote>",
"should support lazy text (5)"
);
assert_eq!(
- micromark_with_options("1 < 3", &mdx)?,
+ to_html_with_options("1 < 3", &mdx)?,
"<p>1 &lt; 3</p>",
"should allow `<` followed by markdown whitespace as text in markdown"
);
diff --git a/tests/mdx_swc.rs b/tests/mdx_swc.rs
index d4b8e46..ed9bc60 100644
--- a/tests/mdx_swc.rs
+++ b/tests/mdx_swc.rs
@@ -1,6 +1,6 @@
-extern crate micromark;
+extern crate markdown;
mod test_utils;
-use micromark::{micromark_with_options, Constructs, Options, ParseOptions};
+use markdown::{to_html_with_options, Constructs, Options, ParseOptions};
use pretty_assertions::assert_eq;
use test_utils::swc::{parse_esm, parse_expression};
@@ -17,31 +17,31 @@ fn mdx_swc() -> Result<(), String> {
};
assert_eq!(
- micromark_with_options("{'}'}", &swc)?,
+ to_html_with_options("{'}'}", &swc)?,
"",
"should support JavaScript-aware flow expressions w/ `mdx_expression_parse`"
);
assert_eq!(
- micromark_with_options("a {'}'} b", &swc)?,
+ to_html_with_options("a {'}'} b", &swc)?,
"<p>a b</p>",
"should support JavaScript-aware text expressions w/ `mdx_expression_parse`"
);
assert_eq!(
- micromark_with_options("<a {...a/*}*/} />", &swc)?,
+ to_html_with_options("<a {...a/*}*/} />", &swc)?,
"",
"should support JavaScript-aware attribute expressions w/ `mdx_expression_parse`"
);
assert_eq!(
- micromark_with_options("<a b={'}'} />", &swc)?,
+ to_html_with_options("<a b={'}'} />", &swc)?,
"",
"should support JavaScript-aware attribute value expressions w/ `mdx_expression_parse`"
);
assert_eq!(
- micromark_with_options("import a from 'b'\n\nexport {a}\n\n# c", &swc)?,
+ to_html_with_options("import a from 'b'\n\nexport {a}\n\n# c", &swc)?,
"<h1>c</h1>",
"should support JavaScript-aware ESM w/ `mdx_esm_parse`"
);
diff --git a/tests/misc_bom.rs b/tests/misc_bom.rs
index 47ce902..f15eae2 100644
--- a/tests/misc_bom.rs
+++ b/tests/misc_bom.rs
@@ -1,13 +1,13 @@
-extern crate micromark;
-use micromark::micromark;
+extern crate markdown;
+use markdown::to_html;
use pretty_assertions::assert_eq;
#[test]
fn bom() {
- assert_eq!(micromark("\u{FEFF}"), "", "should ignore just a bom");
+ assert_eq!(to_html("\u{FEFF}"), "", "should ignore just a bom");
assert_eq!(
- micromark("\u{FEFF}# hea\u{FEFF}ding"),
+ to_html("\u{FEFF}# hea\u{FEFF}ding"),
"<h1>hea\u{FEFF}ding</h1>",
"should ignore a bom"
);
diff --git a/tests/misc_dangerous_html.rs b/tests/misc_dangerous_html.rs
index 9787813..6de045f 100644
--- a/tests/misc_dangerous_html.rs
+++ b/tests/misc_dangerous_html.rs
@@ -1,5 +1,5 @@
-extern crate micromark;
-use micromark::{micromark, micromark_with_options, CompileOptions, Options};
+extern crate markdown;
+use markdown::{to_html, to_html_with_options, CompileOptions, Options};
use pretty_assertions::assert_eq;
#[test]
@@ -14,19 +14,19 @@ fn dangerous_html() -> Result<(), String> {
};
assert_eq!(
- micromark("<x>"),
+ to_html("<x>"),
"&lt;x&gt;",
"should be safe by default for flow"
);
assert_eq!(
- micromark("a<b>"),
+ to_html("a<b>"),
"<p>a&lt;b&gt;</p>",
"should be safe by default for text"
);
assert_eq!(
- micromark_with_options("<x>", danger)?,
+ to_html_with_options("<x>", danger)?,
"<x>",
"should be unsafe w/ `allowDangerousHtml`"
);
diff --git a/tests/misc_dangerous_protocol.rs b/tests/misc_dangerous_protocol.rs
index 0c25eba..1703d60 100644
--- a/tests/misc_dangerous_protocol.rs
+++ b/tests/misc_dangerous_protocol.rs
@@ -1,35 +1,35 @@
-extern crate micromark;
-use micromark::micromark;
+extern crate markdown;
+use markdown::to_html;
use pretty_assertions::assert_eq;
#[test]
fn dangerous_protocol_autolink() {
assert_eq!(
- micromark("<javascript:alert(1)>"),
+ to_html("<javascript:alert(1)>"),
"<p><a href=\"\">javascript:alert(1)</a></p>",
"should be safe by default"
);
assert_eq!(
- micromark("<http://a>"),
+ to_html("<http://a>"),
"<p><a href=\"http://a\">http://a</a></p>",
"should allow `http:`"
);
assert_eq!(
- micromark("<https://a>"),
+ to_html("<https://a>"),
"<p><a href=\"https://a\">https://a</a></p>",
"should allow `https:`"
);
assert_eq!(
- micromark("<irc:///help>"),
+ to_html("<irc:///help>"),
"<p><a href=\"irc:///help\">irc:///help</a></p>",
"should allow `irc:`"
);
assert_eq!(
- micromark("<mailto:a>"),
+ to_html("<mailto:a>"),
"<p><a href=\"mailto:a\">mailto:a</a></p>",
"should allow `mailto:`"
);
@@ -38,79 +38,79 @@ fn dangerous_protocol_autolink() {
#[test]
fn dangerous_protocol_image() {
assert_eq!(
- micromark("![](javascript:alert(1))"),
+ to_html("![](javascript:alert(1))"),
"<p><img src=\"\" alt=\"\" /></p>",
"should be safe by default"
);
assert_eq!(
- micromark("![](http://a)"),
+ to_html("![](http://a)"),
"<p><img src=\"http://a\" alt=\"\" /></p>",
"should allow `http:`"
);
assert_eq!(
- micromark("![](https://a)"),
+ to_html("![](https://a)"),
"<p><img src=\"https://a\" alt=\"\" /></p>",
"should allow `https:`"
);
assert_eq!(
- micromark("![](irc:///help)"),
+ to_html("![](irc:///help)"),
"<p><img src=\"\" alt=\"\" /></p>",
"should not allow `irc:`"
);
assert_eq!(
- micromark("![](mailto:a)"),
+ to_html("![](mailto:a)"),
"<p><img src=\"\" alt=\"\" /></p>",
"should not allow `mailto:`"
);
assert_eq!(
- micromark("![](#a)"),
+ to_html("![](#a)"),
"<p><img src=\"#a\" alt=\"\" /></p>",
"should allow a hash"
);
assert_eq!(
- micromark("![](?a)"),
+ to_html("![](?a)"),
"<p><img src=\"?a\" alt=\"\" /></p>",
"should allow a search"
);
assert_eq!(
- micromark("![](/a)"),
+ to_html("![](/a)"),
"<p><img src=\"/a\" alt=\"\" /></p>",
"should allow an absolute"
);
assert_eq!(
- micromark("![](./a)"),
+ to_html("![](./a)"),
"<p><img src=\"./a\" alt=\"\" /></p>",
"should allow an relative"
);
assert_eq!(
- micromark("![](../a)"),
+ to_html("![](../a)"),
"<p><img src=\"../a\" alt=\"\" /></p>",
"should allow an upwards relative"
);
assert_eq!(
- micromark("![](a#b:c)"),
+ to_html("![](a#b:c)"),
"<p><img src=\"a#b:c\" alt=\"\" /></p>",
"should allow a colon in a hash"
);
assert_eq!(
- micromark("![](a?b:c)"),
+ to_html("![](a?b:c)"),
"<p><img src=\"a?b:c\" alt=\"\" /></p>",
"should allow a colon in a search"
);
assert_eq!(
- micromark("![](a/b:c)"),
+ to_html("![](a/b:c)"),
"<p><img src=\"a/b:c\" alt=\"\" /></p>",
"should allow a colon in a path"
);
@@ -119,79 +119,79 @@ fn dangerous_protocol_image() {
#[test]
fn dangerous_protocol_link() {
assert_eq!(
- micromark("[](javascript:alert(1))"),
+ to_html("[](javascript:alert(1))"),
"<p><a href=\"\"></a></p>",
"should be safe by default"
);
assert_eq!(
- micromark("[](http://a)"),
+ to_html("[](http://a)"),
"<p><a href=\"http://a\"></a></p>",
"should allow `http:`"
);
assert_eq!(
- micromark("[](https://a)"),
+ to_html("[](https://a)"),
"<p><a href=\"https://a\"></a></p>",
"should allow `https:`"
);
assert_eq!(
- micromark("[](irc:///help)"),
+ to_html("[](irc:///help)"),
"<p><a href=\"irc:///help\"></a></p>",
"should allow `irc:`"
);
assert_eq!(
- micromark("[](mailto:a)"),
+ to_html("[](mailto:a)"),
"<p><a href=\"mailto:a\"></a></p>",
"should allow `mailto:`"
);
assert_eq!(
- micromark("[](#a)"),
+ to_html("[](#a)"),
"<p><a href=\"#a\"></a></p>",
"should allow a hash"
);
assert_eq!(
- micromark("[](?a)"),
+ to_html("[](?a)"),
"<p><a href=\"?a\"></a></p>",
"should allow a search"
);
assert_eq!(
- micromark("[](/a)"),
+ to_html("[](/a)"),
"<p><a href=\"/a\"></a></p>",
"should allow an absolute"
);
assert_eq!(
- micromark("[](./a)"),
+ to_html("[](./a)"),
"<p><a href=\"./a\"></a></p>",
"should allow an relative"
);
assert_eq!(
- micromark("[](../a)"),
+ to_html("[](../a)"),
"<p><a href=\"../a\"></a></p>",
"should allow an upwards relative"
);
assert_eq!(
- micromark("[](a#b:c)"),
+ to_html("[](a#b:c)"),
"<p><a href=\"a#b:c\"></a></p>",
"should allow a colon in a hash"
);
assert_eq!(
- micromark("[](a?b:c)"),
+ to_html("[](a?b:c)"),
"<p><a href=\"a?b:c\"></a></p>",
"should allow a colon in a search"
);
assert_eq!(
- micromark("[](a/b:c)"),
+ to_html("[](a/b:c)"),
"<p><a href=\"a/b:c\"></a></p>",
"should allow a colon in a path"
);
diff --git a/tests/misc_default_line_ending.rs b/tests/misc_default_line_ending.rs
index f839e2c..306b1bc 100644
--- a/tests/misc_default_line_ending.rs
+++ b/tests/misc_default_line_ending.rs
@@ -1,35 +1,35 @@
-extern crate micromark;
-use micromark::{micromark, micromark_with_options, CompileOptions, LineEnding, Options};
+extern crate markdown;
+use markdown::{to_html, to_html_with_options, CompileOptions, LineEnding, Options};
use pretty_assertions::assert_eq;
#[test]
fn default_line_ending() -> Result<(), String> {
assert_eq!(
- micromark("> a"),
+ to_html("> a"),
"<blockquote>\n<p>a</p>\n</blockquote>",
"should use `\\n` default"
);
assert_eq!(
- micromark("> a\n"),
+ to_html("> a\n"),
"<blockquote>\n<p>a</p>\n</blockquote>\n",
"should infer the first line ending (1)"
);
assert_eq!(
- micromark("> a\r"),
+ to_html("> a\r"),
"<blockquote>\r<p>a</p>\r</blockquote>\r",
"should infer the first line ending (2)"
);
assert_eq!(
- micromark("> a\r\n"),
+ to_html("> a\r\n"),
"<blockquote>\r\n<p>a</p>\r\n</blockquote>\r\n",
"should infer the first line ending (3)"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"> a",
&Options {
compile: CompileOptions {
@@ -44,7 +44,7 @@ fn default_line_ending() -> Result<(), String> {
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"> a\n",
&Options {
compile: CompileOptions {
@@ -54,7 +54,7 @@ fn default_line_ending() -> Result<(), String> {
..Options::default()
}
)?,
- // To do: is this a bug in `micromark.js` that it uses `\r` for earlier line endings?
+ // To do: is this a bug in `to_html.js` that it uses `\r` for earlier line endings?
// "<blockquote>\r<p>a</p>\r</blockquote>\n",
"<blockquote>\n<p>a</p>\n</blockquote>\n",
"should support the given line ending, even if line endings exist"
diff --git a/tests/misc_line_ending.rs b/tests/misc_line_ending.rs
index 90f9df0..52b84d8 100644
--- a/tests/misc_line_ending.rs
+++ b/tests/misc_line_ending.rs
@@ -1,5 +1,5 @@
-extern crate micromark;
-use micromark::{micromark, micromark_with_options, CompileOptions, Options};
+extern crate markdown;
+use markdown::{to_html, to_html_with_options, CompileOptions, Options};
use pretty_assertions::assert_eq;
#[test]
@@ -13,176 +13,176 @@ fn line_ending() -> Result<(), String> {
..Options::default()
};
- assert_eq!(micromark("\n"), "", "should support just a line feed");
+ assert_eq!(to_html("\n"), "", "should support just a line feed");
- assert_eq!(micromark("\r"), "", "should support just a carriage return");
+ assert_eq!(to_html("\r"), "", "should support just a carriage return");
assert_eq!(
- micromark("\r\n"),
+ to_html("\r\n"),
"",
"should support just a carriage return + line feed"
);
- assert_eq!(micromark("\n\n"), "", "should support just two line feeds");
+ assert_eq!(to_html("\n\n"), "", "should support just two line feeds");
assert_eq!(
- micromark("\r\r"),
+ to_html("\r\r"),
"",
"should support just two carriage return"
);
assert_eq!(
- micromark("\r\n\r\n"),
+ to_html("\r\n\r\n"),
"",
"should support just two carriage return + line feeds"
);
assert_eq!(
- micromark("a\nb"),
+ to_html("a\nb"),
"<p>a\nb</p>",
"should support a line feed for a line ending inside a paragraph"
);
assert_eq!(
- micromark("a\rb"),
+ to_html("a\rb"),
"<p>a\rb</p>",
"should support a carriage return for a line ending inside a paragraph"
);
assert_eq!(
- micromark("a\r\nb"),
+ to_html("a\r\nb"),
"<p>a\r\nb</p>",
"should support a carriage return + line feed for a line ending inside a paragraph"
);
assert_eq!(
- micromark("\ta\n\tb"),
+ to_html("\ta\n\tb"),
"<pre><code>a\nb\n</code></pre>",
"should support a line feed in indented code (and prefer it)"
);
assert_eq!(
- micromark("\ta\r\tb"),
+ to_html("\ta\r\tb"),
"<pre><code>a\rb\r</code></pre>",
"should support a carriage return in indented code (and prefer it)"
);
assert_eq!(
- micromark("\ta\r\n\tb"),
+ to_html("\ta\r\n\tb"),
"<pre><code>a\r\nb\r\n</code></pre>",
"should support a carriage return + line feed in indented code (and prefer it)"
);
assert_eq!(
- micromark("***\n### Heading"),
+ to_html("***\n### Heading"),
"<hr />\n<h3>Heading</h3>",
"should support a line feed between flow"
);
assert_eq!(
- micromark("***\r### Heading"),
+ to_html("***\r### Heading"),
"<hr />\r<h3>Heading</h3>",
"should support a carriage return between flow"
);
assert_eq!(
- micromark("***\r\n### Heading"),
+ to_html("***\r\n### Heading"),
"<hr />\r\n<h3>Heading</h3>",
"should support a carriage return + line feed between flow"
);
assert_eq!(
- micromark("***\n\n\n### Heading\n"),
+ to_html("***\n\n\n### Heading\n"),
"<hr />\n<h3>Heading</h3>\n",
"should support several line feeds between flow"
);
assert_eq!(
- micromark("***\r\r\r### Heading\r"),
+ to_html("***\r\r\r### Heading\r"),
"<hr />\r<h3>Heading</h3>\r",
"should support several carriage returns between flow"
);
assert_eq!(
- micromark("***\r\n\r\n\r\n### Heading\r\n"),
+ to_html("***\r\n\r\n\r\n### Heading\r\n"),
"<hr />\r\n<h3>Heading</h3>\r\n",
"should support several carriage return + line feeds between flow"
);
assert_eq!(
- micromark("```x\n\n\ny\n\n\n```\n\n\n"),
+ to_html("```x\n\n\ny\n\n\n```\n\n\n"),
"<pre><code class=\"language-x\">\n\ny\n\n\n</code></pre>\n",
"should support several line feeds in fenced code"
);
assert_eq!(
- micromark("```x\r\r\ry\r\r\r```\r\r\r"),
+ to_html("```x\r\r\ry\r\r\r```\r\r\r"),
"<pre><code class=\"language-x\">\r\ry\r\r\r</code></pre>\r",
"should support several carriage returns in fenced code"
);
assert_eq!(
- micromark("```x\r\n\r\n\r\ny\r\n\r\n\r\n```\r\n\r\n\r\n"),
+ to_html("```x\r\n\r\n\r\ny\r\n\r\n\r\n```\r\n\r\n\r\n"),
"<pre><code class=\"language-x\">\r\n\r\ny\r\n\r\n\r\n</code></pre>\r\n",
"should support several carriage return + line feeds in fenced code"
);
assert_eq!(
- micromark("A\r\nB\r\n-\r\nC"),
+ to_html("A\r\nB\r\n-\r\nC"),
"<h2>A\r\nB</h2>\r\n<p>C</p>",
"should support a carriage return + line feed in content"
);
assert_eq!(
- micromark_with_options("<div\n", danger)?,
+ to_html_with_options("<div\n", danger)?,
"<div\n",
"should support a line feed after html"
);
assert_eq!(
- micromark_with_options("<div\r", danger)?,
+ to_html_with_options("<div\r", danger)?,
"<div\r",
"should support a carriage return after html"
);
assert_eq!(
- micromark_with_options("<div\r\n", danger)?,
+ to_html_with_options("<div\r\n", danger)?,
"<div\r\n",
"should support a carriage return + line feed after html"
);
assert_eq!(
- micromark_with_options("<div>\n\nx", danger)?,
+ to_html_with_options("<div>\n\nx", danger)?,
"<div>\n<p>x</p>",
"should support a blank line w/ line feeds after html"
);
assert_eq!(
- micromark_with_options("<div>\r\rx", danger)?,
+ to_html_with_options("<div>\r\rx", danger)?,
"<div>\r<p>x</p>",
"should support a blank line w/ carriage returns after html"
);
assert_eq!(
- micromark_with_options("<div>\r\n\r\nx", danger)?,
+ to_html_with_options("<div>\r\n\r\nx", danger)?,
"<div>\r\n<p>x</p>",
"should support a blank line w/ carriage return + line feeds after html"
);
assert_eq!(
- micromark_with_options("<div>\nx", danger)?,
+ to_html_with_options("<div>\nx", danger)?,
"<div>\nx",
"should support a non-blank line w/ line feed in html"
);
assert_eq!(
- micromark_with_options("<div>\rx", danger)?,
+ to_html_with_options("<div>\rx", danger)?,
"<div>\rx",
"should support a non-blank line w/ carriage return in html"
);
assert_eq!(
- micromark_with_options("<div>\r\nx", danger)?,
+ to_html_with_options("<div>\r\nx", danger)?,
"<div>\r\nx",
"should support a non-blank line w/ carriage return + line feed in html"
);
diff --git a/tests/misc_soft_break.rs b/tests/misc_soft_break.rs
index 43e2f3d..3d00464 100644
--- a/tests/misc_soft_break.rs
+++ b/tests/misc_soft_break.rs
@@ -1,17 +1,17 @@
-extern crate micromark;
-use micromark::micromark;
+extern crate markdown;
+use markdown::to_html;
use pretty_assertions::assert_eq;
#[test]
fn soft_break() {
assert_eq!(
- micromark("foo\nbaz"),
+ to_html("foo\nbaz"),
"<p>foo\nbaz</p>",
"should support line endings"
);
assert_eq!(
- micromark("foo \n baz"),
+ to_html("foo \n baz"),
"<p>foo\nbaz</p>",
"should trim spaces around line endings"
);
diff --git a/tests/misc_tabs.rs b/tests/misc_tabs.rs
index 56698e8..5de8de2 100644
--- a/tests/misc_tabs.rs
+++ b/tests/misc_tabs.rs
@@ -1,5 +1,5 @@
-extern crate micromark;
-use micromark::{micromark, micromark_with_options, CompileOptions, Options};
+extern crate markdown;
+use markdown::{to_html, to_html_with_options, CompileOptions, Options};
use pretty_assertions::assert_eq;
#[test]
@@ -14,121 +14,121 @@ fn tabs_flow() -> Result<(), String> {
};
assert_eq!(
- micromark(" x"),
+ to_html(" x"),
"<pre><code>x\n</code></pre>",
"should support a 4*SP to start code"
);
assert_eq!(
- micromark("\tx"),
+ to_html("\tx"),
"<pre><code>x\n</code></pre>",
"should support a HT to start code"
);
assert_eq!(
- micromark(" \tx"),
+ to_html(" \tx"),
"<pre><code>x\n</code></pre>",
"should support a SP + HT to start code"
);
assert_eq!(
- micromark(" \tx"),
+ to_html(" \tx"),
"<pre><code>x\n</code></pre>",
"should support a 2*SP + HT to start code"
);
assert_eq!(
- micromark(" \tx"),
+ to_html(" \tx"),
"<pre><code>x\n</code></pre>",
"should support a 3*SP + HT to start code"
);
assert_eq!(
- micromark(" \tx"),
+ to_html(" \tx"),
"<pre><code>\tx\n</code></pre>",
"should support a 4*SP to start code, and leave the next HT as code data"
);
assert_eq!(
- micromark(" \t# x"),
+ to_html(" \t# x"),
"<pre><code># x\n</code></pre>",
"should not support a 3*SP + HT to start an ATX heading"
);
assert_eq!(
- micromark(" \t> x"),
+ to_html(" \t> x"),
"<pre><code>&gt; x\n</code></pre>",
"should not support a 3*SP + HT to start a block quote"
);
assert_eq!(
- micromark(" \t- x"),
+ to_html(" \t- x"),
"<pre><code>- x\n</code></pre>",
"should not support a 3*SP + HT to start a list item"
);
assert_eq!(
- micromark(" \t---"),
+ to_html(" \t---"),
"<pre><code>---\n</code></pre>",
"should not support a 3*SP + HT to start a thematic break"
);
assert_eq!(
- micromark(" \t```"),
+ to_html(" \t```"),
"<pre><code>```\n</code></pre>",
"should not support a 3*SP + HT to start a fenced code"
);
assert_eq!(
- micromark(" \t<div>"),
+ to_html(" \t<div>"),
"<pre><code>&lt;div&gt;\n</code></pre>",
"should not support a 3*SP + HT to start HTML"
);
assert_eq!(
- micromark("#\tx\t#\t"),
+ to_html("#\tx\t#\t"),
"<h1>x</h1>",
"should support tabs around ATX heading sequences"
);
assert_eq!(
- micromark("#\t\tx\t\t#\t\t"),
+ to_html("#\t\tx\t\t#\t\t"),
"<h1>x</h1>",
"should support arbitrary tabs around ATX heading sequences"
);
assert_eq!(
- micromark("```\tx\ty\t\n```\t"),
+ to_html("```\tx\ty\t\n```\t"),
"<pre><code class=\"language-x\"></code></pre>",
"should support tabs around fenced code fences, info, and meta"
);
assert_eq!(
- micromark("```\t\tx\t\ty\t\t\n```\t\t"),
+ to_html("```\t\tx\t\ty\t\t\n```\t\t"),
"<pre><code class=\"language-x\"></code></pre>",
"should support arbitrary tabs around fenced code fences, info, and meta"
);
assert_eq!(
- micromark("```x\n\t```"),
+ to_html("```x\n\t```"),
"<pre><code class=\"language-x\">\t```\n</code></pre>\n",
"should not support tabs before fenced code closing fences"
);
assert_eq!(
- micromark_with_options("<x\ty\tz\t=\t\"\tx\t\">", danger)?,
+ to_html_with_options("<x\ty\tz\t=\t\"\tx\t\">", danger)?,
"<x\ty\tz\t=\t\"\tx\t\">",
"should support tabs in HTML (if whitespace is allowed)"
);
assert_eq!(
- micromark("*\t*\t*\t"),
+ to_html("*\t*\t*\t"),
"<hr />",
"should support tabs in thematic breaks"
);
assert_eq!(
- micromark("*\t\t*\t\t*\t\t"),
+ to_html("*\t\t*\t\t*\t\t"),
"<hr />",
"should support arbitrary tabs in thematic breaks"
);
@@ -139,67 +139,67 @@ fn tabs_flow() -> Result<(), String> {
#[test]
fn tabs_text() {
assert_eq!(
- micromark("<http:\t>"),
+ to_html("<http:\t>"),
"<p>&lt;http:\t&gt;</p>",
"should not support a tab to start an autolink w/ protocol’s rest"
);
assert_eq!(
- micromark("<http:x\t>"),
+ to_html("<http:x\t>"),
"<p>&lt;http:x\t&gt;</p>",
"should not support a tab in an autolink w/ protocol’s rest"
);
assert_eq!(
- micromark("<example\t@x.com>"),
+ to_html("<example\t@x.com>"),
"<p>&lt;example\t@x.com&gt;</p>",
"should not support a tab in an email autolink’s local part"
);
assert_eq!(
- micromark("<example@x\ty.com>"),
+ to_html("<example@x\ty.com>"),
"<p>&lt;example@x\ty.com&gt;</p>",
"should not support a tab in an email autolink’s label"
);
assert_eq!(
- micromark("\\\tx"),
+ to_html("\\\tx"),
"<p>\\\tx</p>",
"should not support character escaped tab"
);
assert_eq!(
- micromark("&#9;"),
+ to_html("&#9;"),
"<p>\t</p>",
"should support character reference resolving to a tab"
);
assert_eq!(
- micromark("`\tx`"),
+ to_html("`\tx`"),
"<p><code>\tx</code></p>",
"should support a tab starting code"
);
assert_eq!(
- micromark("`x\t`"),
+ to_html("`x\t`"),
"<p><code>x\t</code></p>",
"should support a tab ending code"
);
assert_eq!(
- micromark("`\tx\t`"),
+ to_html("`\tx\t`"),
"<p><code>\tx\t</code></p>",
"should support tabs around code"
);
assert_eq!(
- micromark("`\tx `"),
+ to_html("`\tx `"),
"<p><code>\tx </code></p>",
"should support a tab starting, and a space ending, code"
);
assert_eq!(
- micromark("` x\t`"),
+ to_html("` x\t`"),
"<p><code> x\t</code></p>",
"should support a space starting, and a tab ending, code"
);
@@ -208,50 +208,50 @@ fn tabs_text() {
// However, that should be a bug there: makes more sense to remove it like
// trailing spaces.
assert_eq!(
- micromark("x\t\ny"),
+ to_html("x\t\ny"),
"<p>x\ny</p>",
"should support a trailing tab at a line ending in a paragraph"
);
assert_eq!(
- micromark("x\n\ty"),
+ to_html("x\n\ty"),
"<p>x\ny</p>",
"should support an initial tab after a line ending in a paragraph"
);
assert_eq!(
- micromark("x[\ty](z)"),
+ to_html("x[\ty](z)"),
"<p>x<a href=\"z\">\ty</a></p>",
"should support an initial tab in a link label"
);
assert_eq!(
- micromark("x[y\t](z)"),
+ to_html("x[y\t](z)"),
"<p>x<a href=\"z\">y\t</a></p>",
"should support a final tab in a link label"
);
assert_eq!(
- micromark("[x\ty](z)"),
+ to_html("[x\ty](z)"),
"<p><a href=\"z\">x\ty</a></p>",
"should support a tab in a link label"
);
// Note: CM.js bug, see: <https://github.com/commonmark/commonmark.js/issues/191>
assert_eq!(
- micromark("[x](\ty)"),
+ to_html("[x](\ty)"),
"<p><a href=\"y\">x</a></p>",
"should support a tab starting a link resource"
);
assert_eq!(
- micromark("[x](y\t)"),
+ to_html("[x](y\t)"),
"<p><a href=\"y\">x</a></p>",
"should support a tab ending a link resource"
);
assert_eq!(
- micromark("[x](y\t\"z\")"),
+ to_html("[x](y\t\"z\")"),
"<p><a href=\"y\" title=\"z\">x</a></p>",
"should support a tab between a link destination and title"
);
@@ -260,31 +260,31 @@ fn tabs_text() {
#[test]
fn tabs_virtual_spaces() {
assert_eq!(
- micromark("```\n\tx"),
+ to_html("```\n\tx"),
"<pre><code>\tx\n</code></pre>\n",
"should support a tab in fenced code"
);
assert_eq!(
- micromark(" ```\n\tx"),
+ to_html(" ```\n\tx"),
"<pre><code> x\n</code></pre>\n",
"should strip 1 space from an initial tab in fenced code if the opening fence is indented as such"
);
assert_eq!(
- micromark(" ```\n\tx"),
+ to_html(" ```\n\tx"),
"<pre><code> x\n</code></pre>\n",
"should strip 2 spaces from an initial tab in fenced code if the opening fence is indented as such"
);
assert_eq!(
- micromark(" ```\n\tx"),
+ to_html(" ```\n\tx"),
"<pre><code> x\n</code></pre>\n",
"should strip 3 spaces from an initial tab in fenced code if the opening fence is indented as such"
);
assert_eq!(
- micromark("-\ta\n\n\tb"),
+ to_html("-\ta\n\n\tb"),
"<ul>\n<li>\n<p>a</p>\n<p>\tb</p>\n</li>\n</ul>",
// To do: CM.js does not output the tab before `b`. See if that makes sense?
// "<ul>\n<li>\n<p>a</p>\n<p>b</p>\n</li>\n</ul>",
diff --git a/tests/misc_url.rs b/tests/misc_url.rs
index 4fff26d..531b4ec 100644
--- a/tests/misc_url.rs
+++ b/tests/misc_url.rs
@@ -1,119 +1,119 @@
-extern crate micromark;
-use micromark::micromark;
+extern crate markdown;
+use markdown::to_html;
use pretty_assertions::assert_eq;
#[test]
fn url() {
assert_eq!(
- micromark("<https://%>"),
+ to_html("<https://%>"),
"<p><a href=\"https://%25\">https://%</a></p>",
"should support incorrect percentage encoded values (0)"
);
assert_eq!(
- micromark("[](<%>)"),
+ to_html("[](<%>)"),
"<p><a href=\"%25\"></a></p>",
"should support incorrect percentage encoded values (1)"
);
assert_eq!(
- micromark("[](<%%20>)"),
+ to_html("[](<%%20>)"),
"<p><a href=\"%25%20\"></a></p>",
"should support incorrect percentage encoded values (2)"
);
assert_eq!(
- micromark("[](<%a%20>)"),
+ to_html("[](<%a%20>)"),
"<p><a href=\"%25a%20\"></a></p>",
"should support incorrect percentage encoded values (3)"
);
// Note: Surrogate handling not needed in Rust.
// assert_eq!(
- // micromark("[](<foo\u{D800}bar>)"),
+ // to_html("[](<foo\u{D800}bar>)"),
// "<p><a href=\"foo%EF%BF%BDbar\"></a></p>",
// "should support a lone high surrogate (lowest)"
// );
// Surrogate handling not needed in Rust.
// assert_eq!(
- // micromark("[](<foo\u{DBFF}bar>)"),
+ // to_html("[](<foo\u{DBFF}bar>)"),
// "<p><a href=\"foo%EF%BF%BDbar\"></a></p>",
// "should support a lone high surrogate (highest)"
// );
// Surrogate handling not needed in Rust.
// assert_eq!(
- // micromark("[](<\u{D800}bar>)"),
+ // to_html("[](<\u{D800}bar>)"),
// "<p><a href=\"%EF%BF%BDbar\"></a></p>",
// "should support a lone high surrogate at the start (lowest)"
// );
// Surrogate handling not needed in Rust.
// assert_eq!(
- // micromark("[](<\u{DBFF}bar>)"),
+ // to_html("[](<\u{DBFF}bar>)"),
// "<p><a href=\"%EF%BF%BDbar\"></a></p>",
// "should support a lone high surrogate at the start (highest)"
// );
// Surrogate handling not needed in Rust.
// assert_eq!(
- // micromark("[](<foo\u{D800}>)"),
+ // to_html("[](<foo\u{D800}>)"),
// "<p><a href=\"foo%EF%BF%BD\"></a></p>",
// "should support a lone high surrogate at the end (lowest)"
// );
// Surrogate handling not needed in Rust.
// assert_eq!(
- // micromark("[](<foo\u{DBFF}>)"),
+ // to_html("[](<foo\u{DBFF}>)"),
// "<p><a href=\"foo%EF%BF%BD\"></a></p>",
// "should support a lone high surrogate at the end (highest)"
// );
// Surrogate handling not needed in Rust.
// assert_eq!(
- // micromark("[](<foo\u{DC00}bar>)"),
+ // to_html("[](<foo\u{DC00}bar>)"),
// "<p><a href=\"foo%EF%BF%BDbar\"></a></p>",
// "should support a lone low surrogate (lowest)"
// );
// Surrogate handling not needed in Rust.
// assert_eq!(
- // micromark("[](<foo\u{DFFF}bar>)"),
+ // to_html("[](<foo\u{DFFF}bar>)"),
// "<p><a href=\"foo%EF%BF%BDbar\"></a></p>",
// "should support a lone low surrogate (highest)"
// );
// Surrogate handling not needed in Rust.
// assert_eq!(
- // micromark("[](<\u{DC00}bar>)"),
+ // to_html("[](<\u{DC00}bar>)"),
// "<p><a href=\"%EF%BF%BDbar\"></a></p>",
// "should support a lone low surrogate at the start (lowest)"
// );
// Surrogate handling not needed in Rust.
// assert_eq!(
- // micromark("[](<\u{DFFF}bar>)"),
+ // to_html("[](<\u{DFFF}bar>)"),
// "<p><a href=\"%EF%BF%BDbar\"></a></p>",
// "should support a lone low surrogate at the start (highest)"
// );
// Surrogate handling not needed in Rust.
// assert_eq!(
- // micromark("[](<foo\u{DC00}>)"),
+ // to_html("[](<foo\u{DC00}>)"),
// "<p><a href=\"foo%EF%BF%BD\"></a></p>",
// "should support a lone low surrogate at the end (lowest)"
// );
// Surrogate handling not needed in Rust.
// assert_eq!(
- // micromark("[](<foo\u{DFFF}>)"),
+ // to_html("[](<foo\u{DFFF}>)"),
// "<p><a href=\"foo%EF%BF%BD\"></a></p>",
// "should support a lone low surrogate at the end (highest)"
// );
assert_eq!(
- micromark("[](<🤔>)"),
+ to_html("[](<🤔>)"),
"<p><a href=\"%F0%9F%A4%94\"></a></p>",
"should support an emoji"
);
@@ -141,7 +141,7 @@ fn url() {
let ascii_in = ascii.into_iter().collect::<String>();
let ascii_out = "%EF%BF%BD%01%02%03%04%05%06%07%08%09%0B%0C%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22#$%25&amp;'()*+,-./0123456789:;%3C=%3E?@ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F";
assert_eq!(
- micromark(&format!("[](<{}>)", ascii_in)),
+ to_html(&format!("[](<{}>)", ascii_in)),
format!("<p><a href=\"{}\"></a></p>", ascii_out),
"should support ascii characters"
);
diff --git a/tests/misc_zero.rs b/tests/misc_zero.rs
index 0b54d50..751a632 100644
--- a/tests/misc_zero.rs
+++ b/tests/misc_zero.rs
@@ -1,19 +1,19 @@
-extern crate micromark;
-use micromark::micromark;
+extern crate markdown;
+use markdown::to_html;
use pretty_assertions::assert_eq;
#[test]
fn zero() {
- assert_eq!(micromark(""), "", "should support no markdown");
+ assert_eq!(to_html(""), "", "should support no markdown");
assert_eq!(
- micromark("asd\0asd"),
+ to_html("asd\0asd"),
"<p>asd�asd</p>",
"should replace `\\0` w/ a replacement characters (`�`)"
);
assert_eq!(
- micromark("&#0;"),
+ to_html("&#0;"),
"<p>�</p>",
"should replace NUL in a character reference"
);
@@ -21,7 +21,7 @@ fn zero() {
// This doesn’t make sense in markdown, as character escapes only work on
// ascii punctuation, but it’s good to demonstrate the behavior.
assert_eq!(
- micromark("\\0"),
+ to_html("\\0"),
"<p>\\0</p>",
"should not support NUL in a character escape"
);
diff --git a/tests/test_utils/hast.rs b/tests/test_utils/hast.rs
index bc8f472..09a180a 100644
--- a/tests/test_utils/hast.rs
+++ b/tests/test_utils/hast.rs
@@ -6,14 +6,14 @@
// ^-- To do: externalize.
extern crate alloc;
-extern crate micromark;
+extern crate markdown;
use alloc::{
fmt,
string::{String, ToString},
vec::Vec,
};
-pub use micromark::mdast::{AttributeContent, AttributeValue, MdxJsxAttribute, Stop};
-use micromark::unist::Position;
+pub use markdown::mdast::{AttributeContent, AttributeValue, MdxJsxAttribute, Stop};
+use markdown::unist::Position;
/// Nodes.
#[derive(Clone, PartialEq, Eq)]
diff --git a/tests/test_utils/hast_util_to_swc.rs b/tests/test_utils/hast_util_to_swc.rs
index a4bb9b9..bd9b865 100644
--- a/tests/test_utils/hast_util_to_swc.rs
+++ b/tests/test_utils/hast_util_to_swc.rs
@@ -34,7 +34,7 @@ use crate::test_utils::{
swc_utils::{create_ident, position_to_span},
};
use core::str;
-use micromark::{Location, MdxExpressionKind};
+use markdown::{Location, MdxExpressionKind};
/// Result.
#[derive(Debug, PartialEq, Eq)]
diff --git a/tests/test_utils/mdast_util_to_hast.rs b/tests/test_utils/mdast_util_to_hast.rs
index c07d15b..29d9489 100644
--- a/tests/test_utils/mdast_util_to_hast.rs
+++ b/tests/test_utils/mdast_util_to_hast.rs
@@ -27,7 +27,7 @@
//! SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
use crate::test_utils::hast;
-use micromark::{mdast, sanitize, unist::Position};
+use markdown::{mdast, sanitize, unist::Position};
// To do: support these compile options:
// ```
diff --git a/tests/test_utils/mdx.rs b/tests/test_utils/mdx.rs
index 28238d0..4481b78 100644
--- a/tests/test_utils/mdx.rs
+++ b/tests/test_utils/mdx.rs
@@ -5,7 +5,7 @@ use crate::test_utils::{
mdx_plugin_recma_jsx_rewrite::{mdx_plugin_recma_jsx_rewrite, Options as RewriteOptions},
swc::{parse_esm, parse_expression, serialize},
};
-use micromark::{micromark_to_mdast, Constructs, Location, ParseOptions};
+use markdown::{to_mdast, Constructs, Location, ParseOptions};
pub use super::mdx_plugin_recma_document::JsxRuntime;
@@ -181,7 +181,7 @@ pub fn mdx(value: &str, filepath: Option<String>, options: &Options) -> Result<S
};
let location = Location::new(value.as_bytes());
- let mdast = micromark_to_mdast(value, &parse_options)?;
+ let mdast = to_mdast(value, &parse_options)?;
let hast = mdast_util_to_hast(&mdast);
let mut program = hast_util_to_swc(&hast, filepath, Some(&location))?;
mdx_plugin_recma_document(&mut program, &document_options, Some(&location))?;
diff --git a/tests/test_utils/mdx_plugin_recma_document.rs b/tests/test_utils/mdx_plugin_recma_document.rs
index 4c35b7a..34fd5bb 100644
--- a/tests/test_utils/mdx_plugin_recma_document.rs
+++ b/tests/test_utils/mdx_plugin_recma_document.rs
@@ -8,7 +8,7 @@ use crate::test_utils::{
hast_util_to_swc::Program,
swc_utils::{bytepos_to_point, prefix_error_with_point, span_to_position},
};
-use micromark::{
+use markdown::{
unist::{Point, Position},
Location,
};
diff --git a/tests/test_utils/mdx_plugin_recma_jsx_rewrite.rs b/tests/test_utils/mdx_plugin_recma_jsx_rewrite.rs
index 89e0ebd..2223d8e 100644
--- a/tests/test_utils/mdx_plugin_recma_jsx_rewrite.rs
+++ b/tests/test_utils/mdx_plugin_recma_jsx_rewrite.rs
@@ -12,7 +12,7 @@ use crate::test_utils::{
position_to_string, span_to_position,
},
};
-use micromark::{id_cont, id_start, unist::Position, Location};
+use markdown::{id_cont, id_start, unist::Position, Location};
use swc_ecma_visit::{noop_visit_mut_type, VisitMut, VisitMutWith};
/// Configuration.
diff --git a/tests/test_utils/swc.rs b/tests/test_utils/swc.rs
index 3c97d28..c958f6f 100644
--- a/tests/test_utils/swc.rs
+++ b/tests/test_utils/swc.rs
@@ -1,10 +1,10 @@
-//! Bridge between `micromark` and SWC.
-extern crate micromark;
+//! Bridge between `markdown-rs` and SWC.
+extern crate markdown;
extern crate swc_common;
extern crate swc_ecma_ast;
extern crate swc_ecma_parser;
use crate::test_utils::swc_utils::{bytepos_to_point, prefix_error_with_point, RewriteContext};
-use micromark::{mdast::Stop, unist::Point, Location, MdxExpressionKind, MdxSignal};
+use markdown::{mdast::Stop, unist::Point, Location, MdxExpressionKind, MdxSignal};
use swc_common::{
source_map::Pos, sync::Lrc, BytePos, FileName, FilePathMapping, SourceFile, SourceMap, Spanned,
};
diff --git a/tests/test_utils/swc_utils.rs b/tests/test_utils/swc_utils.rs
index 5a45af6..ac4c4db 100644
--- a/tests/test_utils/swc_utils.rs
+++ b/tests/test_utils/swc_utils.rs
@@ -1,6 +1,6 @@
//! Lots of helpers for dealing with SWC, particularly from unist.
-use micromark::{
+use markdown::{
mdast::Stop,
unist::{Point, Position},
Location,
diff --git a/tests/text.rs b/tests/text.rs
index 584f463..9c2b0a0 100644
--- a/tests/text.rs
+++ b/tests/text.rs
@@ -1,23 +1,23 @@
-extern crate micromark;
-use micromark::micromark;
+extern crate markdown;
+use markdown::to_html;
use pretty_assertions::assert_eq;
#[test]
fn text() {
assert_eq!(
- micromark("hello $.;'there"),
+ to_html("hello $.;'there"),
"<p>hello $.;'there</p>",
"should support ascii text"
);
assert_eq!(
- micromark("Foo χρῆν"),
+ to_html("Foo χρῆν"),
"<p>Foo χρῆν</p>",
"should support unicode text"
);
assert_eq!(
- micromark("Multiple spaces"),
+ to_html("Multiple spaces"),
"<p>Multiple spaces</p>",
"should preserve internal spaces verbatim"
);
diff --git a/tests/thematic_break.rs b/tests/thematic_break.rs
index c5612bb..735829d 100644
--- a/tests/thematic_break.rs
+++ b/tests/thematic_break.rs
@@ -1,7 +1,7 @@
-extern crate micromark;
-use micromark::{
+extern crate markdown;
+use markdown::{
mdast::{Node, Root, ThematicBreak},
- micromark, micromark_to_mdast, micromark_with_options,
+ to_html, to_html_with_options, to_mdast,
unist::Position,
Constructs, Options, ParseOptions,
};
@@ -10,169 +10,169 @@ use pretty_assertions::assert_eq;
#[test]
fn thematic_break() -> Result<(), String> {
assert_eq!(
- micromark("***\n---\n___"),
+ to_html("***\n---\n___"),
"<hr />\n<hr />\n<hr />",
"should support thematic breaks w/ asterisks, dashes, and underscores"
);
assert_eq!(
- micromark("+++"),
+ to_html("+++"),
"<p>+++</p>",
"should not support thematic breaks w/ plusses"
);
assert_eq!(
- micromark("==="),
+ to_html("==="),
"<p>===</p>",
"should not support thematic breaks w/ equals"
);
assert_eq!(
- micromark("--"),
+ to_html("--"),
"<p>--</p>",
"should not support thematic breaks w/ two dashes"
);
assert_eq!(
- micromark("**"),
+ to_html("**"),
"<p>**</p>",
"should not support thematic breaks w/ two asterisks"
);
assert_eq!(
- micromark("__"),
+ to_html("__"),
"<p>__</p>",
"should not support thematic breaks w/ two underscores"
);
assert_eq!(
- micromark(" ***"),
+ to_html(" ***"),
"<hr />",
"should support thematic breaks w/ 1 space"
);
assert_eq!(
- micromark(" ***"),
+ to_html(" ***"),
"<hr />",
"should support thematic breaks w/ 2 spaces"
);
assert_eq!(
- micromark(" ***"),
+ to_html(" ***"),
"<hr />",
"should support thematic breaks w/ 3 spaces"
);
assert_eq!(
- micromark(" ***"),
+ to_html(" ***"),
"<pre><code>***\n</code></pre>",
"should not support thematic breaks w/ 4 spaces"
);
assert_eq!(
- micromark("Foo\n ***"),
+ to_html("Foo\n ***"),
"<p>Foo\n***</p>",
"should not support thematic breaks w/ 4 spaces as paragraph continuation"
);
assert_eq!(
- micromark("_____________________________________"),
+ to_html("_____________________________________"),
"<hr />",
"should support thematic breaks w/ many markers"
);
assert_eq!(
- micromark(" - - -"),
+ to_html(" - - -"),
"<hr />",
"should support thematic breaks w/ spaces (1)"
);
assert_eq!(
- micromark(" ** * ** * ** * **"),
+ to_html(" ** * ** * ** * **"),
"<hr />",
"should support thematic breaks w/ spaces (2)"
);
assert_eq!(
- micromark("- - - -"),
+ to_html("- - - -"),
"<hr />",
"should support thematic breaks w/ spaces (3)"
);
assert_eq!(
- micromark("- - - - "),
+ to_html("- - - - "),
"<hr />",
"should support thematic breaks w/ trailing spaces"
);
assert_eq!(
- micromark("_ _ _ _ a"),
+ to_html("_ _ _ _ a"),
"<p>_ _ _ _ a</p>",
"should not support thematic breaks w/ other characters (1)"
);
assert_eq!(
- micromark("a------"),
+ to_html("a------"),
"<p>a------</p>",
"should not support thematic breaks w/ other characters (2)"
);
assert_eq!(
- micromark("---a---"),
+ to_html("---a---"),
"<p>---a---</p>",
"should not support thematic breaks w/ other characters (3)"
);
assert_eq!(
- micromark(" *-*"),
+ to_html(" *-*"),
"<p><em>-</em></p>",
"should not support thematic breaks w/ mixed markers"
);
assert_eq!(
- micromark("- foo\n***\n- bar"),
+ to_html("- foo\n***\n- bar"),
"<ul>\n<li>foo</li>\n</ul>\n<hr />\n<ul>\n<li>bar</li>\n</ul>",
"should support thematic breaks mixed w/ lists (1)"
);
assert_eq!(
- micromark("* Foo\n* * *\n* Bar"),
+ to_html("* Foo\n* * *\n* Bar"),
"<ul>\n<li>Foo</li>\n</ul>\n<hr />\n<ul>\n<li>Bar</li>\n</ul>",
"should support thematic breaks mixed w/ lists (2)"
);
assert_eq!(
- micromark("Foo\n***\nbar"),
+ to_html("Foo\n***\nbar"),
"<p>Foo</p>\n<hr />\n<p>bar</p>",
"should support thematic breaks interrupting paragraphs"
);
assert_eq!(
- micromark("Foo\n---\nbar"),
+ to_html("Foo\n---\nbar"),
"<h2>Foo</h2>\n<p>bar</p>",
"should not support thematic breaks w/ dashes interrupting paragraphs (setext heading)"
);
assert_eq!(
- micromark("- Foo\n- * * *"),
+ to_html("- Foo\n- * * *"),
"<ul>\n<li>Foo</li>\n<li>\n<hr />\n</li>\n</ul>",
"should support thematic breaks in lists"
);
assert_eq!(
- micromark("> ---\na"),
+ to_html("> ---\na"),
"<blockquote>\n<hr />\n</blockquote>\n<p>a</p>",
"should not support lazyness (1)"
);
assert_eq!(
- micromark("> a\n---"),
+ to_html("> a\n---"),
"<blockquote>\n<p>a</p>\n</blockquote>\n<hr />",
"should not support lazyness (2)"
);
assert_eq!(
- micromark_with_options(
+ to_html_with_options(
"***",
&Options {
parse: ParseOptions {
@@ -190,7 +190,7 @@ fn thematic_break() -> Result<(), String> {
);
assert_eq!(
- micromark_to_mdast("***", &ParseOptions::default())?,
+ to_mdast("***", &ParseOptions::default())?,
Node::Root(Root {
children: vec![Node::ThematicBreak(ThematicBreak {
position: Some(Position::new(1, 1, 0, 1, 4, 3))
diff --git a/tests/xxx_hast_util_to_swc.rs b/tests/xxx_hast_util_to_swc.rs
index a169811..138dbe3 100644
--- a/tests/xxx_hast_util_to_swc.rs
+++ b/tests/xxx_hast_util_to_swc.rs
@@ -1,4 +1,4 @@
-extern crate micromark;
+extern crate markdown;
extern crate swc_common;
extern crate swc_ecma_ast;
extern crate swc_ecma_codegen;
diff --git a/tests/xxx_mdast_util_to_hast.rs b/tests/xxx_mdast_util_to_hast.rs
index f46f980..dd66226 100644
--- a/tests/xxx_mdast_util_to_hast.rs
+++ b/tests/xxx_mdast_util_to_hast.rs
@@ -1,6 +1,6 @@
-extern crate micromark;
+extern crate markdown;
mod test_utils;
-use micromark::mdast;
+use markdown::mdast;
use pretty_assertions::assert_eq;
use test_utils::{hast, mdast_util_to_hast::mdast_util_to_hast};
diff --git a/tests/xxx_mdx.rs b/tests/xxx_mdx.rs
index 59125b3..3c73c62 100644
--- a/tests/xxx_mdx.rs
+++ b/tests/xxx_mdx.rs
@@ -1,4 +1,4 @@
-extern crate micromark;
+extern crate markdown;
extern crate swc_common;
extern crate swc_ecma_ast;
extern crate swc_ecma_codegen;
diff --git a/tests/xxx_mdx_plugin_recma_document.rs b/tests/xxx_mdx_plugin_recma_document.rs
index 9106c50..de25699 100644
--- a/tests/xxx_mdx_plugin_recma_document.rs
+++ b/tests/xxx_mdx_plugin_recma_document.rs
@@ -1,9 +1,9 @@
-extern crate micromark;
+extern crate markdown;
extern crate swc_common;
extern crate swc_ecma_ast;
extern crate swc_ecma_codegen;
mod test_utils;
-use micromark::{micromark_to_mdast, Constructs, Location, ParseOptions};
+use markdown::{to_mdast, Constructs, Location, ParseOptions};
use pretty_assertions::assert_eq;
use test_utils::{
hast_util_to_swc::hast_util_to_swc,
@@ -14,7 +14,7 @@ use test_utils::{
fn from_markdown(value: &str) -> Result<String, String> {
let location = Location::new(value.as_bytes());
- let mdast = micromark_to_mdast(
+ let mdast = to_mdast(
value,
&ParseOptions {
constructs: Constructs::mdx(),
diff --git a/tests/xxx_mdx_plugin_recma_jsx_rewrite.rs b/tests/xxx_mdx_plugin_recma_jsx_rewrite.rs
index b1d2ca8..9b9a4bc 100644
--- a/tests/xxx_mdx_plugin_recma_jsx_rewrite.rs
+++ b/tests/xxx_mdx_plugin_recma_jsx_rewrite.rs
@@ -1,9 +1,9 @@
-extern crate micromark;
+extern crate markdown;
extern crate swc_common;
extern crate swc_ecma_ast;
extern crate swc_ecma_codegen;
mod test_utils;
-use micromark::{micromark_to_mdast, Constructs, Location, ParseOptions};
+use markdown::{to_mdast, Constructs, Location, ParseOptions};
use pretty_assertions::assert_eq;
use test_utils::{
hast_util_to_swc::hast_util_to_swc,
@@ -15,7 +15,7 @@ use test_utils::{
fn from_markdown(value: &str, options: &RewriteOptions) -> Result<String, String> {
let location = Location::new(value.as_bytes());
- let mdast = micromark_to_mdast(
+ let mdast = to_mdast(
value,
&ParseOptions {
constructs: Constructs::mdx(),