/** * Build a `file:line:col` location string safe for use as an HTML attribute value. * Escapes characters in the path that would break a double-quoted HTML attribute. */ export function buildSourceLoc( relPath: string, line: number, col: number, ): string { const safePath = relPath .replace(/&/g, "&") .replace(/"/g, """) .replace(//g, ">"); return `${safePath}:${line}:${col}`; }