Skip to content

Build your personal knowledge base with Trilium Notes

feat(export/markdown): remove joplin table wrapper

Elian Doran18a50c6339e8
diff --git a/packages/turndown-plugin-gfm/src/tables.js b/packages/turndown-plugin-gfm/src/tables.js
index 4b202f2b4d..263ab259d4 100644
--- a/packages/turndown-plugin-gfm/src/tables.js
+++ b/packages/turndown-plugin-gfm/src/tables.js
@@ -81,24 +81,7 @@ rules.table = {
// Only convert tables that can result in valid Markdown
// Other tables are kept as HTML using `keep` (see below).
if (tableShouldBeHtml(node, options_)) {
- let html = node.outerHTML;
- let divParent = nodeParentDiv(node)
- // Make table in HTML format horizontally scrollable by give table a div parent, so the width of the table is limited to the screen width.
- // see https://github.com/laurent22/joplin/pull/10161
- // test cases:
- // packages/app-cli/tests/html_to_md/preserve_nested_tables.html
- // packages/app-cli/tests/html_to_md/table_with_blockquote.html
- // packages/app-cli/tests/html_to_md/table_with_code_1.html
- // packages/app-cli/tests/html_to_md/table_with_code_2.html
- // packages/app-cli/tests/html_to_md/table_with_code_3.html
- // packages/app-cli/tests/html_to_md/table_with_heading.html
- // packages/app-cli/tests/html_to_md/table_with_hr.html
- // packages/app-cli/tests/html_to_md/table_with_list.html
- if (divParent === null || !divParent.classList.contains('joplin-table-wrapper')){
- return `\n\n<div class="joplin-table-wrapper">${html}</div>\n\n`;
- } else {
- return html
- }
+ return node.outerHTML;
} else {
if (tableShouldBeSkipped(node)) return content;
diff --git a/src/services/export/markdown.spec.ts b/src/services/export/markdown.spec.ts
index 6baa194a2f..1eccd25a02 100644
--- a/src/services/export/markdown.spec.ts
+++ b/src/services/export/markdown.spec.ts
@@ -219,10 +219,10 @@ describe("Markdown export", () => {
`;
const expected = trimIndentation`\
- <div class="joplin-table-wrapper"><table><tbody><tr><td>Row 1</td><td><p>Allows displaying the value of one or more attributes in the calendar like this:&nbsp;</p><p><img src="13_Calendar View_image.png" alt=""></p><pre><code class="language-text-x-trilium-auto">#weight="70"
+ <table><tbody><tr><td>Row 1</td><td><p>Allows displaying the value of one or more attributes in the calendar like this:&nbsp;</p><p><img src="13_Calendar View_image.png" alt=""></p><pre><code class="language-text-x-trilium-auto">#weight="70"
#Mood="Good"
#calendar:displayedAttributes="weight,Mood"</code></pre><p>It can also be used with relations, case in which it will display the title of the target note:</p><pre><code class="language-text-x-trilium-auto">~assignee=@My assignee
- #calendar:displayedAttributes="assignee"</code></pre></td></tr></tbody></table></div>`;
+ #calendar:displayedAttributes="assignee"</code></pre></td></tr></tbody></table>`;
expect(markdownExportService.toMarkdown(html)).toBe(expected);
});