mirror of
https://github.com/wekan/wekan.git
synced 2025-12-30 22:28:49 +01:00
18 lines
497 B
JavaScript
Executable file
18 lines
497 B
JavaScript
Executable file
import sanitizeXss from 'xss';
|
|
|
|
if (Package.ui) {
|
|
const Template = Package.templating.Template;
|
|
const UI = Package.ui.UI;
|
|
const HTML = Package.htmljs.HTML;
|
|
const Blaze = Package.blaze.Blaze; // implied by `ui`
|
|
|
|
UI.registerHelper('markdown', new Template('markdown', function () {
|
|
const self = this;
|
|
let text = '';
|
|
if (self.templateContentBlock) {
|
|
text = Blaze._toText(self.templateContentBlock, HTML.TEXTMODE.STRING);
|
|
}
|
|
|
|
return HTML.Raw(sanitizeXss(Markdown(text)));
|
|
}));
|
|
}
|