Skip to content

Build your personal knowledge base with Trilium Notes

fix(export/zip): links breaking down in markdown export

Elian Doranf656c2caaa15
diff --git a/apps/server/src/services/export/zip/markdown.ts b/apps/server/src/services/export/zip/markdown.ts
index 827f059d68..c876a5c161 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() { }