0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-06-22 04:58:40 +00:00

more solid block tokenizing

This commit is contained in:
Víctor Losada Hernández
2026-05-16 16:28:53 +02:00
parent 16948f451f
commit 074af5e8e0
2 changed files with 12 additions and 2 deletions
+2 -1
View File
@@ -63,7 +63,8 @@
&.term { color : rgb(96, 117, 143); } &.term { color : rgb(96, 117, 143); }
&.definition { color : rgb(97, 57, 178); } &.definition { color : rgb(97, 57, 178); }
} }
.cm-block:not(.cm-comment) { .cm-block:not(.cm-comment),
.cm-block:not(.cm-comment) * {
font-weight : bold; font-weight : bold;
color : purple; color : purple;
} }
@@ -250,8 +250,17 @@ function tokenizeCustomMarkdown(text) {
/^ *{{(?=((?:[:=](?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':={}\s]*)*))\1 *$|^ *}}$/, /^ *{{(?=((?:[:=](?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':={}\s]*)*))\1 *$|^ *}}$/,
); );
if(match) endCh = match.index + match[0].length; if(match) endCh = match.index + match[0].length;
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 }); tokens.push({ line: lineNumber, type: customTags.block });
} }
}
}); });
return tokens; return tokens;