summaryrefslogtreecommitdiff
path: root/README
diff options
context:
space:
mode:
Diffstat (limited to 'README')
-rw-r--r--README71
1 files changed, 71 insertions, 0 deletions
diff --git a/README b/README
index 2cb4618e4..139ad3c8a 100644
--- a/README
+++ b/README
@@ -282,6 +282,13 @@ For further documentation, see the `pandoc(1)` man page.
one) in the output document. This option has no effect with `man`,
`docbook`, or `s5` output formats.
+`--template=`*file*
+: uses *file* as a custom template for the generated document. Implies
+ `-s`. See [Templates](#templates) below for a description
+ of template syntax. If this option is not used, a default
+ template appropriate for the output format will be used. See also
+ `-D/--print-default-template`.
+
`-c` or `--css` *filename*
: allows the user to specify a custom stylesheet that will be linked to
in HTML and S5 output. This option can be used repeatedly to include
@@ -437,6 +444,70 @@ For further documentation, see the `pandoc(1)` man page.
[gladTeX]: http://www.math.uio.no/~martingu/gladtex/index.html
[mimeTeX]: http://www.forkosh.com/mimetex.html
+Templates
+=========
+
+When the `-s/--standalone` option is used, pandoc uses a template to
+add header and footer material that is needed for a self-standing
+document. To see the default template that is used, just type
+
+ pandoc --print-default-template=FORMAT
+
+where `FORMAT` is the name of the output format. A custom template
+can be specified using the `--template` option.
+
+Templates may contain *variables*. Variable names are sequences of
+alphanumerics, `-`, and `_`, starting with a letter. A variable name
+surrounded by `$` signs will be replaced by its value. For example,
+the string `$title$` in
+
+ <title>$title$</title>
+
+will be replaced by the document title.
+
+Some variables are set automatically by pandoc. These vary somewhat
+depending on the output format, but include:
+
+`before`
+: contents specified by `-B/--include-before-body`
+`after`
+: contents specified by `-A/--include-after-body`
+`legacy-header`
+: contents specified by `-C/--custom-header`
+`header-includes`
+: contents specified by `-H/--include-in-header`
+`toc`
+: non-null value if `--toc/--table-of-contents` was specified
+`body`
+: body of document
+`title`
+: title of document, as specified in title block
+`authors`
+: authors of document, as specified in title block
+`date`
+: date of document, as specified in title block
+`css`
+: links to CSS files, as specified using `-c/--css`
+
+Variables may be set at the command line using the
+`--set` option. This allows users to include custom variables in
+their templates.
+
+Templates may contain conditionals. The syntax is as follows:
+
+ $if(variable)$
+ X
+ $else$
+ Y
+ $endif$
+
+This will include `X` in the template if `variable` has a non-null
+value; otherwise it will include `Y`. `X` and `Y` are placeholders for
+any valid template text, and may include interpolated variables or other
+conditionals. The `$else$` section may be omitted.
+
+To write a literal `$` in a template, use `$$`.
+
Pandoc's markdown vs. standard markdown
=======================================