Skip to content

Commit

Permalink
doc: simplify linkModule parsing by moving into regex
Browse files Browse the repository at this point in the history
  • Loading branch information
foxxyz committed Jul 25, 2021
1 parent 1788343 commit 848b7e5
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions tools/doc/allhtml.mjs
Expand Up @@ -53,9 +53,8 @@ for (const link of toc.match(/<a.*?>/g)) {
return `<a href="#${moduleName}_${anchor}"`;
})
// Prefix all links to other docs modules with those module names
.replace(/<a href="(\w[^#"]*)#/g, (match, href) => {
.replace(/<a href="((\w[^#"]*)\.html)#/g, (match, href, linkModule) => {
if (!htmlFiles.includes(href)) return match;
const linkModule = href.replace(/\.html$/, '');
return `<a href="#${linkModule}_`;
})
.trim() + '\n';
Expand Down

0 comments on commit 848b7e5

Please sign in to comment.