mirror of
https://github.com/zadam/trilium.git
synced 2025-11-18 03:00:41 +01:00
feat(export/markdown): basic support for admonitions
This commit is contained in:
@@ -103,4 +103,94 @@ describe("Markdown export", () => {
|
||||
expect(markdownExportService.toMarkdown(html)).toBe(html);
|
||||
});
|
||||
|
||||
it("exports admonitions properly", () => {
|
||||
const html = trimIndentation`\
|
||||
<p>
|
||||
Before
|
||||
</p>
|
||||
<aside class="admonition note">
|
||||
<p>
|
||||
This is a note.
|
||||
</p>
|
||||
</aside>
|
||||
<aside class="admonition tip">
|
||||
<p>
|
||||
This is a tip.
|
||||
</p>
|
||||
</aside>
|
||||
<aside class="admonition important">
|
||||
<p>
|
||||
This is a very important information.
|
||||
</p>
|
||||
<figure class="table">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
1
|
||||
</td>
|
||||
<td>
|
||||
2
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
3
|
||||
</td>
|
||||
<td>
|
||||
4
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</figure>
|
||||
</aside>
|
||||
<aside class="admonition caution">
|
||||
<p>
|
||||
This is a caution.
|
||||
</p>
|
||||
</aside>
|
||||
<aside class="admonition warning">
|
||||
<h2>
|
||||
Title goes here
|
||||
</h2>
|
||||
<p>
|
||||
This is a warning.
|
||||
</p>
|
||||
</aside>
|
||||
<p>
|
||||
After
|
||||
</p>
|
||||
`;
|
||||
|
||||
const space = " "; // editor config trimming space.
|
||||
const expected = trimIndentation`\
|
||||
Before
|
||||
|
||||
> [!NOTE]
|
||||
> This is a note.
|
||||
|
||||
> [!TIP]
|
||||
> This is a tip.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> This is a very important information.
|
||||
>${space}
|
||||
> | | |
|
||||
> | --- | --- |
|
||||
> | 1 | 2 |
|
||||
> | 3 | 4 |
|
||||
|
||||
> [!CAUTION]
|
||||
> This is a caution.
|
||||
|
||||
> [!WARNING]
|
||||
> ## Title goes here
|
||||
>${space}
|
||||
> This is a warning.
|
||||
|
||||
After`;
|
||||
expect(markdownExportService.toMarkdown(html)).toBe(expected);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user