Skip to content

Commit

Permalink
Update tools/doc/html.js
Browse files Browse the repository at this point in the history
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
Trott and aduh95 committed Mar 20, 2021
1 parent 814f56d commit 6e5288b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tools/doc/html.js
Expand Up @@ -73,10 +73,8 @@ function processContent(content) {
if (content.includes('<h6>')) {
throw new Error('Cannot increment a level 6 header');
}
if (/<h[1-5][^>]/.test(content) {
throw new Error('Cannot parse header tag with attributes');
}
content.replace(/(?<=<\/?h)[1-5](?=>)/g, (level) => level + 1);
// `++level` to convert the string to a number and increment it.
content = content.replace(/(?<=<\/?h)[1-5](?=[^<>]*>)/g, (level) => ++level);
// Wrap h3 tags in section tags.
let firstTime = true;
return content
Expand Down

0 comments on commit 6e5288b

Please sign in to comment.