Skip to content

Commit 4ce7bd5

Browse files
committed
readme: Allow align attributes
1 parent 113452b commit 4ce7bd5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/render.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ impl<'a> MarkdownRenderer<'a> {
4949
html_sanitizer
5050
.add_tags(&["input"])
5151
.link_rel(Some("nofollow noopener noreferrer"))
52+
.add_generic_attributes(&["align"])
5253
.add_tag_attributes("a", &["id", "target"])
5354
.add_tag_attributes("input", &["checked", "disabled", "type"])
5455
.allowed_classes(allowed_classes)
@@ -510,4 +511,14 @@ mod tests {
510511
"<table><tbody><tr><th rowspan=\"1\" colspan=\"2\">Target</th></tr></tbody></table>\n"
511512
);
512513
}
514+
515+
#[test]
516+
fn text_alignment() {
517+
let text = "<h1 align=\"center\">foo-bar</h1>\n<h5 align=\"center\">Hello World!</h5>\n";
518+
let result = markdown_to_html(text, None);
519+
assert_eq!(
520+
result,
521+
"<h1 align=\"center\">foo-bar</h1>\n<h5 align=\"center\">Hello World!</h5>\n"
522+
);
523+
}
513524
}

0 commit comments

Comments
 (0)