From d0dcbf37e10e97c3b9f87fcaa082d627c50dd7fe Mon Sep 17 00:00:00 2001 From: Reda Al Sulais Date: Sat, 16 Sep 2023 15:02:06 +0300 Subject: [PATCH] feat: support sankey diagram highlighting --- src/lib/util/monacoExtra.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/lib/util/monacoExtra.ts b/src/lib/util/monacoExtra.ts index 5c422f06..a0b4db76 100644 --- a/src/lib/util/monacoExtra.ts +++ b/src/lib/util/monacoExtra.ts @@ -204,6 +204,11 @@ export const initEditor = (monacoEditor: typeof Monaco): void => { 'Rel_Back', 'RelIndex' ] + }, + sankey: { + typeKeywords: ['sankey-beta'], + blockKeywords: [], + keywords: [] } }; @@ -248,6 +253,7 @@ export const initEditor = (monacoEditor: typeof Monaco): void => { [/^\s*stateDiagram(-v2)?/, 'typeKeyword', 'stateDiagram'], [/^\s*er(Diagram)?/, 'typeKeyword', 'erDiagram'], [/^\s*requirement(Diagram)?/, 'typeKeyword', 'requirementDiagram'], + [/^\s*sankey-beta/m, 'typeKeyword', 'sankey'], [ /^\s*(C4Context|C4Container|C4Component|C4Dynamic|C4Deployment)/m, 'typeKeyword', @@ -535,6 +541,16 @@ export const initEditor = (monacoEditor: typeof Monaco): void => { [/,/, 'delimiter.bracket'], [/\)/, { next: '@pop', token: 'delimiter.bracket' }], [/[^),]/, 'string'] + ], + sankey: [ + configDirectiveHandler, + [/(title)(.*)/, ['keyword', 'string']], + [/(accTitle|accDescr)(\s*:)(\s*[^\n\r]+$)/, ['keyword', 'delimiter.bracket', 'string']], + [/".*?"/, 'string'], + [/[A-Za-z]+/, 'string'], + [/\s*\d+/, 'number'], + [/,/, 'delimiter.bracket'], + [/%%[^$]([^%]*(?!%%$)%?)*$/, 'comment'] ] } });