diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-10-13 10:40:01 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-10-13 10:40:01 +0200 |
commit | ec2d1bfb4232178fb3a6cba36f138bc6efbbf34a (patch) | |
tree | 2da4be3be22c2324c48cb17133b3f4b26b9139d2 /examples | |
parent | 861af95c119721e814460fa7dc32bd3d74b38484 (diff) | |
download | markdown-rs-ec2d1bfb4232178fb3a6cba36f138bc6efbbf34a.tar.gz markdown-rs-ec2d1bfb4232178fb3a6cba36f138bc6efbbf34a.tar.bz2 markdown-rs-ec2d1bfb4232178fb3a6cba36f138bc6efbbf34a.zip |
Rename crate to `markdown`
Diffstat (limited to 'examples')
-rw-r--r-- | examples/lib.rs | 26 |
1 files changed, 13 insertions, 13 deletions
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( "<div style=\"color: tomato\">\n\n# Hello, tomato!\n\n</div>", - &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("# <HelloMessage />, {username}!", &ParseOptions::mdx())? + markdown::to_mdast( + "# <HelloMessage />, {username}!", + &markdown::ParseOptions::mdx() + )? ); Ok(()) |