diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-07-18 16:31:14 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-07-18 16:31:14 +0200 |
commit | 5403261e8213f68633a09fc3e9bc2e6e2cd777b2 (patch) | |
tree | bb3a6419ef42f7611c2cb24fe7024228f579331b /tests/character_reference.rs | |
parent | 03544cafaa82ba4bd7e0bc3372fc59549a8dc0cc (diff) | |
download | markdown-rs-5403261e8213f68633a09fc3e9bc2e6e2cd777b2.tar.gz markdown-rs-5403261e8213f68633a09fc3e9bc2e6e2cd777b2.tar.bz2 markdown-rs-5403261e8213f68633a09fc3e9bc2e6e2cd777b2.zip |
Add support for turning off constructs
Diffstat (limited to '')
-rw-r--r-- | tests/character_reference.rs | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/tests/character_reference.rs b/tests/character_reference.rs index ef2ba0d..c41f47d 100644 --- a/tests/character_reference.rs +++ b/tests/character_reference.rs @@ -1,11 +1,5 @@ extern crate micromark; -use micromark::{micromark, micromark_with_options, Options}; - -const DANGER: &Options = &Options { - allow_dangerous_html: true, - allow_dangerous_protocol: true, - default_line_ending: None, -}; +use micromark::{micromark, micromark_with_options, Constructs, Options}; #[test] fn character_reference() { @@ -50,7 +44,13 @@ fn character_reference() { ); assert_eq!( - micromark_with_options("<a href=\"öö.html\">", DANGER), + micromark_with_options( + "<a href=\"öö.html\">", + &Options { + allow_dangerous_html: true, + ..Options::default() + } + ), "<a href=\"öö.html\">", "should not care about character references in html" ); @@ -188,12 +188,18 @@ fn character_reference() { "should not support the other characters inside a hexademical" ); - // To do: turning things off. - // assert_eq!( - // micromark("&", { - // extensions: [{disable: {null: ["characterReferences"]}}] - // }), - // "<p>&</p>", - // "should support turning off character references" - // ); + assert_eq!( + micromark_with_options( + "&", + &Options { + constructs: Constructs { + character_reference: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "<p>&amp;</p>", + "should support turning off character references" + ); } |