Skip to content

Commit e660517

Browse files
committedAug 11, 2018
fix: broken rendering of headings with regexp characters
1 parent ec8f6dc commit e660517

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎src/services/MarkdownRenderer.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ export class MarkdownRenderer {
7878
}
7979

8080
attachHeadingsDescriptions(rawText: string) {
81-
const buildRegexp = heading => new RegExp(`##?\\s+${heading.name}`);
81+
const buildRegexp = heading => {
82+
return new RegExp(`##?\\s+${heading.name.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')}`);
83+
};
8284

8385
const flatHeadings = this.flattenHeadings(this.headings);
8486
if (flatHeadings.length < 1) {

0 commit comments

Comments
 (0)
Please sign in to comment.