// @ts-ignore import markdownit from 'markdown-it'; import hljs from 'highlight.js'; // https://highlightjs.org import katexPlugin from '@iktakahiro/markdown-it-katex'; const codeTool = (text: string) => ``; const md = markdownit({ html: true, linkfy: true, highlight: function (str: string, lang: string) { const baseText = str if (lang && hljs.getLanguage(lang)) { try { return '
' +
hljs.highlight(str, { language: lang, ignoreIllegals: true }).value +
'
' + codeTool(baseText) + '
';
} catch (__) { }
}
return '' + md.utils.escapeHtml(str) + '
' + codeTool(baseText) + '
';
}
});
md.use(katexPlugin);
export default md;