diff --git a/src/services/export/zip.js b/src/services/export/zip.js
index 6bbd1b6ed..d31927d19 100644
--- a/src/services/export/zip.js
+++ b/src/services/export/zip.js
@@ -257,11 +257,11 @@ async function exportToZip(taskContext, branch, format, res, setHeaders = true)
-
${htmlTitle}
+ ${htmlTitle}
-
${htmlTitle}
+
${htmlTitle}
${content}
diff --git a/src/services/import/zip.js b/src/services/import/zip.js
index abe3b58a9..74a942113 100644
--- a/src/services/import/zip.js
+++ b/src/services/import/zip.js
@@ -240,6 +240,8 @@ async function importZip(taskContext, fileBuffer, importRootNote) {
return /^(?:[a-z]+:)?\/\//i.test(url);
}
+ content = removeTrilumTags(content);
+
content = content.replace(/([^<]*)<\/h1>/gi, (match, text) => {
if (noteTitle.trim() === text.trim()) {
return ""; // remove whole H1 tag
@@ -325,6 +327,18 @@ async function importZip(taskContext, fileBuffer, importRootNote) {
return content;
}
+ function removeTrilumTags(content) {
+ const tagsToRemove = [
+ '([^<]*)<\/h1>',
+ '([^<]*)<\/title>'
+ ]
+ for (const tag of tagsToRemove) {
+ let re = new RegExp(tag, "gi");
+ content = content.replace(re, '');
+ }
+ return content;
+ }
+
function processNoteContent(noteMeta, type, mime, content, noteTitle, filePath) {
if (noteMeta?.format === 'markdown'
|| (!noteMeta && taskContext.data.textImportedAsText && ['text/markdown', 'text/x-markdown'].includes(mime))) {