diff options
author | Rich Trott <rtrott@gmail.com> | 2021-07-18 17:04:00 +0300 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2021-09-04 16:14:32 +0300 |
commit | dfb77a581fbc41acfaa49b8baaf0bc0cde03c1af (patch) | |
tree | 544b793ff6f510dace0701ed400faf13e7683d4b /tools | |
parent | 6a4c6ce4d70d6ac0de206d04f3ac3eef83be4f8f (diff) |
tools: make internal link checker more robust
The internal link checker was missing some broken links because it was
being too restrictive about the characters it accepted as part of a link
hash. Accept anything that isn't a terminating quotation mark.
Refs: https://github.com/nodejs/node/pull/39426
Refs: https://github.com/nodejs/node/pull/39425
PR-URL: https://github.com/nodejs/node/pull/39429
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/doc/allhtml.mjs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/doc/allhtml.mjs b/tools/doc/allhtml.mjs index 54a51dd6316..905ea5d3dd6 100644 --- a/tools/doc/allhtml.mjs +++ b/tools/doc/allhtml.mjs @@ -76,13 +76,13 @@ fs.writeFileSync(new URL('./all.html', source), all, 'utf8'); // Validate all hrefs have a target. const ids = new Set(); -const idRe = / id="(\w+)"/g; +const idRe = / id="([^"]+)"/g; let match; while (match = idRe.exec(all)) { ids.add(match[1]); } -const hrefRe = / href="#(\w+)"/g; +const hrefRe = / href="#([^"]+)"/g; while (match = hrefRe.exec(all)) { if (!ids.has(match[1])) throw new Error(`link not found: ${match[1]}`); } |