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

repair injection highlight and add image previews

This commit is contained in:
Víctor Losada Hernández
2026-04-24 12:34:16 +02:00
parent cb4bc16c69
commit 0587266e22
3 changed files with 134 additions and 14 deletions
@@ -182,13 +182,15 @@ export function tokenizeCustomMarkdown(text) {
}
if(lineText.includes('{') && lineText.includes('}')) {
const injectionRegex = /(?:^|[^{\n])({(?=((?:[:=](?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':={}\s]*)*))\2})/gm;
const injectionRegex = /(?:^|[^{\n])({(?=((?:[:=](?:"[\w,\-()#%. ]*"|[\w\-()#%.]*)|[^"':={}\s]*)*))\2})/gmd;
let match;
while ((match = injectionRegex.exec(lineText)) !== null) {
console.log(match.indices[1][0]);
tokens.push({
line : lineNumber,
from : match.index,
to : match.index + match[1].length,
from : match.indices[1][0],
to : match.indices[1][0] + match[1].length,
type : customTags.injection,
});
}