Markdown parser fork with extended syntax for personal use.
at main 34 lines 791 B view raw
1use markdown::{message, to_html, to_html_with_options, CompileOptions, Options}; 2use pretty_assertions::assert_eq; 3 4#[test] 5fn dangerous_html() -> Result<(), message::Message> { 6 let danger = &Options { 7 compile: CompileOptions { 8 allow_dangerous_html: true, 9 allow_dangerous_protocol: true, 10 ..Default::default() 11 }, 12 ..Default::default() 13 }; 14 15 assert_eq!( 16 to_html("<x>"), 17 "&lt;x&gt;", 18 "should be safe by default for flow" 19 ); 20 21 assert_eq!( 22 to_html("a<b>"), 23 "<p>a&lt;b&gt;</p>", 24 "should be safe by default for text" 25 ); 26 27 assert_eq!( 28 to_html_with_options("<x>", danger)?, 29 "<x>", 30 "should be unsafe w/ `allowDangerousHtml`" 31 ); 32 33 Ok(()) 34}