2007-07-21 22:36:08 +02:00
|
|
|
% PANDOC(1) Pandoc User Manuals
|
2007-07-02 01:26:20 +02:00
|
|
|
% John MacFarlane
|
2008-01-08 18:25:57 +01:00
|
|
|
% January 8, 2008
|
2007-07-02 01:26:20 +02:00
|
|
|
|
|
|
|
# NAME
|
|
|
|
|
|
|
|
pandoc - general markup converter
|
|
|
|
|
|
|
|
# SYNOPSIS
|
|
|
|
|
2007-07-02 04:16:58 +02:00
|
|
|
pandoc [*options*] [*input-file*]...
|
2007-07-02 01:26:20 +02:00
|
|
|
|
|
|
|
# DESCRIPTION
|
|
|
|
|
|
|
|
Pandoc converts files from one markup format to another. It can
|
2010-12-04 08:50:03 +01:00
|
|
|
read markdown and (subsets of) Textile, reStructuredText, HTML, and LaTeX,
|
|
|
|
and it can write plain text, markdown, reStructuredText, HTML, LaTeX,
|
2010-04-10 21:38:07 +02:00
|
|
|
ConTeXt, Texinfo, groff man, MediaWiki markup, Textile, RTF,
|
2010-12-05 18:45:45 +01:00
|
|
|
OpenDocument XML, ODT, DocBook XML, EPUB, Emacs Org-Mode, and
|
|
|
|
Slidy or S5 HTML slide shows.
|
2007-07-02 01:26:20 +02:00
|
|
|
|
2008-08-11 00:24:43 +02:00
|
|
|
If no *input-file* is specified, input is read from *stdin*.
|
2007-07-02 01:26:20 +02:00
|
|
|
Otherwise, the *input-files* are concatenated (with a blank
|
2008-08-11 00:24:43 +02:00
|
|
|
line between each) and used as input. Output goes to *stdout* by
|
2010-07-05 08:09:45 +02:00
|
|
|
default (though output to *stdout* is disabled for the `odt` and
|
|
|
|
`epub` output formats). For output to a file, use the `-o` option:
|
2007-07-02 01:26:20 +02:00
|
|
|
|
|
|
|
pandoc -o output.html input.txt
|
|
|
|
|
2010-02-02 08:37:01 +01:00
|
|
|
Instead of a file, an absolute URI may be given. In this case
|
|
|
|
pandoc will fetch the content using HTTP:
|
|
|
|
|
|
|
|
pandoc -f html -t markdown http://www.fsf.org
|
|
|
|
|
2007-07-02 01:26:20 +02:00
|
|
|
The input and output formats may be specified using command-line options
|
|
|
|
(see **OPTIONS**, below, for details). If these formats are not
|
|
|
|
specified explicitly, Pandoc will attempt to determine them
|
|
|
|
from the extensions of the input and output filenames. If input comes
|
2008-08-11 00:24:43 +02:00
|
|
|
from *stdin* or from a file with an unknown extension, the input is assumed
|
2007-07-02 01:26:20 +02:00
|
|
|
to be markdown. If no output filename is specified using the `-o`
|
|
|
|
option, or if a filename is specified but its extension is unknown,
|
|
|
|
the output will default to HTML. Thus, for example,
|
|
|
|
|
|
|
|
pandoc -o chap1.tex chap1.txt
|
|
|
|
|
|
|
|
converts *chap1.txt* from markdown to LaTeX. And
|
|
|
|
|
|
|
|
pandoc README
|
|
|
|
|
|
|
|
converts *README* from markdown to HTML.
|
|
|
|
|
|
|
|
Pandoc's version of markdown is an extended variant of standard
|
|
|
|
markdown: the differences are described in the *README* file in
|
|
|
|
the user documentation. If standard markdown syntax is desired, the
|
|
|
|
`--strict` option may be used.
|
|
|
|
|
2010-05-07 07:32:06 +02:00
|
|
|
Pandoc uses the UTF-8 character encoding for both input and output.
|
|
|
|
If your local character encoding is not UTF-8, you
|
2010-02-02 08:37:01 +01:00
|
|
|
should pipe input and output through `iconv`:
|
2007-07-02 01:26:20 +02:00
|
|
|
|
|
|
|
iconv -t utf-8 input.txt | pandoc | iconv -f utf-8
|
|
|
|
|
|
|
|
# OPTIONS
|
|
|
|
|
2007-07-08 05:31:26 +02:00
|
|
|
-f *FORMAT*, -r *FORMAT*, \--from=*FORMAT*, \--read=*FORMAT*
|
2007-07-02 01:26:20 +02:00
|
|
|
: Specify input format. *FORMAT* can be
|
|
|
|
`native` (native Haskell), `markdown` (markdown or plain text),
|
2010-12-04 08:50:03 +01:00
|
|
|
`textile` (Textile), `rst` (reStructuredText), `html` (HTML),
|
|
|
|
or `latex` (LaTeX). If `+lhs` is appended to `markdown`, `rst`,
|
|
|
|
or `latex`, the input will be treated as literate Haskell source.
|
2007-07-02 01:26:20 +02:00
|
|
|
|
2007-07-08 05:31:26 +02:00
|
|
|
-t *FORMAT*, -w *FORMAT*, \--to=*FORMAT*, \--write=*FORMAT*
|
2007-07-02 01:26:20 +02:00
|
|
|
: Specify output format. *FORMAT* can be `native` (native Haskell),
|
2010-03-18 07:45:43 +01:00
|
|
|
`plain` (plain text), `markdown` (markdown), `rst` (reStructuredText),
|
2007-07-15 05:17:33 +02:00
|
|
|
`html` (HTML), `latex` (LaTeX), `context` (ConTeXt), `man` (groff man),
|
2010-12-05 18:45:45 +01:00
|
|
|
`mediawiki` (MediaWiki markup), `textile` (Textile), `org` (Emacs
|
|
|
|
Org-Mode), `texinfo` (GNU Texinfo), `docbook` (DocBook XML),
|
2010-11-27 19:52:44 +01:00
|
|
|
`opendocument` (OpenDocument XML), `odt` (OpenOffice text document),
|
|
|
|
`epub` (EPUB book), `slidy` (Slidy HTML and javascript slide show),
|
2010-07-05 08:09:45 +02:00
|
|
|
`s5` (S5 HTML and javascript slide show), or `rtf` (rich text
|
|
|
|
format). Note that `odt` and `epub` output will not be directed to
|
|
|
|
*stdout*; an output filename must be specified using the `-o/--output`
|
|
|
|
option. If `+lhs` is appended to `markdown`, `rst`, `latex`, or `html`,
|
|
|
|
the output will be rendered as literate Haskell source.
|
2007-07-02 01:26:20 +02:00
|
|
|
|
2007-07-08 05:31:26 +02:00
|
|
|
-s, \--standalone
|
2007-07-02 01:26:20 +02:00
|
|
|
: Produce output with an appropriate header and footer (e.g. a
|
|
|
|
standalone HTML, LaTeX, or RTF file, not a fragment).
|
|
|
|
|
2007-07-08 05:31:26 +02:00
|
|
|
-o *FILE*, \--output=*FILE*
|
2008-08-11 00:24:43 +02:00
|
|
|
: Write output to *FILE* instead of *stdout*. If *FILE* is
|
|
|
|
\``-`', output will go to *stdout*.
|
2007-07-02 01:26:20 +02:00
|
|
|
|
2007-07-08 05:31:26 +02:00
|
|
|
-p, \--preserve-tabs
|
2007-07-02 01:26:20 +02:00
|
|
|
: Preserve tabs instead of converting them to spaces.
|
|
|
|
|
2007-07-08 05:31:26 +02:00
|
|
|
\--tab-stop=*TABSTOP*
|
2007-07-02 01:26:20 +02:00
|
|
|
: Specify tab stop (default is 4).
|
|
|
|
|
2007-07-08 05:31:26 +02:00
|
|
|
\--strict
|
2007-07-02 01:26:20 +02:00
|
|
|
: Use strict markdown syntax, with no extensions or variants.
|
|
|
|
|
2007-07-08 05:31:26 +02:00
|
|
|
\--reference-links
|
2007-07-02 01:26:20 +02:00
|
|
|
: Use reference-style links, rather than inline links, in writing markdown
|
|
|
|
or reStructuredText.
|
|
|
|
|
2007-07-08 05:31:26 +02:00
|
|
|
-R, \--parse-raw
|
2007-07-02 01:26:20 +02:00
|
|
|
: Parse untranslatable HTML codes and LaTeX environments as raw HTML
|
|
|
|
or LaTeX, instead of ignoring them.
|
|
|
|
|
2007-07-08 05:31:26 +02:00
|
|
|
-S, \--smart
|
2007-07-02 01:26:20 +02:00
|
|
|
: Use smart quotes, dashes, and ellipses. (This option is significant
|
|
|
|
only when the input format is `markdown`. It is selected automatically
|
2007-07-15 05:17:33 +02:00
|
|
|
when the output format is `latex` or `context`.)
|
2007-07-02 01:26:20 +02:00
|
|
|
|
2008-08-13 05:02:42 +02:00
|
|
|
-m*URL*, \--latexmathml=*URL*
|
|
|
|
: Use LaTeXMathML to display embedded TeX math in HTML output.
|
|
|
|
To insert a link to a local copy of the `LaTeXMathML.js` script,
|
2007-07-26 04:40:18 +02:00
|
|
|
provide a *URL*. If no *URL* is provided, the contents of the
|
|
|
|
script will be inserted directly into the HTML header.
|
2007-07-02 01:26:20 +02:00
|
|
|
|
2010-03-18 07:45:56 +01:00
|
|
|
\--mathml
|
|
|
|
: Convert TeX math to MathML. In standalone mode, a small javascript
|
|
|
|
will be inserted that allows the MathML to be viewed on some browsers.
|
|
|
|
|
2008-10-28 22:54:50 +01:00
|
|
|
\--jsmath=*URL*
|
|
|
|
: Use jsMath to display embedded TeX math in HTML output.
|
|
|
|
The *URL* should point to the jsMath load script; if provided,
|
|
|
|
it will be linked to in the header of standalone HTML documents.
|
|
|
|
|
2010-10-27 06:06:51 +02:00
|
|
|
\--mathjax=*URL*
|
|
|
|
: Use MathJax to display embedded TeX math in HTML output.
|
|
|
|
The *URL* should point to the `MathJax.js` load script.
|
|
|
|
|
2007-12-01 04:11:47 +01:00
|
|
|
\--gladtex
|
|
|
|
: Enclose TeX math in `<eq>` tags in HTML output. These can then
|
|
|
|
be processed by gladTeX to produce links to images of the typeset
|
|
|
|
formulas.
|
|
|
|
|
|
|
|
\--mimetex=*URL*
|
|
|
|
: Render TeX math using the mimeTeX CGI script. If *URL* is not specified,
|
|
|
|
it is assumed that the script is at `/cgi-bin/mimetex.cgi`.
|
|
|
|
|
2010-07-16 04:01:00 +02:00
|
|
|
\--webtex=*URL*
|
|
|
|
: Render TeX math using an external script. The formula will be
|
|
|
|
concatenated with the URL provided. If *URL* is not specified, the
|
|
|
|
Google Chart API will be used.
|
|
|
|
|
2007-07-08 05:31:26 +02:00
|
|
|
-i, \--incremental
|
2010-07-14 05:44:56 +02:00
|
|
|
: Make list items in Slidy or S5 display incrementally (one by one).
|
2007-07-02 01:26:20 +02:00
|
|
|
|
2010-07-23 06:50:17 +02:00
|
|
|
\--offline
|
|
|
|
: Include all the CSS and javascript needed for a Slidy or S5 slide
|
|
|
|
show in the output, so that the slide show will work even when no
|
|
|
|
internet connection is available.
|
|
|
|
|
2009-12-31 02:18:06 +01:00
|
|
|
\--xetex
|
|
|
|
: Create LaTeX outut suitable for processing by XeTeX.
|
|
|
|
|
2007-07-08 05:31:26 +02:00
|
|
|
-N, \--number-sections
|
2009-12-08 03:36:16 +01:00
|
|
|
: Number section headings in LaTeX, ConTeXt, or HTML output.
|
|
|
|
(Default is not to number them.)
|
2007-07-02 01:26:20 +02:00
|
|
|
|
2010-07-16 04:01:00 +02:00
|
|
|
\--section-divs
|
|
|
|
: Wrap sections in `<div>` tags, and attach identifiers to the
|
|
|
|
enclosing `<div>` rather than the header itself.
|
|
|
|
|
2007-09-27 03:28:28 +02:00
|
|
|
\--no-wrap
|
2007-11-15 04:23:02 +01:00
|
|
|
: Disable text wrapping in output. (Default is to wrap text.)
|
2007-09-27 03:28:28 +02:00
|
|
|
|
2008-01-03 22:32:32 +01:00
|
|
|
\--sanitize-html
|
|
|
|
: Sanitizes HTML (in markdown or HTML input) using a whitelist.
|
|
|
|
Unsafe tags are replaced by HTML comments; unsafe attributes
|
2008-03-22 21:41:56 +01:00
|
|
|
are omitted. URIs in links and images are also checked against a
|
|
|
|
whitelist of URI schemes.
|
2008-01-03 22:32:32 +01:00
|
|
|
|
2009-01-24 20:58:48 +01:00
|
|
|
\--email-obfuscation=*none|javascript|references*
|
|
|
|
: Specify a method for obfuscating `mailto:` links in HTML documents.
|
|
|
|
*none* leaves `mailto:` links as they are. *javascript* obfuscates
|
|
|
|
them using javascript. *references* obfuscates them by printing their
|
|
|
|
letters as decimal or hexadecimal character references.
|
|
|
|
If `--strict` is specified, *references* is used regardless of the
|
|
|
|
presence of this option.
|
|
|
|
|
2009-12-05 18:56:02 +01:00
|
|
|
\--id-prefix*=string*
|
|
|
|
: Specify a prefix to be added to all automatically generated identifiers
|
|
|
|
in HTML output. This is useful for preventing duplicate identifiers
|
|
|
|
when generating fragments to be included in other pages.
|
|
|
|
|
2009-12-05 05:46:57 +01:00
|
|
|
\--indented-code-classes*=classes*
|
2009-12-01 07:56:47 +01:00
|
|
|
: Specify classes to use for indented code blocks--for example,
|
|
|
|
`perl,numberLines` or `haskell`. Multiple classes may be separated
|
|
|
|
by spaces or commas.
|
|
|
|
|
2007-07-12 05:45:00 +02:00
|
|
|
\--toc, \--table-of-contents
|
|
|
|
: Include an automatically generated table of contents (HTML, markdown,
|
|
|
|
RTF) or an instruction to create one (LaTeX, reStructuredText).
|
2010-07-14 05:44:56 +02:00
|
|
|
This option has no effect on man, DocBook, Slidy, or S5 output.
|
2007-07-12 05:45:00 +02:00
|
|
|
|
2010-03-15 00:23:26 +01:00
|
|
|
\--base-header-level=*LEVEL*
|
|
|
|
: Specify the base level for headers (defaults to 1).
|
|
|
|
|
2009-12-31 02:10:04 +01:00
|
|
|
\--template=*FILE*
|
|
|
|
: Use *FILE* as a custom template for the generated document. Implies
|
|
|
|
`-s`. See 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`.
|
|
|
|
|
2009-12-31 02:10:26 +01:00
|
|
|
-V KEY=VAL, \--variable=*KEY:VAL*
|
|
|
|
: Set the template variable KEY to the value VAL when rendering the
|
|
|
|
document in standalone mode. This is only useful when the
|
|
|
|
`--template` option is used to specify a custom template, since
|
|
|
|
pandoc automatically sets the variables used in the default
|
|
|
|
templates.
|
|
|
|
|
2007-07-08 05:31:26 +02:00
|
|
|
-c *CSS*, \--css=*CSS*
|
2007-07-02 01:26:20 +02:00
|
|
|
: Link to a CSS style sheet. *CSS* is the pathname of the style sheet.
|
|
|
|
|
2007-07-08 05:31:26 +02:00
|
|
|
-H *FILE*, \--include-in-header=*FILE*
|
2007-07-02 01:26:20 +02:00
|
|
|
: Include contents of *FILE* at the end of the header. Implies `-s`.
|
|
|
|
|
2007-07-08 05:31:26 +02:00
|
|
|
-B *FILE*, \--include-before-body=*FILE*
|
2007-07-02 01:26:20 +02:00
|
|
|
: Include contents of *FILE* at the beginning of the document body.
|
2010-03-13 05:11:24 +01:00
|
|
|
Implies `-s`.
|
2007-07-02 01:26:20 +02:00
|
|
|
|
2007-07-08 05:31:26 +02:00
|
|
|
-A *FILE*, \--include-after-body=*FILE*
|
2007-07-02 01:26:20 +02:00
|
|
|
: Include contents of *FILE* at the end of the document body.
|
2010-03-13 05:11:24 +01:00
|
|
|
Implies `-s`.
|
2007-07-02 01:26:20 +02:00
|
|
|
|
2007-07-08 05:31:26 +02:00
|
|
|
-C *FILE*, \--custom-header=*FILE*
|
2010-01-10 03:40:08 +01:00
|
|
|
: Use contents of *FILE* as the document header. *Note: This option is
|
|
|
|
deprecated. Users should transition to using `--template` instead.*
|
2007-07-02 01:26:20 +02:00
|
|
|
|
2009-12-31 23:40:59 +01:00
|
|
|
\--reference-odt=*filename*
|
|
|
|
: Use the specified file as a style reference in producing an ODT.
|
|
|
|
For best results, the reference ODT should be a modified version
|
|
|
|
of an ODT produced using pandoc. The contents of the reference ODT
|
|
|
|
are ignored, but its stylesheets are used in the new ODT. If no
|
|
|
|
reference ODT is specified on the command line, pandoc will look
|
2010-01-14 06:54:38 +01:00
|
|
|
for a file `reference.odt` in the user data directory (see
|
|
|
|
`--data-dir`). If this is not found either, sensible defaults will be
|
2009-12-31 23:40:59 +01:00
|
|
|
used.
|
|
|
|
|
2010-07-05 08:09:45 +02:00
|
|
|
\--epub-stylesheet=*filename*
|
|
|
|
: Use the specified CSS file to style the EPUB. If no stylesheet
|
|
|
|
is specified, pandoc will look for a file `epub.css` in the
|
|
|
|
user data directory (see `--data-dir`, below). If it is not
|
|
|
|
found there, sensible defaults will be used.
|
|
|
|
|
|
|
|
\--epub-metadata=*filename*
|
|
|
|
: Look in the specified XML file for metadata for the EPUB.
|
|
|
|
The file should contain a series of Dublin Core elements
|
|
|
|
(http://dublincore.org/documents/dces/), for example:
|
|
|
|
|
|
|
|
<dc:rights>Creative Commons</dc:rights>
|
|
|
|
<dc:language>es-AR</dc:language>
|
|
|
|
|
|
|
|
By default, pandoc will include the following metadata elements:
|
|
|
|
`<dc:title>` (from the document title), `<dc:creator>` (from the
|
|
|
|
document authors), `<dc:language>` (from the locale), and
|
|
|
|
`<dc:identifier id="BookId">` (a randomly generated UUID). Any of
|
|
|
|
these may be overridden by elements in the metadata file.
|
|
|
|
|
2009-12-31 02:09:36 +01:00
|
|
|
-D *FORMAT*, \--print-default-template=*FORMAT*
|
|
|
|
: Print the default template for an output *FORMAT*. (See `-t`
|
|
|
|
for a list of possible *FORMAT*s.)
|
2007-07-02 01:26:20 +02:00
|
|
|
|
2007-07-08 05:31:26 +02:00
|
|
|
-T *STRING*, \--title-prefix=*STRING*
|
2007-07-02 01:26:20 +02:00
|
|
|
: Specify *STRING* as a prefix to the HTML window title.
|
|
|
|
|
2010-12-03 07:36:22 +01:00
|
|
|
\--bibliography=*FILE*
|
|
|
|
: Specify bibliography database to be used in resolving
|
|
|
|
citations. The database type will be determined from the
|
2010-12-05 18:29:14 +01:00
|
|
|
extension of *FILE*, which may be `.mods` (MODS format),
|
|
|
|
`.bib` (BibTeX format), `.bbx` (BibLaTeX format),
|
|
|
|
`.ris` (RIS format), `.enl` (EndNote format),
|
|
|
|
`.xml` (EndNote XML format), `.wos` (ISI format),
|
|
|
|
`.medline` (MEDLINE format), `.copac` (Copac format),
|
|
|
|
or `.json` (citeproc JSON).
|
2010-12-03 07:36:22 +01:00
|
|
|
|
|
|
|
\--csl=*FILE*
|
|
|
|
: Specify [CSL] style to be used in formatting citations and
|
|
|
|
the bibliography. If *FILE* is not found, pandoc will look
|
|
|
|
for it in
|
|
|
|
|
|
|
|
$HOME/.csl
|
|
|
|
|
|
|
|
in unix and
|
|
|
|
|
2010-12-04 08:05:20 +01:00
|
|
|
C:\Documents And Settings\USERNAME\Application Data\csl
|
2010-12-03 07:36:22 +01:00
|
|
|
|
|
|
|
in Windows. If the `--csl` option is not specified, pandoc
|
|
|
|
will use a default style: either `default.csl` in the
|
|
|
|
user data directory (see `--data-dir`), or, if that is
|
|
|
|
not present, the Chicago author-date style.
|
|
|
|
|
2010-01-14 06:54:38 +01:00
|
|
|
\--data-dir*=DIRECTORY*
|
|
|
|
: Specify the user data directory to search for pandoc data files.
|
|
|
|
If this option is not specified, the default user data directory
|
|
|
|
will be used:
|
|
|
|
|
|
|
|
$HOME/.pandoc
|
|
|
|
|
|
|
|
in unix and
|
|
|
|
|
|
|
|
C:\Documents And Settings\USERNAME\Application Data\pandoc
|
|
|
|
|
2010-07-21 09:00:31 +02:00
|
|
|
in Windows. A `reference.odt`, `epub.css`, `templates` directory,
|
|
|
|
or `s5` directory placed in this directory will override pandoc's
|
|
|
|
normal defaults.
|
2010-01-14 06:54:38 +01:00
|
|
|
|
2007-07-08 05:31:26 +02:00
|
|
|
\--dump-args
|
2008-08-11 00:24:43 +02:00
|
|
|
: Print information about command-line arguments to *stdout*, then exit.
|
2007-07-02 01:26:20 +02:00
|
|
|
The first line of output contains the name of the output file specified
|
2008-08-11 00:24:43 +02:00
|
|
|
with the `-o` option, or \``-`' (for *stdout*) if no output file was
|
2007-07-02 01:26:20 +02:00
|
|
|
specified. The remaining lines contain the command-line arguments,
|
|
|
|
one per line, in the order they appear. These do not include regular
|
|
|
|
Pandoc options and their arguments, but do include any options appearing
|
2007-07-02 04:16:58 +02:00
|
|
|
after a \``--`' separator at the end of the line.
|
2007-07-02 01:26:20 +02:00
|
|
|
This option is intended primarily for use in wrapper scripts.
|
|
|
|
|
2007-07-08 05:31:26 +02:00
|
|
|
\--ignore-args
|
2007-07-02 01:26:20 +02:00
|
|
|
: Ignore command-line arguments (for use in wrapper scripts).
|
|
|
|
Regular Pandoc options are not ignored. Thus, for example,
|
|
|
|
|
2010-07-14 19:51:22 +02:00
|
|
|
pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1
|
2007-07-02 01:26:20 +02:00
|
|
|
|
2010-07-14 19:51:22 +02:00
|
|
|
is equivalent to
|
2007-07-02 01:26:20 +02:00
|
|
|
|
2010-07-14 19:51:22 +02:00
|
|
|
pandoc -o foo.html -s
|
2007-07-02 01:26:20 +02:00
|
|
|
|
2007-07-08 05:31:26 +02:00
|
|
|
-v, \--version
|
2007-07-02 01:26:20 +02:00
|
|
|
: Print version.
|
|
|
|
|
2007-07-08 05:31:26 +02:00
|
|
|
-h, \--help
|
2007-07-02 01:26:20 +02:00
|
|
|
: Show usage message.
|
|
|
|
|
2009-12-31 02:10:04 +01:00
|
|
|
# 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
|
2009-12-31 22:18:13 +01:00
|
|
|
can be specified using the `--template` option. You can also override
|
|
|
|
the system default templates for a given output format `FORMAT`
|
2010-01-14 06:54:38 +01:00
|
|
|
by putting a file `templates/FORMAT.template` in the user data
|
|
|
|
directory (see `--data-dir`, below).
|
2009-12-31 02:10:04 +01:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2009-12-31 02:15:33 +01:00
|
|
|
To write a literal `$` in a template, use `$$`.
|
|
|
|
|
2009-12-31 02:10:04 +01:00
|
|
|
Some variables are set automatically by pandoc. These vary somewhat
|
|
|
|
depending on the output format, but include:
|
|
|
|
|
|
|
|
`legacy-header`
|
|
|
|
: contents specified by `-C/--custom-header`
|
|
|
|
`header-includes`
|
2009-12-31 22:18:13 +01:00
|
|
|
: contents specified by `-H/--include-in-header` (may have multiple
|
|
|
|
values)
|
2009-12-31 02:10:04 +01:00
|
|
|
`toc`
|
|
|
|
: non-null value if `--toc/--table-of-contents` was specified
|
2010-03-13 05:11:24 +01:00
|
|
|
`include-before`
|
|
|
|
: contents specified by `-B/--include-before-body` (may have
|
|
|
|
multiple values)
|
|
|
|
`include-after`
|
|
|
|
: contents specified by `-A/--include-after-body` (may have
|
|
|
|
multiple values)
|
2009-12-31 02:10:04 +01:00
|
|
|
`body`
|
|
|
|
: body of document
|
|
|
|
`title`
|
|
|
|
: title of document, as specified in title block
|
2009-12-31 02:15:33 +01:00
|
|
|
`author`
|
2009-12-31 22:18:13 +01:00
|
|
|
: author of document, as specified in title block (may have
|
|
|
|
multiple values)
|
2009-12-31 02:10:04 +01:00
|
|
|
`date`
|
|
|
|
: date of document, as specified in title block
|
|
|
|
|
2009-12-31 02:10:26 +01:00
|
|
|
Variables may be set at the command line using the `-V/--variable`
|
|
|
|
option. This allows users to include custom variables in their
|
|
|
|
templates.
|
2009-12-31 02:10:04 +01:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
2009-12-31 02:15:33 +01:00
|
|
|
When variables can have multiple values (for example, `author` in
|
|
|
|
a multi-author document), you can use the `$for$` keyword:
|
|
|
|
|
|
|
|
$for(author)$
|
|
|
|
<meta name="author" content="$author$" />
|
|
|
|
$endfor$
|
|
|
|
|
|
|
|
You can optionally specify a separator to be used between
|
|
|
|
consecutive items:
|
|
|
|
|
|
|
|
$for(author)$$author$$sep$, $endfor$
|
2009-12-31 02:10:04 +01:00
|
|
|
|
2007-07-02 01:26:20 +02:00
|
|
|
# SEE ALSO
|
|
|
|
|
2008-08-27 07:50:26 +02:00
|
|
|
`markdown2pdf` (1).
|
2007-07-02 01:26:20 +02:00
|
|
|
The *README* file distributed with Pandoc contains full documentation.
|
|
|
|
|
|
|
|
The Pandoc source code and all documentation may be downloaded from
|
2007-09-13 19:26:01 +02:00
|
|
|
<http://johnmacfarlane.net/pandoc/>.
|
2007-07-02 01:26:20 +02:00
|
|
|
|
2010-12-03 07:36:22 +01:00
|
|
|
[CSL]: CitationStyles.org
|
|
|
|
|