dev_forum
hjm 5 years ago
parent 2d2d92e022
commit 51e215f425

@ -6,26 +6,30 @@ export function isImageExtension(fileName) {
export function markdownToHTML(oldContent, selector) {
window.$('#md_div').html('')
// markdown to html
try {
var markdwonParser = window.editormd.markdownToHTML("md_div", {
markdown: oldContent, // .replace(/▁/g,"▁▁▁"),
emoji: true,
htmlDecode: "style,script,iframe", // you can filter tags decode
taskList: true,
tex: true, // 默认不解析
flowChart: true, // 默认不解析
sequenceDiagram: true // 默认不解析
});
if (selector && oldContent && oldContent.startsWith('<p>')) { // 普通html处理
window.$(selector).html(oldContent)
} else {
try {
var markdwonParser = window.editormd.markdownToHTML("md_div", {
markdown: oldContent, // .replace(/▁/g,"▁▁▁"),
emoji: true,
htmlDecode: "style,script,iframe", // you can filter tags decode
taskList: true,
tex: true, // 默认不解析
flowChart: true, // 默认不解析
sequenceDiagram: true // 默认不解析
});
} catch(e) {
console.error(e)
} catch(e) {
console.error(e)
}
const content = window.$('#md_div').html()
if (selector) {
window.$(selector).html(content)
}
return content
}
const content = window.$('#md_div').html()
if (selector) {
window.$(selector).html(content)
}
return content
}
export function appendFileSizeToUploadFile(item) {

Loading…
Cancel
Save