mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 11:26:15 +01:00
feat(mermaid): add basic syntax highlight
This commit is contained in:
@@ -17,6 +17,11 @@ async function buildJavaScript(mimeType: string) {
|
||||
return extensions;
|
||||
}
|
||||
|
||||
async function buildMermaid() {
|
||||
const { mermaid, foldByIndent } = (await import('codemirror-lang-mermaid'));
|
||||
return [ mermaid(), foldByIndent() ];
|
||||
}
|
||||
|
||||
const byMimeType: Record<string, (() => Promise<StreamParser<unknown> | LanguageSupport | Extension[]>) | null> = {
|
||||
"text/plain": null,
|
||||
|
||||
@@ -55,6 +60,8 @@ const byMimeType: Record<string, (() => Promise<StreamParser<unknown> | Language
|
||||
"text/typescript-jsx": async () => (await import('@codemirror/lang-javascript')).javascript({ typescript: true, jsx: true }),
|
||||
"text/vbscript": async () => (await import('@codemirror/legacy-modes/mode/vbscript')).vbScript,
|
||||
"text/velocity": async () => (await import('@codemirror/legacy-modes/mode/velocity')).velocity,
|
||||
"text/vnd.mermaid": async () => buildMermaid(),
|
||||
"text/mermaid": async () => buildMermaid(),
|
||||
"text/x-asm-mips": null,
|
||||
"text/x-asterisk": async () => (await import('@codemirror/legacy-modes/mode/asterisk')).asterisk,
|
||||
"text/x-brainfuck": async () => (await import('@codemirror/legacy-modes/mode/brainfuck')).brainfuck,
|
||||
|
||||
Reference in New Issue
Block a user