diff --git a/scripts/check-doc-links.mjs b/scripts/check-doc-links.mjs index a47d2dd..b2c1512 100644 --- a/scripts/check-doc-links.mjs +++ b/scripts/check-doc-links.mjs @@ -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');