From ec2d1bfb4232178fb3a6cba36f138bc6efbbf34a Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Thu, 13 Oct 2022 10:40:01 +0200 Subject: Rename crate to `markdown` --- examples/lib.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'examples') diff --git a/examples/lib.rs b/examples/lib.rs index d14f399..6d156df 100644 --- a/examples/lib.rs +++ b/examples/lib.rs @@ -1,7 +1,4 @@ -extern crate micromark; -use micromark::{ - micromark, micromark_to_mdast, micromark_with_options, CompileOptions, Options, ParseOptions, -}; +extern crate markdown; fn main() -> Result<(), String> { // Turn on debugging. @@ -9,20 +6,20 @@ fn main() -> Result<(), String> { env_logger::init(); // Safely turn (untrusted?) markdown into HTML. - println!("{:?}", micromark("## Hello, *world*!")); + println!("{:?}", markdown::to_html("## Hello, *world*!")); // Turn trusted markdown into HTML. println!( "{:?}", - micromark_with_options( + markdown::to_html_with_options( "
\n\n# Hello, tomato!\n\n
", - &Options { - compile: CompileOptions { + &markdown::Options { + compile: markdown::CompileOptions { allow_dangerous_html: true, allow_dangerous_protocol: true, - ..CompileOptions::default() + ..markdown::CompileOptions::default() }, - ..Options::default() + ..markdown::Options::default() } ) ); @@ -30,16 +27,19 @@ fn main() -> Result<(), String> { // Support GFM extensions. println!( "{}", - micromark_with_options( + markdown::to_html_with_options( "* [x] contact@example.com ~~strikethrough~~", - &Options::gfm() + &markdown::Options::gfm() )? ); // Access syntax tree and support MDX extensions: println!( "{:?}", - micromark_to_mdast("# , {username}!", &ParseOptions::mdx())? + markdown::to_mdast( + "# , {username}!", + &markdown::ParseOptions::mdx() + )? ); Ok(()) -- cgit