mirror of
https://github.com/Redocly/redoc.git
synced 2025-02-16 18:00:33 +03:00
fix: broken rendering of headings with regexp characters
This commit is contained in:
parent
ec8f6dc09e
commit
e660517a2a
|
@ -78,7 +78,9 @@ export class MarkdownRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
attachHeadingsDescriptions(rawText: string) {
|
attachHeadingsDescriptions(rawText: string) {
|
||||||
const buildRegexp = heading => new RegExp(`##?\\s+${heading.name}`);
|
const buildRegexp = heading => {
|
||||||
|
return new RegExp(`##?\\s+${heading.name.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')}`);
|
||||||
|
};
|
||||||
|
|
||||||
const flatHeadings = this.flattenHeadings(this.headings);
|
const flatHeadings = this.flattenHeadings(this.headings);
|
||||||
if (flatHeadings.length < 1) {
|
if (flatHeadings.length < 1) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user