Skip to content

A platform for community discussion. Free, open, simple.

FEATURE: Allow `rowspan` and `colspan` attributes on HTML tables (#20973)

John L. Clark9a07a9872f08
diff --git a/app/assets/javascripts/discourse-markdown-it/src/features/table.js b/app/assets/javascripts/discourse-markdown-it/src/features/table.js
index 3a2ed4d7e1d..7c380c78352 100644
--- a/app/assets/javascripts/discourse-markdown-it/src/features/table.js
+++ b/app/assets/javascripts/discourse-markdown-it/src/features/table.js
@@ -34,7 +34,11 @@ export function setup(helper) {
"thead",
"tr",
"th",
+ "th[colspan]",
+ "th[rowspan]",
"td",
+ "td[colspan]",
+ "td[rowspan]",
"div.md-table",
]);
}
diff --git a/app/assets/javascripts/discourse/tests/unit/lib/sanitizer-test.js b/app/assets/javascripts/discourse/tests/unit/lib/sanitizer-test.js
index 04a3935726c..56d4385d6f6 100644
--- a/app/assets/javascripts/discourse/tests/unit/lib/sanitizer-test.js
+++ b/app/assets/javascripts/discourse/tests/unit/lib/sanitizer-test.js
@@ -157,6 +157,11 @@ module("Unit | Utility | sanitizer", function (hooks) {
`<div data-value="<something>" data-html-value="<something>"></div>`,
`<div data-value="&lt;something&gt;"></div>`
);
+
+ cooked(
+ '<table><tr><th rowspan="2">a</th><th colspan="3">b</th><td rowspan="4">c</td><td colspan="5">d</td><td class="fa-spin">e</td></tr></table>',
+ '<table><tr><th rowspan="2">a</th><th colspan="3">b</th><td rowspan="4">c</td><td colspan="5">d</td><td>e</td></tr></table>'
+ );
});
test("ids on headings", function (assert) {