diff --git a/ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/useJoplinMode.ts b/ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/useJoplinMode.ts index 546f10c8c10..7c1b3e2c6f8 100644 --- a/ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/useJoplinMode.ts +++ b/ElectronClient/gui/NoteEditor/NoteBody/CodeMirror/utils/useJoplinMode.ts @@ -4,12 +4,9 @@ import 'codemirror/mode/stex/stex'; // Joplin markdown is a the same as markdown mode, but it has configured defaults // and support for katex math blocks export default function useJoplinMode(CodeMirror: any) { - CodeMirror.defineMode('joplin-markdown', (config: any) => { - const stex = CodeMirror.getMode(config, { name: 'stex', inMathMode: true }); - const blocks = [{ open: '$$', close: '$$', mode: stex, delimStyle: 'katex-marker' }, - { open: '$', close: '$', mode: stex, delimStyle: 'katex-marker' }]; - const markdownOptions = { + CodeMirror.defineMode('joplin-markdown', (config: any) => { + const markdownConfig = { name: 'markdown', taskLists: true, strikethrough: true, @@ -19,7 +16,105 @@ export default function useJoplinMode(CodeMirror: any) { }, }; - return CodeMirror.multiplexingMode(CodeMirror.getMode(config, markdownOptions), ...blocks); + const markdownMode = CodeMirror.getMode(config, markdownConfig); + const stex = CodeMirror.getMode(config, { name: 'stex', inMathMode: true }); + + const inlineKatexOpenRE = /(?