obsidian-pandoc icon indicating copy to clipboard operation
obsidian-pandoc copied to clipboard

Can't export when defining extra pandoc arguments containing spaces

Open mgmeyers opened this issue 3 years ago • 4 comments

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)

mgmeyers avatar Oct 20 '21 04:10 mgmeyers

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

Limezy avatar Oct 21 '21 04:10 Limezy

@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.

mgmeyers avatar Oct 21 '21 04:10 mgmeyers

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

ndegroot avatar Jan 14 '22 22:01 ndegroot

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

naive231 avatar Nov 13 '22 15:11 naive231