Search code examples
pandoc

Specify resource-path in YAML header


According to the documentation, we may use --resource-path=... to specify the path to the resource directory. E.g.:

---
title: Sample document
author: myself
date: now
#resource-path:
#- figures/
...

# Hi all!

Here is my sample document!  And also, there is an wonderful image in
this document.

![The wonderful image.](wimage.pdf)

Done.

The file wimage.pdf is located in figures/. Compiled with the following command, everything is OK, file is found and embedded in the output PDF file.

$ pandoc --resource-path=figures test.md -o test.pdf

Still according to the documentation, I may also use resource-path: in the YAML header. So I uncomment the corresponding 2 lines in the example above, and try compiling with

$ pandoc test.md -o test.pdf
[WARNING] Could not fetch resource wimage.pdf: replacing image with description

As indicated by the warning, the image is not embedded in the output PDF file.

Should the resource-path: in the YAML header work at all or not?


Solution

  • This is a misunderstanding about default files. Those are separate files that contain options and are passed via the --defaults/-D command line option. Putting resource-path in the document's metadata will not work.