discourse/app/assets/javascripts/pretty-text/engines/markdown-it/table.js.es6

32 lines
637 B
JavaScript

export function setup(helper) {
if (!helper.markdownIt) { return; }
// this is built in now
// TODO: sanitizer needs fixing, does not properly support this yet
// we need a custom callback for style handling
helper.whiteList({
custom: function(tag,attr,val) {
if (tag !== 'th' && tag !== 'td') {
return false;
}
if (attr !== 'style') {
return false;
}
return (val === 'text-align:right' || val === 'text-align:left' || val === 'text-align:center');
}
});
helper.whiteList([
'table',
'tbody',
'thead',
'tr',
'th',
'td',
]);
}