fix(docs): allow balanced parens in markdown link URLs

Previously the link-checker regex stopped at the first ')',
breaking on Next.js route-group paths like `app/(app)/...`. The
new regex matches one level of balanced parens inside the URL.

Caught by CI on PR #188 — pre-existing breakage from PBI-78 plan
doc that was already merged on main.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Janpeter Visser 2026-05-10 13:06:07 +02:00
parent ef34dc270e
commit 499f4c10b6

View file

@ -49,7 +49,9 @@ function headingSlugs(filePath) {
return slugs;
}
const LINK_RE = /\[(?:[^\]]*)\]\(([^)]+)\)/g;
// Match `[label](url)` where url may contain one level of balanced parens
// (e.g. Next.js route groups like `app/(app)/...`).
const LINK_RE = /\[(?:[^\]]*)\]\(((?:[^()]+|\([^()]*\))+)\)/g;
function checkFile(filePath) {
const content = readFileSync(filePath, 'utf8');