diff --git a/src/editor/rdt.ts b/src/editor/rdt.ts index 1250c07..2886f04 100644 --- a/src/editor/rdt.ts +++ b/src/editor/rdt.ts @@ -1,5 +1,6 @@ import { Mode as TextMode } from 'ace-code/src/mode/text'; import { TextHighlightRules } from 'ace-code/src/mode/text_highlight_rules'; +import type { Ace } from 'ace-code'; export class RDTHighlightRules extends TextHighlightRules { constructor() { @@ -7,20 +8,77 @@ export class RDTHighlightRules extends TextHighlightRules { this.normalizeRules(); } + _basicRules: Ace.HighlightRule[] = [ + { + token: 'text', + regex: /\\/, + next: 'start', + }, + { + token: 'keyword.operator', + regex: /!@/, + next: 'cellLink', + }, + { + token: 'keyword.operator', + regex: /!~/, + next: 'start', + }, + { + token: 'keyword.operator', + regex: /(!_)|(__)/, + next: 'cellParams', + }, + { + token: 'text', + regex: /~~/, + next: 'sideText', + }, + { + token: 'comment.block', + regex: //, + next: 'start', }, + { defaultToken: 'comment.block' }, ], }; }