aboutsummaryrefslogtreecommitdiffstats
path: root/tests/mdx_jsx_text.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/mdx_jsx_text.rs280
1 files changed, 139 insertions, 141 deletions
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"
);