refactor(export/share): share type for format

This commit is contained in:
Elian Doran
2025-06-24 19:21:09 +03:00
parent 9abdbbbc5b
commit 06de06b501
7 changed files with 15 additions and 14 deletions

View File

@@ -6,6 +6,8 @@ import mimeTypes from "mime-types";
type RewriteLinksFn = (content: string, noteMeta: NoteMeta) => string;
export type ExportFormat = "html" | "markdown" | "share";
export interface AdvancedExportOptions {
/**
* If `true`, then only the note's content will be kept. If `false` (default), then each page will have its own <html> template.
@@ -49,7 +51,7 @@ export abstract class ZipExportProvider {
abstract prepareContent(title: string, content: string | Buffer, noteMeta: NoteMeta, note: BNote | undefined, branch: BBranch): string | Buffer;
abstract afterDone(rootMeta: NoteMeta): void;
mapExtension(type: string | null, mime: string, existingExtension: string, format: string) {
mapExtension(type: string | null, mime: string, existingExtension: string, format: ExportFormat) {
// the following two are handled specifically since we always want to have these extensions no matter the automatic detection
// and/or existing detected extensions in the note name
if (type === "text" && format === "markdown") {

View File

@@ -65,10 +65,6 @@ export default class ShareThemeExportProvider extends ZipExportProvider {
this.#saveIndex(rootMeta);
}
mapExtension(_type: string | null, _mime: string, _existingExtension: string, _format: string): string | null {
return "html";
}
#saveIndex(rootMeta: NoteMeta) {
if (!this.indexMeta?.dataFileName) {
return;