aboutsummaryrefslogtreecommitdiffstats
path: root/tests/gfm_footnote.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/gfm_footnote.rs45
1 files changed, 44 insertions, 1 deletions
diff --git a/tests/gfm_footnote.rs b/tests/gfm_footnote.rs
index 42c70d3..8785239 100644
--- a/tests/gfm_footnote.rs
+++ b/tests/gfm_footnote.rs
@@ -1,5 +1,8 @@
extern crate micromark;
-use micromark::{micromark, micromark_with_options, Constructs, Options};
+use micromark::{
+ mdast::{FootnoteDefinition, FootnoteReference, Node, Paragraph, Position, Root, Text},
+ micromark, micromark_to_mdast, micromark_with_options, Constructs, Options,
+};
use pretty_assertions::assert_eq;
#[test]
@@ -1597,5 +1600,45 @@ multi-paragraph list items. <a href="#user-content-fnref-longnote" data-footnote
"should match references and definitions like GitHub"
);
+ assert_eq!(
+ micromark_to_mdast("[^a]: b\n\tc\n\nd [^a] e.", &gfm)?,
+ Node::Root(Root {
+ children: vec![
+ Node::FootnoteDefinition(FootnoteDefinition {
+ children: vec![Node::Paragraph(Paragraph {
+ children: vec![Node::Text(Text {
+ value: "b\nc".to_string(),
+ position: Some(Position::new(1, 7, 6, 2, 6, 10))
+ })],
+ position: Some(Position::new(1, 7, 6, 2, 6, 10))
+ })],
+ identifier: "a".to_string(),
+ label: Some("a".to_string()),
+ position: Some(Position::new(1, 1, 0, 3, 1, 11))
+ }),
+ Node::Paragraph(Paragraph {
+ children: vec![
+ Node::Text(Text {
+ value: "d ".to_string(),
+ position: Some(Position::new(4, 1, 12, 4, 3, 14))
+ }),
+ Node::FootnoteReference(FootnoteReference {
+ identifier: "a".to_string(),
+ label: Some("a".to_string()),
+ position: Some(Position::new(4, 3, 14, 4, 7, 18))
+ }),
+ Node::Text(Text {
+ value: " e.".to_string(),
+ position: Some(Position::new(4, 7, 18, 4, 10, 21))
+ })
+ ],
+ position: Some(Position::new(4, 1, 12, 4, 10, 21))
+ })
+ ],
+ position: Some(Position::new(1, 1, 0, 4, 10, 21))
+ }),
+ "should support GFM footnotes as `FootnoteDefinition`, `FootnoteReference`s in mdast"
+ );
+
Ok(())
}