2017-07-12 18:10:51 -04:00
|
|
|
export function setup(helper) {
|
2017-11-13 01:52:15 -05:00
|
|
|
helper.registerPlugin((md) => {
|
|
|
|
md.renderer.rules.table_open = function () {
|
2017-11-13 02:09:24 -05:00
|
|
|
return '<div class="md-table">\n<table>\n';
|
2017-11-13 01:52:15 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
md.renderer.rules.table_close = function () {
|
|
|
|
return "</table>\n</div>";
|
|
|
|
};
|
|
|
|
});
|
2017-07-12 08:13:33 -04:00
|
|
|
|
2017-07-14 08:27:28 -04:00
|
|
|
// we need a custom callback for style handling
|
2020-10-27 22:22:06 -04:00
|
|
|
helper.allowList({
|
2021-11-13 08:01:55 -05:00
|
|
|
custom(tag, attr, val) {
|
2017-07-14 08:27:28 -04:00
|
|
|
if (tag !== "th" && tag !== "td") {
|
|
|
|
return false;
|
|
|
|
}
|
2017-07-12 18:10:51 -04:00
|
|
|
|
2017-07-14 08:27:28 -04:00
|
|
|
if (attr !== "style") {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
val === "text-align:right" ||
|
|
|
|
val === "text-align:left" ||
|
|
|
|
val === "text-align:center"
|
|
|
|
);
|
2016-06-14 14:31:51 -04:00
|
|
|
},
|
|
|
|
});
|
2017-07-14 08:27:28 -04:00
|
|
|
|
2020-10-27 22:22:06 -04:00
|
|
|
helper.allowList([
|
2017-07-14 08:27:28 -04:00
|
|
|
"table",
|
|
|
|
"tbody",
|
|
|
|
"thead",
|
|
|
|
"tr",
|
|
|
|
"th",
|
|
|
|
"td",
|
2017-11-13 01:52:15 -05:00
|
|
|
"div.md-table",
|
2017-07-14 08:27:28 -04:00
|
|
|
]);
|
2016-06-14 14:31:51 -04:00
|
|
|
}
|