gpt4 book ai didi

pandoc - 是否可以为 pandoc 设置默认选项?

转载 作者:行者123 更新时间:2023-12-04 12:52:15 26 4
gpt4 key购买 nike

是否可以为 pandoc 设置默认选项? ?例如,我一直想使用 xelatex 生成 PDF,据我所知,我这样做的选择是通过 --latex-engine=xelatex对 pandoc 的每次调用,或者编写一个包装脚本,该脚本仅使用该选项调用 pandoc。

这两个对我来说似乎都不是最佳选择,几乎所有其他命令行程序都有解决这个问题的方法。有时它是通过 shell 中的环境变量完成的(类似于设置 PANDOC_OPTS="--latex-engine=xelatex" ),有时它是一个配置文件(ala ~/.gitconfig 或类似的)。我知道 pandoc 在 ~/.pandoc 有一个数据目录,但从我对文档的阅读来看,没有办法做到这一点。

最佳答案

从 pandoc 2.8 开始,可以通过 --defaults command line parameter 提供默认选项:

-d FILE, --defaults=FILE

Specify a set of default option settings. FILE is a YAML file whose fields correspond to command-line option settings. All options for document conversion, including input and output files, can be set using a defaults file. The file will be searched for first in the working directory, and then in the defaults subdirectory of the user data directory (see --data-dir). The .yaml extension may be omitted. See the section Default files for more information on the file format. Settings from the defaults file may be overridden or extended by subsequent options on the command line.

关于pandoc - 是否可以为 pandoc 设置默认选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40112022/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com