aboutsummaryrefslogtreecommitdiffstats
path: root/tests/gfm_strikethrough.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-09-26 16:12:25 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-09-26 16:12:25 +0200
commita0c84c505d733be2e987a333a34244c1befb56cb (patch)
tree0545a747b6f2f627a71bd31949ad622bbc56c176 /tests/gfm_strikethrough.rs
parent9cb9e37c33173c16cbafd345f43e43b5a550537d (diff)
downloadmarkdown-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 '')
-rw-r--r--tests/gfm_strikethrough.rs33
1 files changed, 32 insertions, 1 deletions
diff --git a/tests/gfm_strikethrough.rs b/tests/gfm_strikethrough.rs
index b8c3e1f..d669a96 100644
--- a/tests/gfm_strikethrough.rs
+++ b/tests/gfm_strikethrough.rs
@@ -1,5 +1,8 @@
extern crate micromark;
-use micromark::{micromark, micromark_with_options, Constructs, Options};
+use micromark::{
+ mdast::{Delete, Node, Paragraph, Position, Root, Text},
+ micromark, micromark_to_mdast, micromark_with_options, Constructs, Options,
+};
use pretty_assertions::assert_eq;
#[test]
@@ -385,5 +388,33 @@ u ~**xxx**~ zzz
"should support strikethrough w/ one tilde if `singleTilde: true`"
);
+ assert_eq!(
+ micromark_to_mdast("a ~~alpha~~ b.", &gfm)?,
+ Node::Root(Root {
+ children: vec![Node::Paragraph(Paragraph {
+ children: vec![
+ Node::Text(Text {
+ value: "a ".to_string(),
+ position: Some(Position::new(1, 1, 0, 1, 3, 2))
+ }),
+ Node::Delete(Delete {
+ children: vec![Node::Text(Text {
+ value: "alpha".to_string(),
+ position: Some(Position::new(1, 5, 4, 1, 10, 9))
+ }),],
+ position: Some(Position::new(1, 3, 2, 1, 12, 11))
+ }),
+ Node::Text(Text {
+ value: " b.".to_string(),
+ position: Some(Position::new(1, 12, 11, 1, 15, 14))
+ }),
+ ],
+ position: Some(Position::new(1, 1, 0, 1, 15, 14))
+ })],
+ position: Some(Position::new(1, 1, 0, 1, 15, 14))
+ }),
+ "should support GFM strikethrough as `Delete`s in mdast"
+ );
+
Ok(())
}