extern crate hoedown; use hoedown::{Markdown, Render}; use hoedown::renderer::html; macro_rules! html_test { ($flag:ident: $left:expr, $right:expr) => ({ let mut html_renderer = html::Html::new(html::$flag, 0); let doc = Markdown::new($left); let output = html_renderer.render(&doc); assert_eq!(output.to_str().unwrap(), $right); }); } #[test] fn test_skip_html() { html_test!(SKIP_HTML: "It must be allergies.", "

It must be allergies.

\n"); } #[test] fn test_escaping() { html_test!(ESCAPE: "JavaScript is pure evil.", "

JavaScript is pure <strong style="color: red;">evil</strong>.

\n"); } #[test] fn test_hard_wrap() { html_test!(HARD_WRAP: "One.\nAt.\nA.\nTime.", "

One.
\nAt.
\nA.
\nTime.

\n"); } #[test] fn test_xhtml() { html_test!(USE_XHTML: "![spacer](spacer.gif)", "

\"spacer\"/

\n"); }