We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 814f56d commit 6e5288bCopy full SHA for 6e5288b
tools/doc/html.js
@@ -73,10 +73,8 @@ function processContent(content) {
73
if (content.includes('<h6>')) {
74
throw new Error('Cannot increment a level 6 header');
75
}
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);
+ // `++level` to convert the string to a number and increment it.
+ content = content.replace(/(?<=<\/?h)[1-5](?=[^<>]*>)/g, (level) => ++level);
80
// Wrap h3 tags in section tags.
81
let firstTime = true;
82
return content
0 commit comments