diff options
author | Kyle McCarthy <km@kylemccarthy.io> | 2023-01-03 04:52:22 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-03 11:52:22 +0100 |
commit | 2045b0bfc467efeb605aad7d8297a1fa1fc3e0e9 (patch) | |
tree | 7dab2abbf993e04b269fbab3191d7bfa7b7663ae /tests | |
parent | af202d3f0ea24e0a957b02a6f9fb23c6c3b4afe7 (diff) | |
download | markdown-rs-2045b0bfc467efeb605aad7d8297a1fa1fc3e0e9.tar.gz markdown-rs-2045b0bfc467efeb605aad7d8297a1fa1fc3e0e9.tar.bz2 markdown-rs-2045b0bfc467efeb605aad7d8297a1fa1fc3e0e9.zip |
Add support for serializing trees as JSON
This adds support for serializing the mdast syntax tree as JSON,
with serde, through a feature.
Closes GH-10.
Related-to GH-30.
Closes GH-37.
Diffstat (limited to '')
-rw-r--r-- | tests/mdx_jsx_text.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/mdx_jsx_text.rs b/tests/mdx_jsx_text.rs index f548672..d0d1972 100644 --- a/tests/mdx_jsx_text.rs +++ b/tests/mdx_jsx_text.rs @@ -1,8 +1,8 @@ mod test_utils; use markdown::{ mdast::{ - AttributeContent, AttributeValue, Emphasis, MdxJsxAttribute, MdxJsxTextElement, Node, - Paragraph, Root, Text, + AttributeContent, AttributeValue, AttributeValueExpression, Emphasis, MdxJsxAttribute, + MdxJsxTextElement, Node, Paragraph, Root, Text, }, to_html_with_options, to_mdast, unist::Position, @@ -165,7 +165,10 @@ fn mdx_jsx_text_core() -> Result<(), String> { children: vec![ Node::MdxJsxTextElement(MdxJsxTextElement { name: Some("a".into()), - attributes: vec![AttributeContent::Expression("...b".into(), vec![(0, 4)])], + attributes: vec![AttributeContent::Expression { + value: "...b".into(), + stops: vec![(0, 4)] + }], children: vec![], position: Some(Position::new(1, 1, 0, 1, 13, 12)) }), @@ -231,7 +234,10 @@ fn mdx_jsx_text_core() -> Result<(), String> { }), AttributeContent::Property(MdxJsxAttribute { name: "f".into(), - value: Some(AttributeValue::Expression("g".into(), vec![(0, 18)])), + value: Some(AttributeValue::Expression(AttributeValueExpression { + value: "g".into(), + stops: vec![(0, 18)] + })), }), ], children: vec![], |