Is it at all possible to set default options for pandoc? For example, I always want to use xelatex to generate PDFs, and as far as I can tell, my options for doing so are to pass --latex-engine=xelatex
to every invocation of pandoc, or to write a wrapper script that just calls pandoc with that option.
Both of these seem suboptimal to me, and nearly every other command-line program has ways to get around this. Sometimes it's done with an environment variable in the shell (something like setting PANDOC_OPTS="--latex-engine=xelatex"
), and other times it's a configuration file (ala ~/.gitconfig
or the like). I know pandoc has a data directory at ~/.pandoc
, but from my reading of the documentation there is no way to do this.
Since pandoc 2.8, one can provide default options via the --defaults
command line parameter:
-d
FILE,--defaults=
FILESpecify 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With