diff --git a/manifest.json b/manifest.json index c66e262..b0ae33b 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-enhancing-export", "name": "Obsidian Enhancing Export", - "version": "1.0.11", + "version": "1.1.0", "minAppVersion": "0.12.0", "description": "This is a enhancing export plugin for Obsidian. It allows to export to formats like Html, DOCX, ePub and PDF or Markdown(Hugo) etc.", "author": "YISH", diff --git a/package.json b/package.json index 9d6a53b..918efae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-enhancing-export", - "version": "1.0.11", + "version": "1.1.0", "description": "This is a enhancing export plugin for Obsidian. It allows to export to formats like Html, DOCX, ePub and PDF or Markdown(Hugo) etc.", "main": "dist/main.js", "scripts": { diff --git a/src/export_command_templates.ts b/src/export_command_templates.ts index c282d37..00336ef 100644 --- a/src/export_command_templates.ts +++ b/src/export_command_templates.ts @@ -44,7 +44,7 @@ export default { name: 'TextBundle', type: 'pandoc', arguments: - '-f markdown --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/markdown.lua" -V media_dir="${outputDir}/${outputFileName}/assets" -s -o "${outputDir}/${outputFileName}/text.md" -t commonmark_x-attributes', + '-f markdown --resource-path="${currentDir}" --resource-path="${attachmentFolderPath}" --lua-filter="${luaDir}/markdown.lua" -V media_dir="${outputDir}/${outputFileName}.textbundle/assets" -s -o "${outputDir}/${outputFileName}.textbundle/text.md" -t commonmark_x-attributes', extension: '.md', }, 'PDF': { diff --git a/src/exporto0o.ts b/src/exporto0o.ts index 938225f..f5ada3e 100644 --- a/src/exporto0o.ts +++ b/src/exporto0o.ts @@ -152,23 +152,32 @@ export async function exportToOo( const cmd = cmdTpl.replace(/\${(.*?)}/g, (_, p1: string) => variables[p1 as keyof typeof variables]); + const args = await yargs(cmd.split(' ')).options({ + output: { type: 'string', alias: 'o' }, + }).argv; + const actualOutputPath = args.output.startsWith('"') && args.output.endsWith('"') + || args.output.startsWith('\'') && args.output.endsWith('\'') + ? args.output.substring(1, args.output.length - 1) + : args.output; + + const actualOutputDir = actualOutputPath.substring(0, actualOutputPath.lastIndexOf('/')); + if (!fs.existsSync(actualOutputDir)) { + fs.mkdirSync(actualOutputDir); + } + executeCommand( cmd, () => { progress.hide(); const next = async () => { - const args = yargs(cmd.split(' ')).options({ - output: { type: 'string', alias: 'o' }, - }); - const argv = await args.argv; if (openExportedFileLocation) { setTimeout(() => { - ct.remote.shell.showItemInFolder(argv.output); + ct.remote.shell.showItemInFolder(actualOutputPath); }, 1000); } if (openExportedFile) { - await ct.remote.shell.openPath(argv.output); + await ct.remote.shell.openPath(actualOutputPath); } if (setting.type === 'pandoc' && setting.runCommand === true && setting.command) { executeCommand(setting.command); diff --git a/versions.json b/versions.json index a30d0ab..6b09861 100644 --- a/versions.json +++ b/versions.json @@ -6,5 +6,6 @@ "1.0.8": "0.12.0", "1.0.9": "0.12.0", "1.0.10": "0.12.0", - "1.0.11": "0.12.0" + "1.0.11": "0.12.0", + "1.1.0": "0.12.0" } \ No newline at end of file