mirror of
https://github.com/zadam/trilium.git
synced 2025-11-10 15:25:51 +01:00
feat(import/markdown): preserve language tags when possible
This commit is contained in:
@@ -16,4 +16,27 @@ describe("markdown", () => {
|
||||
<p>Hello, world</p>
|
||||
`);
|
||||
});
|
||||
|
||||
it("rewrites language of known language tags", () => {
|
||||
const result = markdownService.renderToHtml(trimIndentation`\
|
||||
\`\`\`javascript
|
||||
Hi
|
||||
\`\`\`
|
||||
\`\`\`css
|
||||
there
|
||||
\`\`\`
|
||||
`, "title");
|
||||
expect(result).toBe(trimIndentation`\
|
||||
<pre><code class="language-application-javascript-env-backend">Hi</code></pre><pre><code class="language-text-css">there</code></pre>`);
|
||||
});
|
||||
|
||||
it("rewrites language of unknown language tags", () => {
|
||||
const result = markdownService.renderToHtml(trimIndentation`\
|
||||
\`\`\`unknownlanguage
|
||||
Hi
|
||||
\`\`\`
|
||||
`, "title");
|
||||
expect(result).toBe(trimIndentation`\
|
||||
<pre><code class="language-text-x-trilium-auto">Hi</code></pre>`);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user