From 4c06c8554c35887f8f5147783953b2b7e7c2327f Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Wed, 8 Jun 2022 15:52:16 +0200 Subject: . --- examples/lib.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 examples/lib.rs (limited to 'examples') diff --git a/examples/lib.rs b/examples/lib.rs new file mode 100644 index 0000000..4d01161 --- /dev/null +++ b/examples/lib.rs @@ -0,0 +1,22 @@ +extern crate micromark; +use micromark::{micromark, micromark_with_options, CompileOptions}; + +fn main() { + // Turn on debugging. + // You can show it with `RUST_LOG=debug cargo run --example lib` + env_logger::init(); + + // Safely turn (untrusted?) markdown into HTML. + println!("{:?}", micromark("# Hello, world!")); + + // Turn trusted markdown into HTML. + println!( + "{:?}", + micromark_with_options( + "
\n\n# Hello, tomato!\n\n
", + &CompileOptions { + allow_dangerous_html: true + } + ) + ); +} -- cgit