Skip to content

Commit

Permalink
Allow more syntax highlight modes in cm
Browse files Browse the repository at this point in the history
Signed-off-by: Yukai Huang <yukaihuangtw@gmail.com>
  • Loading branch information
Yukaii committed Aug 19, 2020
1 parent 1465355 commit e317de3
Showing 1 changed file with 35 additions and 3 deletions.
38 changes: 35 additions & 3 deletions public/js/lib/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,44 @@ export default class Editor {
}
}

CodeMirror.defineMode('c', function (config, modeConfig) {
return CodeMirror.overlayMode(CodeMirror.getMode(config, 'text/x-csrc'), ignoreOverlay)
})
CodeMirror.defineMode('cpp', function (config, modeConfig) {
return CodeMirror.overlayMode(CodeMirror.getMode(config, 'text/x-c++src'), ignoreOverlay)
})
CodeMirror.defineMode('java', function (config, modeConfig) {
return CodeMirror.overlayMode(CodeMirror.getMode(config, 'text/x-java'), ignoreOverlay)
})
CodeMirror.defineMode('csharp', function (config, modeConfig) {
return CodeMirror.overlayMode(CodeMirror.getMode(config, 'text/x-csharp'), ignoreOverlay)
})
CodeMirror.defineMode('objectivec', function (config, modeConfig) {
return CodeMirror.overlayMode(CodeMirror.getMode(config, 'text/x-objectivec'), ignoreOverlay)
})
CodeMirror.defineMode('scala', function (config, modeConfig) {
return CodeMirror.overlayMode(CodeMirror.getMode(config, 'text/x-scala'), ignoreOverlay)
})
CodeMirror.defineMode('kotlin', function (config, modeConfig) {
return CodeMirror.overlayMode(CodeMirror.getMode(config, 'text/x-kotlin'), ignoreOverlay)
})
CodeMirror.defineMode('json', function (config, modeConfig) {
return CodeMirror.overlayMode(CodeMirror.getMode(config, 'application/json'), ignoreOverlay)
})
CodeMirror.defineMode('jsonld', function (config, modeConfig) {
return CodeMirror.overlayMode(CodeMirror.getMode(config, 'application/ld+json'), ignoreOverlay)
})
CodeMirror.defineMode('vega', function (config, modeConfig) {
return CodeMirror.overlayMode(CodeMirror.getMode(config, 'application/ld+json'), ignoreOverlay)
})

CodeMirror.defineMode('markmap', function (config, modeConfig) {
return CodeMirror.overlayMode(CodeMirror.getMode(config, 'gfm'), ignoreOverlay)
CodeMirror.defineMode('bash', function (config, modeConfig) {
return CodeMirror.overlayMode(CodeMirror.getMode(config, 'text/x-sh'), ignoreOverlay)
})
CodeMirror.defineMode('ocaml', function (config, modeConfig) {
return CodeMirror.overlayMode(CodeMirror.getMode(config, 'text/x-ocaml'), ignoreOverlay)
})
CodeMirror.defineMode('csvpreview', function (config, modeConfig) {
return CodeMirror.overlayMode(CodeMirror.getMode(config, 'csv'), ignoreOverlay)
})
}

Expand Down

0 comments on commit e317de3

Please sign in to comment.