mirror of
https://github.com/zadam/trilium.git
synced 2025-10-21 15:49:00 +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]
|
> [!IMPORTANT]
|
||||||
> This is a very important information.
|
> This is a very important information.
|
||||||
>${space}
|
>${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]
|
> [!CAUTION]
|
||||||
> This is a caution.
|
> This is a caution.
|
||||||
@ -342,4 +345,37 @@ describe("Markdown export", () => {
|
|||||||
expect(markdownExportService.toMarkdown(html)).toBe(expected);
|
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 {
|
return {
|
||||||
filter(node, options) {
|
filter(node, options) {
|
||||||
return node.nodeName === 'FIGURE'
|
return node.nodeName === 'FIGURE'
|
||||||
|
&& node.classList.contains("image");
|
||||||
},
|
},
|
||||||
replacement(content, node) {
|
replacement(content, node) {
|
||||||
return (node as HTMLElement).outerHTML;
|
return (node as HTMLElement).outerHTML;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user