extern crate micromark; use micromark::{micromark, micromark_with_options, CompileOptions}; const DANGER: &CompileOptions = &CompileOptions { allow_dangerous_html: true, allow_dangerous_protocol: true, }; #[test] fn character_escape() { assert_eq!( micromark( "\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\-\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\_\\`\\{\\|\\}\\~" ), "
!"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~
", "should support escaped ascii punctuation" ); assert_eq!( micromark("\\→\\A\\a\\ \\3\\φ\\«"), "\\→\\A\\a\\ \\3\\φ\\«
", "should not support other characters after a backslash" ); assert_eq!( micromark( "\\*not emphasized*\n\\*not emphasized*\n<br/> not a tag\n[not a link](/foo)\n`not code`\n1. not a list\n* not a list\n# not a heading\n[foo]: /url "not a reference"\nö not a character entity
", "should escape other constructs" ); assert_eq!( micromark("foo\\\nbar"), "foo
\nbar
\\[\\`
\\[\\]\n
",
"should not escape in indented code"
);
assert_eq!(
micromark("foo\n
",
"should escape in fenced code info"
);
// // To do: extensions
// assert_eq!(
// micromark("\\> a", {extensions: [{disable: {null: ["characterEscape"]}}]}),
// "\\> a
", // "should support turning off character escapes" // ); }