mirror of
https://github.com/wekan/wekan.git
synced 2026-02-23 08:24:07 +01:00
WIP: markdown
This commit is contained in:
parent
232bc746f4
commit
1f85b25549
8 changed files with 46 additions and 33 deletions
18
packages/markdown/src/template-integration.js
Executable file
18
packages/markdown/src/template-integration.js
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
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)));
|
||||
}));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue