Almost everything that is set in the YAML metadata affects only through the template used .
Pandoc templates can contain variables. For example, in your HTML template you can write:
<title>$title$</title>
These template variables can be set using the --variable KEY[=VAL] option.
However, they are also set from document metadata, which, in turn, can be set using:
The --variable literally insert lines into the template, and --metadata escapes the lines. Lines in YAML metadata (also when using --metadata-file ) are interpreted as markdowns that can be circumvented using markup pandoc universal raw attributes . For example, for HTML output:
'<script>alert()</script>'{=html}
See this table for a diagram :
| | --variable | --metadata | YAML metadata and --metadata-file | |------------------------|-------------------|-------------------|-----------------------------------| | values can beโฆ | strings and bools | strings and bools | also YAML objects and lists | | strings areโฆ | inserted verbatim | escaped | interpreted as markdown | | accessible by filters: | no | yes | yes |
To answer your question: the template determines which fields in the YAML metadata block have an effect. For example, to view the default latex template, use:
$ pandoc -D latex
To see some variables that pandoc sets automatically, see the manual . Finally, other pandoc behaviors (such as markdown extensions, etc.) can only be specified as command line parameters (except when using a shell script ).
mb21
source share