diff --git a/apps/server/src/services/export/zip/markdown.ts b/apps/server/src/services/export/zip/markdown.ts index 827f059d6..c876a5c16 100644 --- a/apps/server/src/services/export/zip/markdown.ts +++ b/apps/server/src/services/export/zip/markdown.ts @@ -8,18 +8,16 @@ export default class MarkdownExportProvider extends ZipExportProvider { prepareContent(title: string, content: string | Buffer, noteMeta: NoteMeta): string | Buffer { if (noteMeta.format === "markdown" && typeof content === "string") { - let markdownContent = mdService.toMarkdown(content); + content = this.rewriteFn(content, noteMeta); + content = mdService.toMarkdown(content); - if (markdownContent.trim().length > 0 && !markdownContent.startsWith("# ")) { - markdownContent = `# ${title}\r -${markdownContent}`; + if (content.trim().length > 0 && !content.startsWith("# ")) { + content = `\ +# ${title}\r +${content}`; } - - markdownContent = this.rewriteFn(markdownContent, noteMeta); - return markdownContent; - } else { - return content; } + return content; } afterDone() { }