diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-09-26 16:12:25 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-09-26 16:12:25 +0200 |
commit | a0c84c505d733be2e987a333a34244c1befb56cb (patch) | |
tree | 0545a747b6f2f627a71bd31949ad622bbc56c176 /tests/mdx_jsx_flow.rs | |
parent | 9cb9e37c33173c16cbafd345f43e43b5a550537d (diff) | |
download | markdown-rs-a0c84c505d733be2e987a333a34244c1befb56cb.tar.gz markdown-rs-a0c84c505d733be2e987a333a34244c1befb56cb.tar.bz2 markdown-rs-a0c84c505d733be2e987a333a34244c1befb56cb.zip |
Add support for compiling to mdast
See: <https://github.com/syntax-tree/mdast>.
Diffstat (limited to 'tests/mdx_jsx_flow.rs')
-rw-r--r-- | tests/mdx_jsx_flow.rs | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/tests/mdx_jsx_flow.rs b/tests/mdx_jsx_flow.rs index 9b0453f..14e14f0 100644 --- a/tests/mdx_jsx_flow.rs +++ b/tests/mdx_jsx_flow.rs @@ -1,5 +1,8 @@ extern crate micromark; -use micromark::{micromark_with_options, Constructs, Options}; +use micromark::{ + mdast::{List, ListItem, MdxJsxFlowElement, Node, Paragraph, Position, Root, Text}, + micromark_to_mdast, micromark_with_options, Constructs, Options, +}; use pretty_assertions::assert_eq; #[test] @@ -141,5 +144,36 @@ fn mdx_jsx_flow_essence() -> Result<(), String> { "should not support lazy flow (7)" ); + assert_eq!( + micromark_to_mdast("<>\n * a\n</>", &mdx)?, + Node::Root(Root { + children: vec![Node::MdxJsxFlowElement(MdxJsxFlowElement { + name: None, + attributes: vec![], + children: vec![Node::List(List { + ordered: false, + spread: false, + start: None, + children: vec![Node::ListItem(ListItem { + checked: None, + spread: false, + children: vec![Node::Paragraph(Paragraph { + children: vec![Node::Text(Text { + value: "a".to_string(), + position: Some(Position::new(2, 5, 7, 2, 6, 8)) + }),], + position: Some(Position::new(2, 5, 7, 2, 6, 8)) + })], + position: Some(Position::new(2, 1, 3, 2, 6, 8)) + })], + position: Some(Position::new(2, 1, 3, 2, 6, 8)) + })], + position: Some(Position::new(1, 1, 0, 3, 4, 12)) + })], + position: Some(Position::new(1, 1, 0, 3, 4, 12)) + }), + "should support mdx jsx (flow) as `MdxJsxFlowElement`s in mdast" + ); + Ok(()) } |