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

Pandoc does not export pictures due to wrong path

Open sOER-Frank opened this issue 3 years ago • 4 comments

When I want to export an Obsidian file to word in which I integrated a picture I get the following error message: image

My pictures are stored in an attachment folder.

What can I do?

sOER-Frank avatar Jan 14 '22 08:01 sOER-Frank

see my comment on #81

ndegroot avatar Jan 14 '22 22:01 ndegroot

This might work for one fixed directory, but I have many folders with notes and images.

For me the better workaround is:

Suppose the note is in

/foo/bar/note.md

use the plugin to export note.md as LaTeX to /foo/bar/note.tex

then on the command line,

cd /foo/bar
pdflatex note.text

and that will give a correct note.pdf

There is something fundamentally broken in this plugin. Probably it does not put its current directory to where the note is, before running pandoc.

dirkroorda avatar Jun 22 '22 09:06 dirkroorda

I have found a hot fix:

In the main.js of the pandoc plugin, in the functionconst pandoc = ..., under the line

let args = [];

add these two lines

args.push('--resource-path')
args.push(path$1.dirname(input.file))

The effect is that pandoc will be called with `--resource-path=parentdir where parentdir is the parent directory containing the note. This will enable pandoc to resolve all relative links in the note.

dirkroorda avatar Jun 22 '22 11:06 dirkroorda

Of course, this is a fix in the generated main.js. @OliverBalfour Maybe you can review this proposal and fix it in the source? I think this will improve the plugin a lot!

I have written a pull-request in the mean-while.

dirkroorda avatar Jun 22 '22 11:06 dirkroorda