\enableregime[utf]  % use UTF-8

\setupcolors[state=start]
\setupinteraction[state=start, color=middleblue] % needed for hyperlinks

\setuppapersize[letter][letter]  % use letter paper
\setuplayout[width=middle, backspace=1.5in, cutspace=1.5in,
             height=middle, header=0.75in, footer=0.75in] % page layout
\setuppagenumbering[location={footer,center}]  % number pages
\setupbodyfont[11pt]  % 11pt font
\setupwhitespace[medium]  % inter-paragraph spacing

\setuphead[section][style=\tfc]
\setuphead[subsection][style=\tfb]
\setuphead[subsubsection][style=\bf]

% define descr (for definition lists)
\definedescription[descr][
  headstyle=bold,style=normal,align=left,location=hanging,
  width=broad,margin=1cm]

% prevent orphaned list intros
\setupitemize[autointro]

% define defaults for bulleted lists
\setupitemize[1][symbol=1][indentnext=no]
\setupitemize[2][symbol=2][indentnext=no]
\setupitemize[3][symbol=3][indentnext=no]
\setupitemize[4][symbol=4][indentnext=no]

\setupthinrules[width=15em]  % width of horizontal rules

% for block quotations
\unprotect

\startvariables all
blockquote: blockquote
\stopvariables

\definedelimitedtext
[\v!blockquote][\v!quotation]

\setupdelimitedtext
[\v!blockquote]
[\c!left=,
\c!right=,
before={\blank[medium]},
after={\blank[medium]},
]

\protect

