fix: prevent URL marking within variable patterns in CodeMirror (#6680)

This commit is contained in:
Chirag Chandrashekhar
2026-01-14 14:00:28 +05:30
committed by GitHub
parent 4c110900c1
commit bc0bb64400

View File

@@ -59,7 +59,18 @@ function markUrls(editor, linkify, linkClass, linkHint) {
const matches = linkify.match(lineContent);
if (!matches) continue;
const variablePatterns = [];
const variablePattern = /\{\{[^}]*\}\}/g;
let varMatch;
while ((varMatch = variablePattern.exec(lineContent)) !== null) {
variablePatterns.push({ start: varMatch.index, end: varMatch.index + varMatch[0].length });
}
matches.forEach(({ index, lastIndex, url }) => {
const isInVariable = variablePatterns.some(
({ start, end }) => index < end && lastIndex > start
);
if (isInVariable) return;
try {
editor.markText(
{ line: lineNum, ch: index },