|
@@ -1,4 +1,5 @@
|
|
-import sanitizeXss from 'xss';
|
|
|
|
|
|
+import DOMPurify from 'dompurify';
|
|
|
|
+
|
|
var Markdown = require('markdown-it')({
|
|
var Markdown = require('markdown-it')({
|
|
html: true,
|
|
html: true,
|
|
linkify: true,
|
|
linkify: true,
|
|
@@ -6,7 +7,9 @@ var Markdown = require('markdown-it')({
|
|
breaks: true,
|
|
breaks: true,
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+import markdownItMermaid from "@liradb2000/markdown-it-mermaid";
|
|
|
|
|
|
|
|
+/*
|
|
// Static URL Scheme Listing
|
|
// Static URL Scheme Listing
|
|
var urlschemes = [
|
|
var urlschemes = [
|
|
"aodroplink",
|
|
"aodroplink",
|
|
@@ -19,7 +22,7 @@ var urlschemes = [
|
|
"mailspring"
|
|
"mailspring"
|
|
];
|
|
];
|
|
|
|
|
|
-// Better would be a field in the admin backend to set this dynamically
|
|
|
|
|
|
+// Better would be a field in the admin backend to set this dynamically
|
|
// instead of putting all known or wanted url schemes here hard into code
|
|
// instead of putting all known or wanted url schemes here hard into code
|
|
// but i was not able to access those settings
|
|
// but i was not able to access those settings
|
|
// var urlschemes = currentSetting.automaticLinkedUrlSchemes.split('\n');
|
|
// var urlschemes = currentSetting.automaticLinkedUrlSchemes.split('\n');
|
|
@@ -44,14 +47,18 @@ function mySafeAttrValue(tag, name, value, cssFilter) {
|
|
// use the default safeAttrValue function to process all non cbthunderlinks
|
|
// use the default safeAttrValue function to process all non cbthunderlinks
|
|
return sanitizeXss.safeAttrValue(tag, name, value, cssFilter);
|
|
return sanitizeXss.safeAttrValue(tag, name, value, cssFilter);
|
|
}
|
|
}
|
|
|
|
+// } else if (tag === 'svg') {
|
|
|
|
+// return `<img src="data:image/svg+xml;base64,` + atob(value) + `"></img>`;
|
|
} else {
|
|
} else {
|
|
// use the default safeAttrValue function to process it
|
|
// use the default safeAttrValue function to process it
|
|
return sanitizeXss.safeAttrValue(tag, name, value, cssFilter);
|
|
return sanitizeXss.safeAttrValue(tag, name, value, cssFilter);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+*/
|
|
|
|
|
|
var emoji = require('markdown-it-emoji');
|
|
var emoji = require('markdown-it-emoji');
|
|
Markdown.use(emoji);
|
|
Markdown.use(emoji);
|
|
|
|
+Markdown.use(markdownItMermaid);
|
|
|
|
|
|
if (Package.ui) {
|
|
if (Package.ui) {
|
|
const Template = Package.templating.Template;
|
|
const Template = Package.templating.Template;
|
|
@@ -66,6 +73,6 @@ if (Package.ui) {
|
|
text = Blaze._toText(self.templateContentBlock, HTML.TEXTMODE.STRING);
|
|
text = Blaze._toText(self.templateContentBlock, HTML.TEXTMODE.STRING);
|
|
}
|
|
}
|
|
|
|
|
|
- return HTML.Raw(sanitizeXss(Markdown.render(text), { safeAttrValue: mySafeAttrValue }));
|
|
|
|
|
|
+ return HTML.Raw(DOMPurify.sanitize(Markdown.render(text), {ALLOW_UNKNOWN_PROTOCOLS: true}));
|
|
}));
|
|
}));
|
|
}
|
|
}
|