|
|
@ -6,18 +6,14 @@ import showdownKatex from 'showdown-katex'
|
|
|
|
export function isImageExtension(fileName) {
|
|
|
|
export function isImageExtension(fileName) {
|
|
|
|
return fileName ? !!(fileName.match(/.(jpg|jpeg|png|gif)$/i)) : false
|
|
|
|
return fileName ? !!(fileName.match(/.(jpg|jpeg|png|gif)$/i)) : false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const katex = showdownKatex()
|
|
|
|
const katex = showdownKatex()
|
|
|
|
const converter = new showdown.Converter({
|
|
|
|
const converter = new showdown.Converter({
|
|
|
|
extensions: [katex]
|
|
|
|
extensions: [katex]
|
|
|
|
})
|
|
|
|
})
|
|
|
|
// const katexRex = /(?:\$\$)([^\$]+)(?:\$\$)/g
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function markdownToHTML(oldContent) {
|
|
|
|
export function markdownToHTML(oldContent) {
|
|
|
|
if (oldContent) {
|
|
|
|
if (oldContent) {
|
|
|
|
//let rs = oldContent.replace(katexRex, (_, p1) => `$${p1}$`)
|
|
|
|
return converter.makeHtml(oldContent)
|
|
|
|
let rs = converter.makeHtml(oldContent)
|
|
|
|
|
|
|
|
return rs
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return oldContent
|
|
|
|
return oldContent
|
|
|
|
}
|
|
|
|
}
|
|
|
|