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
  • Loading branch information
Trott committed Jul 18, 2021
1 parent 07e83f7 commit 3702051
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 3702051

Please sign in to comment.