From 6e5288b28b18c80c1a1ac8fcd488dbe20e2e3cfd Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 20 Mar 2021 12:08:48 -0700 Subject: [PATCH] Update tools/doc/html.js Co-authored-by: Antoine du Hamel --- tools/doc/html.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/doc/html.js b/tools/doc/html.js index c631afe534e103..9089ce7e443232 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -73,10 +73,8 @@ function processContent(content) { if (content.includes('
')) { throw new Error('Cannot increment a level 6 header'); } - if (/]/.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