From ea8573dbd78439be50aa2b38f1c83658c16783e3 Mon Sep 17 00:00:00 2001 From: TJT Date: Fri, 31 Dec 2021 19:00:09 +0800 Subject: [PATCH] fix: attachHeadingsDescriptions match headings incorrectly (#1845) * fix: attachHeadingsDescriptions match headings incorrectly * fix: match new line instead of `$` in MarkdownRenderer.attachHeadingsDescriptions Co-authored-by: TJT --- src/services/MarkdownRenderer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/MarkdownRenderer.ts b/src/services/MarkdownRenderer.ts index efef59ad..494a5777 100644 --- a/src/services/MarkdownRenderer.ts +++ b/src/services/MarkdownRenderer.ts @@ -101,7 +101,7 @@ export class MarkdownRenderer { attachHeadingsDescriptions(rawText: string) { const buildRegexp = (heading: MarkdownHeading) => { - return new RegExp(`##?\\s+${heading.name.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')}`); + return new RegExp(`##?\\s+${heading.name.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')}\s*\n`); }; const flatHeadings = this.flattenHeadings(this.headings);