在 YAML header 中指定 resource-path

Specify resource-path in YAML header

根据documentation,我们可以使用--resource-path=...来指定资源目录的路径。例如:

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

文件 wimage.pdf 位于 figures/。使用以下命令编译,一切正常,文件已找到并嵌入到输出 PDF 文件中。

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

还是按照documentation,我也可能在YAMLheader中使用resource-path:。所以我在上面的例子中取消了相应的2行,并尝试用

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

如警告所示,图像未嵌入输出的 PDF 文件中。

YAML header 中的 resource-path: 是否应该工作?

这是对默认文件的误解。这些是包含选项的单独文件,并通过 --defaults/-D 命令行选项传递。将 resource-path 放入文档的元数据中将不起作用。