mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
fix(export/markdown): simple tables rendered as HTML (closes #6366)
This commit is contained in:
parent
7c6af568d8
commit
17c6eb1680
@ -176,7 +176,10 @@ describe("Markdown export", () => {
|
||||
> [!IMPORTANT]
|
||||
> This is a very important information.
|
||||
>${space}
|
||||
> <figure class="table"><table><tbody><tr><td>1</td><td>2</td></tr><tr><td>3</td><td>4</td></tr></tbody></table></figure>
|
||||
> | | |
|
||||
> | --- | --- |
|
||||
> | 1 | 2 |
|
||||
> | 3 | 4 |
|
||||
|
||||
> [!CAUTION]
|
||||
> This is a caution.
|
||||
@ -342,4 +345,37 @@ describe("Markdown export", () => {
|
||||
expect(markdownExportService.toMarkdown(html)).toBe(expected);
|
||||
});
|
||||
|
||||
it("exports unformatted table", () => {
|
||||
const html = trimIndentation/*html*/`\
|
||||
<figure class="table">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
Hi
|
||||
</td>
|
||||
<td>
|
||||
there
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Hi
|
||||
</td>
|
||||
<td>
|
||||
there
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</figure>
|
||||
`;
|
||||
const expected = trimIndentation`\
|
||||
| | |
|
||||
| --- | --- |
|
||||
| Hi | there |
|
||||
| Hi | there |`;
|
||||
expect(markdownExportService.toMarkdown(html)).toBe(expected);
|
||||
});
|
||||
|
||||
});
|
||||
|
@ -209,6 +209,7 @@ function buildFigureFilter(): Rule {
|
||||
return {
|
||||
filter(node, options) {
|
||||
return node.nodeName === 'FIGURE'
|
||||
&& node.classList.contains("image");
|
||||
},
|
||||
replacement(content, node) {
|
||||
return (node as HTMLElement).outerHTML;
|
||||
|
Loading…
x
Reference in New Issue
Block a user