From 074af5e8e0dba553ba3e30c75cb828f7acea5fa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Losada=20Hern=C3=A1ndez?= Date: Sat, 16 May 2026 16:28:53 +0200 Subject: [PATCH] more solid block tokenizing --- client/components/codeEditor/codeEditor.less | 3 ++- .../codeEditor/extensions/customHighlight.js | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/client/components/codeEditor/codeEditor.less b/client/components/codeEditor/codeEditor.less index f3658f290..ca77f29a8 100644 --- a/client/components/codeEditor/codeEditor.less +++ b/client/components/codeEditor/codeEditor.less @@ -63,7 +63,8 @@ &.term { color : rgb(96, 117, 143); } &.definition { color : rgb(97, 57, 178); } } - .cm-block:not(.cm-comment) { + .cm-block:not(.cm-comment), + .cm-block:not(.cm-comment) * { font-weight : bold; color : purple; } diff --git a/client/components/codeEditor/extensions/customHighlight.js b/client/components/codeEditor/extensions/customHighlight.js index 410bfe0d1..9f08c2e1a 100644 --- a/client/components/codeEditor/extensions/customHighlight.js +++ b/client/components/codeEditor/extensions/customHighlight.js @@ -250,7 +250,16 @@ function tokenizeCustomMarkdown(text) { /^ *{{(?=((?:[:=](?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':={}\s]*)*))\1 *$|^ *}}$/, ); if(match) endCh = match.index + match[0].length; - tokens.push({ line: lineNumber, type: customTags.block }); + const closingMatch = lineText.match(/ *(}})/d); + + if(closingMatch) { + console.log('closing', closingMatch); + console.log(closingMatch.indices[1][0], closingMatch.indices[1][1]) + tokens.push({ line: lineNumber, from: closingMatch.indices[1][0], to: closingMatch.indices[1][1], type: customTags.block }); + } else { + tokens.push({ line: lineNumber, type: customTags.block }); + } + } });