feat(export/md): rewrite language tag to a more common syntax

This commit is contained in:
Elian Doran
2024-12-17 23:35:08 +02:00
parent ba95caaf6d
commit eee21f3741
2 changed files with 56 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import markdownExportService from "../../../src/services/export/md.js";
import { trimIndentation } from "../../support/utils.js";
describe("Markdown export", () => {
it("trims language tag for code blocks", () => {
const html = trimIndentation`\
<p>A diff:</p>
<pre><code class="language-text-x-diff">Hello
-world
+worldy
</code></pre>`;
const expected = trimIndentation`\
A diff:
\`\`\`diff
Hello
-world
+worldy
\`\`\``;
expect(markdownExportService.toMarkdown(html)).toBe(expected);
});
});