From 499f4c10b6525e1c9dc44395421a6b266369effb Mon Sep 17 00:00:00 2001 From: Madhura68 Date: Sun, 10 May 2026 13:06:07 +0200 Subject: [PATCH] fix(docs): allow balanced parens in markdown link URLs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- scripts/check-doc-links.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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');