Conversion from markdown to PDF results in "Failed to load file", even with "--resource-path" flag #9315
Replies: 4 comments
-
In your case, if you can't use relative paths, you could try using a Lua filter that rewrites the paths as relative when you use pandoc. |
Beta Was this translation helpful? Give feedback.
-
@jgm thanks for this. I'm following the docs here and making a Python filter, which for now simply prints to STDOUT if the AST node is an
It's a "Hello, world" filter for now, just to make sure I'm doing things correctly up to this point. I'm running pandoc using the following command:
However, I'm getting the following error:
I've got
And just in case pandoc is expecting the original Any advice on the |
Beta Was this translation helpful? Give feedback.
-
Try changing
to
or if that doesn't work hard-code the path to python3. My guess is that the environment in which the filters are being run won't include your local shell alias. |
Beta Was this translation helpful? Give feedback.
-
I tried changing the shebang as you mentioned, but that didn't work. I ended up using Paru to make both a converter and a filter, and that seems to have done the trick. Thanks all the same for the quick response! |
Beta Was this translation helpful? Give feedback.
-
I have a Jekyll site that I publish on Github pages, and the directory structure looks like so:
I want to convert
install-rbenv-content.md
to a PDF file, including its embedded images. The images are included in the markdown file like so:This loads fine when I spin up the Jekyll server and navigate to http://localhost:4000/.
However, when I run pandoc from
main_directory
to try and convert the markdown file to a PDF, I get the following error:I also tried the
--extract-media
flag, and got a different error:Judging by the
Failed to load file:///assets/images/
error, it looks like pandoc is not using the specified resource path, relative to the current directory (i.e.main_directory
). Not sure why.Can anyone help me out?
EDIT:
I tried removing the leading
/
from in front ofassets
inside the Markdown image declaration:i.e.
(assets/images
instead of(/assets/images
. This time, I get a successful result:However, now the images won't render in the browser. I need a solution that lets me convert Markdown to PDF without having to manually remove that leading
/
from every image.Beta Was this translation helpful? Give feedback.
All reactions