extern crate hoedown; use hoedown::{Markdown, Render}; use hoedown::renderer::html; macro_rules! extensions_test { ($extension:ident: $left:expr, $right:expr) => ({ let mut renderer = html::Html::new(html::Flags::empty(), 0); let doc = Markdown::new($left) .extensions(hoedown::$extension); assert_eq!(renderer.render(&doc).to_str().unwrap(), $right); }); } #[test] fn test_hard_wrap() { extensions_test!(AUTOLINK: "https://github.com/", "

https://github.com/

\n"); } #[test] fn test_fenced_code() { extensions_test!(FENCED_CODE: "```\n$ :(){ :|:& };:\n```", "
$ :(){ :|:& };:\n
\n"); } #[test] fn test_fenced_code_lang() { extensions_test!(FENCED_CODE: "```bash\n$ :(){ :|:& };:\n```", "
$ :(){ :|:& };:\n
\n"); } #[test] fn test_footnotes() { extensions_test!(FOOTNOTES: "What you looking at? [^1]\n\n[^1]: Yeah, I\'m talking to you pal.", "

What you looking at? 1


  1. Yeah, I'm talking to you pal. 

\n"); } #[test] fn test_highlight() { extensions_test!(HIGHLIGHT: "I\'m ==special==.", "

I'm special.

\n"); } #[test] fn test_no_indented_code() { extensions_test!(DISABLE_INDENTED_CODE: " $ :(){ :|:& };:", "

$ :(){ :|:& };:

\n"); } #[test] fn test_no_intra_emphasis() { extensions_test!(NO_INTRA_EMPHASIS: "Sorry,_my_space_key_is_broken.", "

Sorry,_my_space_key_is_broken.

\n"); } #[test] fn test_quote() { extensions_test!(QUOTE: r#""Air quotes are obnoxious.""#, "

Air quotes are obnoxious.

\n"); } #[test] fn test_space_headers() { extensions_test!(SPACE_HEADERS: "#Are you listening to me?!", "

#Are you listening to me?!

\n"); } #[test] fn test_strikethrough() { extensions_test!(STRIKETHROUGH: "I\'m ~~running~~ out of ideas.", "

I'm running out of ideas.

\n"); } #[test] fn test_superscript() { extensions_test!(SUPERSCRIPT: "^bro", "

bro

\n"); } #[test] fn test_tables() { extensions_test!(TABLES: "| 1 | 2 | 3 | | --- | --- | --- | | X | X | O | | O | O | X | | X | O | X | ", "
1 2 3
X X O
O O X
X O X
\n"); } #[test] fn test_underline() { extensions_test!(UNDERLINE: "What do you _mean_?", "

What do you mean?

\n"); }