extern crate markdown; use markdown::{to_html, to_html_with_options, CompileOptions, Options}; use pretty_assertions::assert_eq; #[test] fn dangerous_html() -> Result<(), String> { let danger = &Options { compile: CompileOptions { allow_dangerous_html: true, allow_dangerous_protocol: true, ..CompileOptions::default() }, ..Options::default() }; assert_eq!( to_html(""), "<x>", "should be safe by default for flow" ); assert_eq!( to_html("a"), "

a<b>

", "should be safe by default for text" ); assert_eq!( to_html_with_options("", danger)?, "", "should be unsafe w/ `allowDangerousHtml`" ); Ok(()) }