Skip to content

Commit

Permalink
fix: broken rendering of headings with regexp characters
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanHotsiy committed Aug 11, 2018
1 parent ec8f6dc commit e660517
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/services/MarkdownRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ export class MarkdownRenderer {
}

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);
if (flatHeadings.length < 1) {
Expand Down

0 comments on commit e660517

Please sign in to comment.