mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
feat(export/md): remove trilium language tag for code blocks
This commit is contained in:
parent
eee21f3741
commit
2fbdec4448
@ -21,4 +21,21 @@ describe("Markdown export", () => {
|
||||
|
||||
expect(markdownExportService.toMarkdown(html)).toBe(expected);
|
||||
});
|
||||
|
||||
it("removes auto tag for code blocks", () => {
|
||||
const html = trimIndentation`\
|
||||
<pre><code class="language-text-x-trilium-auto">Hello
|
||||
-world
|
||||
+worldy
|
||||
</code></pre>`;
|
||||
const expected = trimIndentation`\
|
||||
\`\`\`
|
||||
Hello
|
||||
-world
|
||||
+worldy
|
||||
|
||||
\`\`\``;
|
||||
|
||||
expect(markdownExportService.toMarkdown(html)).toBe(expected);
|
||||
})
|
||||
});
|
@ -41,6 +41,10 @@ function toMarkdown(content: string) {
|
||||
}
|
||||
|
||||
function rewriteLanguageTag(source: string) {
|
||||
if (source === "text-x-trilium-auto") {
|
||||
return "";
|
||||
}
|
||||
|
||||
return source
|
||||
.split("-")
|
||||
.at(-1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user