import { readFileSync, existsSync } from "node:fs" import { dirname, resolve } from "node:path" const f = ".scratch/cockpit-real-data-wayfinding/issues/67-district.md" const text = readFileSync(f, "utf8") const links = [...text.matchAll(/\]\(([^)#][^)]*)\)/g)].map((m) => m[1]).filter((l) => !/^https?:/.test(l)) const bad = [] for (const l of links) { const target = resolve(dirname(f), l.split("#")[0]) if (!existsSync(target)) bad.push(l) } console.log("links:", links.length, "broken:", bad.length) for (const b of bad) console.log(" BROKEN", b)