fix: attachHeadingsDescriptions match headings incorrectly

This commit is contained in:
TJT 2021-12-24 22:31:48 +08:00
parent 6c41e95aa0
commit 07e2246ada

View File

@ -101,7 +101,7 @@ export class MarkdownRenderer {
attachHeadingsDescriptions(rawText: string) { attachHeadingsDescriptions(rawText: string) {
const buildRegexp = (heading: MarkdownHeading) => { const buildRegexp = (heading: MarkdownHeading) => {
return new RegExp(`##?\\s+${heading.name.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')}`); return new RegExp(`##?\\s+${heading.name.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&')}\s*$`);
}; };
const flatHeadings = this.flattenHeadings(this.headings); const flatHeadings = this.flattenHeadings(this.headings);