mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 19:36:12 +01:00
chore(code): reintegrate batch syntax
This commit is contained in:
@@ -1,8 +1,14 @@
|
|||||||
// Source: https://github.com/deathau/cm-editor-syntax-highlight-obsidian/issues/27#issuecomment-1340586596
|
/**
|
||||||
(() => {
|
* @module
|
||||||
var varsAndArgsRegex = /(%[0-9]|%~\S+|%\S+%)/;
|
*
|
||||||
|
* Ported to CodeMirror 6 from https://github.com/deathau/cm-editor-syntax-highlight-obsidian/issues/27#issuecomment-1340586596
|
||||||
|
*/
|
||||||
|
|
||||||
CodeMirror.defineSimpleMode("batch", {
|
import { simpleMode } from "@codemirror/legacy-modes/mode/simple-mode";
|
||||||
|
|
||||||
|
const varsAndArgsRegex = /(%[0-9]|%~\S+|%\S+%)/;
|
||||||
|
|
||||||
|
export const batch = simpleMode({
|
||||||
start: [
|
start: [
|
||||||
{ //comment
|
{ //comment
|
||||||
regex: /(rem|::)(?:\s.*|$)/i,
|
regex: /(rem|::)(?:\s.*|$)/i,
|
||||||
@@ -40,12 +46,3 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.defineMIME("application/x-bat", "batch");
|
|
||||||
CodeMirror.modeInfo.push({
|
|
||||||
ext: [ "bat", "cmd" ],
|
|
||||||
mime: "application/x-bat",
|
|
||||||
mode: "batch",
|
|
||||||
name: "Batch file"
|
|
||||||
});
|
|
||||||
})();
|
|
||||||
@@ -6,7 +6,7 @@ const byMimeType: Record<string, (() => Promise<StreamParser<unknown>>) | null>
|
|||||||
"text/x-ttcn-asn": async () => (await import('@codemirror/legacy-modes/mode/ttcn')).ttcn,
|
"text/x-ttcn-asn": async () => (await import('@codemirror/legacy-modes/mode/ttcn')).ttcn,
|
||||||
"application/x-aspx": null,
|
"application/x-aspx": null,
|
||||||
"text/x-asterisk": async () => (await import('@codemirror/legacy-modes/mode/asterisk')).asterisk,
|
"text/x-asterisk": async () => (await import('@codemirror/legacy-modes/mode/asterisk')).asterisk,
|
||||||
"application/x-bat": null,
|
"application/x-bat": async () => (await import("./languages/batch.js")).batch,
|
||||||
"text/x-brainfuck": async () => (await import('@codemirror/legacy-modes/mode/brainfuck')).brainfuck,
|
"text/x-brainfuck": async () => (await import('@codemirror/legacy-modes/mode/brainfuck')).brainfuck,
|
||||||
"text/x-csrc": async () => (await import('@codemirror/legacy-modes/mode/clike')).c,
|
"text/x-csrc": async () => (await import('@codemirror/legacy-modes/mode/clike')).c,
|
||||||
"text/x-csharp": async () => (await import('@codemirror/legacy-modes/mode/clike')).csharp,
|
"text/x-csharp": async () => (await import('@codemirror/legacy-modes/mode/clike')).csharp,
|
||||||
|
|||||||
Reference in New Issue
Block a user