diff --git a/electron-docs-main.ts b/electron-docs-main.ts index c0ec81783..724ee73b0 100644 --- a/electron-docs-main.ts +++ b/electron-docs-main.ts @@ -99,6 +99,7 @@ async function exportData(noteId: string, format: "html" | "markdown", outputPat const exportOpts: AdvancedExportOptions = {}; if (format === "html") { + exportOpts.skipHtmlTemplate = true; exportOpts.customRewriteLinks = (originalRewriteLinks, getNoteTargetUrl) => { return (content: string, noteMeta: NoteMeta) => { content = content.replace(/src="[^"]*api\/images\/([a-zA-Z0-9_]+)\/[^"]*"/g, (match, targetNoteId) => { diff --git a/src/services/export/zip.ts b/src/services/export/zip.ts index 392b58cd2..5974d77eb 100644 --- a/src/services/export/zip.ts +++ b/src/services/export/zip.ts @@ -26,6 +26,11 @@ import type { NoteMetaFile } from "../meta/note_meta.js"; type RewriteLinksFn = (content: string, noteMeta: NoteMeta) => string; export interface AdvancedExportOptions { + /** + * If `true`, then only the note's content will be kept. If `false` (default), then each page will have its own template. + */ + skipHtmlTemplate?: boolean; + /** * Provides a custom function to rewrite the links found in HTML or Markdown notes. This method is called for every note imported, if it's of the right type. * @@ -316,7 +321,7 @@ async function exportToZip(taskContext: TaskContext, branch: BBranch, format: "h } if (noteMeta.format === "html" && typeof content === "string") { - if (!content.substr(0, 100).toLowerCase().includes("