From a0c84c505d733be2e987a333a34244c1befb56cb Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Mon, 26 Sep 2022 16:12:25 +0200 Subject: Add support for compiling to mdast See: . --- examples/lib.rs | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) (limited to 'examples') diff --git a/examples/lib.rs b/examples/lib.rs index 98089de..ed108d2 100644 --- a/examples/lib.rs +++ b/examples/lib.rs @@ -1,5 +1,5 @@ extern crate micromark; -use micromark::{micromark, micromark_with_options, Constructs, Options}; +use micromark::{micromark, micromark_to_mdast, micromark_with_options, Constructs, Options}; fn main() -> Result<(), String> { // Turn on debugging. @@ -35,30 +35,13 @@ fn main() -> Result<(), String> { )? ); - // Support MDX extensions. - // Note: mdx compiles to nothing, handle it yourself. + // Access syntax tree and support MDX extensions: println!( - "{}", - micromark_with_options( + "{:?}", + micromark_to_mdast( "# , {username}!", &Options { constructs: Constructs::mdx(), - gfm_tagfilter: true, - ..Options::default() - } - )? - ); - - // Support other extensions that are not in CommonMark. - println!( - "{:?}", - micromark_with_options( - "---\ntitle: Neptune\n---\nSome stuff on the moons of Neptune.", - &Options { - constructs: Constructs { - frontmatter: true, - ..Constructs::default() - }, ..Options::default() } )? -- cgit