diff --git a/src/core/Templater.ts b/src/core/Templater.ts index bf38ac54..3ec67cac 100644 --- a/src/core/Templater.ts +++ b/src/core/Templater.ts @@ -112,7 +112,8 @@ export class Templater { template: TFile | string, folder?: TFolder | string, filename?: string, - open_new_note = true + open_new_note = true, + extension?: string ): Promise { // TODO: Maybe there is an obsidian API function for that if (!folder) { @@ -136,8 +137,8 @@ export class Templater { } } - const extension = - template instanceof TFile ? template.extension || "md" : "md"; + extension = extension || + (template instanceof TFile ? template.extension || "md" : "md"); const created_note = await errorWrapper(async () => { const folderPath = folder instanceof TFolder ? folder.path : folder; const path = app.vault.getAvailablePath( diff --git a/src/core/functions/internal_functions/file/InternalModuleFile.ts b/src/core/functions/internal_functions/file/InternalModuleFile.ts index 66655fca..00a0169f 100644 --- a/src/core/functions/internal_functions/file/InternalModuleFile.ts +++ b/src/core/functions/internal_functions/file/InternalModuleFile.ts @@ -63,13 +63,15 @@ export class InternalModuleFile extends InternalModule { template: TFile | string, filename: string, open_new: boolean, - folder?: TFolder | string + folder?: TFolder | string, + extension?: string ) => Promise { return async ( template: TFile | string, filename: string, open_new = false, - folder?: TFolder | string + folder?: TFolder | string, + extension?: string ) => { this.create_new_depth += 1; if (this.create_new_depth > DEPTH_LIMIT) { @@ -84,7 +86,8 @@ export class InternalModuleFile extends InternalModule { template, folder, filename, - open_new + open_new, + extension ); this.create_new_depth -= 1;