aboutsummaryrefslogtreecommitdiffstats
path: root/tests/image.rs
diff options
context:
space:
mode:
authorLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-18 16:31:14 +0200
committerLibravatar Titus Wormer <tituswormer@gmail.com>2022-07-18 16:31:14 +0200
commit5403261e8213f68633a09fc3e9bc2e6e2cd777b2 (patch)
treebb3a6419ef42f7611c2cb24fe7024228f579331b /tests/image.rs
parent03544cafaa82ba4bd7e0bc3372fc59549a8dc0cc (diff)
downloadmarkdown-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/image.rs25
1 files changed, 16 insertions, 9 deletions
diff --git a/tests/image.rs b/tests/image.rs
index 32d4171..460d8bb 100644
--- a/tests/image.rs
+++ b/tests/image.rs
@@ -1,5 +1,5 @@
extern crate micromark;
-use micromark::{micromark, micromark_with_options, Options};
+use micromark::{micromark, micromark_with_options, Constructs, Options};
#[test]
fn image() {
@@ -191,12 +191,20 @@ fn image() {
"should ignore an empty title"
);
- // To do: turning things off.
- // assert_eq!(
- // micromark("![x]()", {extensions: [{disable: {null: ["labelStartImage"]}}]}),
- // "<p>!<a href=\"\">x</a></p>",
- // "should support turning off label start (image)"
- // );
+ assert_eq!(
+ micromark_with_options(
+ "![x]()",
+ &Options {
+ constructs: Constructs {
+ label_start_image: false,
+ ..Constructs::default()
+ },
+ ..Options::default()
+ }
+ ),
+ "<p>!<a href=\"\">x</a></p>",
+ "should support turning off label start (image)"
+ );
assert_eq!(
micromark("![](javascript:alert(1))"),
@@ -209,8 +217,7 @@ fn image() {
"![](javascript:alert(1))",
&Options {
allow_dangerous_protocol: true,
- allow_dangerous_html: false,
- default_line_ending: None
+ ..Options::default()
}
),
"<p><img src=\"javascript:alert(1)\" alt=\"\" /></p>",