\starttext
\startalignment[center]
  \blank[2*big]
  {\tfd Pandoc User's Guide}
  \blank[3*medium]
  {\tfa John MacFarlane}
  \blank[2*medium]
  {\tfa March 20, 2010}
  \blank[3*medium]
\stopalignment

Pandoc is a \useURL[1][http://www.haskell.org/][][Haskell]\from[1]
library for converting from one markup format to another, and a
command-line tool that uses this library. It can read
\useURL[2][http://daringfireball.net/projects/markdown/][][markdown]\from[2]
and (subsets of)
\useURL[3][http://docutils.sourceforge.net/docs/ref/rst/introduction.html][][reStructuredText]\from[3],
\useURL[4][http://www.w3.org/TR/html40/][][HTML]\from[4], and
\useURL[5][http://www.latex-project.org/][][LaTeX]\from[5]; and it
can write plain text,
\useURL[6][http://daringfireball.net/projects/markdown/][][markdown]\from[6],
\useURL[7][http://docutils.sourceforge.net/docs/ref/rst/introduction.html][][reStructuredText]\from[7],
\useURL[8][http://www.w3.org/TR/html40/][][HTML]\from[8],
\useURL[9][http://www.latex-project.org/][][LaTeX]\from[9],
\useURL[10][http://www.pragma-ade.nl/][][ConTeXt]\from[10],
\useURL[11][http://en.wikipedia.org/wiki/Rich_Text_Format][][RTF]\from[11],
\useURL[12][http://www.docbook.org/][][DocBook XML]\from[12],
\useURL[13][http://opendocument.xml.org/][][OpenDocument XML]\from[13],
\useURL[14][http://en.wikipedia.org/wiki/OpenDocument][][ODT]\from[14],
\useURL[15][http://www.gnu.org/software/texinfo/][][GNU Texinfo]\from[15],
\useURL[16][http://www.mediawiki.org/wiki/Help:Formatting][][MediaWiki markup]\from[16],
\useURL[17][http://developer.apple.com/DOCUMENTATION/Darwin/Reference/ManPages/man7/groff_man.7.html][][groff man]\from[17]
pages, and
\useURL[18][http://meyerweb.com/eric/tools/s5/][][S5]\from[18] HTML
slide shows. Pandoc's enhanced version of markdown includes syntax
for footnotes, tables, flexible ordered lists, definition lists,
delimited code blocks, superscript, subscript, strikeout, title
blocks, automatic tables of contents, embedded LaTeX math, and
markdown inside HTML block elements. (These enhancements can be
disabled if a drop-in replacement for \type{Markdown.pl} is
desired.)

In contrast to most existing tools for converting markdown to HTML,
which use regex substitutions, Pandoc has a modular design: it
consists of a set of readers, which parse text in a given format
and produce a native representation of the document, and a set of
writers, which convert this native representation into a target
format. Thus, adding an input or output format requires only adding
a reader or writer.

© 2006--9 John MacFarlane (jgm at berkeley dot edu). Released under
the
\useURL[19][http://www.gnu.org/copyleft/gpl.html][][GPL]\from[19],
version 2 or greater. This software carries no warranty of any
kind. (See COPYRIGHT for full copyright and warranty notices.)
Contributors: Recai Oktaş (build system, debian package, wrapper
scripts), Peter Wang (Texinfo writer), Andrea Rossato (OpenDocument
writer).

\subject{Using Pandoc}

If you run \type{pandoc} without arguments, it will accept input
from stdin. If you run it with file names as arguments, it will
take input from those files. By default, \type{pandoc} writes its
output to stdout.
\footnote{The exception is for \type{odt}. Since this is a binary output
format, an output file must be specified explicitly.}
If you want to write to a file, use the \type{-o} option:

\starttyping
pandoc -o hello.html hello.txt
\stoptyping

Note that you can specify multiple input files on the command line.
\type{pandoc} will concatenate them all (with blank lines between
them) before parsing:

\starttyping
pandoc -s ch1.txt ch2.txt refs.txt > book.html
\stoptyping

(The \type{-s} option here tells \type{pandoc} to produce a
standalone HTML file, with a proper header, rather than a fragment.
For more details on this and many other command-line options, see
below.)

Instead of a filename, you can specify an absolute URI. In this
case pandoc will attempt to download the content via HTTP:

\starttyping
pandoc -f html -t markdown http://www.fsf.org
\stoptyping

The format of the input and output can be specified explicitly
using command-line options. The input format can be specified using
the \type{-r/--read} or \type{-f/--from} options, the output format
using the \type{-w/--write} or \type{-t/--to} options. Thus, to
convert \type{hello.txt} from markdown to LaTeX, you could type:

\starttyping
pandoc -f markdown -t latex hello.txt
\stoptyping

To convert \type{hello.html} from html to markdown:

\starttyping
pandoc -f html -t markdown hello.html
\stoptyping

Supported output formats include \type{markdown}, \type{latex},
\type{context} (ConTeXt), \type{html}, \type{rtf} (rich text
format), \type{rst} (reStructuredText), \type{docbook} (DocBook
XML), \type{opendocument} (OpenDocument XML), \type{odt}
(OpenOffice text document), \type{texinfo}, (GNU Texinfo),
\type{mediawiki} (MediaWiki markup), \type{man} (groff man), and
\type{s5} (which produces an HTML file that acts like powerpoint).

Supported input formats include \type{markdown}, \type{html},
\type{latex}, and \type{rst}. Note that the \type{rst} reader only
parses a subset of reStructuredText syntax. For example, it doesn't
handle tables, option lists, or footnotes. But for simple documents
it should be adequate. The \type{latex} and \type{html} readers are
also limited in what they can do.

If you don't specify a reader or writer explicitly, \type{pandoc}
will try to determine the input and output format from the
extensions of the input and output filenames. Thus, for example,

\starttyping
pandoc -o hello.tex hello.txt
\stoptyping

will convert \type{hello.txt} from markdown to LaTeX. If no output
file is specified (so that output goes to stdout), or if the output
file's extension is unknown, the output format will default to
HTML. If no input file is specified (so that input comes from
stdin), or if the input files' extensions are unknown, the input
format will be assumed to be markdown unless explicitly specified.

\subsubject{Character encodings}

All input is assumed to be in the UTF--8 encoding, and all output
is in UTF--8 (unless your version of pandoc was compiled using GHC
6.12 or higher, in which case the local encoding will be used). If
your local character encoding is not UTF--8 and you use accented or
foreign characters, you should pipe the input and output through
\useURL[20][http://www.gnu.org/software/libiconv/][][iconv]\from[20].
For example,

\starttyping
iconv -t utf-8 source.txt | pandoc | iconv -f utf-8 > output.html
\stoptyping

will convert \type{source.txt} from the local encoding to UTF--8,
then convert it to HTML, then convert back to the local encoding,
putting the output in \type{output.html}.

\subject{Wrappers}

\subsubject{\type{markdown2pdf}}

The standard Pandoc installation includes \type{markdown2pdf}, a
wrapper around \type{pandoc} and \type{pdflatex} that produces PDFs
directly from markdown sources. The default behavior of
\type{markdown2pdf} is to create a file with the same base name as
the first argument and the extension \type{pdf}; thus, for example,

markdown2pdf sample.txt endnotes.txt

will produce \type{sample.pdf}. (If \type{sample.pdf} exists
already, it will be backed up before being overwritten.) An output
file name can be specified explicitly using the \type{-o} option:

markdown2pdf -o book.pdf chap1 chap2

If no input file is specified, input will be taken from stdin. All
of \type{pandoc}'s options will work with \type{markdown2pdf} as
well.

\type{markdown2pdf} assumes that \type{pdflatex} is in the path. It
also assumes that the following LaTeX packages are available:
\type{unicode}, \type{fancyhdr} (if you have verbatim text in
footnotes), \type{graphicx} (if you use images), \type{array} (if
you use tables), and \type{ulem} (if you use strikeout text). If
they are not already included in your LaTeX distribution, you can
get them from \useURL[21][http://www.ctan.org][][CTAN]\from[21]. A
full \useURL[22][http://www.tug.org/texlive/][][TeX Live]\from[22]
or \useURL[23][http://www.tug.org/mactex/][][MacTeX]\from[23]
distribution will have all of these packages.

\subsubject{\type{hsmarkdown}}

A user who wants a drop-in replacement for \type{Markdown.pl} may
create a symbolic link to the \type{pandoc} executable called
\type{hsmarkdown}. When invoked under the name \type{hsmarkdown},
\type{pandoc} will behave as if the \type{--strict} flag had been
selected, and no command-line options will be recognized. However,
this approach does not work under Cygwin, due to problems with its
simulation of symbolic links.

\subject{Command-line options}

Various command-line options can be used to customize the output.
For further documentation, see the \type{pandoc(1)} man page.

\startdescr{\type{-f}, \type{--from}, \type{-r}, or \type{--read} {\em format}}
specifies the input format (the format Pandoc will be converting
{\em from}). {\em format} can be \type{native}, \type{markdown},
\type{rst}, \type{html}, or \type{latex}. (\type{+lhs} can be
appended to indicate that the input should be treated as literate
Haskell source. See
\useURL[24][#literate-haskell-support][][Literate Haskell support]\from[24],
below.)
\stopdescr

\startdescr{\type{-t}, \type{--to}, \type{-w}, or \type{--write} {\em format}}
specifies the output format --- the format Pandoc will be
converting {\em to}. {\em format} can be \type{native},
\type{html}, \type{s5}, \type{docbook}, \type{opendocument},
\type{latex}, \type{context}, \type{markdown}, \type{man},
\type{plain}, \type{rst}, and \type{rtf}. (\type{+lhs} can be
appended to indicate that the output should be treated as literate
Haskell source. See
\useURL[25][#literate-haskell-support][][Literate Haskell support]\from[25],
below.)
\stopdescr

\startdescr{\type{-s} or \type{--standalone}}
indicates that a standalone document is to be produced (with
appropriate headers and footers), rather than a fragment.
\stopdescr

\startdescr{\type{-o} or \type{--output} {\em filename}}
sends output to {\em filename}. If this option is not specified, or
if its argument is \type{-}, output will be sent to stdout.
(Exception: if the output format is \type{odt}, output to stdout is
disabled.)
\stopdescr

\startdescr{\type{-p} or \type{--preserve-tabs}}
causes tabs in the source text to be preserved, rather than
converted to spaces (the default).
\stopdescr

\startdescr{\type{--tab-stop} {\em tabstop}}
sets the number of spaces per tab to {\em tabstop} (defaults to 4).
\stopdescr

\startdescr{\type{--strict}}
specifies that strict markdown syntax is to be used, without
pandoc's usual extensions and variants (described below). When the
input format is HTML, this means that constructs that have no
equivalents in standard markdown (e.g. definition lists or
strikeout text) will be parsed as raw HTML.
\stopdescr

\startdescr{\type{--reference-links}}
causes reference-style links to be used in markdown and
reStructuredText output. By default inline links are used.
\stopdescr

\startdescr{\type{-R} or \type{--parse-raw}}
causes the HTML and LaTeX readers to parse HTML codes and LaTeX
environments that it can't translate as raw HTML or LaTeX. Raw HTML
can be printed in markdown, reStructuredText, HTML, and S5 output;
raw LaTeX can be printed in markdown, reStructuredText, LaTeX, and
ConTeXt output. The default is for the readers to omit
untranslatable HTML codes and LaTeX environments. (The LaTeX reader
does pass through untranslatable LaTeX {\em commands}, even if
\type{-R} is not specified.)
\stopdescr

\startdescr{\type{-C} or \type{--custom-header} {\em filename}}
can be used to specify a custom document header. Implies
\type{--standalone}.
{\em Note: this option is deprecated. Use of \type{--template} is preferred.}
\stopdescr

\startdescr{\type{--toc} or \type{--table-of-contents}}
includes an automatically generated table of contents (or, in the
case of \type{latex}, \type{context}, and \type{rst}, an
instruction to create one) in the output document. This option has
no effect with \type{man}, \type{docbook}, or \type{s5} output
formats.
\stopdescr

\startdescr{\type{--base-header-level} {\em level}}
specifies the base level for headers (defaults to 1).
\stopdescr

\startdescr{\type{--template=}{\em file}}
uses {\em file} as a custom template for the generated document.
Implies \type{-s}. See
\useURL[26][#templates][][Templates]\from[26] 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 \type{-D/--print-default-template}.
\stopdescr

\startdescr{\type{-V} {\em key=val}, \type{--variable=}{\em key:val}}
sets the template variable {\em key} to the value {\em val} when
rendering the document in standalone mode. This is only useful when
the \type{--template} option is used to specify a custom template,
since pandoc automatically sets the variables used in the default
templates.
\stopdescr

\startdescr{\type{-c} or \type{--css} {\em 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 multiple stylesheets. They will be included in the order
specified. Implies \type{--standalone}.
\stopdescr

\startdescr{\type{-H} or \type{--include-in-header} {\em filename}}
includes the contents of {\em filename} (verbatim) at the end of
the document header. This can be used, for example, to include
special CSS or javascript in HTML documents. This option can be
used repeatedly to include multiple files in the header. They will
be included in the order specified. Implies \type{--standalone}.
\stopdescr

\startdescr{\type{-B} or \type{--include-before-body} {\em filename}}
includes the contents of {\em filename} (verbatim) at the beginning
of the document body (e.g. after the \type{<body>} tag in HTML, or
the \type{\begin{document}} command in LaTeX). This can be used to
include navigation bars or banners in HTML documents. This option
can be used repeatedly to include multiple files. They will be
included in the order specified. Implies \type{--standalone}.
\stopdescr

\startdescr{\type{-A} or \type{--include-after-body} {\em filename}}
includes the contents of {\em filename} (verbatim) at the end of
the document body (before the \type{</body>} tag in HTML, or the
\type{\end{document}} command in LaTeX). This option can be be used
repeatedly to include multiple files. They will be included in the
order specified. Implies \type{--standalone}.
\stopdescr

\startdescr{\type{--reference-odt} {\em filename}}
uses 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
for a file \type{reference.odt} in the user data directory (see
\type{--data-dir}, below). If it is not found there, sensible
defaults will be used.
\stopdescr

\startdescr{\type{-D} or \type{--print-default-template} {\em format}}
prints the default template for an output {\em format}. (See
\type{-t} for a list of possible {\em format}s.)
\stopdescr

\startdescr{\type{-T} or \type{--title-prefix} {\em string}}
includes {\em string} as a prefix at the beginning of the title
that appears in the HTML header (but not in the title as it appears
at the beginning of the HTML body). (See below on
\useURL[27][#title-blocks][][Title Blocks]\from[27].) Implies
\type{--standalone}.
\stopdescr

\startdescr{\type{-S} or \type{--smart}}
causes \type{pandoc} to produce typographically correct output,
along the lines of John Gruber's
\useURL[28][http://daringfireball.net/projects/smartypants/][][Smartypants]\from[28].
Straight quotes are converted to curly quotes, \type{---} to
dashes, and \type{...} to ellipses. Nonbreaking spaces are inserted
after certain abbreviations, such as \quotation{Mr.} (Note: This
option is only significant when the input format is
\type{markdown}. It is selected automatically when the output
format is \type{latex} or \type{context}.)
\stopdescr

\startdescr{\type{-m}{\em [url]} or \type{--latexmathml}{\em [=url]}}
causes \type{pandoc} to use the
\useURL[29][http://math.etsu.edu/LaTeXMathML/][][LaTeXMathML]\from[29]
script to display TeX math in HTML or S5. If a local copy of
\type{LaTeXMathML.js} is available on the webserver where the page
will be viewed, provide a {\em url} and a link will be inserted in
the generated HTML or S5. If no {\em url} is provided, the contents
of the script will be inserted directly; this provides portability
at the price of efficiency. If you plan to use math on several
pages, it is much better to link to a copy of
\type{LaTeXMathML.js}, which can be cached. (See \type{--jsmath},
\type{--gladtex}, and \type{--mimetex} for alternative ways of
dealing with math in HTML.)
\stopdescr

\startdescr{\type{--mathml}}
causes \type{pandoc} to convert all TeX math to MathML. In
standalone mode, a small javascript will be inserted that allows
the MathML to be viewed on some browsers.
\stopdescr

\startdescr{\type{--jsmath}{\em =[url]}}
causes \type{pandoc} to use the
\useURL[30][http://www.math.union.edu/~dpvc/jsmath/][][jsMath]\from[30]
script to display TeX math in HTML or S5. The {\em url} should
point to the jsMath load script (e.g. \type{jsMath/easy/load.js}).
If it is provided, a link to it will be included in the header of
standalone HTML documents. (See \type{--latexmathml},
\type{--mimetex}, and \type{--gladtex} for alternative ways of
dealing with math in HTML.)
\stopdescr

\startdescr{\type{--gladtex}{\em [=url]}}
causes TeX formulas to be enclosed in \type{<eq>} tags in HTML or
S5 output. This output can then be processed by
\useURL[31][http://www.math.uio.no/~martingu/gladtex/index.html][][gladTeX]\from[31]
to produce links to images with the typeset formulas. (See
\type{--latexmathml}, \type{--jsmath}, and \type{--mimetex} for
alternative ways of dealing with math in HTML.)
\stopdescr

\startdescr{\type{--mimetex}{\em [=url]}}
causes TeX formulas to be replaced by \type{<img>} tags linking to
the
\useURL[32][http://www.forkosh.com/mimetex.html][][mimeTeX]\from[32]
CGI script, which will produce images with the typeset formulas.
(See \type{--latexmathml}, \type{--jsmath}, and \type{--gladtex}
for alternative ways of dealing with math in HTML.)
\stopdescr

\startdescr{\type{-i} or \type{--incremental}}
causes all lists in S5 output to be displayed incrementally by
default (one item at a time). The normal default is for lists to be
displayed all at once.
\stopdescr

\startdescr{\type{--xetex}}
creates LaTeX outut suitable for processing by XeTeX.
\stopdescr

\startdescr{\type{-N} or \type{--number-sections}}
causes sections to be numbered in LaTeX, ConTeXt, or HTML output.
By default, sections are not numbered.
\stopdescr

\startdescr{\type{--no-wrap}}
disables text-wrapping in output. By default, text is wrapped
appropriately for the output format.
\stopdescr

\startdescr{\type{--sanitize-html}}
sanitizes HTML (in markdown or HTML input) using a whitelist.
Unsafe tags are replaced by HTML comments; unsafe attributes are
omitted. URIs in links and images are also checked against a
whitelist of URI schemes.
\stopdescr

\startdescr{\type{--email-obfuscation}{\em =none\letterbar{}javascript\letterbar{}references}}
specifies a method for obfuscating \type{mailto:} links in HTML
documents. {\em none} leaves \type{mailto:} links as they are.
{\em javascript} obfuscates them using javascript. {\em references}
obfuscates them by printing their letters as decimal or hexadecimal
character references. If \type{--strict} is specified,
{\em references} is used regardless of the presence of this option.
\stopdescr

\startdescr{\type{--id-prefix}{\em =string}}
specifies 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.
\stopdescr

\startdescr{\type{--indented-code-classes}{\em =classes}}
specifies classes to use for indented code blocks---for example,
\type{perl,numberLines} or \type{haskell}. Multiple classes may be
separated by spaces or commas.
\stopdescr

\startdescr{\type{--data-dir}{\em =directory}}
specifies the user data directory to search for pandoc data files.
If this option is not specified, the default user data directory
will be used:

\starttyping
$HOME/.pandoc
\stoptyping

in unix and

\starttyping
C:\Documents And Settings\USERNAME\Application Data\pandoc
\stoptyping

in Windows. A reference ODT, \type{templates} directory, \type{s5}
directory placed in this directory will override pandoc's normal
defaults.
\stopdescr

\startdescr{\type{--dump-args}}
is intended to make it easier to create wrapper scripts that use
Pandoc. It causes Pandoc to dump information about the arguments
with which it was called to stdout, then exit. The first line
printed is the name of the output file specified using the
\type{-o} or \type{--output} option, or \type{-} if output would go
to stdout. The remaining lines, if any, list command-line
arguments. These will include the names of input files and any
special options passed after \type{--} on the command line. So, for
example,

\starttyping
pandoc --dump-args -o foo.html -s foo.txt \
  appendix.txt -- -e latin1
\stoptyping

will cause the following to be printed to stdout:

\starttyping
foo.html foo.txt appendix.txt -e latin1
\stoptyping

\stopdescr

\startdescr{\type{--ignore-args}}
causes Pandoc to ignore all command-line arguments. Regular Pandoc
options are not ignored. Thus, for example,

\starttyping
pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1
\stoptyping

is equivalent to

\starttyping
pandoc -o foo.html -s
\stoptyping

\stopdescr

\startdescr{\type{-v} or \type{--version}}
prints the version number to STDERR.
\stopdescr

\startdescr{\type{-h} or \type{--help}}
prints a usage message to STDERR.
\stopdescr

\subject{Templates}

When the \type{-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

\starttyping
pandoc -D FORMAT
\stoptyping

where \type{FORMAT} is the name of the output format. A custom
template can be specified using the \type{--template} option. You
can also override the system default templates for a given output
format \type{FORMAT} by putting a file
\type{templates/FORMAT.template} in the user data directory (see
\type{--data-dir}, above).

Templates may contain {\em variables}. Variable names are sequences
of alphanumerics, \type{-}, and \type{_}, starting with a letter. A
variable name surrounded by \type{$} signs will be replaced by its
value. For example, the string \type{$title$} in

\starttyping
<title>$title$</title>
\stoptyping

will be replaced by the document title.

To write a literal \type{$} in a template, use \type{$$}.

Some variables are set automatically by pandoc. These vary somewhat
depending on the output format, but include:

\startdescr{\type{legacy-header}}
contents specified by \type{-C/--custom-header}
\stopdescr

\startdescr{\type{header-includes}}
contents specified by \type{-H/--include-in-header} (may have
multiple values)
\stopdescr

\startdescr{\type{toc}}
non-null value if \type{--toc/--table-of-contents} was specified
\stopdescr

\startdescr{\type{include-before}}
contents specified by \type{-B/--include-before-body} (may have
multiple values)
\stopdescr

\startdescr{\type{include-after}}
contents specified by \type{-A/--include-after-body} (may have
multiple values)
\stopdescr

\startdescr{\type{body}}
body of document
\stopdescr

\startdescr{\type{title}}
title of document, as specified in title block
\stopdescr

\startdescr{\type{author}}
author of document, as specified in title block (may have multiple
values)
\stopdescr

\startdescr{\type{date}}
date of document, as specified in title block
\stopdescr

Variables may be set at the command line using the
\type{-V/--variable} option. This allows users to include custom
variables in their templates.

Templates may contain conditionals. The syntax is as follows:

\starttyping
$if(variable)$
X
$else$
Y
$endif$
\stoptyping

This will include \type{X} in the template if \type{variable} has a
non-null value; otherwise it will include \type{Y}. \type{X} and
\type{Y} are placeholders for any valid template text, and may
include interpolated variables or other conditionals. The
\type{$else$} section may be omitted.

When variables can have multiple values (for example, \type{author}
in a multi-author document), you can use the \type{$for$} keyword:

\starttyping
$for(author)$
<meta name="author" content="$author$" />
$endfor$
\stoptyping

You can optionally specify a separator to be used between
consecutive items:

\starttyping
$for(author)$$author$$sep$, $endfor$
\stoptyping

\subject{Pandoc's markdown vs.~standard markdown}

In parsing markdown, Pandoc departs from and extends
\useURL[33][http://daringfireball.net/projects/markdown/syntax][][standard markdown]\from[33]
in a few respects. Except where noted, these differences can be
suppressed by specifying the \type{--strict} command-line option.

\subsubject{Backslash escapes}

Except inside a code block or inline code, any punctuation or space
character preceded by a backslash will be treated literally, even
if it would normally indicate formatting. Thus, for example, if one
writes

\starttyping
*\*hello\**
\stoptyping

one will get

\starttyping
<em>*hello*</em>
\stoptyping

instead of

\starttyping
<strong>hello</strong>
\stoptyping

This rule is easier to remember than standard markdown's rule,
which allows only the following characters to be backslash-escaped:

\starttyping
\`*_{}[]()>#+-.!
\stoptyping

A backslash-escaped space is parsed as a nonbreaking space. It will
appear in TeX output as \quote{\type{~}} and in HTML and XML as
\quote{\type{\&#160;}} or \quote{\type{\&nbsp;}}.

A backslash-escaped newline (i.e. a backslash occurring at the end
of a line) is parsed as a hard line break. It will appear in TeX
output as \quote{\type{\\}} and in HTML as \quote{\type{<br />}}.
This is a nice alternative to markdown's \quotation{invisible} way
of indicating hard line breaks using two trailing spaces on a line.

\subsubject{Subscripts and superscripts}

Superscripts may be written by surrounding the superscripted text
by \type{^} characters; subscripts may be written by surrounding
the subscripted text by \type{~} characters. Thus, for example,

\starttyping
H~2~O is a liquid.  2^10^ is 1024.
\stoptyping

If the superscripted or subscripted text contains spaces, these
spaces must be escaped with backslashes. (This is to prevent
accidental superscripting and subscripting through the ordinary use
of \type{~} and \type{^}.) Thus, if you want the letter P with
\quote{a cat} in subscripts, use \type{P~a\ cat~}, not
\type{P~a cat~}.

\subsubject{Strikeout}

To strikeout a section of text with a horizontal line, begin and
end it with \type{~~}. Thus, for example,

\starttyping
This ~~is deleted text.~~
\stoptyping

\subsubject{Nested Lists}

Pandoc behaves differently from standard markdown on some
\quotation{edge cases} involving lists. Consider this source:

\starttyping
1.  First
2.  Second:
    -   Fee
    -   Fie
    -   Foe

3.  Third
\stoptyping

Pandoc transforms this into a \quotation{compact list} (with no
\type{<p>} tags around \quotation{First}, \quotation{Second}, or
\quotation{Third}), while markdown puts \type{<p>} tags around
\quotation{Second} and \quotation{Third} (but not
\quotation{First}), because of the blank space around
\quotation{Third}. Pandoc follows a simple rule: if the text is
followed by a blank line, it is treated as a paragraph. Since
\quotation{Second} is followed by a list, and not a blank line, it
isn't treated as a paragraph. The fact that the list is followed by
a blank line is irrelevant. (Note: Pandoc works this way even when
the \type{--strict} option is specified. This behavior is
consistent with the official markdown syntax description, even
though it is different from that of \type{Markdown.pl}.)

\subsubject{Ordered Lists}

Unlike standard markdown, Pandoc allows ordered list items to be
marked with uppercase and lowercase letters and roman numerals, in
addition to arabic numerals. (This behavior can be turned off using
the \type{--strict} option.) List markers may be enclosed in
parentheses or followed by a single right-parentheses or period.
They must be separated from the text that follows by at least one
space, and, if the list marker is a capital letter with a period,
by at least two spaces.
\footnote{The point of this rule is to ensure that normal paragraphs starting
with people's initials, like

\starttyping
B. Russell was an English philosopher.
\stoptyping

do not get treated as list items.

This rule will not prevent

\starttyping
(C) 2007 Joe Smith
\stoptyping

from being interpreted as a list item. In this case, a backslash
escape can be used:

\starttyping
(C\) 2007 Joe Smith
\stoptyping
}

Pandoc also pays attention to the type of list marker used, and to
the starting number, and both of these are preserved where possible
in the output format. Thus, the following yields a list with
numbers followed by a single parenthesis, starting with 9, and a
sublist with lowercase roman numerals:

\starttyping
 9)  Ninth
10)  Tenth
11)  Eleventh
       i. subone
      ii. subtwo
     iii. subthree
\stoptyping

Note that Pandoc pays attention only to the {\em starting} marker
in a list. So, the following yields a list numbered sequentially
starting from 2:

\starttyping
(2) Two
(5) Three
1.  Four
*   Five
\stoptyping

If default list markers are desired, use \quote{\type{#.}}:

\starttyping
#.  one
#.  two
#.  three
\stoptyping

\subsubject{Definition lists}

Pandoc supports definition lists, using a syntax inspired by
\useURL[34][http://www.michelf.com/projects/php-markdown/extra/][][PHP Markdown Extra]\from[34]
and
\useURL[35][http://docutils.sourceforge.net/docs/ref/rst/introduction.html][][reStructuredText]\from[35]:
\footnote{I have also been influenced by the suggestions of
\useURL[36][http://www.justatheory.com/computers/markup/modest-markdown-proposal.html][][David Wheeler]\from[36].}

\starttyping
Term 1

:   Definition 1

Term 2 with *inline markup*

:   Definition 2

        { some code, part of Definition 2 }

    Third paragraph of definition 2.
\stoptyping

Each term must fit on one line, which may optionally be followed by
a blank line, and must be followed by one or more definitions. A
definition begins with a colon or tilde, which may be indented one
or two spaces. A term may have multiple definitions, and each
definition may consist of one or more block elements (paragraph,
code block, list, etc.), each indented four spaces or one tab stop.

If you leave space after the definition (as in the example above),
the blocks of the definitions will be considered paragraphs. In
some output formats, this will mean greater spacing between
term/definition pairs. For a compact definition list, do not leave
space between the definition and the next term:

\starttyping
Term 1
  ~ Definition 1
Term 2
  ~ Definition 2a
  ~ Definition 2b
\stoptyping

\subsubject{Reference links}

Pandoc allows implicit reference links with just a single set of
brackets. So, the following links are equivalent:

\starttyping
1. Here's my [link]
2. Here's my [link][]

[link]: linky.com
\stoptyping

(Note: Pandoc works this way even if \type{--strict} is specified,
because \type{Markdown.pl} 1.0.2b7 allows single-bracket links.)

\subsubject{Footnotes}

Pandoc's markdown allows footnotes, using the following syntax:

\starttyping
Here is a footnote reference,[^1] and another.[^longnote]

[^1]: Here is the footnote.

[^longnote]: Here's one with multiple blocks.

    Subsequent paragraphs are indented to show that they
belong to the previous footnote.

        { some.code }

    The whole paragraph can be indented, or just the first
    line.  In this way, multi-paragraph footnotes work like
    multi-paragraph list items.

This paragraph won't be part of the note, because it isn't indented.
\stoptyping

The identifiers in footnote references may not contain spaces,
tabs, or newlines. These identifiers are used only to correlate the
footnote reference with the note itself; in the output, footnotes
will be numbered sequentially.

The footnotes themselves need not be placed at the end of the
document. They may appear anywhere except inside other block
elements (lists, block quotes, tables, etc.).

Inline footnotes are also allowed (though, unlike regular notes,
they cannot contain multiple paragraphs). The syntax is as follows:

\starttyping
Here is an inline note.^[Inlines notes are easier to write, since
you don't have to pick an identifier and move down to type the
note.]
\stoptyping

Inline and regular footnotes may be mixed freely.

\subsubject{Tables}

Two kinds of tables may be used. Both kinds presuppose the use of a
fixed-width font, such as Courier.

Simple tables look like this:

\starttyping
  Right     Left     Center     Default
-------     ------ ----------   -------
     12     12        12            12
    123     123       123          123
      1     1          1             1

Table:  Demonstration of simple table syntax.
\stoptyping

The headers and table rows must each fit on one line. Column
alignments are determined by the position of the header text
relative to the dashed line below it:
\footnote{This scheme is due to Michel Fortin, who proposed it on the
\useURL[37][http://six.pairlist.net/pipermail/markdown-discuss/2005-March/001097.html][][Markdown discussion list]\from[37].}

\startitemize
\item
  If the dashed line is flush with the header text on the right side
  but extends beyond it on the left, the column is right-aligned.
\item
  If the dashed line is flush with the header text on the left side
  but extends beyond it on the right, the column is left-aligned.
\item
  If the dashed line extends beyond the header text on both sides,
  the column is centered.
\item
  If the dashed line is flush with the header text on both sides, the
  default alignment is used (in most cases, this will be left).
\stopitemize

The table must end with a blank line, or a line of dashes followed
by a blank line. A caption may optionally be provided (as
illustrated in the example above). A caption is a paragraph
beginning with the string \type{Table:}, which will be stripped
off.

The column headers may be omitted, provided a dashed line is used
to end the table. For example:

\starttyping
-------     ------ ----------   -------
     12     12        12             12
    123     123       123           123
      1     1          1              1
-------     ------ ----------   -------
\stoptyping

When headers are omitted, column alignments are determined on the
basis of the first line of the table body. So, in the tables above,
the columns would be right, left, center, and right aligned,
respectively.

Multiline tables allow headers and table rows to span multiple
lines of text. Here is an example:

\starttyping
-------------------------------------------------------------
 Centered   Default           Right Left
  Header    Aligned         Aligned Aligned
----------- ------- --------------- -------------------------
   First    row                12.0 Example of a row that
                                    spans multiple lines.

  Second    row                 5.0 Here's another one. Note
                                    the blank line between
                                    rows.
-------------------------------------------------------------

Table: Here's the caption. It, too, may span
multiple lines.
\stoptyping

These work like simple tables, but with the following differences:

\startitemize
\item
  They must begin with a row of dashes, before the header text
  (unless the headers are omitted).
\item
  They must end with a row of dashes, then a blank line.
\item
  The rows must be separated by blank lines.
\stopitemize

In multiline tables, the table parser pays attention to the widths
of the columns, and the writers try to reproduce these relative
widths in the output. So, if you find that one of the columns is
too narrow in the output, try widening it in the markdown source.

Headers may be omitted in multiline tables as well as simple
tables:

\starttyping
----------- ------- --------------- -------------------------
   First    row                12.0 Example of a row that
                                    spans multiple lines.

  Second    row                 5.0 Here's another one. Note
                                    the blank line between
                                    rows.
-------------------------------------------------------------

Table: Here's a multiline table without headers.
\stoptyping

It is possible for a multiline table to have just one row, but the
row should be followed by a blank line (and then the row of dashes
that ends the table), or the table may be interpreted as a simple
table.

\subsubject{Delimited Code blocks}

In addition to standard indented code blocks, Pandoc supports
{\em delimited} code blocks. These begin with a row of three or
more tildes (\type{~}) and end with a row of tildes that must be at
least as long as the starting row. Everything between the
tilde-lines is treated as code. No indentation is necessary:

\starttyping
~~~~~~~
{code here}
~~~~~~~
\stoptyping

Like regular code blocks, delimited code blocks must be separated
from surrounding text by blank lines.

If the code itself contains a row of tildes, just use a longer row
of tildes at the start and end:

\starttyping
~~~~~~~~~~~~~~~~
~~~~~~~~~~
code including tildes
~~~~~~~~~~
~~~~~~~~~~~~~~~~
\stoptyping

Optionally, you may specify the language of the code block using
this syntax:

\starttyping
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.haskell .numberLines}
qsort []     = []
qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
               qsort (filter (>= x) xs)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
\stoptyping

Some output formats can use this information to do syntax
highlighting. Currently, the only output format that uses this
information is HTML.

If pandoc has been compiled with syntax highlighting support, then
the code block above will appear highlighted, with numbered lines.
(To see which languages are supported, do \type{pandoc --version}.)

If pandoc has not been compiled with syntax highlighting support,
the code block above will appear as follows:

\starttyping
<pre class="haskell">
  <code>
  ...
  </code>
</pre>
\stoptyping

\subsubject{Images with captions}

An image occurring by itself in a paragraph will be rendered as a
figure with a caption.
\footnote{This feature is not yet implemented for RTF, OpenDocument, or ODT.
In those formats, you'll just get an image in a paragraph by
itself, with no caption.}
(In LaTeX, a figure environment will be used; in HTML, the image
will be placed in a \type{div} with class \type{figure}, together
with a caption in a \type{p} with class \type{caption}.) The
image's alt text will be used as the caption.

\starttyping
![This is the caption](/url/of/image.png)
\stoptyping

If you just want a regular inline image, just make sure it is not
the only thing in the paragraph. One way to do this is to insert a
nonbreaking space after the image:

\starttyping
![This image won't be a figure](/url/of/image.png)\
\stoptyping

\subsubject{Title blocks}

If the file begins with a title block

\starttyping
% title
% author(s) (separated by semicolons)
% date
\stoptyping

it will be parsed as bibliographic information, not regular text.
(It will be used, for example, in the title of standalone LaTeX or
HTML output.) The block may contain just a title, a title and an
author, or all three elements. If you want to include an author but
no title, or a title and a date but no author, you need a blank
line:

\starttyping
%
% Author

% My title
%
% June 15, 2006
\stoptyping

The title may occupy multiple lines, but continuation lines must
begin with leading space, thus:

\starttyping
% My title
  on multiple lines
\stoptyping

If a document has multiple authors, the authors may be put on
separate lines with leading space, or separated by semicolons, or
both. So, all of the following are equivalent:

\starttyping
% Author One
  Author Two

% Author One; Author Two

% Author One;
  Author Two
\stoptyping

The date must fit on one line.

All three metadata fields may contain standard inline formatting
(italics, links, footnotes, etc.).

Title blocks will always be parsed, but they will affect the output
only when the \type{--standalone} (\type{-s}) option is chosen. In
HTML output, titles will appear twice: once in the document head
--- this is the title that will appear at the top of the window in
a browser --- and once at the beginning of the document body. The
title in the document head can have an optional prefix attached
(\type{--title-prefix} or \type{-T} option). The title in the body
appears as an H1 element with class \quotation{title}, so it can be
suppressed or reformatted with CSS. If a title prefix is specified
with \type{-T} and no title block appears in the document, the
title prefix will be used by itself as the HTML title.

The man page writer extracts a title, man page section number, and
other header and footer information from the title line. The title
is assumed to be the first word on the title line, which may
optionally end with a (single-digit) section number in parentheses.
(There should be no space between the title and the parentheses.)
Anything after this is assumed to be additional footer and header
text. A single pipe character (\type{|}) should be used to separate
the footer text from the header text. Thus,

\starttyping
% PANDOC(1)
\stoptyping

will yield a man page with the title \type{PANDOC} and section 1.

\starttyping
% PANDOC(1) Pandoc User Manuals
\stoptyping

will also have \quotation{Pandoc User Manuals} in the footer.

\starttyping
% PANDOC(1) Pandoc User Manuals | Version 4.0
\stoptyping

will also have \quotation{Version 4.0} in the header.

\subsubject{Markdown in HTML blocks}

While standard markdown leaves HTML blocks exactly as they are,
Pandoc treats text between HTML tags as markdown. Thus, for
example, Pandoc will turn

\starttyping
<table>
    <tr>
        <td>*one*</td>
        <td>[a link](http://google.com)</td>
    </tr>
</table>
\stoptyping

into

\starttyping
<table>
    <tr>
        <td><em>one</em></td>
        <td><a href="http://google.com">a link</a></td>
    </tr>
</table>
\stoptyping

whereas \type{Markdown.pl} will preserve it as is.

There is one exception to this rule: text between \type{<script>}
and \type{</script>} tags is not interpreted as markdown.

This departure from standard markdown should make it easier to mix
markdown with HTML block elements. For example, one can surround a
block of markdown text with \type{<div>} tags without preventing it
from being interpreted as markdown.

\subsubject{Header identifiers in HTML}

Each header element in pandoc's HTML output is given a unique
identifier. This identifier is based on the text of the header. To
derive the identifier from the header text,

\startitemize
\item
  Remove all formatting, links, etc.
\item
  Remove all punctuation, except underscores, hyphens, and periods.
\item
  Replace all spaces and newlines with hyphens.
\item
  Convert all alphabetic characters to lowercase.
\item
  Remove everything up to the first letter (identifiers may not begin
  with a number or punctuation mark).
\item
  If nothing is left after this, use the identifier \type{section}.
\stopitemize

Thus, for example,

\placetable[here]{none}
\starttable[|l|l|]
\HL
\NC Header
\NC Identifier
\NC\AR
\HL
\NC Header identifiers in HTML
\NC \type{header-identifiers-in-html}
\NC\AR
\NC {\em Dogs}?---in {\em my} house?
\NC \type{dogs--in-my-house}
\NC\AR
\NC \useURL[38][http://www.w3.org/TR/html40/][][HTML]\from[38],
    \useURL[39][http://meyerweb.com/eric/tools/s5/][][S5]\from[39], or
    \useURL[40][http://en.wikipedia.org/wiki/Rich_Text_Format][][RTF]\from[40]?
\NC \type{html-s5-or-rtf}
\NC\AR
\NC 3. Applications
\NC \type{applications}
\NC\AR
\NC 33
\NC \type{section}
\NC\AR
\HL
\stoptable

These rules should, in most cases, allow one to determine the
identifier from the header text. The exception is when several
headers have the same text; in this case, the first will get an
identifier as described above; the second will get the same
identifier with \type{-1} appended; the third with \type{-2}; and
so on.

These identifiers are used to provide link targets in the table of
contents generated by the \type{--toc|--table-of-contents} option.
They also make it easy to provide links from one section of a
document to another. A link to this section, for example, might
look like this:

\starttyping
See the section on [header identifiers](#header-identifiers-in-html).
\stoptyping

Note, however, that this method of providing links to sections
works only in HTML.

\subsubject{Blank lines before headers and blockquotes}

Standard markdown syntax does not require a blank line before a
header or blockquote. Pandoc does require this (except, of course,
at the beginning of the document). The reason for the requirement
is that it is all too easy for a \type{>} or \type{#} to end up at
the beginning of a line by accident (perhaps through line
wrapping). Consider, for example:

\starttyping
I like several of their flavors of ice cream:  #22, for example, and
#5.
\stoptyping

\subsubject{Math}

Anything between two \$ characters will be treated as TeX math. The
opening \$ must have a character immediately to its right, while
the closing \$ must have a character immediately to its left. Thus,
\type{$20,000 and $30,000} won't parse as math. If for some reason
you need to enclose text in literal \$ characters, backslash-escape
them and they won't be treated as math delimiters.

TeX math will be printed in all output formats. In Markdown,
reStructuredText, LaTeX, and ConTeXt output, it will appear
verbatim between \$ characters.

In reStructuredText output, it will be rendered using an
interpreted text role \type{:math:}, as described
\useURL[41][http://www.american.edu/econ/itex2mml/mathhack.rst][][here]\from[41].

In Texinfo output, it will be rendered inside a \type{@math}
command.

In groff man output, it will be rendered verbatim without \$'s.

In MediaWiki output, it will be rendered inside \type{<math>} tags.

In RTF, Docbook, and OpenDocument output, it will be rendered, as
far as possible, using unicode characters, and will otherwise
appear verbatim. Unknown commands and symbols, and commands that
cannot be dealt with this way (like \type{\frac}), will be rendered
verbatim. So the results may be a mix of raw TeX code and properly
rendered unicode math.

In HTML and S5 output, the way math is rendered will depend on the
command-line options selected:

\startitemize[n][stopper=.]
\item
  The default is to render TeX math as far as possible using unicode
  characters, as with RTF, Docbook, and OpenDocument output. Formulas
  are put inside a \type{span} with \type{class="math"}, so that they
  may be styled differently from the surrounding text if needed.
\item
  If the \type{--latexmathml} option is used, TeX math will be
  displayed between \$ or \$\$ characters and put in \type{<span>}
  tags with class \type{LaTeX}. The
  \useURL[42][http://math.etsu.edu/LaTeXMathML/][][LaTeXMathML]\from[42]
  script will be used to render it as formulas. (This trick does not
  work in all browsers, but it works in Firefox. In browsers that do
  not support LaTeXMathML, TeX math will appear verbatim between \$
  characters.)
\item
  If the \type{--jsmath} option is used, TeX math will be put inside
  \type{<span>} tags (for inline math) or \type{<div>} tags (for
  display math) with class \type{math}. The
  \useURL[43][http://www.math.union.edu/~dpvc/jsmath/][][jsMath]\from[43]
  script will be used to render it.
\item
  If the \type{--mimetex} option is used, the
  \useURL[44][http://www.forkosh.com/mimetex.html][][mimeTeX]\from[44]
  CGI script will be called to generate images for each TeX formula.
  This should work in all browsers. The \type{--mimetex} option takes
  an optional URL as argument. If no URL is specified, it will be
  assumed that the mimeTeX CGI script is at
  \type{/cgi-bin/mimetex.cgi}.
\item
  If the \type{--gladtex} option is used, TeX formulas will be
  enclosed in \type{<eq>} tags in the HTML output. The resulting
  \type{htex} file may then be processed by
  \useURL[45][http://www.math.uio.no/~martingu/gladtex/index.html][][gladTeX]\from[45],
  which will produce image files for each formula and an \type{html}
  file with links to these images. So, the procedure is:

  \starttyping
pandoc -s --gladtex myfile.txt -o myfile.htex
gladtex -d myfile-images myfile.htex
# produces myfile.html and images in myfile-images
\stoptyping

\stopitemize

\subsubject{Inline TeX}

Inline TeX commands will be preserved and passed unchanged to the
LaTeX and ConTeXt writers. Thus, for example, you can use LaTeX to
include BibTeX citations:

\starttyping
This result was proved in \cite{jones.1967}.
\stoptyping

Note that in LaTeX environments, like

\starttyping
\begin{tabular}{|l|l|}\hline
Age & Frequency \\ \hline
18--25  & 15 \\
26--35  & 33 \\
36--45  & 22 \\ \hline
\end{tabular}
\stoptyping

the material between the begin and end tags will be interpreted as
raw LaTeX, not as markdown.

Inline LaTeX is ignored in output formats other than Markdown,
LaTeX, and ConTeXt.

\subject{Producing S5 with Pandoc}

Producing an
\useURL[42][http://meyerweb.com/eric/tools/s5/][][S5]\from[42]
web-based slide show with Pandoc is easy. A title page is
constructed automatically from the document's title block (see
above). Each section (with a level-one header) produces a single
slide. (Note that if the section is too big, the slide will not fit
on the page; S5 is not smart enough to produce multiple pages.)

Here's the markdown source for a simple slide show,
\type{eating.txt}:

\starttyping
% Eating Habits
% John Doe
% March 22, 2005

# In the morning

- Eat eggs
- Drink coffee

# In the evening

- Eat spaghetti
- Drink wine
\stoptyping

To produce the slide show, simply type

\starttyping
pandoc -w s5 -s eating.txt > eating.html
\stoptyping

and open up \type{eating.html} in a browser.

Note that by default, the S5 writer produces lists that display
\quotation{all at once.} If you want your lists to display
incrementally (one item at a time), use the \type{-i} option. If
you want a particular list to depart from the default (that is, to
display incrementally without the \type{-i} option and all at once
with the \type{-i} option), put it in a block quote:

\starttyping
> - Eat spaghetti
> - Drink wine
\stoptyping

In this way incremental and nonincremental lists can be mixed in a
single document.

Note: the S5 file produced by pandoc with the
\type{-s/--standalone} option embeds the javascript and CSS
required to show the slides. Thus it does not depend on any
additional files: you can send the HTML file to others, and they
will be able to view the slide show just by opening it. However, if
you intend to produce several S5 slide shows, and you are
displaying them on your own website, it is better to keep the S5
javascript and CSS files separate from the slide shows themselves,
so that they may be cached. The best approach in this case is to
use pandoc without the \type{-s} option to produce the body of the
S5 document, which can then be inserted into an HTML template that
links to the javascript and CSS files required by S5. (See the
instructions on the S5 website.) Alternatively, you may use
\type{-s} together with the \type{--template} option to specify a
custom template.

You can change the style of the slides by putting customized CSS
files in \type{$DATADIR/s5/default}, where \type{$DATADIR} is the
user data directory (see \type{--data-dir}, above). The originals
may be found in pandoc's system data directory (generally
\type{$CABALDIR/pandoc-VERSION/s5/default}). Pandoc will look there
for any files it does not find in the user data directory.

\subject{Literate Haskell support}

If you append \type{+lhs} to an appropriate input or output format
(\type{markdown}, \type{rst}, or \type{latex} for input or output;
\type{html} for output only), pandoc will treat the document as
literate Haskell source. This means that

\startitemize
\item
  In markdown input, \quotation{bird track} sections will be parsed
  as Haskell code rather than block quotations. Text between
  \type{\begin{code}} and \type{\end{code}} will also be treated as
  Haskell code.
\item
  In markdown output, code blocks with class \type{haskell} will be
  rendered using bird tracks, and block quotations will be indented
  one space, so they will not be treated as Haskell code. In
  addition, headers will be rendered setext-style (with underlines)
  rather than atx-style (with \quote{\#} characters). (This is
  because ghc treats \quote{\#} characters in column 1 as introducing
  line numbers.)
\item
  In restructured text input, \quotation{bird track} sections will be
  parsed as Haskell code.
\item
  In restructured text output, code blocks with class \type{haskell}
  will be rendered using bird tracks.
\item
  In LaTeX input, text in \type{code} environments will be parsed as
  Haskell code.
\item
  In LaTeX output, code blocks with class \type{haskell} will be
  rendered inside \type{code} environments.
\item
  In HTML output, code blocks with class \type{haskell} will be
  rendered with class \type{literatehaskell} and bird tracks.
\stopitemize

Examples:

\starttyping
pandoc -f markdown+lhs -t html
\stoptyping

reads literate Haskell source formatted with markdown conventions
and writes ordinary HTML (without bird tracks).

\starttyping
pandoc -f markdown+lhs -t html+lhs
\stoptyping

writes HTML with the Haskell code in bird tracks, so it can be
copied and pasted as literate Haskell source.

\stoptext