Skip to content

Commit f39d7b7

Browse files
committed
doc: throw if id/href in marks do not match
1 parent 71cd9c7 commit f39d7b7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/doc/allhtml.mjs

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ for (const link of toc.match(/<a.*?>/g)) {
4444
apicontent += '<section>' + data.slice(match.index + match[0].length)
4545
.replace(/<!-- API END -->[\s\S]*/, '</section>')
4646
// Prefix all in-page anchor marks with module name
47-
.replace(/<a class="mark" href="#([^"]+)" id="([^"]+)"/g, (match, anchor) => {
47+
.replace(/<a class="mark" href="#([^"]+)" id="([^"]+)"/g, (match, anchor, id) => {
48+
if (anchor !== id) throw new Error(`Mark does not match: ${anchor} should match ${id}`);
4849
return `<a class="mark" href="#${moduleName}_${anchor}" id="${moduleName}_${anchor}"`;
4950
})
5051
// Prefix all in-page links with current module name

0 commit comments

Comments
 (0)