JessicaTegner/pypandoc

Relative Image Paths do not work for docx or epub

antiskid56 opened this issue · 2 comments

In converting a markdown file to docx or epub, I run into PandocResourceNotFound for images with a relative path.

I can duplicate this issue with pandoc itself, by running pandoc from a directory other than the one where the input markdown file is.

With pandoc itself, I can solve the problem, by specifying a nondefault extension. The from file type changes from markdown to markdown+rebase_relative_paths. Here rebase_relative_paths is the nondefault extension.

But there seems to be no way to specify any pandoc extension in this way with pypandoc. The code that normalizes the from file types does not seem to allow it.

In any case, I haven't found a workaround for this issue. Does someone else have a workaround?

Thanks.

Hi there.
When setting the input or output format with pypandoc, you can also set extensions like you did in your example

Thanks for your prompt response.

After additional testing and research, I think the real issue is the "--sandbox" parameter that is being passed to pandoc by default. If I disable this, by passing sandbox=False in the pypandoc argument list, then pandoc finds the image file as one would expect.

If I don't disable this, there is no workaround that will fix the problem.

I think the top-level documentation should prominently mention this issue and its workaround. Currently it does not. I had to dig through commit messages and source code to find this.