fix: correct verbose [OK]/[BROKEN] overlap and line number drift

Broken refs no longer print [OK] before [BROKEN] in --verbose mode.
Code block stripping now preserves newlines so offsetToLine() reports
accurate line numbers when code blocks precede broken references.
This commit is contained in:
Michael Pursifull 2026-01-31 14:30:48 -06:00
parent 961a892578
commit 773da2820a
No known key found for this signature in database
1 changed files with 3 additions and 2 deletions

View File

@ -124,13 +124,13 @@ function getSourceFiles(dir) {
// --- Code Block Stripping --- // --- Code Block Stripping ---
function stripCodeBlocks(content) { function stripCodeBlocks(content) {
return content.replaceAll(/```[\s\S]*?```/g, ''); return content.replaceAll(/```[\s\S]*?```/g, (m) => m.replaceAll(/[^\n]/g, ''));
} }
function stripJsonExampleBlocks(content) { function stripJsonExampleBlocks(content) {
// Strip bare JSON example blocks: { and } each on their own line. // Strip bare JSON example blocks: { and } each on their own line.
// These are example/template data (not real file references). // These are example/template data (not real file references).
return content.replaceAll(/^\{\s*\n(?:.*\n)*?^\}\s*$/gm, ''); return content.replaceAll(/^\{\s*\n(?:.*\n)*?^\}\s*$/gm, (m) => m.replaceAll(/[^\n]/g, ''));
} }
// --- Path Mapping --- // --- Path Mapping ---
@ -368,6 +368,7 @@ for (const filePath of files) {
} }
broken.push({ ref, resolved: path.relative(PROJECT_ROOT, resolved) }); broken.push({ ref, resolved: path.relative(PROJECT_ROOT, resolved) });
brokenRefs++; brokenRefs++;
continue;
} }
if (VERBOSE && resolved) { if (VERBOSE && resolved) {