Skip to content

Commit ad5dc4c

Browse files
Trottnodejs-github-bot
authored andcommitted
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: #39426 Refs: #39425 PR-URL: #39429 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Zeyu Yang <[email protected]>
1 parent e83c8ae commit ad5dc4c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/doc/allhtml.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ fs.writeFileSync(new URL('./all.html', source), all, 'utf8');
7676

7777
// Validate all hrefs have a target.
7878
const ids = new Set();
79-
const idRe = / id="(\w+)"/g;
79+
const idRe = / id="([^"]+)"/g;
8080
let match;
8181
while (match = idRe.exec(all)) {
8282
ids.add(match[1]);
8383
}
8484

85-
const hrefRe = / href="#(\w+)"/g;
85+
const hrefRe = / href="#([^"]+)"/g;
8686
while (match = hrefRe.exec(all)) {
8787
if (!ids.has(match[1])) throw new Error(`link not found: ${match[1]}`);
8888
}

0 commit comments

Comments
 (0)