diff options
Diffstat (limited to 'server/sonar-docs/src/templates')
-rw-r--r-- | server/sonar-docs/src/templates/page.tsx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/server/sonar-docs/src/templates/page.tsx b/server/sonar-docs/src/templates/page.tsx index b468d39971c..e0239d2bf27 100644 --- a/server/sonar-docs/src/templates/page.tsx +++ b/server/sonar-docs/src/templates/page.tsx @@ -157,7 +157,10 @@ function removeExtraHeadings(content: string, headings: MarkdownHeading[]) { .filter(heading => !heading.value || !heading.value.match(/Table of content/i)) .filter(heading => { const regex = new RegExp( - `<!-- sonarcloud -->[\\s\\S]*<h2>${heading.value}<\\/h2>[\\s\\S]*<!-- /sonarcloud -->`, + `<!-- sonarcloud -->[\\s\\S]*<h2>${heading.value!.replace( + /[.*+?^${}()|[\]\\]/g, + '\\$&' + )}<\\/h2>[\\s\\S]*<!-- /sonarcloud -->`, 'gim' ); return !content.match(regex); |