Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

core: fix html export empty p tag regex

Abdullah Atta07fb572a676f
diff --git a/packages/core/__tests__/notes.test.js b/packages/core/__tests__/notes.test.js
index 228f16177..34f7193eb 100644
--- a/packages/core/__tests__/notes.test.js
+++ b/packages/core/__tests__/notes.test.js
@@ -262,7 +262,7 @@ test("export note to html", () =>
test("export note to md", () =>
noteTest().then(async ({ db, id }) => {
const md = await db.notes.note(id).export("md");
- expect(md.includes(`Hello \nThis is colorful\n`)).toBeTruthy();
+ expect(md.includes(`Hello This is colorful\n`)).toBeTruthy();
}));
test("export note to txt", () =>
diff --git a/packages/core/__tests__/utils/index.js b/packages/core/__tests__/utils/index.js
index 848189bca..10901a7c6 100644
--- a/packages/core/__tests__/utils/index.js
+++ b/packages/core/__tests__/utils/index.js
@@ -51,7 +51,7 @@ const notebookTest = (notebook = TEST_NOTEBOOK) =>
var TEST_NOTE = {
content: {
type: "tiptap",
- data: `<p>Hello<br/><span style="color:#f00">This is colorful</span></p>`
+ data: `<p>Hello <span style="color:#f00">This is colorful</span></p>`
}
};
diff --git a/packages/core/utils/templates/html/builder.js b/packages/core/utils/templates/html/builder.js
index 60d387a78..241639e73 100644
--- a/packages/core/utils/templates/html/builder.js
+++ b/packages/core/utils/templates/html/builder.js
@@ -29,7 +29,7 @@ async function buildHTML(templateData) {
async function preprocessHTML(templateData) {
const { content } = templateData;
const doc = parseHTML(
- content.replaceAll(/<p(.+?)><\/p>/gm, "<p$1><br/></p>")
+ content.replaceAll(/<p([^>]*)><\/p>/gm, "<p$1><br/></p>")
);
const mathBlocks = doc.querySelectorAll(".math-block.math-node");