Skip to content

Build your personal knowledge base with Trilium Notes

fix import with style.css

zadam4cb511bad059
diff --git a/src/services/import/tar.js b/src/services/import/tar.js
index 43ef79ab19..49bedc41b0 100644
--- a/src/services/import/tar.js
+++ b/src/services/import/tar.js
@@ -274,6 +274,9 @@ async function importTar(taskContext, fileBuffer, importRootNote) {
return /^(?:[a-z]+:)?\/\//i.test(url);
}
+ content = content.replace(/<html.*<body[^>]*>/gis, "");
+ content = content.replace(/<\/body>.*<\/html>/gis, "");
+
content = content.replace(/src="([^"]*)"/g, (match, url) => {
url = decodeURIComponent(url);
@@ -298,9 +301,6 @@ async function importTar(taskContext, fileBuffer, importRootNote) {
return `href="#root/${targetNoteId}"`;
});
- content = content.replace(/<html.*<body[^>]*>/gis, "");
- content = content.replace(/<\/body>.*<\/html>/gis, "");
-
content = content.replace(/<h1>([^<]*)<\/h1>/gi, (match, text) => {
if (noteTitle.trim() === text.trim()) {
return ""; // remove whole H1 tag