Skip to content

Commit af26bb3

Browse files
committed
Auto merge of #1870 - jtescher:markdown-table-allowed-attributes, r=jtgeibel
Allow rowspan and colspan in markdown table rendering Allow `rowspan` and `colspan` attributes of forms in READMEs. Fixes #1863
2 parents ccfda71 + ecb2877 commit af26bb3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/render.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ impl<'a> MarkdownRenderer<'a> {
6767
("a", hashset(&["href", "id", "target"])),
6868
("img", hashset(&["width", "height", "src", "alt", "align"])),
6969
("input", hashset(&["checked", "disabled", "type"])),
70+
("th", hashset(&["rowspan", "colspan"])),
71+
("td", hashset(&["rowspan", "colspan"])),
7072
]);
7173
let allowed_classes = hashmap(&[(
7274
"code",
@@ -455,4 +457,14 @@ mod tests {
455457
"<h1><a href=\"#my-crate\" id=\"user-content-my-crate\" rel=\"nofollow noopener noreferrer\"></a>My crate</h1>\n<p>Hello, world!</p>\n"
456458
);
457459
}
460+
461+
#[test]
462+
fn tables_with_rowspan_and_colspan() {
463+
let text = "<table><tr><th rowspan=\"1\" colspan=\"2\">Target</th></tr></table>\n";
464+
let result = markdown_to_html(text, None);
465+
assert_eq!(
466+
result,
467+
"<table><tbody><tr><th rowspan=\"1\" colspan=\"2\">Target</th></tr></tbody></table>\n"
468+
);
469+
}
458470
}

0 commit comments

Comments
 (0)