Skip to content

Build your personal knowledge base with Trilium Notes

possible fix to "double new lines"

azivner36e525952708
diff --git a/static/js/html2notecase.js b/static/js/html2notecase.js
index 786b2ac219..25f191705d 100644
--- a/static/js/html2notecase.js
+++ b/static/js/html2notecase.js
@@ -1,4 +1,7 @@
function html2notecase(contents, note) {
+ // remove any possible extra newlines which might be inserted - all relevant new lines should be only in <br> and <p>
+ contents = contents.replace(/(?:\r\n|\r|\n)/, '');
+
contents = contents.replace(/<br \/>/g, '\n');
contents = contents.replace(/<br>/g, '\n');
contents = contents.replace(/<\/p>/g, '\n');