Skip to content

Commit

Permalink
tools: make internal link checker more robust
Browse files Browse the repository at this point in the history
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 <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>
  • Loading branch information
Trott authored and targos committed Jul 21, 2021
1 parent ee152f2 commit 2047072
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/doc/allhtml.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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]}`);
}

0 comments on commit 2047072

Please sign in to comment.