0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-05-07 18:48:39 +00:00

correct injection highlight

This commit is contained in:
Víctor Losada Hernández
2026-04-04 22:18:35 +02:00
parent 78a34e3b58
commit becf95a644
@@ -81,8 +81,8 @@ export function tokenizeCustomMarkdown(text) {
} }
} }
// --- single line def list ---
const singleLineRegex = /^([^:\n]*\S)(\s*)(::)([^\n]*)$/dmy; const singleLineRegex = /^([^:\n]*\S)(\s*)(::)([^\n]*)$/dmy;
const match = singleLineRegex.exec(lineText); const match = singleLineRegex.exec(lineText);
if(match) { if(match) {
@@ -129,7 +129,7 @@ export function tokenizeCustomMarkdown(text) {
return; return;
} }
// multiline def list // --- multiline def list ---
if(!/^::/.test(lines[lineNumber]) && lineNumber + 1 < lines.length && /^::/.test(lines[lineNumber + 1])) { if(!/^::/.test(lines[lineNumber]) && lineNumber + 1 < lines.length && /^::/.test(lines[lineNumber + 1])) {
const startLine = lineNumber; const startLine = lineNumber;
const defs = []; const defs = [];
@@ -189,8 +189,8 @@ export function tokenizeCustomMarkdown(text) {
while ((match = injectionRegex.exec(lineText)) !== null) { while ((match = injectionRegex.exec(lineText)) !== null) {
tokens.push({ tokens.push({
line : lineNumber, line : lineNumber,
from : match.index +1, from : match.index,
to : match.index + match[1].length +1, to : match.index + match[1].length,
type : customTags.injection, type : customTags.injection,
}); });
} }