Skip to content

Commit 9073d1a

Browse files
committed
Use ammonia default tags. Add input tag
Crates.io has only the input tag as an added tag other than the default ones from ammonia. So adding only that one.
1 parent 6131592 commit 9073d1a

File tree

1 file changed

+2
-43
lines changed

1 file changed

+2
-43
lines changed

src/render.rs

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -22,47 +22,6 @@ impl<'a> MarkdownRenderer<'a> {
2222
/// Per `readme_to_html`, `base_url` is the base URL prepended to any
2323
/// relative links in the input document. See that function for more detail.
2424
fn new(base_url: Option<&'a str>) -> MarkdownRenderer<'a> {
25-
let tags = hashset(&[
26-
"a",
27-
"b",
28-
"blockquote",
29-
"br",
30-
"code",
31-
"dd",
32-
"del",
33-
"dl",
34-
"dt",
35-
"em",
36-
"h1",
37-
"h2",
38-
"h3",
39-
"h4",
40-
"h5",
41-
"h6",
42-
"hr",
43-
"i",
44-
"img",
45-
"input",
46-
"kbd",
47-
"li",
48-
"ol",
49-
"p",
50-
"pre",
51-
"s",
52-
"strike",
53-
"strong",
54-
"sub",
55-
"sup",
56-
"table",
57-
"tbody",
58-
"td",
59-
"th",
60-
"thead",
61-
"tr",
62-
"ul",
63-
"hr",
64-
"span",
65-
]);
6625
let tag_attributes = hashmap(&[
6726
("a", hashset(&["href", "id", "target"])),
6827
("img", hashset(&["width", "height", "src", "alt", "align"])),
@@ -91,10 +50,10 @@ impl<'a> MarkdownRenderer<'a> {
9150
)]);
9251
let sanitize_url = UrlRelative::Custom(Box::new(SanitizeUrl::new(base_url)));
9352

94-
let mut html_sanitizer = Builder::new();
53+
let mut html_sanitizer = Builder::default();
9554
html_sanitizer
55+
.add_tags(&["input"])
9656
.link_rel(Some("nofollow noopener noreferrer"))
97-
.tags(tags)
9857
.tag_attributes(tag_attributes)
9958
.allowed_classes(allowed_classes)
10059
.url_relative(sanitize_url)

0 commit comments

Comments
 (0)