diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-07-01 16:21:20 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-07-01 16:21:20 +0200 |
commit | e1cae8c705e66669d043f5269e9f58c09c7b0eaa (patch) | |
tree | 31c35582bddde4db681a38b8d3e2fb69f90c5300 /examples | |
parent | 41afec1ed898159e1df3bc1157768f2066dd85e5 (diff) | |
download | markdown-rs-e1cae8c705e66669d043f5269e9f58c09c7b0eaa.tar.gz markdown-rs-e1cae8c705e66669d043f5269e9f58c09c7b0eaa.tar.bz2 markdown-rs-e1cae8c705e66669d043f5269e9f58c09c7b0eaa.zip |
Fix example
Diffstat (limited to 'examples')
-rw-r--r-- | examples/lib.rs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/examples/lib.rs b/examples/lib.rs index 816aa33..718e400 100644 --- a/examples/lib.rs +++ b/examples/lib.rs @@ -1,8 +1,24 @@ extern crate micromark; -use micromark::micromark; +use micromark::{micromark, micromark_with_options, Options}; fn main() { + // Turn on debugging. + // You can show it with `RUST_LOG=debug cargo run --example lib` env_logger::init(); - println!("{:?}", micromark("[](irc:///help)")); + // Safely turn (untrusted?) markdown into HTML. + println!("{:?}", micromark("# Hello, world!")); + + // Turn trusted markdown into HTML. + println!( + "{:?}", + micromark_with_options( + "<div style=\"color: tomato\">\n\n# Hello, tomato!\n\n</div>", + &Options { + allow_dangerous_html: true, + allow_dangerous_protocol: true, + default_line_ending: None + } + ) + ); } |