OliverBalfour / obsidian-pandoc

Pandoc document export plugin for Obsidian (https://obsidian.md)
MIT License
684 stars 58 forks source link

Can't export when defining extra pandoc arguments containing spaces #77

Open mgmeyers opened 2 years ago

mgmeyers commented 2 years ago

I use a reference document with pandoc like so:

--reference-doc=/Users/matt/Library/Mobile Documents/iCloud~md~obsidian/Documents/Knowledge Garden/Templates/essay-template.docx

But because "Extra Pandoc arguments" are split on spaces, the plugin sees this as three arguments rather than one.

https://github.com/OliverBalfour/obsidian-pandoc/blob/master/pandoc.ts#L141

This throws the error:

pandoc: Documents/iCloud~md~obsidian/Documents/Knowledge: openBinaryFile: does not exist (No such file or directory)
Limezy commented 2 years ago

Hi, Have you tried using \ as an escape ?

--reference-doc=/Users/matt/Library/Mobile Documents/iCloud~md~obsidian/Documents/Knowledge\ Garden/Templates/essay-template.docx
mgmeyers commented 2 years ago

@Limezy Yeah, but no luck. The value of "Extra Pandoc arguments" is split on space characters before it's sent to the command line, so escaping that space has no effect.

ndegroot commented 2 years ago

I can confirm this. I did find a workaround for (path) spaces in plugin settings Please test it.

naive231 commented 1 year ago

workaround for (path) spaces in plugin settings

I think you're missing another '\'. It should be placed in front of "Documents" of "Mobile Documents" like:

--reference-doc=/Users/matt/Library/Mobile\ Documents/iCloud~md~obsidian/Documents/Knowledge\ Garden/Templates/essay-template.docx