mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	feat(export/md): remove trilium language tag for code blocks
This commit is contained in:
		| @@ -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); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user