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/link_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/link_reference.rs | 56 |
1 files changed, 36 insertions, 20 deletions
diff --git a/tests/link_reference.rs b/tests/link_reference.rs index 30fb2b5..17c8cde 100644 --- a/tests/link_reference.rs +++ b/tests/link_reference.rs @@ -1,14 +1,14 @@ 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 link_reference() { + let danger = Options { + allow_dangerous_html: true, + allow_dangerous_protocol: true, + ..Options::default() + }; + assert_eq!( micromark("[bar]: /url \"title\"\n\n[foo][bar]"), "<p><a href=\"/url\" title=\"title\">foo</a></p>", @@ -64,7 +64,7 @@ fn link_reference() { ); assert_eq!( - micromark_with_options("[ref]: /uri\n\n[foo <bar attr=\"][ref]\">", DANGER), + micromark_with_options("[ref]: /uri\n\n[foo <bar attr=\"][ref]\">", &danger), "<p>[foo <bar attr=\"][ref]\"></p>", "should prefer HTML over link references" ); @@ -383,17 +383,33 @@ fn link_reference() { "should not fail on a missing colon in a definition" ); - // To do: turning things off. - // assert_eq!( - // micromark("[x]()", {extensions: [{disable: {null: ["labelStartLink"]}}]}), - // "<p>[x]()</p>", - // "should support turning off label start (link)" - // ); + assert_eq!( + micromark_with_options( + "[x]()", + &Options { + constructs: Constructs { + label_start_link: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "<p>[x]()</p>", + "should support turning off label start (link)" + ); - // To do: turning things off. - // assert_eq!( - // micromark("[x]()", {extensions: [{disable: {null: ["labelEnd"]}}]}), - // "<p>[x]()</p>", - // "should support turning off label end" - // ); + assert_eq!( + micromark_with_options( + "[x]()", + &Options { + constructs: Constructs { + label_end: false, + ..Constructs::default() + }, + ..Options::default() + } + ), + "<p>[x]()</p>", + "should support turning off label end" + ); } |