diff --git a/spec/services/export/md.spec.ts b/spec/services/export/md.spec.ts index 612b43513..980f7fa2c 100644 --- a/spec/services/export/md.spec.ts +++ b/spec/services/export/md.spec.ts @@ -21,4 +21,21 @@ describe("Markdown export", () => { expect(markdownExportService.toMarkdown(html)).toBe(expected); }); + + it("removes auto tag for code blocks", () => { + const html = trimIndentation`\ +
Hello
+ -world
+ +worldy
+
`;
+ const expected = trimIndentation`\
+ \`\`\`
+ Hello
+ -world
+ +worldy
+
+ \`\`\``;
+
+ expect(markdownExportService.toMarkdown(html)).toBe(expected);
+ })
});
\ No newline at end of file
diff --git a/src/services/export/md.ts b/src/services/export/md.ts
index 8f7213f84..4669dd68e 100644
--- a/src/services/export/md.ts
+++ b/src/services/export/md.ts
@@ -41,6 +41,10 @@ function toMarkdown(content: string) {
}
function rewriteLanguageTag(source: string) {
+ if (source === "text-x-trilium-auto") {
+ return "";
+ }
+
return source
.split("-")
.at(-1);