Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
Replace newlines inside table cells so that resulting markdown is valid
Laurent Cozic7af39b57f04b
diff --git a/README.md b/README.mdindex c05a4f57c8..f712bd65ee 100644--- a/README.md+++ b/README.md@@ -6,6 +6,7 @@ This is a fork of the original [turndown-plugin-gfm](https://github.com/domchris- Always render tables even they don't have a header.- Don't render the border of tables that contain other tables (frequent for websites that do the layout using tables). Only render the inner tables, if any, and if they also don't contain other tables.+- Replace newlines (`\n`) with `<br>` inside table cells so that multi-line content is displayed correctly as Markdown.## Installationdiff --git a/publish.sh b/publish.shnew file mode 100644index 0000000000..b6b7faee62--- /dev/null+++ b/publish.sh@@ -0,0 +1,3 @@+#!/bin/bash+npm version patch+npm publish\ No newline at end of filediff --git a/src/tables.js b/src/tables.jsindex 7e98203199..8b782dc72e 100644--- a/src/tables.js+++ b/src/tables.js@@ -99,7 +99,7 @@ function cell (content, node) {var index = indexOf.call(node.parentNode.childNodes, node)var prefix = ' 'if (index === 0) prefix = '| '- return prefix + content + ' |'+ return prefix + content.trim().replace(/[\n\r]/g, "<br>") + ' |'}function nodeContainsTable(node) {