Skip to content

Commit 6e5288b

Browse files
Trottaduh95
andauthored
Update tools/doc/html.js
Co-authored-by: Antoine du Hamel <[email protected]>
1 parent 814f56d commit 6e5288b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

tools/doc/html.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,8 @@ function processContent(content) {
7373
if (content.includes('<h6>')) {
7474
throw new Error('Cannot increment a level 6 header');
7575
}
76-
if (/<h[1-5][^>]/.test(content) {
77-
throw new Error('Cannot parse header tag with attributes');
78-
}
79-
content.replace(/(?<=<\/?h)[1-5](?=>)/g, (level) => level + 1);
76+
// `++level` to convert the string to a number and increment it.
77+
content = content.replace(/(?<=<\/?h)[1-5](?=[^<>]*>)/g, (level) => ++level);
8078
// Wrap h3 tags in section tags.
8179
let firstTime = true;
8280
return content

0 commit comments

Comments
 (0)