git.iko.soy/typeable/pandoc
on 2.7.2 help sign in
6247 lines 189 kB history raw
1.\"t
2.TH PANDOC 1 "April 5, 2019" "pandoc 2.7.2"
3.SH NAME
4pandoc - general markup converter
5.SH SYNOPSIS
6.PP
7\f[C]pandoc\f[R] [\f[I]options\f[R]] [\f[I]input-file\f[R]]...
8.SH DESCRIPTION
9.PP
10Pandoc is a Haskell library for converting from one markup format to
11another, and a command-line tool that uses this library.
12.PP
13Pandoc can convert between numerous markup and word processing formats,
14including, but not limited to, various flavors of Markdown, HTML, LaTeX
15and Word docx.
16For the full lists of input and output formats, see the \f[C]--from\f[R]
17and \f[C]--to\f[R] options below.
18Pandoc can also produce PDF output: see creating a PDF, below.
19.PP
20Pandoc\[aq]s enhanced version of Markdown includes syntax for tables,
21definition lists, metadata blocks, footnotes, citations, math, and much
22more.
23See below under Pandoc\[aq]s Markdown.
24.PP
25Pandoc has a modular design: it consists of a set of readers, which
26parse text in a given format and produce a native representation of the
27document (an \f[I]abstract syntax tree\f[R] or AST), and a set of
28writers, which convert this native representation into a target format.
29Thus, adding an input or output format requires only adding a reader or
30writer.
31Users can also run custom pandoc filters to modify the intermediate AST.
32.PP
33Because pandoc\[aq]s intermediate representation of a document is less
34expressive than many of the formats it converts between, one should not
35expect perfect conversions between every format and every other.
36Pandoc attempts to preserve the structural elements of a document, but
37not formatting details such as margin size.
38And some document elements, such as complex tables, may not fit into
39pandoc\[aq]s simple document model.
40While conversions from pandoc\[aq]s Markdown to all formats aspire to be
41perfect, conversions from formats more expressive than pandoc\[aq]s
42Markdown can be expected to be lossy.
43.SS Using pandoc
44.PP
45If no \f[I]input-files\f[R] are specified, input is read from
46\f[I]stdin\f[R].
47Output goes to \f[I]stdout\f[R] by default.
48For output to a file, use the \f[C]-o\f[R] option:
49.IP
50.nf
51\f[C]
52pandoc -o output.html input.txt
53\f[R]
54.fi
55.PP
56By default, pandoc produces a document fragment.
57To produce a standalone document (e.g.
58a valid HTML file including \f[C]<head>\f[R] and \f[C]<body>\f[R]), use
59the \f[C]-s\f[R] or \f[C]--standalone\f[R] flag:
60.IP
61.nf
62\f[C]
63pandoc -s -o output.html input.txt
64\f[R]
65.fi
66.PP
67For more information on how standalone documents are produced, see
68Templates below.
69.PP
70If multiple input files are given, \f[C]pandoc\f[R] will concatenate
71them all (with blank lines between them) before parsing.
72(Use \f[C]--file-scope\f[R] to parse files individually.)
73.SS Specifying formats
74.PP
75The format of the input and output can be specified explicitly using
76command-line options.
77The input format can be specified using the \f[C]-f/--from\f[R] option,
78the output format using the \f[C]-t/--to\f[R] option.
79Thus, to convert \f[C]hello.txt\f[R] from Markdown to LaTeX, you could
80type:
81.IP
82.nf
83\f[C]
84pandoc -f markdown -t latex hello.txt
85\f[R]
86.fi
87.PP
88To convert \f[C]hello.html\f[R] from HTML to Markdown:
89.IP
90.nf
91\f[C]
92pandoc -f html -t markdown hello.html
93\f[R]
94.fi
95.PP
96Supported input and output formats are listed below under Options (see
97\f[C]-f\f[R] for input formats and \f[C]-t\f[R] for output formats).
98You can also use \f[C]pandoc --list-input-formats\f[R] and
99\f[C]pandoc --list-output-formats\f[R] to print lists of supported
100formats.
101.PP
102If the input or output format is not specified explicitly,
103\f[C]pandoc\f[R] will attempt to guess it from the extensions of the
104filenames.
105Thus, for example,
106.IP
107.nf
108\f[C]
109pandoc -o hello.tex hello.txt
110\f[R]
111.fi
112.PP
113will convert \f[C]hello.txt\f[R] from Markdown to LaTeX.
114If no output file is specified (so that output goes to
115\f[I]stdout\f[R]), or if the output file\[aq]s extension is unknown, the
116output format will default to HTML.
117If no input file is specified (so that input comes from
118\f[I]stdin\f[R]), or if the input files\[aq] extensions are unknown, the
119input format will be assumed to be Markdown.
120.SS Character encoding
121.PP
122Pandoc uses the UTF-8 character encoding for both input and output.
123If your local character encoding is not UTF-8, you should pipe input and
124output through \f[C]iconv\f[R]:
125.IP
126.nf
127\f[C]
128iconv -t utf-8 input.txt | pandoc | iconv -f utf-8
129\f[R]
130.fi
131.PP
132Note that in some output formats (such as HTML, LaTeX, ConTeXt, RTF,
133OPML, DocBook, and Texinfo), information about the character encoding is
134included in the document header, which will only be included if you use
135the \f[C]-s/--standalone\f[R] option.
136.SS Creating a PDF
137.PP
138To produce a PDF, specify an output file with a \f[C].pdf\f[R]
139extension:
140.IP
141.nf
142\f[C]
143pandoc test.txt -o test.pdf
144\f[R]
145.fi
146.PP
147By default, pandoc will use LaTeX to create the PDF, which requires that
148a LaTeX engine be installed (see \f[C]--pdf-engine\f[R] below).
149.PP
150Alternatively, pandoc can use ConTeXt, \f[C]pdfroff\f[R], or any of the
151following HTML/CSS-to-PDF-engines, to create a PDF:
152\f[C]wkhtmltopdf\f[R], \f[C]weasyprint\f[R] or \f[C]prince\f[R].
153To do this, specify an output file with a \f[C].pdf\f[R] extension, as
154before, but add the \f[C]--pdf-engine\f[R] option or
155\f[C]-t context\f[R], \f[C]-t html\f[R], or \f[C]-t ms\f[R] to the
156command line (\f[C]-t html\f[R] defaults to
157\f[C]--pdf-engine=wkhtmltopdf\f[R]).
158.PP
159PDF output uses variables for LaTeX (with a LaTeX engine); variables for
160ConTeXt (with ConTeXt); or variables for \f[C]wkhtmltopdf\f[R] (an
161HTML/CSS-to-PDF engine; \f[C]--css\f[R] also affects the output).
162.PP
163To debug the PDF creation, it can be useful to look at the intermediate
164representation: instead of \f[C]-o test.pdf\f[R], use for example
165\f[C]-s -o test.tex\f[R] to output the generated LaTeX.
166You can then test it with \f[C]pdflatex test.tex\f[R].
167.PP
168When using LaTeX, the following packages need to be available (they are
169included with all recent versions of TeX Live): \f[C]amsfonts\f[R],
170\f[C]amsmath\f[R], \f[C]lm\f[R], \f[C]unicode-math\f[R],
171\f[C]ifxetex\f[R], \f[C]ifluatex\f[R], \f[C]listings\f[R] (if the
172\f[C]--listings\f[R] option is used), \f[C]fancyvrb\f[R],
173\f[C]longtable\f[R], \f[C]booktabs\f[R], \f[C]graphicx\f[R] and
174\f[C]grffile\f[R] (if the document contains images), \f[C]hyperref\f[R],
175\f[C]xcolor\f[R], \f[C]ulem\f[R], \f[C]geometry\f[R] (with the
176\f[C]geometry\f[R] variable set), \f[C]setspace\f[R] (with
177\f[C]linestretch\f[R]), and \f[C]babel\f[R] (with \f[C]lang\f[R]).
178The use of \f[C]xelatex\f[R] or \f[C]lualatex\f[R] as the PDF engine
179requires \f[C]fontspec\f[R].
180\f[C]xelatex\f[R] uses \f[C]polyglossia\f[R] (with \f[C]lang\f[R]),
181\f[C]xecjk\f[R], and \f[C]bidi\f[R] (with the \f[C]dir\f[R] variable
182set).
183If the \f[C]mathspec\f[R] variable is set, \f[C]xelatex\f[R] will use
184\f[C]mathspec\f[R] instead of \f[C]unicode-math\f[R].
185The \f[C]upquote\f[R] and \f[C]microtype\f[R] packages are used if
186available, and \f[C]csquotes\f[R] will be used for typography if
187\f[C]\[rs]usepackage{csquotes}\f[R] is present in the template or
188included via \f[C]/H/--include-in-header\f[R].
189The \f[C]natbib\f[R], \f[C]biblatex\f[R], \f[C]bibtex\f[R], and
190\f[C]biber\f[R] packages can optionally be used for citation rendering.
191The following packages will be used to improve output quality if
192present, but pandoc does not require them to be present:
193\f[C]upquote\f[R] (for straight quotes in verbatim environments),
194\f[C]microtype\f[R] (for better spacing adjustments), \f[C]parskip\f[R]
195(for better inter-paragraph spaces), \f[C]xurl\f[R] (for better line
196breaks in URLs), \f[C]bookmark\f[R] (for better PDF bookmarks), and
197\f[C]footnotehyper\f[R] or \f[C]footnote\f[R] (to allow footnotes in
198tables).
199.SS Reading from the Web
200.PP
201Instead of an input file, an absolute URI may be given.
202In this case pandoc will fetch the content using HTTP:
203.IP
204.nf
205\f[C]
206pandoc -f html -t markdown http://www.fsf.org
207\f[R]
208.fi
209.PP
210It is possible to supply a custom User-Agent string or other header when
211requesting a document from a URL:
212.IP
213.nf
214\f[C]
215pandoc -f html -t markdown --request-header User-Agent:\[dq]Mozilla/5.0\[dq] \[rs]
216 http://www.fsf.org
217\f[R]
218.fi
219.SH OPTIONS
220.SS General options
221.TP
222.B \f[C]-f\f[R] \f[I]FORMAT\f[R], \f[C]-r\f[R] \f[I]FORMAT\f[R], \f[C]--from=\f[R]\f[I]FORMAT\f[R], \f[C]--read=\f[R]\f[I]FORMAT\f[R]
223Specify input format.
224\f[I]FORMAT\f[R] can be:
225.RS
226.IP \[bu] 2
227\f[C]commonmark\f[R] (CommonMark Markdown)
228.IP \[bu] 2
229\f[C]creole\f[R] (Creole 1.0)
230.IP \[bu] 2
231\f[C]docbook\f[R] (DocBook)
232.IP \[bu] 2
233\f[C]docx\f[R] (Word docx)
234.IP \[bu] 2
235\f[C]dokuwiki\f[R] (DokuWiki markup)
236.IP \[bu] 2
237\f[C]epub\f[R] (EPUB)
238.IP \[bu] 2
239\f[C]fb2\f[R] (FictionBook2 e-book)
240.IP \[bu] 2
241\f[C]gfm\f[R] (GitHub-Flavored Markdown), or the deprecated and less
242accurate \f[C]markdown_github\f[R]; use \f[C]markdown_github\f[R] only
243if you need extensions not supported in \f[C]gfm\f[R].
244.IP \[bu] 2
245\f[C]haddock\f[R] (Haddock markup)
246.IP \[bu] 2
247\f[C]html\f[R] (HTML)
248.IP \[bu] 2
249\f[C]ipynb\f[R] (Jupyter notebook)
250.IP \[bu] 2
251\f[C]jats\f[R] (JATS XML)
252.IP \[bu] 2
253\f[C]json\f[R] (JSON version of native AST)
254.IP \[bu] 2
255\f[C]latex\f[R] (LaTeX)
256.IP \[bu] 2
257\f[C]markdown\f[R] (Pandoc\[aq]s Markdown)
258.IP \[bu] 2
259\f[C]markdown_mmd\f[R] (MultiMarkdown)
260.IP \[bu] 2
261\f[C]markdown_phpextra\f[R] (PHP Markdown Extra)
262.IP \[bu] 2
263\f[C]markdown_strict\f[R] (original unextended Markdown)
264.IP \[bu] 2
265\f[C]mediawiki\f[R] (MediaWiki markup)
266.IP \[bu] 2
267\f[C]man\f[R] (roff man)
268.IP \[bu] 2
269\f[C]muse\f[R] (Muse)
270.IP \[bu] 2
271\f[C]native\f[R] (native Haskell)
272.IP \[bu] 2
273\f[C]odt\f[R] (ODT)
274.IP \[bu] 2
275\f[C]opml\f[R] (OPML)
276.IP \[bu] 2
277\f[C]org\f[R] (Emacs Org mode)
278.IP \[bu] 2
279\f[C]rst\f[R] (reStructuredText)
280.IP \[bu] 2
281\f[C]t2t\f[R] (txt2tags)
282.IP \[bu] 2
283\f[C]textile\f[R] (Textile)
284.IP \[bu] 2
285\f[C]tikiwiki\f[R] (TikiWiki markup)
286.IP \[bu] 2
287\f[C]twiki\f[R] (TWiki markup)
288.IP \[bu] 2
289\f[C]vimwiki\f[R] (Vimwiki)
290.PP
291Extensions can be individually enabled or disabled by appending
292\f[C]+EXTENSION\f[R] or \f[C]-EXTENSION\f[R] to the format name.
293See Extensions below, for a list of extensions and their names.
294See \f[C]--list-input-formats\f[R] and \f[C]--list-extensions\f[R],
295below.
296.RE
297.TP
298.B \f[C]-t\f[R] \f[I]FORMAT\f[R], \f[C]-w\f[R] \f[I]FORMAT\f[R], \f[C]--to=\f[R]\f[I]FORMAT\f[R], \f[C]--write=\f[R]\f[I]FORMAT\f[R]
299Specify output format.
300\f[I]FORMAT\f[R] can be:
301.RS
302.IP \[bu] 2
303\f[C]asciidoc\f[R] (AsciiDoc) or \f[C]asciidoctor\f[R] (AsciiDoctor)
304.IP \[bu] 2
305\f[C]beamer\f[R] (LaTeX beamer slide show)
306.IP \[bu] 2
307\f[C]commonmark\f[R] (CommonMark Markdown)
308.IP \[bu] 2
309\f[C]context\f[R] (ConTeXt)
310.IP \[bu] 2
311\f[C]docbook\f[R] or \f[C]docbook4\f[R] (DocBook 4)
312.IP \[bu] 2
313\f[C]docbook5\f[R] (DocBook 5)
314.IP \[bu] 2
315\f[C]docx\f[R] (Word docx)
316.IP \[bu] 2
317\f[C]dokuwiki\f[R] (DokuWiki markup)
318.IP \[bu] 2
319\f[C]epub\f[R] or \f[C]epub3\f[R] (EPUB v3 book)
320.IP \[bu] 2
321\f[C]epub2\f[R] (EPUB v2)
322.IP \[bu] 2
323\f[C]fb2\f[R] (FictionBook2 e-book)
324.IP \[bu] 2
325\f[C]gfm\f[R] (GitHub-Flavored Markdown), or the deprecated and less
326accurate \f[C]markdown_github\f[R]; use \f[C]markdown_github\f[R] only
327if you need extensions not supported in \f[C]gfm\f[R].
328.IP \[bu] 2
329\f[C]haddock\f[R] (Haddock markup)
330.IP \[bu] 2
331\f[C]html\f[R] or \f[C]html5\f[R] (HTML, i.e.
332HTML5/XHTML polyglot markup)
333.IP \[bu] 2
334\f[C]html4\f[R] (XHTML 1.0 Transitional)
335.IP \[bu] 2
336\f[C]icml\f[R] (InDesign ICML)
337.IP \[bu] 2
338\f[C]ipynb\f[R] (Jupyter notebook)
339.IP \[bu] 2
340\f[C]jats\f[R] (JATS XML)
341.IP \[bu] 2
342\f[C]json\f[R] (JSON version of native AST)
343.IP \[bu] 2
344\f[C]latex\f[R] (LaTeX)
345.IP \[bu] 2
346\f[C]man\f[R] (roff man)
347.IP \[bu] 2
348\f[C]markdown\f[R] (Pandoc\[aq]s Markdown)
349.IP \[bu] 2
350\f[C]markdown_mmd\f[R] (MultiMarkdown)
351.IP \[bu] 2
352\f[C]markdown_phpextra\f[R] (PHP Markdown Extra)
353.IP \[bu] 2
354\f[C]markdown_strict\f[R] (original unextended Markdown)
355.IP \[bu] 2
356\f[C]mediawiki\f[R] (MediaWiki markup)
357.IP \[bu] 2
358\f[C]ms\f[R] (roff ms)
359.IP \[bu] 2
360\f[C]muse\f[R] (Muse),
361.IP \[bu] 2
362\f[C]native\f[R] (native Haskell),
363.IP \[bu] 2
364\f[C]odt\f[R] (OpenOffice text document)
365.IP \[bu] 2
366\f[C]opml\f[R] (OPML)
367.IP \[bu] 2
368\f[C]opendocument\f[R] (OpenDocument)
369.IP \[bu] 2
370\f[C]org\f[R] (Emacs Org mode)
371.IP \[bu] 2
372\f[C]plain\f[R] (plain text),
373.IP \[bu] 2
374\f[C]pptx\f[R] (PowerPoint slide show)
375.IP \[bu] 2
376\f[C]rst\f[R] (reStructuredText)
377.IP \[bu] 2
378\f[C]rtf\f[R] (Rich Text Format)
379.IP \[bu] 2
380\f[C]texinfo\f[R] (GNU Texinfo)
381.IP \[bu] 2
382\f[C]textile\f[R] (Textile)
383.IP \[bu] 2
384\f[C]slideous\f[R] (Slideous HTML and JavaScript slide show)
385.IP \[bu] 2
386\f[C]slidy\f[R] (Slidy HTML and JavaScript slide show)
387.IP \[bu] 2
388\f[C]dzslides\f[R] (DZSlides HTML5 + JavaScript slide show),
389.IP \[bu] 2
390\f[C]revealjs\f[R] (reveal.js HTML5 + JavaScript slide show)
391.IP \[bu] 2
392\f[C]s5\f[R] (S5 HTML and JavaScript slide show)
393.IP \[bu] 2
394\f[C]tei\f[R] (TEI Simple)
395.IP \[bu] 2
396\f[C]xwiki\f[R] (XWiki markup)
397.IP \[bu] 2
398\f[C]zimwiki\f[R] (ZimWiki markup)
399.IP \[bu] 2
400the path of a custom lua writer, see Custom writers below
401.PP
402Note that \f[C]odt\f[R], \f[C]docx\f[R], and \f[C]epub\f[R] output will
403not be directed to \f[I]stdout\f[R] unless forced with \f[C]-o -\f[R].
404.PP
405Extensions can be individually enabled or disabled by appending
406\f[C]+EXTENSION\f[R] or \f[C]-EXTENSION\f[R] to the format name.
407See Extensions below, for a list of extensions and their names.
408See \f[C]--list-output-formats\f[R] and \f[C]--list-extensions\f[R],
409below.
410.RE
411.TP
412.B \f[C]-o\f[R] \f[I]FILE\f[R], \f[C]--output=\f[R]\f[I]FILE\f[R]
413Write output to \f[I]FILE\f[R] instead of \f[I]stdout\f[R].
414If \f[I]FILE\f[R] is \f[C]-\f[R], output will go to \f[I]stdout\f[R],
415even if a non-textual format (\f[C]docx\f[R], \f[C]odt\f[R],
416\f[C]epub2\f[R], \f[C]epub3\f[R]) is specified.
417.TP
418.B \f[C]--data-dir=\f[R]\f[I]DIRECTORY\f[R]
419Specify the user data directory to search for pandoc data files.
420If this option is not specified, the default user data directory will be
421used.
422On *nix and macOS systems this will be the \f[C]pandoc\f[R] subdirectory
423of the XDG data directory (by default, \f[C]$HOME/.local/share\f[R],
424overridable by setting the \f[C]XDG_DATA_HOME\f[R] environment
425variable).
426If that directory does not exist, \f[C]$HOME/.pandoc\f[R] will be used
427(for backwards compatibility).
428In Windows the default user data directory is
429\f[C]C:\[rs]Users\[rs]USERNAME\[rs]AppData\[rs]Roaming\[rs]pandoc\f[R].
430You can find the default user data directory on your system by looking
431at the output of \f[C]pandoc --version\f[R].
432A \f[C]reference.odt\f[R], \f[C]reference.docx\f[R], \f[C]epub.css\f[R],
433\f[C]templates\f[R], \f[C]slidy\f[R], \f[C]slideous\f[R], or
434\f[C]s5\f[R] directory placed in this directory will override
435pandoc\[aq]s normal defaults.
436.TP
437.B \f[C]--bash-completion\f[R]
438Generate a bash completion script.
439To enable bash completion with pandoc, add this to your
440\f[C].bashrc\f[R]:
441.RS
442.IP
443.nf
444\f[C]
445eval \[dq]$(pandoc --bash-completion)\[dq]
446\f[R]
447.fi
448.RE
449.TP
450.B \f[C]--verbose\f[R]
451Give verbose debugging output.
452Currently this only has an effect with PDF output.
453.TP
454.B \f[C]--quiet\f[R]
455Suppress warning messages.
456.TP
457.B \f[C]--fail-if-warnings\f[R]
458Exit with error status if there are any warnings.
459.TP
460.B \f[C]--log=\f[R]\f[I]FILE\f[R]
461Write log messages in machine-readable JSON format to \f[I]FILE\f[R].
462All messages above DEBUG level will be written, regardless of verbosity
463settings (\f[C]--verbose\f[R], \f[C]--quiet\f[R]).
464.TP
465.B \f[C]--list-input-formats\f[R]
466List supported input formats, one per line.
467.TP
468.B \f[C]--list-output-formats\f[R]
469List supported output formats, one per line.
470.TP
471.B \f[C]--list-extensions\f[R][\f[C]=\f[R]\f[I]FORMAT\f[R]]
472List supported extensions, one per line, preceded by a \f[C]+\f[R] or
473\f[C]-\f[R] indicating whether it is enabled by default in
474\f[I]FORMAT\f[R].
475If \f[I]FORMAT\f[R] is not specified, defaults for pandoc\[aq]s Markdown
476are given.
477.TP
478.B \f[C]--list-highlight-languages\f[R]
479List supported languages for syntax highlighting, one per line.
480.TP
481.B \f[C]--list-highlight-styles\f[R]
482List supported styles for syntax highlighting, one per line.
483See \f[C]--highlight-style\f[R].
484.TP
485.B \f[C]-v\f[R], \f[C]--version\f[R]
486Print version.
487.TP
488.B \f[C]-h\f[R], \f[C]--help\f[R]
489Show usage message.
490.SS Reader options
491.TP
492.B \f[C]--base-header-level=\f[R]\f[I]NUMBER\f[R]
493Specify the base level for headings (defaults to 1).
494.TP
495.B \f[C]--strip-empty-paragraphs\f[R]
496\f[I]Deprecated. Use the \f[CI]+empty_paragraphs\f[I] extension
497instead.\f[R] Ignore paragraphs with no content.
498This option is useful for converting word processing documents where
499users have used empty paragraphs to create inter-paragraph space.
500.TP
501.B \f[C]--indented-code-classes=\f[R]\f[I]CLASSES\f[R]
502Specify classes to use for indented code blocks--for example,
503\f[C]perl,numberLines\f[R] or \f[C]haskell\f[R].
504Multiple classes may be separated by spaces or commas.
505.TP
506.B \f[C]--default-image-extension=\f[R]\f[I]EXTENSION\f[R]
507Specify a default extension to use when image paths/URLs have no
508extension.
509This allows you to use the same source for formats that require
510different kinds of images.
511Currently this option only affects the Markdown and LaTeX readers.
512.TP
513.B \f[C]--file-scope\f[R]
514Parse each file individually before combining for multifile documents.
515This will allow footnotes in different files with the same identifiers
516to work as expected.
517If this option is set, footnotes and links will not work across files.
518Reading binary files (docx, odt, epub) implies \f[C]--file-scope\f[R].
519.TP
520.B \f[C]-F\f[R] \f[I]PROGRAM\f[R], \f[C]--filter=\f[R]\f[I]PROGRAM\f[R]
521Specify an executable to be used as a filter transforming the pandoc AST
522after the input is parsed and before the output is written.
523The executable should read JSON from stdin and write JSON to stdout.
524The JSON must be formatted like pandoc\[aq]s own JSON input and output.
525The name of the output format will be passed to the filter as the first
526argument.
527Hence,
528.RS
529.IP
530.nf
531\f[C]
532pandoc --filter ./caps.py -t latex
533\f[R]
534.fi
535.PP
536is equivalent to
537.IP
538.nf
539\f[C]
540pandoc -t json | ./caps.py latex | pandoc -f json -t latex
541\f[R]
542.fi
543.PP
544The latter form may be useful for debugging filters.
545.PP
546Filters may be written in any language.
547\f[C]Text.Pandoc.JSON\f[R] exports \f[C]toJSONFilter\f[R] to facilitate
548writing filters in Haskell.
549Those who would prefer to write filters in python can use the module
550\f[C]pandocfilters\f[R], installable from PyPI.
551There are also pandoc filter libraries in PHP, perl, and
552JavaScript/node.js.
553.PP
554In order of preference, pandoc will look for filters in
555.IP "1." 3
556a specified full or relative path (executable or non-executable)
557.IP "2." 3
558\f[C]$DATADIR/filters\f[R] (executable or non-executable) where
559\f[C]$DATADIR\f[R] is the user data directory (see \f[C]--data-dir\f[R],
560above).
561.IP "3." 3
562\f[C]$PATH\f[R] (executable only)
563.PP
564Filters and lua-filters are applied in the order specified on the
565command line.
566.RE
567.TP
568.B \f[C]--lua-filter=\f[R]\f[I]SCRIPT\f[R]
569Transform the document in a similar fashion as JSON filters (see
570\f[C]--filter\f[R]), but use pandoc\[aq]s build-in lua filtering system.
571The given lua script is expected to return a list of lua filters which
572will be applied in order.
573Each lua filter must contain element-transforming functions indexed by
574the name of the AST element on which the filter function should be
575applied.
576.RS
577.PP
578The \f[C]pandoc\f[R] lua module provides helper functions for element
579creation.
580It is always loaded into the script\[aq]s lua environment.
581.PP
582The following is an example lua script for macro-expansion:
583.IP
584.nf
585\f[C]
586function expand_hello_world(inline)
587 if inline.c == \[aq]{{helloworld}}\[aq] then
588 return pandoc.Emph{ pandoc.Str \[dq]Hello, World\[dq] }
589 else
590 return inline
591 end
592end
594return {{Str = expand_hello_world}}
595\f[R]
596.fi
597.PP
598In order of preference, pandoc will look for lua filters in
599.IP "1." 3
600a specified full or relative path (executable or non-executable)
601.IP "2." 3
602\f[C]$DATADIR/filters\f[R] (executable or non-executable) where
603\f[C]$DATADIR\f[R] is the user data directory (see \f[C]--data-dir\f[R],
604above).
605.RE
606.TP
607.B \f[C]-M\f[R] \f[I]KEY\f[R][\f[C]=\f[R]\f[I]VAL\f[R]], \f[C]--metadata=\f[R]\f[I]KEY\f[R][\f[C]:\f[R]\f[I]VAL\f[R]]
608Set the metadata field \f[I]KEY\f[R] to the value \f[I]VAL\f[R].
609A value specified on the command line overrides a value specified in the
610document using YAML metadata blocks.
611Values will be parsed as YAML boolean or string values.
612If no value is specified, the value will be treated as Boolean true.
613Like \f[C]--variable\f[R], \f[C]--metadata\f[R] causes template
614variables to be set.
615But unlike \f[C]--variable\f[R], \f[C]--metadata\f[R] affects the
616metadata of the underlying document (which is accessible from filters
617and may be printed in some output formats) and metadata values will be
618escaped when inserted into the template.
619.TP
620.B \f[C]--metadata-file=\f[R]\f[I]FILE\f[R]
621Read metadata from the supplied YAML (or JSON) file.
622This option can be used with every input format, but string scalars in
623the YAML file will always be parsed as Markdown.
624Generally, the input will be handled the same as in YAML metadata
625blocks.
626Metadata values specified inside the document, or by using \f[C]-M\f[R],
627overwrite values specified with this option.
628.TP
629.B \f[C]-p\f[R], \f[C]--preserve-tabs\f[R]
630Preserve tabs instead of converting them to spaces (the default).
631Note that this will only affect tabs in literal code spans and code
632blocks; tabs in regular text will be treated as spaces.
633.TP
634.B \f[C]--tab-stop=\f[R]\f[I]NUMBER\f[R]
635Specify the number of spaces per tab (default is 4).
636.TP
637.B \f[C]--track-changes=accept\f[R]|\f[C]reject\f[R]|\f[C]all\f[R]
638Specifies what to do with insertions, deletions, and comments produced
639by the MS Word \[dq]Track Changes\[dq] feature.
640\f[C]accept\f[R] (the default), inserts all insertions, and ignores all
641deletions.
642\f[C]reject\f[R] inserts all deletions and ignores insertions.
643Both \f[C]accept\f[R] and \f[C]reject\f[R] ignore comments.
644\f[C]all\f[R] puts in insertions, deletions, and comments, wrapped in
645spans with \f[C]insertion\f[R], \f[C]deletion\f[R],
646\f[C]comment-start\f[R], and \f[C]comment-end\f[R] classes,
647respectively.
648The author and time of change is included.
649\f[C]all\f[R] is useful for scripting: only accepting changes from a
650certain reviewer, say, or before a certain date.
651If a paragraph is inserted or deleted, \f[C]track-changes=all\f[R]
652produces a span with the class
653\f[C]paragraph-insertion\f[R]/\f[C]paragraph-deletion\f[R] before the
654affected paragraph break.
655This option only affects the docx reader.
656.TP
657.B \f[C]--extract-media=\f[R]\f[I]DIR\f[R]
658Extract images and other media contained in or linked from the source
659document to the path \f[I]DIR\f[R], creating it if necessary, and adjust
660the images references in the document so they point to the extracted
661files.
662If the source format is a binary container (docx, epub, or odt), the
663media is extracted from the container and the original filenames are
664used.
665Otherwise the media is read from the file system or downloaded, and new
666filenames are constructed based on SHA1 hashes of the contents.
667.TP
668.B \f[C]--abbreviations=\f[R]\f[I]FILE\f[R]
669Specifies a custom abbreviations file, with abbreviations one to a line.
670If this option is not specified, pandoc will read the data file
671\f[C]abbreviations\f[R] from the user data directory or fall back on a
672system default.
673To see the system default, use
674\f[C]pandoc --print-default-data-file=abbreviations\f[R].
675The only use pandoc makes of this list is in the Markdown reader.
676Strings ending in a period that are found in this list will be followed
677by a nonbreaking space, so that the period will not produce
678sentence-ending space in formats like LaTeX.
679.SS General writer options
680.TP
681.B \f[C]-s\f[R], \f[C]--standalone\f[R]
682Produce output with an appropriate header and footer (e.g.
683a standalone HTML, LaTeX, TEI, or RTF file, not a fragment).
684This option is set automatically for \f[C]pdf\f[R], \f[C]epub\f[R],
685\f[C]epub3\f[R], \f[C]fb2\f[R], \f[C]docx\f[R], and \f[C]odt\f[R]
686output.
687For \f[C]native\f[R] output, this option causes metadata to be included;
688otherwise, metadata is suppressed.
689.TP
690.B \f[C]--template=\f[R]\f[I]FILE\f[R]|\f[I]URL\f[R]
691Use the specified file as a custom template for the generated document.
692Implies \f[C]--standalone\f[R].
693See Templates, below, for a description of template syntax.
694If no extension is specified, an extension corresponding to the writer
695will be added, so that \f[C]--template=special\f[R] looks for
696\f[C]special.html\f[R] for HTML output.
697If the template is not found, pandoc will search for it in the
698\f[C]templates\f[R] subdirectory of the user data directory (see
699\f[C]--data-dir\f[R]).
700If this option is not used, a default template appropriate for the
701output format will be used (see \f[C]-D/--print-default-template\f[R]).
702.TP
703.B \f[C]-V\f[R] \f[I]KEY\f[R][\f[C]=\f[R]\f[I]VAL\f[R]], \f[C]--variable=\f[R]\f[I]KEY\f[R][\f[C]:\f[R]\f[I]VAL\f[R]]
704Set the template variable \f[I]KEY\f[R] to the value \f[I]VAL\f[R] when
705rendering the document in standalone mode.
706This is generally only useful when the \f[C]--template\f[R] option is
707used to specify a custom template, since pandoc automatically sets the
708variables used in the default templates.
709If no \f[I]VAL\f[R] is specified, the key will be given the value
710\f[C]true\f[R].
711.TP
712.B \f[C]-D\f[R] \f[I]FORMAT\f[R], \f[C]--print-default-template=\f[R]\f[I]FORMAT\f[R]
713Print the system default template for an output \f[I]FORMAT\f[R].
714(See \f[C]-t\f[R] for a list of possible \f[I]FORMAT\f[R]s.) Templates
715in the user data directory are ignored.
716This option may be used with \f[C]-o\f[R]/\f[C]--output\f[R] to redirect
717output to a file, but \f[C]-o\f[R]/\f[C]--output\f[R] must come before
718\f[C]--print-default-template\f[R] on the command line.
719.TP
720.B \f[C]--print-default-data-file=\f[R]\f[I]FILE\f[R]
721Print a system default data file.
722Files in the user data directory are ignored.
723This option may be used with \f[C]-o\f[R]/\f[C]--output\f[R] to redirect
724output to a file, but \f[C]-o\f[R]/\f[C]--output\f[R] must come before
725\f[C]--print-default-data-file\f[R] on the command line.
726.TP
727.B \f[C]--eol=crlf\f[R]|\f[C]lf\f[R]|\f[C]native\f[R]
728Manually specify line endings: \f[C]crlf\f[R] (Windows), \f[C]lf\f[R]
729(macOS/Linux/UNIX), or \f[C]native\f[R] (line endings appropriate to the
730OS on which pandoc is being run).
731The default is \f[C]native\f[R].
732.TP
733.B \f[C]--dpi\f[R]=\f[I]NUMBER\f[R]
734Specify the dpi (dots per inch) value for conversion from pixels to
735inch/centimeters and vice versa.
736The default is 96dpi.
737Technically, the correct term would be ppi (pixels per inch).
738.TP
739.B \f[C]--wrap=auto\f[R]|\f[C]none\f[R]|\f[C]preserve\f[R]
740Determine how text is wrapped in the output (the source code, not the
741rendered version).
742With \f[C]auto\f[R] (the default), pandoc will attempt to wrap lines to
743the column width specified by \f[C]--columns\f[R] (default 72).
744With \f[C]none\f[R], pandoc will not wrap lines at all.
745With \f[C]preserve\f[R], pandoc will attempt to preserve the wrapping
746from the source document (that is, where there are nonsemantic newlines
747in the source, there will be nonsemantic newlines in the output as
748well).
749Automatic wrapping does not currently work in HTML output.
750In \f[C]ipynb\f[R] output, this option affects wrapping of the contents
751of markdown cells.
752.TP
753.B \f[C]--columns=\f[R]\f[I]NUMBER\f[R]
754Specify length of lines in characters.
755This affects text wrapping in the generated source code (see
756\f[C]--wrap\f[R]).
757It also affects calculation of column widths for plain text tables (see
758Tables below).
759.TP
760.B \f[C]--toc\f[R], \f[C]--table-of-contents\f[R]
761Include an automatically generated table of contents (or, in the case of
762\f[C]latex\f[R], \f[C]context\f[R], \f[C]docx\f[R], \f[C]odt\f[R],
763\f[C]opendocument\f[R], \f[C]rst\f[R], or \f[C]ms\f[R], an instruction
764to create one) in the output document.
765This option has no effect unless \f[C]-s/--standalone\f[R] is used, and
766it has no effect on \f[C]man\f[R], \f[C]docbook4\f[R],
767\f[C]docbook5\f[R], or \f[C]jats\f[R] output.
768.TP
769.B \f[C]--toc-depth=\f[R]\f[I]NUMBER\f[R]
770Specify the number of section levels to include in the table of
771contents.
772The default is 3 (which means that level-1, 2, and 3 headings will be
773listed in the contents).
774.TP
775.B \f[C]--strip-comments\f[R]
776Strip out HTML comments in the Markdown or Textile source, rather than
777passing them on to Markdown, Textile or HTML output as raw HTML.
778This does not apply to HTML comments inside raw HTML blocks when the
779\f[C]markdown_in_html_blocks\f[R] extension is not set.
780.TP
781.B \f[C]--no-highlight\f[R]
782Disables syntax highlighting for code blocks and inlines, even when a
783language attribute is given.
784.TP
785.B \f[C]--highlight-style=\f[R]\f[I]STYLE\f[R]|\f[I]FILE\f[R]
786Specifies the coloring style to be used in highlighted source code.
787Options are \f[C]pygments\f[R] (the default), \f[C]kate\f[R],
788\f[C]monochrome\f[R], \f[C]breezeDark\f[R], \f[C]espresso\f[R],
789\f[C]zenburn\f[R], \f[C]haddock\f[R], and \f[C]tango\f[R].
790For more information on syntax highlighting in pandoc, see Syntax
791highlighting, below.
792See also \f[C]--list-highlight-styles\f[R].
793.RS
794.PP
795Instead of a \f[I]STYLE\f[R] name, a JSON file with extension
796\f[C].theme\f[R] may be supplied.
797This will be parsed as a KDE syntax highlighting theme and (if valid)
798used as the highlighting style.
799.PP
800To generate the JSON version of an existing style, use
801\f[C]--print-highlight-style\f[R].
802.RE
803.TP
804.B \f[C]--print-highlight-style=\f[R]\f[I]STYLE\f[R]|\f[I]FILE\f[R]
805Prints a JSON version of a highlighting style, which can be modified,
806saved with a \f[C].theme\f[R] extension, and used with
807\f[C]--highlight-style\f[R].
808This option may be used with \f[C]-o\f[R]/\f[C]--output\f[R] to redirect
809output to a file, but \f[C]-o\f[R]/\f[C]--output\f[R] must come before
810\f[C]--print-highlight-style\f[R] on the command line.
811.TP
812.B \f[C]--syntax-definition=\f[R]\f[I]FILE\f[R]
813Instructs pandoc to load a KDE XML syntax definition file, which will be
814used for syntax highlighting of appropriately marked code blocks.
815This can be used to add support for new languages or to use altered
816syntax definitions for existing languages.
817.TP
818.B \f[C]-H\f[R] \f[I]FILE\f[R], \f[C]--include-in-header=\f[R]\f[I]FILE\f[R]|\f[I]URL\f[R]
819Include contents of \f[I]FILE\f[R], verbatim, at the end of the header.
820This can be used, for example, to include special CSS or JavaScript in
821HTML documents.
822This option can be used repeatedly to include multiple files in the
823header.
824They will be included in the order specified.
825Implies \f[C]--standalone\f[R].
826.TP
827.B \f[C]-B\f[R] \f[I]FILE\f[R], \f[C]--include-before-body=\f[R]\f[I]FILE\f[R]|\f[I]URL\f[R]
828Include contents of \f[I]FILE\f[R], verbatim, at the beginning of the
829document body (e.g.
830after the \f[C]<body>\f[R] tag in HTML, or the
831\f[C]\[rs]begin{document}\f[R] command in LaTeX).
832This can be used to include navigation bars or banners in HTML
833documents.
834This option can be used repeatedly to include multiple files.
835They will be included in the order specified.
836Implies \f[C]--standalone\f[R].
837.TP
838.B \f[C]-A\f[R] \f[I]FILE\f[R], \f[C]--include-after-body=\f[R]\f[I]FILE\f[R]|\f[I]URL\f[R]
839Include contents of \f[I]FILE\f[R], verbatim, at the end of the document
840body (before the \f[C]</body>\f[R] tag in HTML, or the
841\f[C]\[rs]end{document}\f[R] command in LaTeX).
842This option can be used repeatedly to include multiple files.
843They will be included in the order specified.
844Implies \f[C]--standalone\f[R].
845.TP
846.B \f[C]--resource-path=\f[R]\f[I]SEARCHPATH\f[R]
847List of paths to search for images and other resources.
848The paths should be separated by \f[C]:\f[R] on Linux, UNIX, and macOS
849systems, and by \f[C];\f[R] on Windows.
850If \f[C]--resource-path\f[R] is not specified, the default resource path
851is the working directory.
852Note that, if \f[C]--resource-path\f[R] is specified, the working
853directory must be explicitly listed or it will not be searched.
854For example: \f[C]--resource-path=.:test\f[R] will search the working
855directory and the \f[C]test\f[R] subdirectory, in that order.
856.RS
857.PP
858\f[C]--resource-path\f[R] only has an effect if (a) the output format
859embeds images (for example, \f[C]docx\f[R], \f[C]pdf\f[R], or
860\f[C]html\f[R] with \f[C]--self-contained\f[R]) or (b) it is used
861together with \f[C]--extract-media\f[R].
862.RE
863.TP
864.B \f[C]--request-header=\f[R]\f[I]NAME\f[R]\f[C]:\f[R]\f[I]VAL\f[R]
865Set the request header \f[I]NAME\f[R] to the value \f[I]VAL\f[R] when
866making HTTP requests (for example, when a URL is given on the command
867line, or when resources used in a document must be downloaded).
868If you\[aq]re behind a proxy, you also need to set the environment
869variable \f[C]http_proxy\f[R] to \f[C]http://...\f[R].
870.SS Options affecting specific writers
871.TP
872.B \f[C]--self-contained\f[R]
873Produce a standalone HTML file with no external dependencies, using
874\f[C]data:\f[R] URIs to incorporate the contents of linked scripts,
875stylesheets, images, and videos.
876Implies \f[C]--standalone\f[R].
877The resulting file should be \[dq]self-contained,\[dq] in the sense that
878it needs no external files and no net access to be displayed properly by
879a browser.
880This option works only with HTML output formats, including
881\f[C]html4\f[R], \f[C]html5\f[R], \f[C]html+lhs\f[R],
882\f[C]html5+lhs\f[R], \f[C]s5\f[R], \f[C]slidy\f[R], \f[C]slideous\f[R],
883\f[C]dzslides\f[R], and \f[C]revealjs\f[R].
884Scripts, images, and stylesheets at absolute URLs will be downloaded;
885those at relative URLs will be sought relative to the working directory
886(if the first source file is local) or relative to the base URL (if the
887first source file is remote).
888Elements with the attribute \f[C]data-external=\[dq]1\[dq]\f[R] will be
889left alone; the documents they link to will not be incorporated in the
890document.
891Limitation: resources that are loaded dynamically through JavaScript
892cannot be incorporated; as a result, \f[C]--self-contained\f[R] does not
893work with \f[C]--mathjax\f[R], and some advanced features (e.g.
894zoom or speaker notes) may not work in an offline
895\[dq]self-contained\[dq] \f[C]reveal.js\f[R] slide show.
896.TP
897.B \f[C]--html-q-tags\f[R]
898Use \f[C]<q>\f[R] tags for quotes in HTML.
899.TP
900.B \f[C]--ascii\f[R]
901Use only ASCII characters in output.
902Currently supported for XML and HTML formats (which use entities instead
903of UTF-8 when this option is selected), CommonMark, gfm, and Markdown
904(which use entities), roff ms (which use hexadecimal escapes), and to a
905limited degree LaTeX (which uses standard commands for accented
906characters when possible).
907roff man output uses ASCII by default.
908.TP
909.B \f[C]--reference-links\f[R]
910Use reference-style links, rather than inline links, in writing Markdown
911or reStructuredText.
912By default inline links are used.
913The placement of link references is affected by the
914\f[C]--reference-location\f[R] option.
915.TP
916.B \f[C]--reference-location = block\f[R]|\f[C]section\f[R]|\f[C]document\f[R]
917Specify whether footnotes (and references, if \f[C]reference-links\f[R]
918is set) are placed at the end of the current (top-level) block, the
919current section, or the document.
920The default is \f[C]document\f[R].
921Currently only affects the markdown writer.
922.TP
923.B \f[C]--atx-headers\f[R]
924Use ATX-style headings in Markdown output.
925The default is to use setext-style headings for levels 1 to 2, and then
926ATX headings.
927(Note: for \f[C]gfm\f[R] output, ATX headings are always used.) This
928option also affects markdown cells in \f[C]ipynb\f[R] output.
929.TP
930.B \f[C]--top-level-division=[default|section|chapter|part]\f[R]
931Treat top-level headings as the given division type in LaTeX, ConTeXt,
932DocBook, and TEI output.
933The hierarchy order is part, chapter, then section; all headings are
934shifted such that the top-level heading becomes the specified type.
935The default behavior is to determine the best division type via
936heuristics: unless other conditions apply, \f[C]section\f[R] is chosen.
937When the LaTeX document class is set to \f[C]report\f[R],
938\f[C]book\f[R], or \f[C]memoir\f[R] (unless the \f[C]article\f[R] option
939is specified), \f[C]chapter\f[R] is implied as the setting for this
940option.
941If \f[C]beamer\f[R] is the output format, specifying either
942\f[C]chapter\f[R] or \f[C]part\f[R] will cause top-level headings to
943become \f[C]\[rs]part{..}\f[R], while second-level headings remain as
944their default type.
945.TP
946.B \f[C]-N\f[R], \f[C]--number-sections\f[R]
947Number section headings in LaTeX, ConTeXt, HTML, or EPUB output.
948By default, sections are not numbered.
949Sections with class \f[C]unnumbered\f[R] will never be numbered, even if
950\f[C]--number-sections\f[R] is specified.
951.TP
952.B \f[C]--number-offset=\f[R]\f[I]NUMBER\f[R][\f[C],\f[R]\f[I]NUMBER\f[R]\f[C],\f[R]\f[I]...\f[R]]
953Offset for section headings in HTML output (ignored in other output
954formats).
955The first number is added to the section number for top-level headings,
956the second for second-level headings, and so on.
957So, for example, if you want the first top-level heading in your
958document to be numbered \[dq]6\[dq], specify
959\f[C]--number-offset=5\f[R].
960If your document starts with a level-2 heading which you want to be
961numbered \[dq]1.5\[dq], specify \f[C]--number-offset=1,4\f[R].
962Offsets are 0 by default.
963Implies \f[C]--number-sections\f[R].
964.TP
965.B \f[C]--listings\f[R]
966Use the \f[C]listings\f[R] package for LaTeX code blocks.
967The package does not support multi-byte encoding for source code.
968To handle UTF-8 you would need to use a custom template.
969This issue is fully documented here: Encoding issue with the listings
970package.
971.TP
972.B \f[C]-i\f[R], \f[C]--incremental\f[R]
973Make list items in slide shows display incrementally (one by one).
974The default is for lists to be displayed all at once.
975.TP
976.B \f[C]--slide-level=\f[R]\f[I]NUMBER\f[R]
977Specifies that headings with the specified level create slides (for
978\f[C]beamer\f[R], \f[C]s5\f[R], \f[C]slidy\f[R], \f[C]slideous\f[R],
979\f[C]dzslides\f[R]).
980Headings above this level in the hierarchy are used to divide the slide
981show into sections; headings below this level create subheads within a
982slide.
983Note that content that is not contained under slide-level headings will
984not appear in the slide show.
985The default is to set the slide level based on the contents of the
986document; see Structuring the slide show.
987.TP
988.B \f[C]--section-divs\f[R]
989Wrap sections in \f[C]<section>\f[R] tags (or \f[C]<div>\f[R] tags for
990\f[C]html4\f[R]), and attach identifiers to the enclosing
991\f[C]<section>\f[R] (or \f[C]<div>\f[R]) rather than the heading itself.
992See Heading identifiers, below.
993.TP
994.B \f[C]--email-obfuscation=none\f[R]|\f[C]javascript\f[R]|\f[C]references\f[R]
995Specify a method for obfuscating \f[C]mailto:\f[R] links in HTML
996documents.
997\f[C]none\f[R] leaves \f[C]mailto:\f[R] links as they are.
998\f[C]javascript\f[R] obfuscates them using JavaScript.
999\f[C]references\f[R] obfuscates them by printing their letters as
1000decimal or hexadecimal character references.
1001The default is \f[C]none\f[R].
1002.TP
1003.B \f[C]--id-prefix=\f[R]\f[I]STRING\f[R]
1004Specify a prefix to be added to all identifiers and internal links in
1005HTML and DocBook output, and to footnote numbers in Markdown and Haddock
1006output.
1007This is useful for preventing duplicate identifiers when generating
1008fragments to be included in other pages.
1009.TP
1010.B \f[C]-T\f[R] \f[I]STRING\f[R], \f[C]--title-prefix=\f[R]\f[I]STRING\f[R]
1011Specify \f[I]STRING\f[R] as a prefix at the beginning of the title that
1012appears in the HTML header (but not in the title as it appears at the
1013beginning of the HTML body).
1014Implies \f[C]--standalone\f[R].
1015.TP
1016.B \f[C]-c\f[R] \f[I]URL\f[R], \f[C]--css=\f[R]\f[I]URL\f[R]
1017Link to a CSS style sheet.
1018This option can be used repeatedly to include multiple files.
1019They will be included in the order specified.
1020.RS
1021.PP
1022A stylesheet is required for generating EPUB.
1023If none is provided using this option (or the \f[C]css\f[R] or
1024\f[C]stylesheet\f[R] metadata fields), pandoc will look for a file
1025\f[C]epub.css\f[R] in the user data directory (see
1026\f[C]--data-dir\f[R]).
1027If it is not found there, sensible defaults will be used.
1028.RE
1029.TP
1030.B \f[C]--reference-doc=\f[R]\f[I]FILE\f[R]
1031Use the specified file as a style reference in producing a docx or ODT
1032file.
1033.RS
1034.TP
1035.B Docx
1036For best results, the reference docx should be a modified version of a
1037docx file produced using pandoc.
1038The contents of the reference docx are ignored, but its stylesheets and
1039document properties (including margins, page size, header, and footer)
1040are used in the new docx.
1041If no reference docx is specified on the command line, pandoc will look
1042for a file \f[C]reference.docx\f[R] in the user data directory (see
1043\f[C]--data-dir\f[R]).
1044If this is not found either, sensible defaults will be used.
1045.RS
1046.PP
1047To produce a custom \f[C]reference.docx\f[R], first get a copy of the
1048default \f[C]reference.docx\f[R]:
1049\f[C]pandoc -o custom-reference.docx --print-default-data-file reference.docx\f[R].
1050Then open \f[C]custom-reference.docx\f[R] in Word, modify the styles as
1051you wish, and save the file.
1052For best results, do not make changes to this file other than modifying
1053the styles used by pandoc:
1054.PP
1055Paragraph styles:
1056.IP \[bu] 2
1057Normal
1058.IP \[bu] 2
1059Body Text
1060.IP \[bu] 2
1061First Paragraph
1062.IP \[bu] 2
1063Compact
1064.IP \[bu] 2
1065Title
1066.IP \[bu] 2
1067Subtitle
1068.IP \[bu] 2
1069Author
1070.IP \[bu] 2
1071Date
1072.IP \[bu] 2
1073Abstract
1074.IP \[bu] 2
1075Bibliography
1076.IP \[bu] 2
1077Heading 1
1078.IP \[bu] 2
1079Heading 2
1080.IP \[bu] 2
1081Heading 3
1082.IP \[bu] 2
1083Heading 4
1084.IP \[bu] 2
1085Heading 5
1086.IP \[bu] 2
1087Heading 6
1088.IP \[bu] 2
1089Heading 7
1090.IP \[bu] 2
1091Heading 8
1092.IP \[bu] 2
1093Heading 9
1094.IP \[bu] 2
1095Block Text
1096.IP \[bu] 2
1097Footnote Text
1098.IP \[bu] 2
1099Definition Term
1100.IP \[bu] 2
1101Definition
1102.IP \[bu] 2
1103Caption
1104.IP \[bu] 2
1105Table Caption
1106.IP \[bu] 2
1107Image Caption
1108.IP \[bu] 2
1109Figure
1110.IP \[bu] 2
1111Captioned Figure
1112.IP \[bu] 2
1113TOC Heading
1114.PP
1115Character styles:
1116.IP \[bu] 2
1117Default Paragraph Font
1118.IP \[bu] 2
1119Body Text Char
1120.IP \[bu] 2
1121Verbatim Char
1122.IP \[bu] 2
1123Footnote Reference
1124.IP \[bu] 2
1125Hyperlink
1126.PP
1127Table style:
1128.IP \[bu] 2
1129Table
1130.RE
1131.TP
1132.B ODT
1133For best results, the reference ODT should be a modified version of an
1134ODT produced using pandoc.
1135The contents of the reference ODT are ignored, but its stylesheets are
1136used in the new ODT.
1137If no reference ODT is specified on the command line, pandoc will look
1138for a file \f[C]reference.odt\f[R] in the user data directory (see
1139\f[C]--data-dir\f[R]).
1140If this is not found either, sensible defaults will be used.
1141.RS
1142.PP
1143To produce a custom \f[C]reference.odt\f[R], first get a copy of the
1144default \f[C]reference.odt\f[R]:
1145\f[C]pandoc -o custom-reference.odt --print-default-data-file reference.odt\f[R].
1146Then open \f[C]custom-reference.odt\f[R] in LibreOffice, modify the
1147styles as you wish, and save the file.
1148.RE
1149.TP
1150.B PowerPoint
1151Templates included with Microsoft PowerPoint 2013 (either with
1152\f[C].pptx\f[R] or \f[C].potx\f[R] extension) are known to work, as are
1153most templates derived from these.
1154.RS
1155.PP
1156The specific requirement is that the template should begin with the
1157following first four layouts:
1158.IP "1." 3
1159Title Slide
1160.IP "2." 3
1161Title and Content
1162.IP "3." 3
1163Section Header
1164.IP "4." 3
1165Two Content
1166.PP
1167All templates included with a recent version of MS PowerPoint will fit
1168these criteria.
1169(You can click on \f[C]Layout\f[R] under the \f[C]Home\f[R] menu to
1170check.)
1171.PP
1172You can also modify the default \f[C]reference.pptx\f[R]: first run
1173\f[C]pandoc -o custom-reference.pptx --print-default-data-file reference.pptx\f[R],
1174and then modify \f[C]custom-reference.pptx\f[R] in MS PowerPoint (pandoc
1175will use the first four layout slides, as mentioned above).
1176.RE
1177.RE
1178.TP
1179.B \f[C]--epub-cover-image=\f[R]\f[I]FILE\f[R]
1180Use the specified image as the EPUB cover.
1181It is recommended that the image be less than 1000px in width and
1182height.
1183Note that in a Markdown source document you can also specify
1184\f[C]cover-image\f[R] in a YAML metadata block (see EPUB Metadata,
1185below).
1186.TP
1187.B \f[C]--epub-metadata=\f[R]\f[I]FILE\f[R]
1188Look in the specified XML file for metadata for the EPUB.
1189The file should contain a series of Dublin Core elements.
1190For example:
1191.RS
1192.IP
1193.nf
1194\f[C]
1195 <dc:rights>Creative Commons</dc:rights>
1196 <dc:language>es-AR</dc:language>
1197\f[R]
1198.fi
1199.PP
1200By default, pandoc will include the following metadata elements:
1201\f[C]<dc:title>\f[R] (from the document title), \f[C]<dc:creator>\f[R]
1202(from the document authors), \f[C]<dc:date>\f[R] (from the document
1203date, which should be in ISO 8601 format), \f[C]<dc:language>\f[R] (from
1204the \f[C]lang\f[R] variable, or, if is not set, the locale), and
1205\f[C]<dc:identifier id=\[dq]BookId\[dq]>\f[R] (a randomly generated
1206UUID).
1207Any of these may be overridden by elements in the metadata file.
1208.PP
1209Note: if the source document is Markdown, a YAML metadata block in the
1210document can be used instead.
1211See below under EPUB Metadata.
1212.RE
1213.TP
1214.B \f[C]--epub-embed-font=\f[R]\f[I]FILE\f[R]
1215Embed the specified font in the EPUB.
1216This option can be repeated to embed multiple fonts.
1217Wildcards can also be used: for example, \f[C]DejaVuSans-*.ttf\f[R].
1218However, if you use wildcards on the command line, be sure to escape
1219them or put the whole filename in single quotes, to prevent them from
1220being interpreted by the shell.
1221To use the embedded fonts, you will need to add declarations like the
1222following to your CSS (see \f[C]--css\f[R]):
1223.RS
1224.IP
1225.nf
1226\f[C]
1227\[at]font-face {
1228font-family: DejaVuSans;
1229font-style: normal;
1230font-weight: normal;
1231src:url(\[dq]DejaVuSans-Regular.ttf\[dq]);
1233\[at]font-face {
1234font-family: DejaVuSans;
1235font-style: normal;
1236font-weight: bold;
1237src:url(\[dq]DejaVuSans-Bold.ttf\[dq]);
1239\[at]font-face {
1240font-family: DejaVuSans;
1241font-style: italic;
1242font-weight: normal;
1243src:url(\[dq]DejaVuSans-Oblique.ttf\[dq]);
1245\[at]font-face {
1246font-family: DejaVuSans;
1247font-style: italic;
1248font-weight: bold;
1249src:url(\[dq]DejaVuSans-BoldOblique.ttf\[dq]);
1251body { font-family: \[dq]DejaVuSans\[dq]; }
1252\f[R]
1253.fi
1254.RE
1255.TP
1256.B \f[C]--epub-chapter-level=\f[R]\f[I]NUMBER\f[R]
1257Specify the heading level at which to split the EPUB into separate
1258\[dq]chapter\[dq] files.
1259The default is to split into chapters at level-1 headings.
1260This option only affects the internal composition of the EPUB, not the
1261way chapters and sections are displayed to users.
1262Some readers may be slow if the chapter files are too large, so for
1263large documents with few level-1 headings, one might want to use a
1264chapter level of 2 or 3.
1265.TP
1266.B \f[C]--epub-subdirectory=\f[R]\f[I]DIRNAME\f[R]
1267Specify the subdirectory in the OCF container that is to hold the
1268EPUB-specific contents.
1269The default is \f[C]EPUB\f[R].
1270To put the EPUB contents in the top level, use an empty string.
1271.TP
1272.B \f[C]--ipynb-output=all|none|best\f[R]
1273Determines how ipynb output cells are treated.
1274\f[C]all\f[R] means that all of the data formats included in the
1275original are preserved.
1276\f[C]none\f[R] means that the contents of data cells are omitted.
1277\f[C]best\f[R] causes pandoc to try to pick the richest data block in
1278each output cell that is compatible with the output format.
1279The default is \f[C]best\f[R].
1280.TP
1281.B \f[C]--pdf-engine=\f[R]\f[I]PROGRAM\f[R]
1282Use the specified engine when producing PDF output.
1283Valid values are \f[C]pdflatex\f[R], \f[C]lualatex\f[R],
1284\f[C]xelatex\f[R], \f[C]latexmk\f[R], \f[C]tectonic\f[R],
1285\f[C]wkhtmltopdf\f[R], \f[C]weasyprint\f[R], \f[C]prince\f[R],
1286\f[C]context\f[R], and \f[C]pdfroff\f[R].
1287The default is \f[C]pdflatex\f[R].
1288If the engine is not in your PATH, the full path of the engine may be
1289specified here.
1290.TP
1291.B \f[C]--pdf-engine-opt=\f[R]\f[I]STRING\f[R]
1292Use the given string as a command-line argument to the
1293\f[C]pdf-engine\f[R].
1294For example, to use a persistent directory \f[C]foo\f[R] for
1295\f[C]latexmk\f[R]\[aq]s auxiliary files, use
1296\f[C]--pdf-engine-opt=-outdir=foo\f[R].
1297Note that no check for duplicate options is done.
1298.SS Citation rendering
1299.TP
1300.B \f[C]--bibliography=\f[R]\f[I]FILE\f[R]
1301Set the \f[C]bibliography\f[R] field in the document\[aq]s metadata to
1302\f[I]FILE\f[R], overriding any value set in the metadata, and process
1303citations using \f[C]pandoc-citeproc\f[R].
1304(This is equivalent to
1305\f[C]--metadata bibliography=FILE --filter pandoc-citeproc\f[R].) If
1306\f[C]--natbib\f[R] or \f[C]--biblatex\f[R] is also supplied,
1307\f[C]pandoc-citeproc\f[R] is not used, making this equivalent to
1308\f[C]--metadata bibliography=FILE\f[R].
1309If you supply this argument multiple times, each \f[I]FILE\f[R] will be
1310added to bibliography.
1311.TP
1312.B \f[C]--csl=\f[R]\f[I]FILE\f[R]
1313Set the \f[C]csl\f[R] field in the document\[aq]s metadata to
1314\f[I]FILE\f[R], overriding any value set in the metadata.
1315(This is equivalent to \f[C]--metadata csl=FILE\f[R].) This option is
1316only relevant with \f[C]pandoc-citeproc\f[R].
1317.TP
1318.B \f[C]--citation-abbreviations=\f[R]\f[I]FILE\f[R]
1319Set the \f[C]citation-abbreviations\f[R] field in the document\[aq]s
1320metadata to \f[I]FILE\f[R], overriding any value set in the metadata.
1321(This is equivalent to
1322\f[C]--metadata citation-abbreviations=FILE\f[R].) This option is only
1323relevant with \f[C]pandoc-citeproc\f[R].
1324.TP
1325.B \f[C]--natbib\f[R]
1326Use \f[C]natbib\f[R] for citations in LaTeX output.
1327This option is not for use with the \f[C]pandoc-citeproc\f[R] filter or
1328with PDF output.
1329It is intended for use in producing a LaTeX file that can be processed
1330with \f[C]bibtex\f[R].
1331.TP
1332.B \f[C]--biblatex\f[R]
1333Use \f[C]biblatex\f[R] for citations in LaTeX output.
1334This option is not for use with the \f[C]pandoc-citeproc\f[R] filter or
1335with PDF output.
1336It is intended for use in producing a LaTeX file that can be processed
1337with \f[C]bibtex\f[R] or \f[C]biber\f[R].
1338.SS Math rendering in HTML
1339.PP
1340The default is to render TeX math as far as possible using Unicode
1341characters.
1342Formulas are put inside a \f[C]span\f[R] with
1343\f[C]class=\[dq]math\[dq]\f[R], so that they may be styled differently
1344from the surrounding text if needed.
1345However, this gives acceptable results only for basic math, usually you
1346will want to use \f[C]--mathjax\f[R] or another of the following
1347options.
1348.TP
1349.B \f[C]--mathjax\f[R][\f[C]=\f[R]\f[I]URL\f[R]]
1350Use MathJax to display embedded TeX math in HTML output.
1351TeX math will be put between \f[C]\[rs](...\[rs])\f[R] (for inline math)
1352or \f[C]\[rs][...\[rs]]\f[R] (for display math) and wrapped in
1353\f[C]<span>\f[R] tags with class \f[C]math\f[R].
1354Then the MathJax JavaScript will render it.
1355The \f[I]URL\f[R] should point to the \f[C]MathJax.js\f[R] load script.
1356If a \f[I]URL\f[R] is not provided, a link to the Cloudflare CDN will be
1357inserted.
1358.TP
1359.B \f[C]--mathml\f[R]
1360Convert TeX math to MathML (in \f[C]epub3\f[R], \f[C]docbook4\f[R],
1361\f[C]docbook5\f[R], \f[C]jats\f[R], \f[C]html4\f[R] and
1362\f[C]html5\f[R]).
1363This is the default in \f[C]odt\f[R] output.
1364Note that currently only Firefox and Safari (and select e-book readers)
1365natively support MathML.
1366.TP
1367.B \f[C]--webtex\f[R][\f[C]=\f[R]\f[I]URL\f[R]]
1368Convert TeX formulas to \f[C]<img>\f[R] tags that link to an external
1369script that converts formulas to images.
1370The formula will be URL-encoded and concatenated with the URL provided.
1371For SVG images you can for example use
1372\f[C]--webtex https://latex.codecogs.com/svg.latex?\f[R].
1373If no URL is specified, the CodeCogs URL generating PNGs will be used
1374(\f[C]https://latex.codecogs.com/png.latex?\f[R]).
1375Note: the \f[C]--webtex\f[R] option will affect Markdown output as well
1376as HTML, which is useful if you\[aq]re targeting a version of Markdown
1377without native math support.
1378.TP
1379.B \f[C]--katex\f[R][\f[C]=\f[R]\f[I]URL\f[R]]
1380Use KaTeX to display embedded TeX math in HTML output.
1381The \f[I]URL\f[R] is the base URL for the KaTeX library.
1382That directory should contain a \f[C]katex.min.js\f[R] and a
1383\f[C]katex.min.css\f[R] file.
1384If a \f[I]URL\f[R] is not provided, a link to the KaTeX CDN will be
1385inserted.
1386.TP
1387.B \f[C]--gladtex\f[R]
1388Enclose TeX math in \f[C]<eq>\f[R] tags in HTML output.
1389The resulting HTML can then be processed by GladTeX to produce images of
1390the typeset formulas and an HTML file with links to these images.
1391So, the procedure is:
1392.RS
1393.IP
1394.nf
1395\f[C]
1396pandoc -s --gladtex input.md -o myfile.htex
1397gladtex -d myfile-images myfile.htex
1398# produces myfile.html and images in myfile-images
1399\f[R]
1400.fi
1401.RE
1402.SS Options for wrapper scripts
1403.TP
1404.B \f[C]--dump-args\f[R]
1405Print information about command-line arguments to \f[I]stdout\f[R], then
1406exit.
1407This option is intended primarily for use in wrapper scripts.
1408The first line of output contains the name of the output file specified
1409with the \f[C]-o\f[R] option, or \f[C]-\f[R] (for \f[I]stdout\f[R]) if
1410no output file was specified.
1411The remaining lines contain the command-line arguments, one per line, in
1412the order they appear.
1413These do not include regular pandoc options and their arguments, but do
1414include any options appearing after a \f[C]--\f[R] separator at the end
1415of the line.
1416.TP
1417.B \f[C]--ignore-args\f[R]
1418Ignore command-line arguments (for use in wrapper scripts).
1419Regular pandoc options are not ignored.
1420Thus, for example,
1421.RS
1422.IP
1423.nf
1424\f[C]
1425pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1
1426\f[R]
1427.fi
1428.PP
1429is equivalent to
1430.IP
1431.nf
1432\f[C]
1433pandoc -o foo.html -s
1434\f[R]
1435.fi
1436.RE
1437.SH TEMPLATES
1438.PP
1439When the \f[C]-s/--standalone\f[R] option is used, pandoc uses a
1440template to add header and footer material that is needed for a
1441self-standing document.
1442To see the default template that is used, just type
1443.IP
1444.nf
1445\f[C]
1446pandoc -D *FORMAT*
1447\f[R]
1448.fi
1449.PP
1450where \f[I]FORMAT\f[R] is the name of the output format.
1451A custom template can be specified using the \f[C]--template\f[R]
1452option.
1453You can also override the system default templates for a given output
1454format \f[I]FORMAT\f[R] by putting a file
1455\f[C]templates/default.*FORMAT*\f[R] in the user data directory (see
1456\f[C]--data-dir\f[R], above).
1457\f[I]Exceptions:\f[R]
1458.IP \[bu] 2
1459For \f[C]odt\f[R] output, customize the \f[C]default.opendocument\f[R]
1460template.
1461.IP \[bu] 2
1462For \f[C]pdf\f[R] output, customize the \f[C]default.latex\f[R] template
1463(or the \f[C]default.context\f[R] template, if you use
1464\f[C]-t context\f[R], or the \f[C]default.ms\f[R] template, if you use
1465\f[C]-t ms\f[R], or the \f[C]default.html\f[R] template, if you use
1466\f[C]-t html\f[R]).
1467.IP \[bu] 2
1468\f[C]docx\f[R] and \f[C]pptx\f[R] have no template (however, you can use
1469\f[C]--reference-doc\f[R] to customize the output).
1470.PP
1471Templates contain \f[I]variables\f[R], which allow for the inclusion of
1472arbitrary information at any point in the file.
1473They may be set at the command line using the \f[C]-V/--variable\f[R]
1474option.
1475If a variable is not set, pandoc will look for the key in the
1476document\[aq]s metadata \[en] which can be set using either YAML
1477metadata blocks or with the \f[C]-M/--metadata\f[R] option.
1478.SS Metadata variables
1479.TP
1480.B \f[C]title\f[R], \f[C]author\f[R], \f[C]date\f[R]
1481allow identification of basic aspects of the document.
1482Included in PDF metadata through LaTeX and ConTeXt.
1483These can be set through a pandoc title block, which allows for multiple
1484authors, or through a YAML metadata block:
1485.RS
1486.IP
1487.nf
1488\f[C]
1489---
1490author:
1491- Aristotle
1492- Peter Abelard
1493\&...
1494\f[R]
1495.fi
1496.RE
1497.TP
1498.B \f[C]subtitle\f[R]
1499document subtitle, included in HTML, EPUB, LaTeX, ConTeXt, and docx
1500documents
1501.TP
1502.B \f[C]abstract\f[R]
1503document summary, included in LaTeX, ConTeXt, AsciiDoc, and docx
1504documents
1505.TP
1506.B \f[C]keywords\f[R]
1507list of keywords to be included in HTML, PDF, ODT, pptx, docx and
1508AsciiDoc metadata; repeat as for \f[C]author\f[R], above
1509.TP
1510.B \f[C]subject\f[R]
1511document subject, included in ODT, PDF, docx and pptx metadata
1512.TP
1513.B \f[C]description\f[R]
1514document description, included in ODT, docx and pptx metadata.
1515Some applications show this as \f[C]Comments\f[R] metadata.
1516.TP
1517.B \f[C]category\f[R]
1518document category, included in docx and pptx metadata
1519.PP
1520Additionally, any root-level string metadata, not included in ODT, docx
1521or pptx metadata is added as a \f[I]custom property\f[R].
1522The following YAML metadata block for instance:
1523.IP
1524.nf
1525\f[C]
1526---
1527title: \[aq]This is the title\[aq]
1528subtitle: \[dq]This is the subtitle\[dq]
1529author:
1530- Author One
1531- Author Two
1532description: |
1533 This is a long
1534 description.
1536 It consists of two paragraphs
1537\&...
1538\f[R]
1539.fi
1540.PP
1541will include \f[C]title\f[R], \f[C]author\f[R] and \f[C]description\f[R]
1542as standard document properties and \f[C]subtitle\f[R] as a custom
1543property when converting to docx, ODT or pptx.
1544.SS Language variables
1545.TP
1546.B \f[C]lang\f[R]
1547identifies the main language of the document using IETF language tags
1548(following the BCP 47 standard), such as \f[C]en\f[R] or
1549\f[C]en-GB\f[R].
1550The Language subtag lookup tool can look up or verify these tags.
1551This affects most formats, and controls hyphenation in PDF output when
1552using LaTeX (through \f[C]babel\f[R] and \f[C]polyglossia\f[R]) or
1553ConTeXt.
1554.RS
1555.PP
1556Use native pandoc Divs and Spans with the \f[C]lang\f[R] attribute to
1557switch the language:
1558.IP
1559.nf
1560\f[C]
1561---
1562lang: en-GB
1563\&...
1565Text in the main document language (British English).
1567::: {lang=fr-CA}
1568> Cette citation est \['e]crite en fran\[,c]ais canadien.
1569:::
1571More text in English. [\[aq]Zitat auf Deutsch.\[aq]]{lang=de}
1572\f[R]
1573.fi
1574.RE
1575.TP
1576.B \f[C]dir\f[R]
1577the base script direction, either \f[C]rtl\f[R] (right-to-left) or
1578\f[C]ltr\f[R] (left-to-right).
1579.RS
1580.PP
1581For bidirectional documents, native pandoc \f[C]span\f[R]s and
1582\f[C]div\f[R]s with the \f[C]dir\f[R] attribute (value \f[C]rtl\f[R] or
1583\f[C]ltr\f[R]) can be used to override the base direction in some output
1584formats.
1585This may not always be necessary if the final renderer (e.g.
1586the browser, when generating HTML) supports the Unicode Bidirectional
1587Algorithm.
1588.PP
1589When using LaTeX for bidirectional documents, only the \f[C]xelatex\f[R]
1590engine is fully supported (use \f[C]--pdf-engine=xelatex\f[R]).
1591.RE
1592.SS Variables for HTML slides
1593.PP
1594These affect HTML output when producing slide shows with pandoc.
1595All reveal.js configuration options are available as variables.
1596.TP
1597.B \f[C]revealjs-url\f[R]
1598base URL for reveal.js documents (defaults to \f[C]reveal.js\f[R])
1599.TP
1600.B \f[C]s5-url\f[R]
1601base URL for S5 documents (defaults to \f[C]s5/default\f[R])
1602.TP
1603.B \f[C]slidy-url\f[R]
1604base URL for Slidy documents (defaults to
1605\f[C]https://www.w3.org/Talks/Tools/Slidy2\f[R])
1606.TP
1607.B \f[C]slideous-url\f[R]
1608base URL for Slideous documents (defaults to \f[C]slideous\f[R])
1609.SS Variables for Beamer slides
1610.PP
1611These variables change the appearance of PDF slides using
1612\f[C]beamer\f[R].
1613.TP
1614.B \f[C]aspectratio\f[R]
1615slide aspect ratio (\f[C]43\f[R] for 4:3 [default], \f[C]169\f[R] for
161616:9, \f[C]1610\f[R] for 16:10, \f[C]149\f[R] for 14:9, \f[C]141\f[R]
1617for 1.41:1, \f[C]54\f[R] for 5:4, \f[C]32\f[R] for 3:2)
1618.TP
1619.B \f[C]beamerarticle\f[R]
1620produce an article from Beamer slides
1621.TP
1622.B \f[C]beameroption\f[R]
1623add extra beamer option with \f[C]\[rs]setbeameroption{}\f[R]
1624.TP
1625.B \f[C]institute\f[R]
1626author affiliations: can be a list when there are multiple authors
1627.TP
1628.B \f[C]logo\f[R]
1629logo image for slides
1630.TP
1631.B \f[C]navigation\f[R]
1632controls navigation symbols (default is \f[C]empty\f[R] for no
1633navigation symbols; other valid values are \f[C]frame\f[R],
1634\f[C]vertical\f[R], and \f[C]horizontal\f[R])
1635.TP
1636.B \f[C]section-titles\f[R]
1637enables \[dq]title pages\[dq] for new sections (default is true)
1638.TP
1639.B \f[C]theme\f[R], \f[C]colortheme\f[R], \f[C]fonttheme\f[R], \f[C]innertheme\f[R], \f[C]outertheme\f[R]
1640beamer themes:
1641.TP
1642.B \f[C]themeoptions\f[R]
1643options for LaTeX beamer themes (a list).
1644.TP
1645.B \f[C]titlegraphic\f[R]
1646image for title slide
1647.SS Variables for LaTeX
1648.PP
1649Pandoc uses these variables when creating a PDF with a LaTeX engine.
1650.SS Layout
1651.TP
1652.B \f[C]block-headings\f[R]
1653make \f[C]\[rs]paragraph\f[R] and \f[C]\[rs]subparagraph\f[R] (fourth-
1654and fifth-level headings, or fifth- and sixth-level with book classes)
1655free-standing rather than run-in; requires further formatting to
1656distinguish from \f[C]\[rs]subsubsection\f[R] (third- or fourth-level
1657headings).
1658Instead of using this option, KOMA-Script can adjust headings more
1659extensively:
1660.RS
1661.IP
1662.nf
1663\f[C]
1664---
1665documentclass: scrartcl
1666header-includes: |
1667 \[rs]RedeclareSectionCommand[
1668 beforeskip=-10pt plus -2pt minus -1pt,
1669 afterskip=1sp plus -1sp minus 1sp,
1670 font=\[rs]normalfont\[rs]itshape]{paragraph}
1671 \[rs]RedeclareSectionCommand[
1672 beforeskip=-10pt plus -2pt minus -1pt,
1673 afterskip=1sp plus -1sp minus 1sp,
1674 font=\[rs]normalfont\[rs]scshape,
1675 indent=0pt]{subparagraph}
1676\&...
1677\f[R]
1678.fi
1679.RE
1680.TP
1681.B \f[C]classoption\f[R]
1682option for document class, e.g.
1683\f[C]oneside\f[R]; repeat for multiple options:
1684.RS
1685.IP
1686.nf
1687\f[C]
1688---
1689classoption:
1690- twocolumn
1691- landscape
1692\&...
1693\f[R]
1694.fi
1695.RE
1696.TP
1697.B \f[C]documentclass\f[R]
1698document class: usually one of the standard classes, \f[C]article\f[R],
1699\f[C]book\f[R], and \f[C]report\f[R]; the KOMA-Script equivalents,
1700\f[C]scrartcl\f[R], \f[C]scrbook\f[R], and \f[C]scrreprt\f[R], which
1701default to smaller margins; or \f[C]memoir\f[R]
1702.TP
1703.B \f[C]geometry\f[R]
1704option for \f[C]geometry\f[R] package, e.g.
1705\f[C]margin=1in\f[R]; repeat for multiple options:
1706.RS
1707.IP
1708.nf
1709\f[C]
1710---
1711geometry:
1712- top=30mm
1713- left=20mm
1714- heightrounded
1715\&...
1716\f[R]
1717.fi
1718.RE
1719.TP
1720.B \f[C]indent\f[R]
1721uses document class settings for indentation (the default LaTeX template
1722otherwise removes indentation and adds space between paragraphs)
1723.TP
1724.B \f[C]linestretch\f[R]
1725adjusts line spacing using the \f[C]setspace\f[R] package, e.g.
1726\f[C]1.25\f[R], \f[C]1.5\f[R]
1727.TP
1728.B \f[C]margin-left\f[R], \f[C]margin-right\f[R], \f[C]margin-top\f[R], \f[C]margin-bottom\f[R]
1729sets margins if \f[C]geometry\f[R] is not used (otherwise
1730\f[C]geometry\f[R] overrides these)
1731.TP
1732.B \f[C]pagestyle\f[R]
1733control \f[C]\[rs]pagestyle{}\f[R]: the default article class supports
1734\f[C]plain\f[R] (default), \f[C]empty\f[R] (no running heads or page
1735numbers), and \f[C]headings\f[R] (section titles in running heads)
1736.TP
1737.B \f[C]papersize\f[R]
1738paper size, e.g.
1739\f[C]letter\f[R], \f[C]a4\f[R]
1740.TP
1741.B \f[C]secnumdepth\f[R]
1742numbering depth for sections (with \f[C]--number-sections\f[R] option or
1743\f[C]numbersections\f[R] variable)
1744.SS Fonts
1745.TP
1746.B \f[C]fontenc\f[R]
1747allows font encoding to be specified through \f[C]fontenc\f[R] package
1748(with \f[C]pdflatex\f[R]); default is \f[C]T1\f[R] (see LaTeX font
1749encodings guide)
1750.TP
1751.B \f[C]fontfamily\f[R]
1752font package for use with \f[C]pdflatex\f[R]: TeX Live includes many
1753options, documented in the LaTeX Font Catalogue.
1754The default is Latin Modern.
1755.TP
1756.B \f[C]fontfamilyoptions\f[R]
1757options for package used as \f[C]fontfamily\f[R]; repeat for multiple
1758options.
1759For example, to use the Libertine font with proportional lowercase
1760(old-style) figures through the \f[C]libertinus\f[R] package:
1761.RS
1762.IP
1763.nf
1764\f[C]
1765---
1766fontfamily: libertinus
1767fontfamilyoptions:
1768- osf
1769- p
1770\&...
1771\f[R]
1772.fi
1773.RE
1774.TP
1775.B \f[C]fontsize\f[R]
1776font size for body text.
1777The standard classes allow 10pt, 11pt, and 12pt.
1778To use another size, set \f[C]documentclass\f[R] to one of the
1779KOMA-Script classes, such as \f[C]scrartcl\f[R] or \f[C]scrbook\f[R].
1780.TP
1781.B \f[C]mainfont\f[R], \f[C]sansfont\f[R], \f[C]monofont\f[R], \f[C]mathfont\f[R], \f[C]CJKmainfont\f[R]
1782font families for use with \f[C]xelatex\f[R] or \f[C]lualatex\f[R]: take
1783the name of any system font, using the \f[C]fontspec\f[R] package.
1784\f[C]CJKmainfont\f[R] uses the \f[C]xecjk\f[R] package.
1785.TP
1786.B \f[C]mainfontoptions\f[R], \f[C]sansfontoptions\f[R], \f[C]monofontoptions\f[R], \f[C]mathfontoptions\f[R], \f[C]CJKoptions\f[R]
1787options to use with \f[C]mainfont\f[R], \f[C]sansfont\f[R],
1788\f[C]monofont\f[R], \f[C]mathfont\f[R], \f[C]CJKmainfont\f[R] in
1789\f[C]xelatex\f[R] and \f[C]lualatex\f[R].
1790Allow for any choices available through \f[C]fontspec\f[R]; repeat for
1791multiple options.
1792For example, to use the TeX Gyre version of Palatino with lowercase
1793figures:
1794.RS
1795.IP
1796.nf
1797\f[C]
1798---
1799mainfont: TeX Gyre Pagella
1800mainfontoptions:
1801- Numbers=Lowercase
1802- Numbers=Proportional
1803\&...
1804\f[R]
1805.fi
1806.RE
1807.TP
1808.B \f[C]microtypeoptions\f[R]
1809options to pass to the microtype package
1810.SS Links
1811.TP
1812.B \f[C]colorlinks\f[R]
1813add color to link text; automatically enabled if any of
1814\f[C]linkcolor\f[R], \f[C]filecolor\f[R], \f[C]citecolor\f[R],
1815\f[C]urlcolor\f[R], or \f[C]toccolor\f[R] are set
1816.TP
1817.B \f[C]linkcolor\f[R], \f[C]filecolor\f[R], \f[C]citecolor\f[R], \f[C]urlcolor\f[R], \f[C]toccolor\f[R]
1818color for internal links, external links, citation links, linked URLs,
1819and links in table of contents, respectively: uses options allowed by
1820\f[C]xcolor\f[R], including the \f[C]dvipsnames\f[R],
1821\f[C]svgnames\f[R], and \f[C]x11names\f[R] lists
1822.TP
1823.B \f[C]links-as-notes\f[R]
1824causes links to be printed as footnotes
1825.SS Front matter
1826.TP
1827.B \f[C]lof\f[R], \f[C]lot\f[R]
1828include list of figures, list of tables
1829.TP
1830.B \f[C]thanks\f[R]
1831contents of acknowledgments footnote after document title
1832.TP
1833.B \f[C]toc\f[R]
1834include table of contents (can also be set using
1835\f[C]--toc/--table-of-contents\f[R])
1836.TP
1837.B \f[C]toc-depth\f[R]
1838level of section to include in table of contents
1839.SS BibLaTeX Bibliographies
1840.PP
1841These variables function when using BibLaTeX for citation rendering.
1842.TP
1843.B \f[C]biblatexoptions\f[R]
1844list of options for biblatex
1845.TP
1846.B \f[C]biblio-style\f[R]
1847bibliography style, when used with \f[C]--natbib\f[R] and
1848\f[C]--biblatex\f[R].
1849.TP
1850.B \f[C]biblio-title\f[R]
1851bibliography title, when used with \f[C]--natbib\f[R] and
1852\f[C]--biblatex\f[R].
1853.TP
1854.B \f[C]bibliography\f[R]
1855bibliography to use for resolving references
1856.TP
1857.B \f[C]natbiboptions\f[R]
1858list of options for natbib
1859.SS Variables for ConTeXt
1860.PP
1861Pandoc uses these variables when creating a PDF with ConTeXt.
1862.TP
1863.B \f[C]fontsize\f[R]
1864font size for body text (e.g.
1865\f[C]10pt\f[R], \f[C]12pt\f[R])
1866.TP
1867.B \f[C]headertext\f[R], \f[C]footertext\f[R]
1868text to be placed in running header or footer (see ConTeXt Headers and
1869Footers); repeat up to four times for different placement
1870.TP
1871.B \f[C]indenting\f[R]
1872controls indentation of paragraphs, e.g.
1873\f[C]yes,small,next\f[R] (see ConTeXt Indentation); repeat for multiple
1874options
1875.TP
1876.B \f[C]interlinespace\f[R]
1877adjusts line spacing, e.g.
1878\f[C]4ex\f[R] (using \f[C]setupinterlinespace\f[R]); repeat for multiple
1879options
1880.TP
1881.B \f[C]layout\f[R]
1882options for page margins and text arrangement (see ConTeXt Layout);
1883repeat for multiple options
1884.TP
1885.B \f[C]linkcolor\f[R], \f[C]contrastcolor\f[R]
1886color for links outside and inside a page, e.g.
1887\f[C]red\f[R], \f[C]blue\f[R] (see ConTeXt Color)
1888.TP
1889.B \f[C]linkstyle\f[R]
1890typeface style for links, e.g.
1891\f[C]normal\f[R], \f[C]bold\f[R], \f[C]slanted\f[R],
1892\f[C]boldslanted\f[R], \f[C]type\f[R], \f[C]cap\f[R], \f[C]small\f[R]
1893.TP
1894.B \f[C]lof\f[R], \f[C]lot\f[R]
1895include list of figures, list of tables
1896.TP
1897.B \f[C]mainfont\f[R], \f[C]sansfont\f[R], \f[C]monofont\f[R], \f[C]mathfont\f[R]
1898font families: take the name of any system font (see ConTeXt Font
1899Switching)
1900.TP
1901.B \f[C]margin-left\f[R], \f[C]margin-right\f[R], \f[C]margin-top\f[R], \f[C]margin-bottom\f[R]
1902sets margins, if \f[C]layout\f[R] is not used (otherwise
1903\f[C]layout\f[R] overrides these)
1904.TP
1905.B \f[C]pagenumbering\f[R]
1906page number style and location (using \f[C]setuppagenumbering\f[R]);
1907repeat for multiple options
1908.TP
1909.B \f[C]papersize\f[R]
1910paper size, e.g.
1911\f[C]letter\f[R], \f[C]A4\f[R], \f[C]landscape\f[R] (see ConTeXt Paper
1912Setup); repeat for multiple options
1913.TP
1914.B \f[C]pdfa\f[R]
1915adds to the preamble the setup necessary to generate PDF/A-1b:2005.
1916To successfully generate PDF/A the required ICC color profiles have to
1917be available and the content and all included files (such as images)
1918have to be standard conforming.
1919The ICC profiles can be obtained from ConTeXt ICC Profiles.
1920See also ConTeXt PDFA for more details.
1921.TP
1922.B \f[C]toc\f[R]
1923include table of contents (can also be set using
1924\f[C]--toc/--table-of-contents\f[R])
1925.TP
1926.B \f[C]whitespace\f[R]
1927spacing between paragraphs, e.g.
1928\f[C]none\f[R], \f[C]small\f[R] (using \f[C]setupwhitespace\f[R])
1929.SS Variables for \f[C]wkhtmltopdf\f[R]
1930.PP
1931Pandoc uses these variables when creating a PDF with
1932\f[C]wkhtmltopdf\f[R].
1933The \f[C]--css\f[R] option also affects the output.
1934.TP
1935.B \f[C]footer-html\f[R], \f[C]header-html\f[R]
1936add information to the header and footer
1937.TP
1938.B \f[C]margin-left\f[R], \f[C]margin-right\f[R], \f[C]margin-top\f[R], \f[C]margin-bottom\f[R]
1939set the page margins
1940.TP
1941.B \f[C]papersize\f[R]
1942sets the PDF paper size
1943.SS Variables for man pages
1944.TP
1945.B \f[C]adjusting\f[R]
1946adjusts text to left (\f[C]l\f[R]), right (\f[C]r\f[R]), center
1947(\f[C]c\f[R]), or both (\f[C]b\f[R]) margins
1948.TP
1949.B \f[C]footer\f[R]
1950footer in man pages
1951.TP
1952.B \f[C]header\f[R]
1953header in man pages
1954.TP
1955.B \f[C]hyphenate\f[R]
1956if \f[C]true\f[R] (the default), hyphenation will be used
1957.TP
1958.B \f[C]section\f[R]
1959section number in man pages
1960.SS Variables for ms
1961.TP
1962.B \f[C]fontfamily\f[R]
1963font family (e.g.
1964\f[C]T\f[R] or \f[C]P\f[R])
1965.TP
1966.B \f[C]indent\f[R]
1967paragraph indent (e.g.
1968\f[C]2m\f[R])
1969.TP
1970.B \f[C]lineheight\f[R]
1971line height (e.g.
1972\f[C]12p\f[R])
1973.TP
1974.B \f[C]pointsize\f[R]
1975point size (e.g.
1976\f[C]10p\f[R])
1977.SS Structural variables
1978.PP
1979Pandoc sets these variables automatically in response to options or
1980document contents; users can also modify them.
1981These vary depending on the output format, and include the following:
1982.TP
1983.B \f[C]body\f[R]
1984body of document
1985.TP
1986.B \f[C]date-meta\f[R]
1987the \f[C]date\f[R] variable converted to ISO 8601 YYYY-MM-DD, included
1988in all HTML based formats (dzslides, epub, html, html4, html5, revealjs,
1989s5, slideous, slidy).
1990The recognized formats for \f[C]date\f[R] are: \f[C]mm/dd/yyyy\f[R],
1991\f[C]mm/dd/yy\f[R], \f[C]yyyy-mm-dd\f[R] (ISO 8601),
1992\f[C]dd MM yyyy\f[R] (e.g.
1993either \f[C]02 Apr 2018\f[R] or \f[C]02 April 2018\f[R]),
1994\f[C]MM dd, yyyy\f[R] (e.g.
1995\f[C]Apr. 02, 2018\f[R] or
1996\f[C]April 02, 2018),\f[R]yyyy[mm[dd]]]\f[C](e.g.\f[R]20180402,
1997\f[C]201804\f[R] or \f[C]2018\f[R]).
1998.TP
1999.B \f[C]header-includes\f[R]
2000contents specified by \f[C]-H/--include-in-header\f[R] (may have
2001multiple values)
2002.TP
2003.B \f[C]include-before\f[R]
2004contents specified by \f[C]-B/--include-before-body\f[R] (may have
2005multiple values)
2006.TP
2007.B \f[C]include-after\f[R]
2008contents specified by \f[C]-A/--include-after-body\f[R] (may have
2009multiple values)
2010.TP
2011.B \f[C]meta-json\f[R]
2012JSON representation of all of the document\[aq]s metadata.
2013Field values are transformed to the selected output format.
2014.TP
2015.B \f[C]numbersections\f[R]
2016non-null value if \f[C]-N/--number-sections\f[R] was specified
2017.TP
2018.B \f[C]sourcefile\f[R], \f[C]outputfile\f[R]
2019source and destination filenames, as given on the command line.
2020\f[C]sourcefile\f[R] can also be a list if input comes from multiple
2021files, or empty if input is from stdin.
2022You can use the following snippet in your template to distinguish them:
2023.RS
2024.IP
2025.nf
2026\f[C]
2027$if(sourcefile)$
2028$for(sourcefile)$
2029$sourcefile$
2030$endfor$
2031$else$
2032(stdin)
2033$endif$
2034\f[R]
2035.fi
2036.PP
2037Similarly, \f[C]outputfile\f[R] can be \f[C]-\f[R] if output goes to the
2038terminal.
2039.RE
2040.TP
2041.B \f[C]toc\f[R]
2042non-null value if \f[C]--toc/--table-of-contents\f[R] was specified
2043.TP
2044.B \f[C]toc-title\f[R]
2045title of table of contents (works only with EPUB, opendocument, odt,
2046docx, pptx, beamer, LaTeX)
2047.SS Using variables in templates
2048.PP
2049Variable names are sequences of alphanumerics, \f[C]-\f[R], and
2050\f[C]_\f[R], starting with a letter.
2051A variable name surrounded by \f[C]$\f[R] signs will be replaced by its
2052value.
2053For example, the string \f[C]$title$\f[R] in
2054.IP
2055.nf
2056\f[C]
2057<title>$title$</title>
2058\f[R]
2059.fi
2060.PP
2061will be replaced by the document title.
2062.PP
2063To write a literal \f[C]$\f[R] in a template, use \f[C]$$\f[R].
2064.PP
2065Templates may contain conditionals.
2066The syntax is as follows:
2067.IP
2068.nf
2069\f[C]
2070$if(variable)$
2072$else$
2074$endif$
2075\f[R]
2076.fi
2077.PP
2078This will include \f[C]X\f[R] in the template if \f[C]variable\f[R] has
2079a truthy value; otherwise it will include \f[C]Y\f[R].
2080Here a truthy value is any of the following:
2081.IP \[bu] 2
2082a string that is not entirely white space,
2083.IP \[bu] 2
2084a non-empty array where the first value is truthy,
2085.IP \[bu] 2
2086any number (including zero),
2087.IP \[bu] 2
2088any object,
2089.IP \[bu] 2
2090the boolean \f[C]true\f[R] (to specify the boolean \f[C]true\f[R] value
2091using YAML metadata or the \f[C]--metadata\f[R] flag, use
2092\f[C]true\f[R], \f[C]True\f[R], or \f[C]TRUE\f[R]; with the
2093\f[C]--variable\f[R] flag, simply omit a value for the variable, e.g.
2094\f[C]--variable draft\f[R]).
2095.PP
2096\f[C]X\f[R] and \f[C]Y\f[R] are placeholders for any valid template
2097text, and may include interpolated variables or other conditionals.
2098The \f[C]$else$\f[R] section may be omitted.
2099.PP
2100When variables can have multiple values (for example, \f[C]author\f[R]
2101in a multi-author document), you can use the \f[C]$for$\f[R] keyword:
2102.IP
2103.nf
2104\f[C]
2105$for(author)$
2106<meta name=\[dq]author\[dq] content=\[dq]$author$\[dq] />
2107$endfor$
2108\f[R]
2109.fi
2110.PP
2111You can optionally specify a separator to be used between consecutive
2112items:
2113.IP
2114.nf
2115\f[C]
2116$for(author)$$author$$sep$, $endfor$
2117\f[R]
2118.fi
2119.PP
2120Note that the separator needs to be specified immediately before the
2121\f[C]$endfor\f[R] keyword.
2122.PP
2123A dot can be used to select a field of a variable that takes an object
2124as its value.
2125So, for example:
2126.IP
2127.nf
2128\f[C]
2129$author.name$ ($author.affiliation$)
2130\f[R]
2131.fi
2132.PP
2133The value of a variable will be indented to the same level as the
2134variable.
2135.PP
2136If you use custom templates, you may need to revise them as pandoc
2137changes.
2138We recommend tracking the changes in the default templates, and
2139modifying your custom templates accordingly.
2140An easy way to do this is to fork the pandoc-templates repository and
2141merge in changes after each pandoc release.
2142.PP
2143Templates may contain comments: anything on a line after \f[C]$--\f[R]
2144will be treated as a comment and ignored.
2145.SH EXTENSIONS
2146.PP
2147The behavior of some of the readers and writers can be adjusted by
2148enabling or disabling various extensions.
2149.PP
2150An extension can be enabled by adding \f[C]+EXTENSION\f[R] to the format
2151name and disabled by adding \f[C]-EXTENSION\f[R].
2152For example, \f[C]--from markdown_strict+footnotes\f[R] is strict
2153Markdown with footnotes enabled, while
2154\f[C]--from markdown-footnotes-pipe_tables\f[R] is pandoc\[aq]s Markdown
2155without footnotes or pipe tables.
2156.PP
2157The markdown reader and writer make by far the most use of extensions.
2158Extensions only used by them are therefore covered in the section
2159Pandoc\[aq]s Markdown below (See Markdown variants for
2160\f[C]commonmark\f[R] and \f[C]gfm\f[R].) In the following, extensions
2161that also work for other formats are covered.
2162.PP
2163Note that markdown extensions added to the \f[C]ipynb\f[R] format affect
2164Markdown cells in Jupyter notebooks (as do command-line options like
2165\f[C]--atx-headers\f[R]).
2166.SS Typography
2167.SS Extension: \f[C]smart\f[R]
2168.PP
2169Interpret straight quotes as curly quotes, \f[C]---\f[R] as em-dashes,
2170\f[C]--\f[R] as en-dashes, and \f[C]...\f[R] as ellipses.
2171Nonbreaking spaces are inserted after certain abbreviations, such as
2172\[dq]Mr.\[dq]
2173.PP
2174This extension can be enabled/disabled for the following formats:
2175.TP
2176.B input formats
2177\f[C]markdown\f[R], \f[C]commonmark\f[R], \f[C]latex\f[R],
2178\f[C]mediawiki\f[R], \f[C]org\f[R], \f[C]rst\f[R], \f[C]twiki\f[R]
2179.TP
2180.B output formats
2181\f[C]markdown\f[R], \f[C]latex\f[R], \f[C]context\f[R], \f[C]rst\f[R]
2182.TP
2183.B enabled by default in
2184\f[C]markdown\f[R], \f[C]latex\f[R], \f[C]context\f[R] (both input and
2185output)
2186.PP
2187Note: If you are \f[I]writing\f[R] Markdown, then the \f[C]smart\f[R]
2188extension has the reverse effect: what would have been curly quotes
2189comes out straight.
2190.PP
2191In LaTeX, \f[C]smart\f[R] means to use the standard TeX ligatures for
2192quotation marks (\f[C]\[ga]\[ga]\f[R] and \f[C]\[aq]\[aq]\f[R] for
2193double quotes, \f[C]\[ga]\f[R] and \f[C]\[aq]\f[R] for single quotes)
2194and dashes (\f[C]--\f[R] for en-dash and \f[C]---\f[R] for em-dash).
2195If \f[C]smart\f[R] is disabled, then in reading LaTeX pandoc will parse
2196these characters literally.
2197In writing LaTeX, enabling \f[C]smart\f[R] tells pandoc to use the
2198ligatures when possible; if \f[C]smart\f[R] is disabled pandoc will use
2199unicode quotation mark and dash characters.
2200.SS Headings and sections
2201.SS Extension: \f[C]auto_identifiers\f[R]
2202.PP
2203A heading without an explicitly specified identifier will be
2204automatically assigned a unique identifier based on the heading text.
2205.PP
2206This extension can be enabled/disabled for the following formats:
2207.TP
2208.B input formats
2209\f[C]markdown\f[R], \f[C]latex\f[R], \f[C]rst\f[R], \f[C]mediawiki\f[R],
2210\f[C]textile\f[R]
2211.TP
2212.B output formats
2213\f[C]markdown\f[R], \f[C]muse\f[R]
2214.TP
2215.B enabled by default in
2216\f[C]markdown\f[R], \f[C]muse\f[R]
2217.PP
2218The default algorithm used to derive the identifier from the heading
2219text is:
2220.IP \[bu] 2
2221Remove all formatting, links, etc.
2222.IP \[bu] 2
2223Remove all footnotes.
2224.IP \[bu] 2
2225Remove all non-alphanumeric characters, except underscores, hyphens, and
2226periods.
2227.IP \[bu] 2
2228Replace all spaces and newlines with hyphens.
2229.IP \[bu] 2
2230Convert all alphabetic characters to lowercase.
2231.IP \[bu] 2
2232Remove everything up to the first letter (identifiers may not begin with
2233a number or punctuation mark).
2234.IP \[bu] 2
2235If nothing is left after this, use the identifier \f[C]section\f[R].
2236.PP
2237Thus, for example,
2238.PP
2239.TS
2240tab(@);
2241l l.
2243Heading
2244T}@T{
2245Identifier
2249\f[C]Heading identifiers in HTML\f[R]
2250T}@T{
2251\f[C]heading-identifiers-in-html\f[R]
2254\f[C]Ma\[^i]tre d\[aq]h\[^o]tel\f[R]
2255T}@T{
2256\f[C]ma\[^i]tre-dh\[^o]tel\f[R]
2259\f[C]*Dogs*?--in *my* house?\f[R]
2260T}@T{
2261\f[C]dogs--in-my-house\f[R]
2264\f[C][HTML], [S5], or [RTF]?\f[R]
2265T}@T{
2266\f[C]html-s5-or-rtf\f[R]
2269\f[C]3. Applications\f[R]
2270T}@T{
2271\f[C]applications\f[R]
2274\f[C]33\f[R]
2275T}@T{
2276\f[C]section\f[R]
2278.TE
2279.PP
2280These rules should, in most cases, allow one to determine the identifier
2281from the heading text.
2282The exception is when several headings have the same text; in this case,
2283the first will get an identifier as described above; the second will get
2284the same identifier with \f[C]-1\f[R] appended; the third with
2285\f[C]-2\f[R]; and so on.
2286.PP
2287(However, a different algorithm is used if
2288\f[C]gfm_auto_identifiers\f[R] is enabled; see below.)
2289.PP
2290These identifiers are used to provide link targets in the table of
2291contents generated by the \f[C]--toc|--table-of-contents\f[R] option.
2292They also make it easy to provide links from one section of a document
2293to another.
2294A link to this section, for example, might look like this:
2295.IP
2296.nf
2297\f[C]
2298See the section on
2299[heading identifiers](#heading-identifiers-in-html-latex-and-context).
2300\f[R]
2301.fi
2302.PP
2303Note, however, that this method of providing links to sections works
2304only in HTML, LaTeX, and ConTeXt formats.
2305.PP
2306If the \f[C]--section-divs\f[R] option is specified, then each section
2307will be wrapped in a \f[C]section\f[R] (or a \f[C]div\f[R], if
2308\f[C]html4\f[R] was specified), and the identifier will be attached to
2309the enclosing \f[C]<section>\f[R] (or \f[C]<div>\f[R]) tag rather than
2310the heading itself.
2311This allows entire sections to be manipulated using JavaScript or
2312treated differently in CSS.
2313.SS Extension: \f[C]ascii_identifiers\f[R]
2314.PP
2315Causes the identifiers produced by \f[C]auto_identifiers\f[R] to be pure
2316ASCII.
2317Accents are stripped off of accented Latin letters, and non-Latin
2318letters are omitted.
2319.SS Extension: \f[C]gfm_auto_identifiers\f[R]
2320.PP
2321Changes the algorithm used by \f[C]auto_identifiers\f[R] to conform to
2322GitHub\[aq]s method.
2323Spaces are converted to dashes (\f[C]-\f[R]), uppercase characters to
2324lowercase characters, and punctuation characters other than \f[C]-\f[R]
2325and \f[C]_\f[R] are removed.
2326.SS Math Input
2327.PP
2328The extensions \f[C]tex_math_dollars\f[R],
2329\f[C]tex_math_single_backslash\f[R], and
2330\f[C]tex_math_double_backslash\f[R] are described in the section about
2331Pandoc\[aq]s Markdown.
2332.PP
2333However, they can also be used with HTML input.
2334This is handy for reading web pages formatted using MathJax, for
2335example.
2336.SS Raw HTML/TeX
2337.PP
2338The following extensions (especially how they affect Markdown
2339input/output) are also described in more detail in their respective
2340sections of Pandoc\[aq]s Markdown.
2341.SS Extension: \f[C]raw_html\f[R]
2342.PP
2343When converting from HTML, parse elements to raw HTML which are not
2344representable in pandoc\[aq]s AST.
2345By default, this is disabled for HTML input.
2346.SS Extension: \f[C]raw_tex\f[R]
2347.PP
2348Allows raw LaTeX, TeX, and ConTeXt to be included in a document.
2349.PP
2350This extension can be enabled/disabled for the following formats (in
2351addition to \f[C]markdown\f[R]):
2352.TP
2353.B input formats
2354\f[C]latex\f[R], \f[C]org\f[R], \f[C]textile\f[R], \f[C]html\f[R]
2355(environments, \f[C]\[rs]ref\f[R], and \f[C]\[rs]eqref\f[R] only),
2356\f[C]ipynb\f[R]
2357.TP
2358.B output formats
2359\f[C]textile\f[R], \f[C]commonmark\f[R]
2360.PP
2361Note: as applied to \f[C]ipynb\f[R], \f[C]raw_html\f[R] and
2362\f[C]raw_tex\f[R] affect not only raw TeX in markdown cells, but data
2363with mime type \f[C]text/html\f[R] in output cells.
2364Since the \f[C]ipynb\f[R] reader attempts to preserve the richest
2365possible outputs when several options are given, you will get best
2366results if you disable \f[C]raw_html\f[R] and \f[C]raw_tex\f[R] when
2367converting to formats like \f[C]docx\f[R] which don\[aq]t allow raw
2368\f[C]html\f[R] or \f[C]tex\f[R].
2369.SS Extension: \f[C]native_divs\f[R]
2370.PP
2371This extension is enabled by default for HTML input.
2372This means that \f[C]div\f[R]s are parsed to pandoc native elements.
2373(Alternatively, you can parse them to raw HTML using
2374\f[C]-f html-native_divs+raw_html\f[R].)
2375.PP
2376When converting HTML to Markdown, for example, you may want to drop all
2377\f[C]div\f[R]s and \f[C]span\f[R]s:
2378.IP
2379.nf
2380\f[C]
2381pandoc -f html-native_divs-native_spans -t markdown
2382\f[R]
2383.fi
2384.SS Extension: \f[C]native_spans\f[R]
2385.PP
2386Analogous to \f[C]native_divs\f[R] above.
2387.SS Literate Haskell support
2388.SS Extension: \f[C]literate_haskell\f[R]
2389.PP
2390Treat the document as literate Haskell source.
2391.PP
2392This extension can be enabled/disabled for the following formats:
2393.TP
2394.B input formats
2395\f[C]markdown\f[R], \f[C]rst\f[R], \f[C]latex\f[R]
2396.TP
2397.B output formats
2398\f[C]markdown\f[R], \f[C]rst\f[R], \f[C]latex\f[R], \f[C]html\f[R]
2399.PP
2400If you append \f[C]+lhs\f[R] (or \f[C]+literate_haskell\f[R]) to one of
2401the formats above, pandoc will treat the document as literate Haskell
2402source.
2403This means that
2404.IP \[bu] 2
2405In Markdown input, \[dq]bird track\[dq] sections will be parsed as
2406Haskell code rather than block quotations.
2407Text between \f[C]\[rs]begin{code}\f[R] and \f[C]\[rs]end{code}\f[R]
2408will also be treated as Haskell code.
2409For ATX-style headings the character \[aq]=\[aq] will be used instead of
2410\[aq]#\[aq].
2411.IP \[bu] 2
2412In Markdown output, code blocks with classes \f[C]haskell\f[R] and
2413\f[C]literate\f[R] will be rendered using bird tracks, and block
2414quotations will be indented one space, so they will not be treated as
2415Haskell code.
2416In addition, headings will be rendered setext-style (with underlines)
2417rather than ATX-style (with \[aq]#\[aq] characters).
2418(This is because ghc treats \[aq]#\[aq] characters in column 1 as
2419introducing line numbers.)
2420.IP \[bu] 2
2421In restructured text input, \[dq]bird track\[dq] sections will be parsed
2422as Haskell code.
2423.IP \[bu] 2
2424In restructured text output, code blocks with class \f[C]haskell\f[R]
2425will be rendered using bird tracks.
2426.IP \[bu] 2
2427In LaTeX input, text in \f[C]code\f[R] environments will be parsed as
2428Haskell code.
2429.IP \[bu] 2
2430In LaTeX output, code blocks with class \f[C]haskell\f[R] will be
2431rendered inside \f[C]code\f[R] environments.
2432.IP \[bu] 2
2433In HTML output, code blocks with class \f[C]haskell\f[R] will be
2434rendered with class \f[C]literatehaskell\f[R] and bird tracks.
2435.PP
2436Examples:
2437.IP
2438.nf
2439\f[C]
2440pandoc -f markdown+lhs -t html
2441\f[R]
2442.fi
2443.PP
2444reads literate Haskell source formatted with Markdown conventions and
2445writes ordinary HTML (without bird tracks).
2446.IP
2447.nf
2448\f[C]
2449pandoc -f markdown+lhs -t html+lhs
2450\f[R]
2451.fi
2452.PP
2453writes HTML with the Haskell code in bird tracks, so it can be copied
2454and pasted as literate Haskell source.
2455.PP
2456Note that GHC expects the bird tracks in the first column, so indented
2457literate code blocks (e.g.
2458inside an itemized environment) will not be picked up by the Haskell
2459compiler.
2460.SS Other extensions
2461.SS Extension: \f[C]empty_paragraphs\f[R]
2462.PP
2463Allows empty paragraphs.
2464By default empty paragraphs are omitted.
2465.PP
2466This extension can be enabled/disabled for the following formats:
2467.TP
2468.B input formats
2469\f[C]docx\f[R], \f[C]html\f[R]
2470.TP
2471.B output formats
2472\f[C]docx\f[R], \f[C]odt\f[R], \f[C]opendocument\f[R], \f[C]html\f[R]
2473.SS Extension: \f[C]styles\f[R]
2474.PP
2475When converting from docx, read all docx styles as divs (for paragraph
2476styles) and spans (for character styles) regardless of whether pandoc
2477understands the meaning of these styles.
2478This can be used with docx custom styles.
2479Disabled by default.
2480.TP
2481.B input formats
2482\f[C]docx\f[R]
2483.SS Extension: \f[C]amuse\f[R]
2484.PP
2485In the \f[C]muse\f[R] input format, this enables Text::Amuse extensions
2486to Emacs Muse markup.
2487.SS Extension: \f[C]citations\f[R]
2488.PP
2489Some aspects of Pandoc\[aq]s Markdown citation syntax are also accepted
2490in \f[C]org\f[R] input.
2491.SS Extension: \f[C]ntb\f[R]
2492.PP
2493In the \f[C]context\f[R] output format this enables the use of Natural
2494Tables (TABLE) instead of the default Extreme Tables (xtables).
2495Natural tables allow more fine-grained global customization but come at
2496a performance penalty compared to extreme tables.
2497.SH PANDOC\[aq]S MARKDOWN
2498.PP
2499Pandoc understands an extended and slightly revised version of John
2500Gruber\[aq]s Markdown syntax.
2501This document explains the syntax, noting differences from standard
2502Markdown.
2503Except where noted, these differences can be suppressed by using the
2504\f[C]markdown_strict\f[R] format instead of \f[C]markdown\f[R].
2505Extensions can be enabled or disabled to specify the behavior more
2506granularly.
2507They are described in the following.
2508See also Extensions above, for extensions that work also on other
2509formats.
2510.SS Philosophy
2511.PP
2512Markdown is designed to be easy to write, and, even more importantly,
2513easy to read:
2514.RS
2515.PP
2516A Markdown-formatted document should be publishable as-is, as plain
2517text, without looking like it\[aq]s been marked up with tags or
2518formatting instructions.
2519-- John Gruber
2520.RE
2521.PP
2522This principle has guided pandoc\[aq]s decisions in finding syntax for
2523tables, footnotes, and other extensions.
2524.PP
2525There is, however, one respect in which pandoc\[aq]s aims are different
2526from the original aims of Markdown.
2527Whereas Markdown was originally designed with HTML generation in mind,
2528pandoc is designed for multiple output formats.
2529Thus, while pandoc allows the embedding of raw HTML, it discourages it,
2530and provides other, non-HTMLish ways of representing important document
2531elements like definition lists, tables, mathematics, and footnotes.
2532.SS Paragraphs
2533.PP
2534A paragraph is one or more lines of text followed by one or more blank
2535lines.
2536Newlines are treated as spaces, so you can reflow your paragraphs as you
2537like.
2538If you need a hard line break, put two or more spaces at the end of a
2539line.
2540.SS Extension: \f[C]escaped_line_breaks\f[R]
2541.PP
2542A backslash followed by a newline is also a hard line break.
2543Note: in multiline and grid table cells, this is the only way to create
2544a hard line break, since trailing spaces in the cells are ignored.
2545.SS Headings
2546.PP
2547There are two kinds of headings: Setext and ATX.
2548.SS Setext-style headings
2549.PP
2550A setext-style heading is a line of text \[dq]underlined\[dq] with a row
2551of \f[C]=\f[R] signs (for a level-one heading) or \f[C]-\f[R] signs (for
2552a level-two heading):
2553.IP
2554.nf
2555\f[C]
2556A level-one heading
2557===================
2559A level-two heading
2560-------------------
2561\f[R]
2562.fi
2563.PP
2564The heading text can contain inline formatting, such as emphasis (see
2565Inline formatting, below).
2566.SS ATX-style headings
2567.PP
2568An ATX-style heading consists of one to six \f[C]#\f[R] signs and a line
2569of text, optionally followed by any number of \f[C]#\f[R] signs.
2570The number of \f[C]#\f[R] signs at the beginning of the line is the
2571heading level:
2572.IP
2573.nf
2574\f[C]
2575## A level-two heading
2577### A level-three heading ###
2578\f[R]
2579.fi
2580.PP
2581As with setext-style headings, the heading text can contain formatting:
2582.IP
2583.nf
2584\f[C]
2585# A level-one heading with a [link](/url) and *emphasis*
2586\f[R]
2587.fi
2588.SS Extension: \f[C]blank_before_header\f[R]
2589.PP
2590Standard Markdown syntax does not require a blank line before a heading.
2591Pandoc does require this (except, of course, at the beginning of the
2592document).
2593The reason for the requirement is that it is all too easy for a
2594\f[C]#\f[R] to end up at the beginning of a line by accident (perhaps
2595through line wrapping).
2596Consider, for example:
2597.IP
2598.nf
2599\f[C]
2600I like several of their flavors of ice cream:
2601#22, for example, and #5.
2602\f[R]
2603.fi
2604.SS Extension: \f[C]space_in_atx_header\f[R]
2605.PP
2606Many Markdown implementations do not require a space between the opening
2607\f[C]#\f[R]s of an ATX heading and the heading text, so that
2608\f[C]#5 bolt\f[R] and \f[C]#hashtag\f[R] count as headings.
2609With this extension, pandoc does require the space.
2610.SS Heading identifiers
2611.PP
2612See also the \f[C]auto_identifiers\f[R] extension above.
2613.SS Extension: \f[C]header_attributes\f[R]
2614.PP
2615Headings can be assigned attributes using this syntax at the end of the
2616line containing the heading text:
2617.IP
2618.nf
2619\f[C]
2620{#identifier .class .class key=value key=value}
2621\f[R]
2622.fi
2623.PP
2624Thus, for example, the following headings will all be assigned the
2625identifier \f[C]foo\f[R]:
2626.IP
2627.nf
2628\f[C]
2629# My heading {#foo}
2631## My heading ## {#foo}
2633My other heading {#foo}
2634---------------
2635\f[R]
2636.fi
2637.PP
2638(This syntax is compatible with PHP Markdown Extra.)
2639.PP
2640Note that although this syntax allows assignment of classes and
2641key/value attributes, writers generally don\[aq]t use all of this
2642information.
2643Identifiers, classes, and key/value attributes are used in HTML and
2644HTML-based formats such as EPUB and slidy.
2645Identifiers are used for labels and link anchors in the LaTeX, ConTeXt,
2646Textile, and AsciiDoc writers.
2647.PP
2648Headings with the class \f[C]unnumbered\f[R] will not be numbered, even
2649if \f[C]--number-sections\f[R] is specified.
2650A single hyphen (\f[C]-\f[R]) in an attribute context is equivalent to
2651\f[C].unnumbered\f[R], and preferable in non-English documents.
2652So,
2653.IP
2654.nf
2655\f[C]
2656# My heading {-}
2657\f[R]
2658.fi
2659.PP
2660is just the same as
2661.IP
2662.nf
2663\f[C]
2664# My heading {.unnumbered}
2665\f[R]
2666.fi
2667.SS Extension: \f[C]implicit_header_references\f[R]
2668.PP
2669Pandoc behaves as if reference links have been defined for each heading.
2670So, to link to a heading
2671.IP
2672.nf
2673\f[C]
2674# Heading identifiers in HTML
2675\f[R]
2676.fi
2677.PP
2678you can simply write
2679.IP
2680.nf
2681\f[C]
2682[Heading identifiers in HTML]
2683\f[R]
2684.fi
2685.PP
2687.IP
2688.nf
2689\f[C]
2690[Heading identifiers in HTML][]
2691\f[R]
2692.fi
2693.PP
2695.IP
2696.nf
2697\f[C]
2698[the section on heading identifiers][heading identifiers in
2699HTML]
2700\f[R]
2701.fi
2702.PP
2703instead of giving the identifier explicitly:
2704.IP
2705.nf
2706\f[C]
2707[Heading identifiers in HTML](#heading-identifiers-in-html)
2708\f[R]
2709.fi
2710.PP
2711If there are multiple headings with identical text, the corresponding
2712reference will link to the first one only, and you will need to use
2713explicit links to link to the others, as described above.
2714.PP
2715Like regular reference links, these references are case-insensitive.
2716.PP
2717Explicit link reference definitions always take priority over implicit
2718heading references.
2719So, in the following example, the link will point to \f[C]bar\f[R], not
2720to \f[C]#foo\f[R]:
2721.IP
2722.nf
2723\f[C]
2724# Foo
2726[foo]: bar
2728See [foo]
2729\f[R]
2730.fi
2731.SS Block quotations
2732.PP
2733Markdown uses email conventions for quoting blocks of text.
2734A block quotation is one or more paragraphs or other block elements
2735(such as lists or headings), with each line preceded by a \f[C]>\f[R]
2736character and an optional space.
2737(The \f[C]>\f[R] need not start at the left margin, but it should not be
2738indented more than three spaces.)
2739.IP
2740.nf
2741\f[C]
2742> This is a block quote. This
2743> paragraph has two lines.
2745> 1. This is a list inside a block quote.
2746> 2. Second item.
2747\f[R]
2748.fi
2749.PP
2750A \[dq]lazy\[dq] form, which requires the \f[C]>\f[R] character only on
2751the first line of each block, is also allowed:
2752.IP
2753.nf
2754\f[C]
2755> This is a block quote. This
2756paragraph has two lines.
2758> 1. This is a list inside a block quote.
27592. Second item.
2760\f[R]
2761.fi
2762.PP
2763Among the block elements that can be contained in a block quote are
2764other block quotes.
2765That is, block quotes can be nested:
2766.IP
2767.nf
2768\f[C]
2769> This is a block quote.
2771> > A block quote within a block quote.
2772\f[R]
2773.fi
2774.PP
2775If the \f[C]>\f[R] character is followed by an optional space, that
2776space will be considered part of the block quote marker and not part of
2777the indentation of the contents.
2778Thus, to put an indented code block in a block quote, you need five
2779spaces after the \f[C]>\f[R]:
2780.IP
2781.nf
2782\f[C]
2783> code
2784\f[R]
2785.fi
2786.SS Extension: \f[C]blank_before_blockquote\f[R]
2787.PP
2788Standard Markdown syntax does not require a blank line before a block
2789quote.
2790Pandoc does require this (except, of course, at the beginning of the
2791document).
2792The reason for the requirement is that it is all too easy for a
2793\f[C]>\f[R] to end up at the beginning of a line by accident (perhaps
2794through line wrapping).
2795So, unless the \f[C]markdown_strict\f[R] format is used, the following
2796does not produce a nested block quote in pandoc:
2797.IP
2798.nf
2799\f[C]
2800> This is a block quote.
2801>> Nested.
2802\f[R]
2803.fi
2804.SS Verbatim (code) blocks
2805.SS Indented code blocks
2806.PP
2807A block of text indented four spaces (or one tab) is treated as verbatim
2808text: that is, special characters do not trigger special formatting, and
2809all spaces and line breaks are preserved.
2810For example,
2811.IP
2812.nf
2813\f[C]
2814 if (a > 3) {
2815 moveShip(5 * gravity, DOWN);
2817\f[R]
2818.fi
2819.PP
2820The initial (four space or one tab) indentation is not considered part
2821of the verbatim text, and is removed in the output.
2822.PP
2823Note: blank lines in the verbatim text need not begin with four spaces.
2824.SS Fenced code blocks
2825.SS Extension: \f[C]fenced_code_blocks\f[R]
2826.PP
2827In addition to standard indented code blocks, pandoc supports
2828\f[I]fenced\f[R] code blocks.
2829These begin with a row of three or more tildes (\f[C]\[ti]\f[R]) and end
2830with a row of tildes that must be at least as long as the starting row.
2831Everything between these lines is treated as code.
2832No indentation is necessary:
2833.IP
2834.nf
2835\f[C]
2836\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]
2837if (a > 3) {
2838 moveShip(5 * gravity, DOWN);
2840\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]
2841\f[R]
2842.fi
2843.PP
2844Like regular code blocks, fenced code blocks must be separated from
2845surrounding text by blank lines.
2846.PP
2847If the code itself contains a row of tildes or backticks, just use a
2848longer row of tildes or backticks at the start and end:
2849.IP
2850.nf
2851\f[C]
2852\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]
2853\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]
2854code including tildes
2855\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]
2856\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]
2857\f[R]
2858.fi
2859.SS Extension: \f[C]backtick_code_blocks\f[R]
2860.PP
2861Same as \f[C]fenced_code_blocks\f[R], but uses backticks
2862(\f[C]\[ga]\f[R]) instead of tildes (\f[C]\[ti]\f[R]).
2863.SS Extension: \f[C]fenced_code_attributes\f[R]
2864.PP
2865Optionally, you may attach attributes to fenced or backtick code block
2866using this syntax:
2867.IP
2868.nf
2869\f[C]
2870\[ti]\[ti]\[ti]\[ti] {#mycode .haskell .numberLines startFrom=\[dq]100\[dq]}
2871qsort [] = []
2872qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
2873 qsort (filter (>= x) xs)
2874\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]
2875\f[R]
2876.fi
2877.PP
2878Here \f[C]mycode\f[R] is an identifier, \f[C]haskell\f[R] and
2879\f[C]numberLines\f[R] are classes, and \f[C]startFrom\f[R] is an
2880attribute with value \f[C]100\f[R].
2881Some output formats can use this information to do syntax highlighting.
2882Currently, the only output formats that uses this information are HTML,
2883LaTeX, Docx, Ms, and PowerPoint.
2884If highlighting is supported for your output format and language, then
2885the code block above will appear highlighted, with numbered lines.
2886(To see which languages are supported, type
2887\f[C]pandoc --list-highlight-languages\f[R].) Otherwise, the code block
2888above will appear as follows:
2889.IP
2890.nf
2891\f[C]
2892<pre id=\[dq]mycode\[dq] class=\[dq]haskell numberLines\[dq] startFrom=\[dq]100\[dq]>
2893 <code>
2894 ...
2895 </code>
2896</pre>
2897\f[R]
2898.fi
2899.PP
2900The \f[C]numberLines\f[R] (or \f[C]number-lines\f[R]) class will cause
2901the lines of the code block to be numbered, starting with \f[C]1\f[R] or
2902the value of the \f[C]startFrom\f[R] attribute.
2903The \f[C]lineAnchors\f[R] (or \f[C]line-anchors\f[R]) class will cause
2904the lines to be clickable anchors in HTML output.
2905.PP
2906A shortcut form can also be used for specifying the language of the code
2907block:
2908.IP
2909.nf
2910\f[C]
2911\[ga]\[ga]\[ga]haskell
2912qsort [] = []
2913\[ga]\[ga]\[ga]
2914\f[R]
2915.fi
2916.PP
2917This is equivalent to:
2918.IP
2919.nf
2920\f[C]
2921\[ga]\[ga]\[ga] {.haskell}
2922qsort [] = []
2923\[ga]\[ga]\[ga]
2924\f[R]
2925.fi
2926.PP
2927If the \f[C]fenced_code_attributes\f[R] extension is disabled, but input
2928contains class attribute(s) for the code block, the first class
2929attribute will be printed after the opening fence as a bare word.
2930.PP
2931To prevent all highlighting, use the \f[C]--no-highlight\f[R] flag.
2932To set the highlighting style, use \f[C]--highlight-style\f[R].
2933For more information on highlighting, see Syntax highlighting, below.
2934.SS Line blocks
2935.SS Extension: \f[C]line_blocks\f[R]
2936.PP
2937A line block is a sequence of lines beginning with a vertical bar
2938(\f[C]|\f[R]) followed by a space.
2939The division into lines will be preserved in the output, as will any
2940leading spaces; otherwise, the lines will be formatted as Markdown.
2941This is useful for verse and addresses:
2942.IP
2943.nf
2944\f[C]
2945| The limerick packs laughs anatomical
2946| In space that is quite economical.
2947| But the good ones I\[aq]ve seen
2948| So seldom are clean
2949| And the clean ones so seldom are comical
2951| 200 Main St.
2952| Berkeley, CA 94718
2953\f[R]
2954.fi
2955.PP
2956The lines can be hard-wrapped if needed, but the continuation line must
2957begin with a space.
2958.IP
2959.nf
2960\f[C]
2961| The Right Honorable Most Venerable and Righteous Samuel L.
2962 Constable, Jr.
2963| 200 Main St.
2964| Berkeley, CA 94718
2965\f[R]
2966.fi
2967.PP
2968This syntax is borrowed from reStructuredText.
2969.SS Lists
2970.SS Bullet lists
2971.PP
2972A bullet list is a list of bulleted list items.
2973A bulleted list item begins with a bullet (\f[C]*\f[R], \f[C]+\f[R], or
2974\f[C]-\f[R]).
2975Here is a simple example:
2976.IP
2977.nf
2978\f[C]
2979* one
2980* two
2981* three
2982\f[R]
2983.fi
2984.PP
2985This will produce a \[dq]compact\[dq] list.
2986If you want a \[dq]loose\[dq] list, in which each item is formatted as a
2987paragraph, put spaces between the items:
2988.IP
2989.nf
2990\f[C]
2991* one
2993* two
2995* three
2996\f[R]
2997.fi
2998.PP
2999The bullets need not be flush with the left margin; they may be indented
3000one, two, or three spaces.
3001The bullet must be followed by whitespace.
3002.PP
3003List items look best if subsequent lines are flush with the first line
3004(after the bullet):
3005.IP
3006.nf
3007\f[C]
3008* here is my first
3009 list item.
3010* and my second.
3011\f[R]
3012.fi
3013.PP
3014But Markdown also allows a \[dq]lazy\[dq] format:
3015.IP
3016.nf
3017\f[C]
3018* here is my first
3019list item.
3020* and my second.
3021\f[R]
3022.fi
3023.SS Block content in list items
3024.PP
3025A list item may contain multiple paragraphs and other block-level
3026content.
3027However, subsequent paragraphs must be preceded by a blank line and
3028indented to line up with the first non-space content after the list
3029marker.
3030.IP
3031.nf
3032\f[C]
3033 * First paragraph.
3035 Continued.
3037 * Second paragraph. With a code block, which must be indented
3038 eight spaces:
3040 { code }
3041\f[R]
3042.fi
3043.PP
3044Exception: if the list marker is followed by an indented code block,
3045which must begin 5 spaces after the list marker, then subsequent
3046paragraphs must begin two columns after the last character of the list
3047marker:
3048.IP
3049.nf
3050\f[C]
3051* code
3053 continuation paragraph
3054\f[R]
3055.fi
3056.PP
3057List items may include other lists.
3058In this case the preceding blank line is optional.
3059The nested list must be indented to line up with the first non-space
3060character after the list marker of the containing list item.
3061.IP
3062.nf
3063\f[C]
3064* fruits
3065 + apples
3066 - macintosh
3067 - red delicious
3068 + pears
3069 + peaches
3070* vegetables
3071 + broccoli
3072 + chard
3073\f[R]
3074.fi
3075.PP
3076As noted above, Markdown allows you to write list items
3077\[dq]lazily,\[dq] instead of indenting continuation lines.
3078However, if there are multiple paragraphs or other blocks in a list
3079item, the first line of each must be indented.
3080.IP
3081.nf
3082\f[C]
3083+ A lazy, lazy, list
3084item.
3086+ Another one; this looks
3087bad but is legal.
3089 Second paragraph of second
3090list item.
3091\f[R]
3092.fi
3093.SS Ordered lists
3094.PP
3095Ordered lists work just like bulleted lists, except that the items begin
3096with enumerators rather than bullets.
3097.PP
3098In standard Markdown, enumerators are decimal numbers followed by a
3099period and a space.
3100The numbers themselves are ignored, so there is no difference between
3101this list:
3102.IP
3103.nf
3104\f[C]
31051. one
31062. two
31073. three
3108\f[R]
3109.fi
3110.PP
3111and this one:
3112.IP
3113.nf
3114\f[C]
31155. one
31167. two
31171. three
3118\f[R]
3119.fi
3120.SS Extension: \f[C]fancy_lists\f[R]
3121.PP
3122Unlike standard Markdown, pandoc allows ordered list items to be marked
3123with uppercase and lowercase letters and roman numerals, in addition to
3124Arabic numerals.
3125List markers may be enclosed in parentheses or followed by a single
3126right-parentheses or period.
3127They must be separated from the text that follows by at least one space,
3128and, if the list marker is a capital letter with a period, by at least
3129two spaces.
3130.PP
3131The \f[C]fancy_lists\f[R] extension also allows \[aq]\f[C]#\f[R]\[aq] to
3132be used as an ordered list marker in place of a numeral:
3133.IP
3134.nf
3135\f[C]
3136#. one
3137#. two
3138\f[R]
3139.fi
3140.SS Extension: \f[C]startnum\f[R]
3141.PP
3142Pandoc also pays attention to the type of list marker used, and to the
3143starting number, and both of these are preserved where possible in the
3144output format.
3145Thus, the following yields a list with numbers followed by a single
3146parenthesis, starting with 9, and a sublist with lowercase roman
3147numerals:
3148.IP
3149.nf
3150\f[C]
3151 9) Ninth
315210) Tenth
315311) Eleventh
3154 i. subone
3155 ii. subtwo
3156 iii. subthree
3157\f[R]
3158.fi
3159.PP
3160Pandoc will start a new list each time a different type of list marker
3161is used.
3162So, the following will create three lists:
3163.IP
3164.nf
3165\f[C]
3166(2) Two
3167(5) Three
31681. Four
3169* Five
3170\f[R]
3171.fi
3172.PP
3173If default list markers are desired, use \f[C]#.\f[R]:
3174.IP
3175.nf
3176\f[C]
3177#. one
3178#. two
3179#. three
3180\f[R]
3181.fi
3182.SS Extension: \f[C]task_lists\f[R]
3183.PP
3184Pandoc supports task lists, using the syntax of GitHub-Flavored
3185Markdown.
3186.IP
3187.nf
3188\f[C]
3189- [ ] an unchecked task list item
3190- [x] checked item
3191\f[R]
3192.fi
3193.SS Definition lists
3194.SS Extension: \f[C]definition_lists\f[R]
3195.PP
3196Pandoc supports definition lists, using the syntax of PHP Markdown Extra
3197with some extensions.
3198.IP
3199.nf
3200\f[C]
3201Term 1
3203: Definition 1
3205Term 2 with *inline markup*
3207: Definition 2
3209 { some code, part of Definition 2 }
3211 Third paragraph of definition 2.
3212\f[R]
3213.fi
3214.PP
3215Each term must fit on one line, which may optionally be followed by a
3216blank line, and must be followed by one or more definitions.
3217A definition begins with a colon or tilde, which may be indented one or
3218two spaces.
3219.PP
3220A term may have multiple definitions, and each definition may consist of
3221one or more block elements (paragraph, code block, list, etc.), each
3222indented four spaces or one tab stop.
3223The body of the definition (including the first line, aside from the
3224colon or tilde) should be indented four spaces.
3225However, as with other Markdown lists, you can \[dq]lazily\[dq] omit
3226indentation except at the beginning of a paragraph or other block
3227element:
3228.IP
3229.nf
3230\f[C]
3231Term 1
3233: Definition
3234with lazy continuation.
3236 Second paragraph of the definition.
3237\f[R]
3238.fi
3239.PP
3240If you leave space before the definition (as in the example above), the
3241text of the definition will be treated as a paragraph.
3242In some output formats, this will mean greater spacing between
3243term/definition pairs.
3244For a more compact definition list, omit the space before the
3245definition:
3246.IP
3247.nf
3248\f[C]
3249Term 1
3250 \[ti] Definition 1
3252Term 2
3253 \[ti] Definition 2a
3254 \[ti] Definition 2b
3255\f[R]
3256.fi
3257.PP
3258Note that space between items in a definition list is required.
3259(A variant that loosens this requirement, but disallows \[dq]lazy\[dq]
3260hard wrapping, can be activated with \f[C]compact_definition_lists\f[R]:
3261see Non-pandoc extensions, below.)
3262.SS Numbered example lists
3263.SS Extension: \f[C]example_lists\f[R]
3264.PP
3265The special list marker \f[C]\[at]\f[R] can be used for sequentially
3266numbered examples.
3267The first list item with a \f[C]\[at]\f[R] marker will be numbered
3268\[aq]1\[aq], the next \[aq]2\[aq], and so on, throughout the document.
3269The numbered examples need not occur in a single list; each new list
3270using \f[C]\[at]\f[R] will take up where the last stopped.
3271So, for example:
3272.IP
3273.nf
3274\f[C]
3275(\[at]) My first example will be numbered (1).
3276(\[at]) My second example will be numbered (2).
3278Explanation of examples.
3280(\[at]) My third example will be numbered (3).
3281\f[R]
3282.fi
3283.PP
3284Numbered examples can be labeled and referred to elsewhere in the
3285document:
3286.IP
3287.nf
3288\f[C]
3289(\[at]good) This is a good example.
3291As (\[at]good) illustrates, ...
3292\f[R]
3293.fi
3294.PP
3295The label can be any string of alphanumeric characters, underscores, or
3296hyphens.
3297.PP
3298Note: continuation paragraphs in example lists must always be indented
3299four spaces, regardless of the length of the list marker.
3300That is, example lists always behave as if the \f[C]four_space_rule\f[R]
3301extension is set.
3302This is because example labels tend to be long, and indenting content to
3303the first non-space character after the label would be awkward.
3304.SS Compact and loose lists
3305.PP
3306Pandoc behaves differently from \f[C]Markdown.pl\f[R] on some \[dq]edge
3307cases\[dq] involving lists.
3308Consider this source:
3309.IP
3310.nf
3311\f[C]
3312+ First
3313+ Second:
3314 - Fee
3315 - Fie
3316 - Foe
3318+ Third
3319\f[R]
3320.fi
3321.PP
3322Pandoc transforms this into a \[dq]compact list\[dq] (with no
3323\f[C]<p>\f[R] tags around \[dq]First\[dq], \[dq]Second\[dq], or
3324\[dq]Third\[dq]), while Markdown puts \f[C]<p>\f[R] tags around
3325\[dq]Second\[dq] and \[dq]Third\[dq] (but not \[dq]First\[dq]), because
3326of the blank space around \[dq]Third\[dq].
3327Pandoc follows a simple rule: if the text is followed by a blank line,
3328it is treated as a paragraph.
3329Since \[dq]Second\[dq] is followed by a list, and not a blank line, it
3330isn\[aq]t treated as a paragraph.
3331The fact that the list is followed by a blank line is irrelevant.
3332(Note: Pandoc works this way even when the \f[C]markdown_strict\f[R]
3333format is specified.
3334This behavior is consistent with the official Markdown syntax
3335description, even though it is different from that of
3336\f[C]Markdown.pl\f[R].)
3337.SS Ending a list
3338.PP
3339What if you want to put an indented code block after a list?
3340.IP
3341.nf
3342\f[C]
3343- item one
3344- item two
3346 { my code block }
3347\f[R]
3348.fi
3349.PP
3350Trouble! Here pandoc (like other Markdown implementations) will treat
3351\f[C]{ my code block }\f[R] as the second paragraph of item two, and not
3352as a code block.
3353.PP
3354To \[dq]cut off\[dq] the list after item two, you can insert some
3355non-indented content, like an HTML comment, which won\[aq]t produce
3356visible output in any format:
3357.IP
3358.nf
3359\f[C]
3360- item one
3361- item two
3363<!-- end of list -->
3365 { my code block }
3366\f[R]
3367.fi
3368.PP
3369You can use the same trick if you want two consecutive lists instead of
3370one big list:
3371.IP
3372.nf
3373\f[C]
33741. one
33752. two
33763. three
3378<!-- -->
33801. uno
33812. dos
33823. tres
3383\f[R]
3384.fi
3385.SS Horizontal rules
3386.PP
3387A line containing a row of three or more \f[C]*\f[R], \f[C]-\f[R], or
3388\f[C]_\f[R] characters (optionally separated by spaces) produces a
3389horizontal rule:
3390.IP
3391.nf
3392\f[C]
3393* * * *
3395---------------
3396\f[R]
3397.fi
3398.SS Tables
3399.PP
3400Four kinds of tables may be used.
3401The first three kinds presuppose the use of a fixed-width font, such as
3402Courier.
3403The fourth kind can be used with proportionally spaced fonts, as it does
3404not require lining up columns.
3405.SS Extension: \f[C]table_captions\f[R]
3406.PP
3407A caption may optionally be provided with all 4 kinds of tables (as
3408illustrated in the examples below).
3409A caption is a paragraph beginning with the string \f[C]Table:\f[R] (or
3410just \f[C]:\f[R]), which will be stripped off.
3411It may appear either before or after the table.
3412.SS Extension: \f[C]simple_tables\f[R]
3413.PP
3414Simple tables look like this:
3415.IP
3416.nf
3417\f[C]
3418 Right Left Center Default
3419------- ------ ---------- -------
3420 12 12 12 12
3421 123 123 123 123
3422 1 1 1 1
3424Table: Demonstration of simple table syntax.
3425\f[R]
3426.fi
3427.PP
3428The header and table rows must each fit on one line.
3429Column alignments are determined by the position of the header text
3430relative to the dashed line below it:
3431.IP \[bu] 2
3432If the dashed line is flush with the header text on the right side but
3433extends beyond it on the left, the column is right-aligned.
3434.IP \[bu] 2
3435If the dashed line is flush with the header text on the left side but
3436extends beyond it on the right, the column is left-aligned.
3437.IP \[bu] 2
3438If the dashed line extends beyond the header text on both sides, the
3439column is centered.
3440.IP \[bu] 2
3441If the dashed line is flush with the header text on both sides, the
3442default alignment is used (in most cases, this will be left).
3443.PP
3444The table must end with a blank line, or a line of dashes followed by a
3445blank line.
3446.PP
3447The column header row may be omitted, provided a dashed line is used to
3448end the table.
3449For example:
3450.IP
3451.nf
3452\f[C]
3453------- ------ ---------- -------
3454 12 12 12 12
3455 123 123 123 123
3456 1 1 1 1
3457------- ------ ---------- -------
3458\f[R]
3459.fi
3460.PP
3461When the header row is omitted, column alignments are determined on the
3462basis of the first line of the table body.
3463So, in the tables above, the columns would be right, left, center, and
3464right aligned, respectively.
3465.SS Extension: \f[C]multiline_tables\f[R]
3466.PP
3467Multiline tables allow header and table rows to span multiple lines of
3468text (but cells that span multiple columns or rows of the table are not
3469supported).
3470Here is an example:
3471.IP
3472.nf
3473\f[C]
3474-------------------------------------------------------------
3475 Centered Default Right Left
3476 Header Aligned Aligned Aligned
3477----------- ------- --------------- -------------------------
3478 First row 12.0 Example of a row that
3479 spans multiple lines.
3481 Second row 5.0 Here\[aq]s another one. Note
3482 the blank line between
3483 rows.
3484-------------------------------------------------------------
3486Table: Here\[aq]s the caption. It, too, may span
3487multiple lines.
3488\f[R]
3489.fi
3490.PP
3491These work like simple tables, but with the following differences:
3492.IP \[bu] 2
3493They must begin with a row of dashes, before the header text (unless the
3494header row is omitted).
3495.IP \[bu] 2
3496They must end with a row of dashes, then a blank line.
3497.IP \[bu] 2
3498The rows must be separated by blank lines.
3499.PP
3500In multiline tables, the table parser pays attention to the widths of
3501the columns, and the writers try to reproduce these relative widths in
3502the output.
3503So, if you find that one of the columns is too narrow in the output, try
3504widening it in the Markdown source.
3505.PP
3506The header may be omitted in multiline tables as well as simple tables:
3507.IP
3508.nf
3509\f[C]
3510----------- ------- --------------- -------------------------
3511 First row 12.0 Example of a row that
3512 spans multiple lines.
3514 Second row 5.0 Here\[aq]s another one. Note
3515 the blank line between
3516 rows.
3517----------- ------- --------------- -------------------------
3519: Here\[aq]s a multiline table without a header.
3520\f[R]
3521.fi
3522.PP
3523It is possible for a multiline table to have just one row, but the row
3524should be followed by a blank line (and then the row of dashes that ends
3525the table), or the table may be interpreted as a simple table.
3526.SS Extension: \f[C]grid_tables\f[R]
3527.PP
3528Grid tables look like this:
3529.IP
3530.nf
3531\f[C]
3532: Sample grid table.
3534+---------------+---------------+--------------------+
3535| Fruit | Price | Advantages |
3536+===============+===============+====================+
3537| Bananas | $1.34 | - built-in wrapper |
3538| | | - bright color |
3539+---------------+---------------+--------------------+
3540| Oranges | $2.10 | - cures scurvy |
3541| | | - tasty |
3542+---------------+---------------+--------------------+
3543\f[R]
3544.fi
3545.PP
3546The row of \f[C]=\f[R]s separates the header from the table body, and
3547can be omitted for a headerless table.
3548The cells of grid tables may contain arbitrary block elements (multiple
3549paragraphs, code blocks, lists, etc.).
3550Cells that span multiple columns or rows are not supported.
3551Grid tables can be created easily using Emacs table mode.
3552.PP
3553Alignments can be specified as with pipe tables, by putting colons at
3554the boundaries of the separator line after the header:
3555.IP
3556.nf
3557\f[C]
3558+---------------+---------------+--------------------+
3559| Right | Left | Centered |
3560+==============:+:==============+:==================:+
3561| Bananas | $1.34 | built-in wrapper |
3562+---------------+---------------+--------------------+
3563\f[R]
3564.fi
3565.PP
3566For headerless tables, the colons go on the top line instead:
3567.IP
3568.nf
3569\f[C]
3570+--------------:+:--------------+:------------------:+
3571| Right | Left | Centered |
3572+---------------+---------------+--------------------+
3573\f[R]
3574.fi
3575.SS Grid Table Limitations
3576.PP
3577Pandoc does not support grid tables with row spans or column spans.
3578This means that neither variable numbers of columns across rows nor
3579variable numbers of rows across columns are supported by Pandoc.
3580All grid tables must have the same number of columns in each row, and
3581the same number of rows in each column.
3582For example, the Docutils sample grid tables will not render as expected
3583with Pandoc.
3584.SS Extension: \f[C]pipe_tables\f[R]
3585.PP
3586Pipe tables look like this:
3587.IP
3588.nf
3589\f[C]
3590| Right | Left | Default | Center |
3591|------:|:-----|---------|:------:|
3592| 12 | 12 | 12 | 12 |
3593| 123 | 123 | 123 | 123 |
3594| 1 | 1 | 1 | 1 |
3596 : Demonstration of pipe table syntax.
3597\f[R]
3598.fi
3599.PP
3600The syntax is identical to PHP Markdown Extra tables.
3601The beginning and ending pipe characters are optional, but pipes are
3602required between all columns.
3603The colons indicate column alignment as shown.
3604The header cannot be omitted.
3605To simulate a headerless table, include a header with blank cells.
3606.PP
3607Since the pipes indicate column boundaries, columns need not be
3608vertically aligned, as they are in the above example.
3609So, this is a perfectly legal (though ugly) pipe table:
3610.IP
3611.nf
3612\f[C]
3613fruit| price
3614-----|-----:
3615apple|2.05
3616pear|1.37
3617orange|3.09
3618\f[R]
3619.fi
3620.PP
3621The cells of pipe tables cannot contain block elements like paragraphs
3622and lists, and cannot span multiple lines.
3623If a pipe table contains a row whose printable content is wider than the
3624column width (see \f[C]--columns\f[R]), then the table will take up the
3625full text width and the cell contents will wrap, with the relative cell
3626widths determined by the number of dashes in the line separating the
3627table header from the table body.
3628(For example \f[C]---|-\f[R] would make the first column 3/4 and the
3629second column 1/4 of the full text width.) On the other hand, if no
3630lines are wider than column width, then cell contents will not be
3631wrapped, and the cells will be sized to their contents.
3632.PP
3633Note: pandoc also recognizes pipe tables of the following form, as can
3634be produced by Emacs\[aq] orgtbl-mode:
3635.IP
3636.nf
3637\f[C]
3638| One | Two |
3639|-----+-------|
3640| my | table |
3641| is | nice |
3642\f[R]
3643.fi
3644.PP
3645The difference is that \f[C]+\f[R] is used instead of \f[C]|\f[R].
3646Other orgtbl features are not supported.
3647In particular, to get non-default column alignment, you\[aq]ll need to
3648add colons as above.
3649.SS Metadata blocks
3650.SS Extension: \f[C]pandoc_title_block\f[R]
3651.PP
3652If the file begins with a title block
3653.IP
3654.nf
3655\f[C]
3656% title
3657% author(s) (separated by semicolons)
3658% date
3659\f[R]
3660.fi
3661.PP
3662it will be parsed as bibliographic information, not regular text.
3663(It will be used, for example, in the title of standalone LaTeX or HTML
3664output.) The block may contain just a title, a title and an author, or
3665all three elements.
3666If you want to include an author but no title, or a title and a date but
3667no author, you need a blank line:
3668.IP
3669.nf
3670\f[C]
3672% Author
3674% My title
3676% June 15, 2006
3677\f[R]
3678.fi
3679.PP
3680The title may occupy multiple lines, but continuation lines must begin
3681with leading space, thus:
3682.IP
3683.nf
3684\f[C]
3685% My title
3686 on multiple lines
3687\f[R]
3688.fi
3689.PP
3690If a document has multiple authors, the authors may be put on separate
3691lines with leading space, or separated by semicolons, or both.
3692So, all of the following are equivalent:
3693.IP
3694.nf
3695\f[C]
3696% Author One
3697 Author Two
3699% Author One; Author Two
3701% Author One;
3702 Author Two
3703\f[R]
3704.fi
3705.PP
3706The date must fit on one line.
3707.PP
3708All three metadata fields may contain standard inline formatting
3709(italics, links, footnotes, etc.).
3710.PP
3711Title blocks will always be parsed, but they will affect the output only
3712when the \f[C]--standalone\f[R] (\f[C]-s\f[R]) option is chosen.
3713In HTML output, titles will appear twice: once in the document head --
3714this is the title that will appear at the top of the window in a browser
3715-- and once at the beginning of the document body.
3716The title in the document head can have an optional prefix attached
3717(\f[C]--title-prefix\f[R] or \f[C]-T\f[R] option).
3718The title in the body appears as an H1 element with class
3719\[dq]title\[dq], so it can be suppressed or reformatted with CSS.
3720If a title prefix is specified with \f[C]-T\f[R] and no title block
3721appears in the document, the title prefix will be used by itself as the
3722HTML title.
3723.PP
3724The man page writer extracts a title, man page section number, and other
3725header and footer information from the title line.
3726The title is assumed to be the first word on the title line, which may
3727optionally end with a (single-digit) section number in parentheses.
3728(There should be no space between the title and the parentheses.)
3729Anything after this is assumed to be additional footer and header text.
3730A single pipe character (\f[C]|\f[R]) should be used to separate the
3731footer text from the header text.
3732Thus,
3733.IP
3734.nf
3735\f[C]
3736% PANDOC(1)
3737\f[R]
3738.fi
3739.PP
3740will yield a man page with the title \f[C]PANDOC\f[R] and section 1.
3741.IP
3742.nf
3743\f[C]
3744% PANDOC(1) Pandoc User Manuals
3745\f[R]
3746.fi
3747.PP
3748will also have \[dq]Pandoc User Manuals\[dq] in the footer.
3749.IP
3750.nf
3751\f[C]
3752% PANDOC(1) Pandoc User Manuals | Version 4.0
3753\f[R]
3754.fi
3755.PP
3756will also have \[dq]Version 4.0\[dq] in the header.
3757.SS Extension: \f[C]yaml_metadata_block\f[R]
3758.PP
3759A YAML metadata block is a valid YAML object, delimited by a line of
3760three hyphens (\f[C]---\f[R]) at the top and a line of three hyphens
3761(\f[C]---\f[R]) or three dots (\f[C]...\f[R]) at the bottom.
3762A YAML metadata block may occur anywhere in the document, but if it is
3763not at the beginning, it must be preceded by a blank line.
3764(Note that, because of the way pandoc concatenates input files when
3765several are provided, you may also keep the metadata in a separate YAML
3766file and pass it to pandoc as an argument, along with your Markdown
3767files:
3768.IP
3769.nf
3770\f[C]
3771pandoc chap1.md chap2.md chap3.md metadata.yaml -s -o book.html
3772\f[R]
3773.fi
3774.PP
3775Just be sure that the YAML file begins with \f[C]---\f[R] and ends with
3776\f[C]---\f[R] or \f[C]...\f[R].) Alternatively, you can use the
3777\f[C]--metadata-file\f[R] option.
3778Using that approach however, you cannot reference content (like
3779footnotes) from the main markdown input document.
3780.PP
3781Metadata will be taken from the fields of the YAML object and added to
3782any existing document metadata.
3783Metadata can contain lists and objects (nested arbitrarily), but all
3784string scalars will be interpreted as Markdown.
3785Fields with names ending in an underscore will be ignored by pandoc.
3786(They may be given a role by external processors.) Field names must not
3787be interpretable as YAML numbers or boolean values (so, for example,
3788\f[C]yes\f[R], \f[C]True\f[R], and \f[C]15\f[R] cannot be used as field
3789names).
3790.PP
3791A document may contain multiple metadata blocks.
3792The metadata fields will be combined through a \f[I]left-biased
3793union\f[R]: if two metadata blocks attempt to set the same field, the
3794value from the first block will be taken.
3795.PP
3796When pandoc is used with \f[C]-t markdown\f[R] to create a Markdown
3797document, a YAML metadata block will be produced only if the
3798\f[C]-s/--standalone\f[R] option is used.
3799All of the metadata will appear in a single block at the beginning of
3800the document.
3801.PP
3802Note that YAML escaping rules must be followed.
3803Thus, for example, if a title contains a colon, it must be quoted.
3804The pipe character (\f[C]|\f[R]) can be used to begin an indented block
3805that will be interpreted literally, without need for escaping.
3806This form is necessary when the field contains blank lines or
3807block-level formatting:
3808.IP
3809.nf
3810\f[C]
3811---
3812title: \[aq]This is the title: it contains a colon\[aq]
3813author:
3814- Author One
3815- Author Two
3816keywords: [nothing, nothingness]
3817abstract: |
3818 This is the abstract.
3820 It consists of two paragraphs.
3821\&...
3822\f[R]
3823.fi
3824.PP
3825Template variables will be set automatically from the metadata.
3826Thus, for example, in writing HTML, the variable \f[C]abstract\f[R] will
3827be set to the HTML equivalent of the Markdown in the \f[C]abstract\f[R]
3828field:
3829.IP
3830.nf
3831\f[C]
3832<p>This is the abstract.</p>
3833<p>It consists of two paragraphs.</p>
3834\f[R]
3835.fi
3836.PP
3837Variables can contain arbitrary YAML structures, but the template must
3838match this structure.
3839The \f[C]author\f[R] variable in the default templates expects a simple
3840list or string, but can be changed to support more complicated
3841structures.
3842The following combination, for example, would add an affiliation to the
3843author if one is given:
3844.IP
3845.nf
3846\f[C]
3847---
3848title: The document title
3849author:
3850- name: Author One
3851 affiliation: University of Somewhere
3852- name: Author Two
3853 affiliation: University of Nowhere
3854\&...
3855\f[R]
3856.fi
3857.PP
3858To use the structured authors in the example above, you would need a
3859custom template:
3860.IP
3861.nf
3862\f[C]
3863$for(author)$
3864$if(author.name)$
3865$author.name$$if(author.affiliation)$ ($author.affiliation$)$endif$
3866$else$
3867$author$
3868$endif$
3869$endfor$
3870\f[R]
3871.fi
3872.PP
3873Raw content to include in the document\[aq]s header may be specified
3874using \f[C]header-includes\f[R]; however, it is important to mark up
3875this content as raw code for a particular output format, using the
3876\f[C]raw_attribute\f[R] extension), or it will be interpreted as
3877markdown.
3878For example:
3879.IP
3880.nf
3881\f[C]
3882header-includes:
3883- |
3884 \[ga]\[ga]\[ga]{=latex}
3885 \[rs]let\[rs]oldsection\[rs]section
3886 \[rs]renewcommand{\[rs]section}[1]{\[rs]clearpage\[rs]oldsection{#1}}
3887 \[ga]\[ga]\[ga]
3888\f[R]
3889.fi
3890.SS Backslash escapes
3891.SS Extension: \f[C]all_symbols_escapable\f[R]
3892.PP
3893Except inside a code block or inline code, any punctuation or space
3894character preceded by a backslash will be treated literally, even if it
3895would normally indicate formatting.
3896Thus, for example, if one writes
3897.IP
3898.nf
3899\f[C]
3900*\[rs]*hello\[rs]**
3901\f[R]
3902.fi
3903.PP
3904one will get
3905.IP
3906.nf
3907\f[C]
3908<em>*hello*</em>
3909\f[R]
3910.fi
3911.PP
3912instead of
3913.IP
3914.nf
3915\f[C]
3916<strong>hello</strong>
3917\f[R]
3918.fi
3919.PP
3920This rule is easier to remember than standard Markdown\[aq]s rule, which
3921allows only the following characters to be backslash-escaped:
3922.IP
3923.nf
3924\f[C]
3925\[rs]\[ga]*_{}[]()>#+-.!
3926\f[R]
3927.fi
3928.PP
3929(However, if the \f[C]markdown_strict\f[R] format is used, the standard
3930Markdown rule will be used.)
3931.PP
3932A backslash-escaped space is parsed as a nonbreaking space.
3933It will appear in TeX output as \f[C]\[ti]\f[R] and in HTML and XML as
3934\f[C]\[rs]&#160;\f[R] or \f[C]\[rs]&nbsp;\f[R].
3935.PP
3936A backslash-escaped newline (i.e.
3937a backslash occurring at the end of a line) is parsed as a hard line
3938break.
3939It will appear in TeX output as \f[C]\[rs]\[rs]\f[R] and in HTML as
3940\f[C]<br />\f[R].
3941This is a nice alternative to Markdown\[aq]s \[dq]invisible\[dq] way of
3942indicating hard line breaks using two trailing spaces on a line.
3943.PP
3944Backslash escapes do not work in verbatim contexts.
3945.SS Inline formatting
3946.SS Emphasis
3947.PP
3948To \f[I]emphasize\f[R] some text, surround it with \f[C]*\f[R]s or
3949\f[C]_\f[R], like this:
3950.IP
3951.nf
3952\f[C]
3953This text is _emphasized with underscores_, and this
3954is *emphasized with asterisks*.
3955\f[R]
3956.fi
3957.PP
3958Double \f[C]*\f[R] or \f[C]_\f[R] produces \f[B]strong emphasis\f[R]:
3959.IP
3960.nf
3961\f[C]
3962This is **strong emphasis** and __with underscores__.
3963\f[R]
3964.fi
3965.PP
3966A \f[C]*\f[R] or \f[C]_\f[R] character surrounded by spaces, or
3967backslash-escaped, will not trigger emphasis:
3968.IP
3969.nf
3970\f[C]
3971This is * not emphasized *, and \[rs]*neither is this\[rs]*.
3972\f[R]
3973.fi
3974.SS Extension: \f[C]intraword_underscores\f[R]
3975.PP
3976Because \f[C]_\f[R] is sometimes used inside words and identifiers,
3977pandoc does not interpret a \f[C]_\f[R] surrounded by alphanumeric
3978characters as an emphasis marker.
3979If you want to emphasize just part of a word, use \f[C]*\f[R]:
3980.IP
3981.nf
3982\f[C]
3983feas*ible*, not feas*able*.
3984\f[R]
3985.fi
3986.SS Strikeout
3987.SS Extension: \f[C]strikeout\f[R]
3988.PP
3989To strikeout a section of text with a horizontal line, begin and end it
3990with \f[C]\[ti]\[ti]\f[R].
3991Thus, for example,
3992.IP
3993.nf
3994\f[C]
3995This \[ti]\[ti]is deleted text.\[ti]\[ti]
3996\f[R]
3997.fi
3998.SS Superscripts and subscripts
3999.SS Extension: \f[C]superscript\f[R], \f[C]subscript\f[R]
4000.PP
4001Superscripts may be written by surrounding the superscripted text by
4002\f[C]\[ha]\f[R] characters; subscripts may be written by surrounding the
4003subscripted text by \f[C]\[ti]\f[R] characters.
4004Thus, for example,
4005.IP
4006.nf
4007\f[C]
4008H\[ti]2\[ti]O is a liquid. 2\[ha]10\[ha] is 1024.
4009\f[R]
4010.fi
4011.PP
4012If the superscripted or subscripted text contains spaces, these spaces
4013must be escaped with backslashes.
4014(This is to prevent accidental superscripting and subscripting through
4015the ordinary use of \f[C]\[ti]\f[R] and \f[C]\[ha]\f[R].) Thus, if you
4016want the letter P with \[aq]a cat\[aq] in subscripts, use
4017\f[C]P\[ti]a\[rs] cat\[ti]\f[R], not \f[C]P\[ti]a cat\[ti]\f[R].
4018.SS Verbatim
4019.PP
4020To make a short span of text verbatim, put it inside backticks:
4021.IP
4022.nf
4023\f[C]
4024What is the difference between \[ga]>>=\[ga] and \[ga]>>\[ga]?
4025\f[R]
4026.fi
4027.PP
4028If the verbatim text includes a backtick, use double backticks:
4029.IP
4030.nf
4031\f[C]
4032Here is a literal backtick \[ga]\[ga] \[ga] \[ga]\[ga].
4033\f[R]
4034.fi
4035.PP
4036(The spaces after the opening backticks and before the closing backticks
4037will be ignored.)
4038.PP
4039The general rule is that a verbatim span starts with a string of
4040consecutive backticks (optionally followed by a space) and ends with a
4041string of the same number of backticks (optionally preceded by a space).
4042.PP
4043Note that backslash-escapes (and other Markdown constructs) do not work
4044in verbatim contexts:
4045.IP
4046.nf
4047\f[C]
4048This is a backslash followed by an asterisk: \[ga]\[rs]*\[ga].
4049\f[R]
4050.fi
4051.SS Extension: \f[C]inline_code_attributes\f[R]
4052.PP
4053Attributes can be attached to verbatim text, just as with fenced code
4054blocks:
4055.IP
4056.nf
4057\f[C]
4058\[ga]<$>\[ga]{.haskell}
4059\f[R]
4060.fi
4061.SS Small caps
4062.PP
4063To write small caps, use the \f[C]smallcaps\f[R] class:
4064.IP
4065.nf
4066\f[C]
4067[Small caps]{.smallcaps}
4068\f[R]
4069.fi
4070.PP
4071Or, without the \f[C]bracketed_spans\f[R] extension:
4072.IP
4073.nf
4074\f[C]
4075<span class=\[dq]smallcaps\[dq]>Small caps</span>
4076\f[R]
4077.fi
4078.PP
4079For compatibility with other Markdown flavors, CSS is also supported:
4080.IP
4081.nf
4082\f[C]
4083<span style=\[dq]font-variant:small-caps;\[dq]>Small caps</span>
4084\f[R]
4085.fi
4086.PP
4087This will work in all output formats that support small caps.
4088.SS Math
4089.SS Extension: \f[C]tex_math_dollars\f[R]
4090.PP
4091Anything between two \f[C]$\f[R] characters will be treated as TeX math.
4092The opening \f[C]$\f[R] must have a non-space character immediately to
4093its right, while the closing \f[C]$\f[R] must have a non-space character
4094immediately to its left, and must not be followed immediately by a
4095digit.
4096Thus, \f[C]$20,000 and $30,000\f[R] won\[aq]t parse as math.
4097If for some reason you need to enclose text in literal \f[C]$\f[R]
4098characters, backslash-escape them and they won\[aq]t be treated as math
4099delimiters.
4100.PP
4101TeX math will be printed in all output formats.
4102How it is rendered depends on the output format:
4103.TP
4104.B LaTeX
4105It will appear verbatim surrounded by \f[C]\[rs](...\[rs])\f[R] (for
4106inline math) or \f[C]\[rs][...\[rs]]\f[R] (for display math).
4107.TP
4108.B Markdown, Emacs Org mode, ConTeXt, ZimWiki
4109It will appear verbatim surrounded by \f[C]$...$\f[R] (for inline math)
4110or \f[C]$$...$$\f[R] (for display math).
4111.TP
4112.B XWiki
4113It will appear verbatim surrounded by
4114\f[C]{{formula}}..{{/formula}}\f[R].
4115.TP
4116.B reStructuredText
4117It will be rendered using an interpreted text role \f[C]:math:\f[R].
4118.TP
4119.B AsciiDoc
4120For AsciiDoc output format (\f[C]-t asciidoc\f[R]) it will appear
4121verbatim surrounded by \f[C]latexmath:[$...$]\f[R] (for inline math) or
4122\f[C][latexmath]++++\[rs][...\[rs]]+++\f[R] (for display math).
4123For AsciiDoctor output format (\f[C]-t asciidoctor\f[R]) the LaTex
4124delimiters (\f[C]$..$\f[R] and \f[C]\[rs][..\[rs]]\f[R]) are omitted.
4125.TP
4126.B Texinfo
4127It will be rendered inside a \f[C]\[at]math\f[R] command.
4128.TP
4129.B roff man
4130It will be rendered verbatim without \f[C]$\f[R]\[aq]s.
4131.TP
4132.B MediaWiki, DokuWiki
4133It will be rendered inside \f[C]<math>\f[R] tags.
4134.TP
4135.B Textile
4136It will be rendered inside \f[C]<span class=\[dq]math\[dq]>\f[R] tags.
4137.TP
4138.B RTF, OpenDocument
4139It will be rendered, if possible, using Unicode characters, and will
4140otherwise appear verbatim.
4141.TP
4142.B ODT
4143It will be rendered, if possible, using MathML.
4144.TP
4145.B DocBook
4146If the \f[C]--mathml\f[R] flag is used, it will be rendered using MathML
4147in an \f[C]inlineequation\f[R] or \f[C]informalequation\f[R] tag.
4148Otherwise it will be rendered, if possible, using Unicode characters.
4149.TP
4150.B Docx
4151It will be rendered using OMML math markup.
4152.TP
4153.B FictionBook2
4154If the \f[C]--webtex\f[R] option is used, formulas are rendered as
4155images using CodeCogs or other compatible web service, downloaded and
4156embedded in the e-book.
4157Otherwise, they will appear verbatim.
4158.TP
4159.B HTML, Slidy, DZSlides, S5, EPUB
4160The way math is rendered in HTML will depend on the command-line options
4161selected.
4162Therefore see Math rendering in HTML above.
4163.SS Raw HTML
4164.SS Extension: \f[C]raw_html\f[R]
4165.PP
4166Markdown allows you to insert raw HTML (or DocBook) anywhere in a
4167document (except verbatim contexts, where \f[C]<\f[R], \f[C]>\f[R], and
4168\f[C]&\f[R] are interpreted literally).
4169(Technically this is not an extension, since standard Markdown allows
4170it, but it has been made an extension so that it can be disabled if
4171desired.)
4172.PP
4173The raw HTML is passed through unchanged in HTML, S5, Slidy, Slideous,
4174DZSlides, EPUB, Markdown, CommonMark, Emacs Org mode, and Textile
4175output, and suppressed in other formats.
4176.PP
4177For a more explicit way of including raw HTML in a Markdown document,
4178see the \f[C]raw_attribute\f[R] extension.
4179.PP
4180In the CommonMark format, if \f[C]raw_html\f[R] is enabled,
4181superscripts, subscripts, strikeouts and small capitals will be
4182represented as HTML.
4183Otherwise, plain-text fallbacks will be used.
4184Note that even if \f[C]raw_html\f[R] is disabled, tables will be
4185rendered with HTML syntax if they cannot use pipe syntax.
4186.SS Extension: \f[C]markdown_in_html_blocks\f[R]
4187.PP
4188Standard Markdown allows you to include HTML \[dq]blocks\[dq]: blocks of
4189HTML between balanced tags that are separated from the surrounding text
4190with blank lines, and start and end at the left margin.
4191Within these blocks, everything is interpreted as HTML, not Markdown; so
4192(for example), \f[C]*\f[R] does not signify emphasis.
4193.PP
4194Pandoc behaves this way when the \f[C]markdown_strict\f[R] format is
4195used; but by default, pandoc interprets material between HTML block tags
4196as Markdown.
4197Thus, for example, pandoc will turn
4198.IP
4199.nf
4200\f[C]
4201<table>
4202<tr>
4203<td>*one*</td>
4204<td>[a link](http://google.com)</td>
4205</tr>
4206</table>
4207\f[R]
4208.fi
4209.PP
4210into
4211.IP
4212.nf
4213\f[C]
4214<table>
4215<tr>
4216<td><em>one</em></td>
4217<td><a href=\[dq]http://google.com\[dq]>a link</a></td>
4218</tr>
4219</table>
4220\f[R]
4221.fi
4222.PP
4223whereas \f[C]Markdown.pl\f[R] will preserve it as is.
4224.PP
4225There is one exception to this rule: text between \f[C]<script>\f[R] and
4226\f[C]<style>\f[R] tags is not interpreted as Markdown.
4227.PP
4228This departure from standard Markdown should make it easier to mix
4229Markdown with HTML block elements.
4230For example, one can surround a block of Markdown text with
4231\f[C]<div>\f[R] tags without preventing it from being interpreted as
4232Markdown.
4233.SS Extension: \f[C]native_divs\f[R]
4234.PP
4235Use native pandoc \f[C]Div\f[R] blocks for content inside
4236\f[C]<div>\f[R] tags.
4237For the most part this should give the same output as
4238\f[C]markdown_in_html_blocks\f[R], but it makes it easier to write
4239pandoc filters to manipulate groups of blocks.
4240.SS Extension: \f[C]native_spans\f[R]
4241.PP
4242Use native pandoc \f[C]Span\f[R] blocks for content inside
4243\f[C]<span>\f[R] tags.
4244For the most part this should give the same output as
4245\f[C]raw_html\f[R], but it makes it easier to write pandoc filters to
4246manipulate groups of inlines.
4247.SS Extension: \f[C]raw_tex\f[R]
4248.PP
4249In addition to raw HTML, pandoc allows raw LaTeX, TeX, and ConTeXt to be
4250included in a document.
4251Inline TeX commands will be preserved and passed unchanged to the LaTeX
4252and ConTeXt writers.
4253Thus, for example, you can use LaTeX to include BibTeX citations:
4254.IP
4255.nf
4256\f[C]
4257This result was proved in \[rs]cite{jones.1967}.
4258\f[R]
4259.fi
4260.PP
4261Note that in LaTeX environments, like
4262.IP
4263.nf
4264\f[C]
4265\[rs]begin{tabular}{|l|l|}\[rs]hline
4266Age & Frequency \[rs]\[rs] \[rs]hline
426718--25 & 15 \[rs]\[rs]
426826--35 & 33 \[rs]\[rs]
426936--45 & 22 \[rs]\[rs] \[rs]hline
4270\[rs]end{tabular}
4271\f[R]
4272.fi
4273.PP
4274the material between the begin and end tags will be interpreted as raw
4275LaTeX, not as Markdown.
4276.PP
4277For a more explicit and flexible way of including raw TeX in a Markdown
4278document, see the \f[C]raw_attribute\f[R] extension.
4279.PP
4280Inline LaTeX is ignored in output formats other than Markdown, LaTeX,
4281Emacs Org mode, and ConTeXt.
4282.SS Generic raw attribute
4283.SS Extension: \f[C]raw_attribute\f[R]
4284.PP
4285Inline spans and fenced code blocks with a special kind of attribute
4286will be parsed as raw content with the designated format.
4287For example, the following produces a raw roff \f[C]ms\f[R] block:
4288.IP
4289.nf
4290\f[C]
4291\[ga]\[ga]\[ga]{=ms}
4292\&.MYMACRO
4293blah blah
4294\[ga]\[ga]\[ga]
4295\f[R]
4296.fi
4297.PP
4298And the following produces a raw \f[C]html\f[R] inline element:
4299.IP
4300.nf
4301\f[C]
4302This is \[ga]<a>html</a>\[ga]{=html}
4303\f[R]
4304.fi
4305.PP
4306This can be useful to insert raw xml into \f[C]docx\f[R] documents, e.g.
4307a pagebreak:
4308.IP
4309.nf
4310\f[C]
4311\[ga]\[ga]\[ga]{=openxml}
4312<w:p>
4313 <w:r>
4314 <w:br w:type=\[dq]page\[dq]/>
4315 </w:r>
4316</w:p>
4317\[ga]\[ga]\[ga]
4318\f[R]
4319.fi
4320.PP
4321The format name should match the target format name (see
4322\f[C]-t/--to\f[R], above, for a list, or use
4323\f[C]pandoc --list-output-formats\f[R]).
4324Use \f[C]openxml\f[R] for \f[C]docx\f[R] output, \f[C]opendocument\f[R]
4325for \f[C]odt\f[R] output, \f[C]html5\f[R] for \f[C]epub3\f[R] output,
4326\f[C]html4\f[R] for \f[C]epub2\f[R] output, and \f[C]latex\f[R],
4327\f[C]beamer\f[R], \f[C]ms\f[R], or \f[C]html5\f[R] for \f[C]pdf\f[R]
4328output (depending on what you use for \f[C]--pdf-engine\f[R]).
4329.PP
4330This extension presupposes that the relevant kind of inline code or
4331fenced code block is enabled.
4332Thus, for example, to use a raw attribute with a backtick code block,
4333\f[C]backtick_code_blocks\f[R] must be enabled.
4334.PP
4335The raw attribute cannot be combined with regular attributes.
4336.SS LaTeX macros
4337.SS Extension: \f[C]latex_macros\f[R]
4338.PP
4339When this extension is enabled, pandoc will parse LaTeX macro
4340definitions and apply the resulting macros to all LaTeX math and raw
4341LaTeX.
4342So, for example, the following will work in all output formats, not just
4343LaTeX:
4344.IP
4345.nf
4346\f[C]
4347\[rs]newcommand{\[rs]tuple}[1]{\[rs]langle #1 \[rs]rangle}
4349$\[rs]tuple{a, b, c}$
4350\f[R]
4351.fi
4352.PP
4353Note that LaTeX macros will not be applied if they occur inside inside a
4354raw span or block marked with the \f[C]raw_attribute\f[R] extension.
4355.PP
4356When \f[C]latex_macros\f[R] is disabled, the raw LaTeX and math will not
4357have macros applied.
4358This is usually a better approach when you are targeting LaTeX or PDF.
4359.PP
4360Whether or not \f[C]latex_macros\f[R] is enabled, the macro definitions
4361will still be passed through as raw LaTeX.
4362.SS Links
4363.PP
4364Markdown allows links to be specified in several ways.
4365.SS Automatic links
4366.PP
4367If you enclose a URL or email address in pointy brackets, it will become
4368a link:
4369.IP
4370.nf
4371\f[C]
4372<http://google.com>
4373<sam\[at]green.eggs.ham>
4374\f[R]
4375.fi
4376.SS Inline links
4377.PP
4378An inline link consists of the link text in square brackets, followed by
4379the URL in parentheses.
4380(Optionally, the URL can be followed by a link title, in quotes.)
4381.IP
4382.nf
4383\f[C]
4384This is an [inline link](/url), and here\[aq]s [one with
4385a title](http://fsf.org \[dq]click here for a good time!\[dq]).
4386\f[R]
4387.fi
4388.PP
4389There can be no space between the bracketed part and the parenthesized
4390part.
4391The link text can contain formatting (such as emphasis), but the title
4392cannot.
4393.PP
4394Email addresses in inline links are not autodetected, so they have to be
4395prefixed with \f[C]mailto\f[R]:
4396.IP
4397.nf
4398\f[C]
4399[Write me!](mailto:sam\[at]green.eggs.ham)
4400\f[R]
4401.fi
4402.SS Reference links
4403.PP
4404An \f[I]explicit\f[R] reference link has two parts, the link itself and
4405the link definition, which may occur elsewhere in the document (either
4406before or after the link).
4407.PP
4408The link consists of link text in square brackets, followed by a label
4409in square brackets.
4410(There cannot be space between the two unless the
4411\f[C]spaced_reference_links\f[R] extension is enabled.) The link
4412definition consists of the bracketed label, followed by a colon and a
4413space, followed by the URL, and optionally (after a space) a link title
4414either in quotes or in parentheses.
4415The label must not be parseable as a citation (assuming the
4416\f[C]citations\f[R] extension is enabled): citations take precedence
4417over link labels.
4418.PP
4419Here are some examples:
4420.IP
4421.nf
4422\f[C]
4423[my label 1]: /foo/bar.html \[dq]My title, optional\[dq]
4424[my label 2]: /foo
4425[my label 3]: http://fsf.org (The free software foundation)
4426[my label 4]: /bar#special \[aq]A title in single quotes\[aq]
4427\f[R]
4428.fi
4429.PP
4430The URL may optionally be surrounded by angle brackets:
4431.IP
4432.nf
4433\f[C]
4434[my label 5]: <http://foo.bar.baz>
4435\f[R]
4436.fi
4437.PP
4438The title may go on the next line:
4439.IP
4440.nf
4441\f[C]
4442[my label 3]: http://fsf.org
4443 \[dq]The free software foundation\[dq]
4444\f[R]
4445.fi
4446.PP
4447Note that link labels are not case sensitive.
4448So, this will work:
4449.IP
4450.nf
4451\f[C]
4452Here is [my link][FOO]
4454[Foo]: /bar/baz
4455\f[R]
4456.fi
4457.PP
4458In an \f[I]implicit\f[R] reference link, the second pair of brackets is
4459empty:
4460.IP
4461.nf
4462\f[C]
4463See [my website][].
4465[my website]: http://foo.bar.baz
4466\f[R]
4467.fi
4468.PP
4469Note: In \f[C]Markdown.pl\f[R] and most other Markdown implementations,
4470reference link definitions cannot occur in nested constructions such as
4471list items or block quotes.
4472Pandoc lifts this arbitrary seeming restriction.
4473So the following is fine in pandoc, though not in most other
4474implementations:
4475.IP
4476.nf
4477\f[C]
4478> My block [quote].
4480> [quote]: /foo
4481\f[R]
4482.fi
4483.SS Extension: \f[C]shortcut_reference_links\f[R]
4484.PP
4485In a \f[I]shortcut\f[R] reference link, the second pair of brackets may
4486be omitted entirely:
4487.IP
4488.nf
4489\f[C]
4490See [my website].
4492[my website]: http://foo.bar.baz
4493\f[R]
4494.fi
4495.SS Internal links
4496.PP
4497To link to another section of the same document, use the automatically
4498generated identifier (see Heading identifiers).
4499For example:
4500.IP
4501.nf
4502\f[C]
4503See the [Introduction](#introduction).
4504\f[R]
4505.fi
4506.PP
4508.IP
4509.nf
4510\f[C]
4511See the [Introduction].
4513[Introduction]: #introduction
4514\f[R]
4515.fi
4516.PP
4517Internal links are currently supported for HTML formats (including HTML
4518slide shows and EPUB), LaTeX, and ConTeXt.
4519.SS Images
4520.PP
4521A link immediately preceded by a \f[C]!\f[R] will be treated as an
4522image.
4523The link text will be used as the image\[aq]s alt text:
4524.IP
4525.nf
4526\f[C]
4527![la lune](lalune.jpg \[dq]Voyage to the moon\[dq])
4529![movie reel]
4531[movie reel]: movie.gif
4532\f[R]
4533.fi
4534.SS Extension: \f[C]implicit_figures\f[R]
4535.PP
4536An image with nonempty alt text, occurring by itself in a paragraph,
4537will be rendered as a figure with a caption.
4538The image\[aq]s alt text will be used as the caption.
4539.IP
4540.nf
4541\f[C]
4542![This is the caption](/url/of/image.png)
4543\f[R]
4544.fi
4545.PP
4546How this is rendered depends on the output format.
4547Some output formats (e.g.
4548RTF) do not yet support figures.
4549In those formats, you\[aq]ll just get an image in a paragraph by itself,
4550with no caption.
4551.PP
4552If you just want a regular inline image, just make sure it is not the
4553only thing in the paragraph.
4554One way to do this is to insert a nonbreaking space after the image:
4555.IP
4556.nf
4557\f[C]
4558![This image won\[aq]t be a figure](/url/of/image.png)\[rs]
4559\f[R]
4560.fi
4561.PP
4562Note that in reveal.js slide shows, an image in a paragraph by itself
4563that has the \f[C]stretch\f[R] class will fill the screen, and the
4564caption and figure tags will be omitted.
4565.SS Extension: \f[C]link_attributes\f[R]
4566.PP
4567Attributes can be set on links and images:
4568.IP
4569.nf
4570\f[C]
4571An inline ![image](foo.jpg){#id .class width=30 height=20px}
4572and a reference ![image][ref] with attributes.
4574[ref]: foo.jpg \[dq]optional title\[dq] {#id .class key=val key2=\[dq]val 2\[dq]}
4575\f[R]
4576.fi
4577.PP
4578(This syntax is compatible with PHP Markdown Extra when only
4579\f[C]#id\f[R] and \f[C].class\f[R] are used.)
4580.PP
4581For HTML and EPUB, all attributes except \f[C]width\f[R] and
4582\f[C]height\f[R] (but including \f[C]srcset\f[R] and \f[C]sizes\f[R])
4583are passed through as is.
4584The other writers ignore attributes that are not supported by their
4585output format.
4586.PP
4587The \f[C]width\f[R] and \f[C]height\f[R] attributes on images are
4588treated specially.
4589When used without a unit, the unit is assumed to be pixels.
4590However, any of the following unit identifiers can be used:
4591\f[C]px\f[R], \f[C]cm\f[R], \f[C]mm\f[R], \f[C]in\f[R], \f[C]inch\f[R]
4592and \f[C]%\f[R].
4593There must not be any spaces between the number and the unit.
4594For example:
4595.IP
4596.nf
4597\f[C]
4598![](file.jpg){ width=50% }
4599\f[R]
4600.fi
4601.IP \[bu] 2
4602Dimensions are converted to inches for output in page-based formats like
4603LaTeX.
4604Dimensions are converted to pixels for output in HTML-like formats.
4605Use the \f[C]--dpi\f[R] option to specify the number of pixels per inch.
4606The default is 96dpi.
4607.IP \[bu] 2
4608The \f[C]%\f[R] unit is generally relative to some available space.
4609For example the above example will render to the following.
4610.RS 2
4611.IP \[bu] 2
4612HTML:
4613\f[C]<img href=\[dq]file.jpg\[dq] style=\[dq]width: 50%;\[dq] />\f[R]
4614.IP \[bu] 2
4615LaTeX:
4616\f[C]\[rs]includegraphics[width=0.5\[rs]textwidth,height=\[rs]textheight]{file.jpg}\f[R]
4617(If you\[aq]re using a custom template, you need to configure
4618\f[C]graphicx\f[R] as in the default template.)
4619.IP \[bu] 2
4620ConTeXt:
4621\f[C]\[rs]externalfigure[file.jpg][width=0.5\[rs]textwidth]\f[R]
4622.RE
4623.IP \[bu] 2
4624Some output formats have a notion of a class (ConTeXt) or a unique
4625identifier (LaTeX \f[C]\[rs]caption\f[R]), or both (HTML).
4626.IP \[bu] 2
4627When no \f[C]width\f[R] or \f[C]height\f[R] attributes are specified,
4628the fallback is to look at the image resolution and the dpi metadata
4629embedded in the image file.
4630.SS Divs and Spans
4631.PP
4632Using the \f[C]native_divs\f[R] and \f[C]native_spans\f[R] extensions
4633(see above), HTML syntax can be used as part of markdown to create
4634native \f[C]Div\f[R] and \f[C]Span\f[R] elements in the pandoc AST (as
4635opposed to raw HTML).
4636However, there is also nicer syntax available:
4637.SS Extension: \f[C]fenced_divs\f[R]
4638.PP
4639Allow special fenced syntax for native \f[C]Div\f[R] blocks.
4640A Div starts with a fence containing at least three consecutive colons
4641plus some attributes.
4642The attributes may optionally be followed by another string of
4643consecutive colons.
4644The attribute syntax is exactly as in fenced code blocks (see Extension:
4645\f[C]fenced_code_attributes\f[R]).
4646As with fenced code blocks, one can use either attributes in curly
4647braces or a single unbraced word, which will be treated as a class name.
4648The Div ends with another line containing a string of at least three
4649consecutive colons.
4650The fenced Div should be separated by blank lines from preceding and
4651following blocks.
4652.PP
4653Example:
4654.IP
4655.nf
4656\f[C]
4657::::: {#special .sidebar}
4658Here is a paragraph.
4660And another.
4661:::::
4662\f[R]
4663.fi
4664.PP
4665Fenced divs can be nested.
4666Opening fences are distinguished because they \f[I]must\f[R] have
4667attributes:
4668.IP
4669.nf
4670\f[C]
4671::: Warning ::::::
4672This is a warning.
4674::: Danger
4675This is a warning within a warning.
4676:::
4677::::::::::::::::::
4678\f[R]
4679.fi
4680.PP
4681Fences without attributes are always closing fences.
4682Unlike with fenced code blocks, the number of colons in the closing
4683fence need not match the number in the opening fence.
4684However, it can be helpful for visual clarity to use fences of different
4685lengths to distinguish nested divs from their parents.
4686.SS Extension: \f[C]bracketed_spans\f[R]
4687.PP
4688A bracketed sequence of inlines, as one would use to begin a link, will
4689be treated as a \f[C]Span\f[R] with attributes if it is followed
4690immediately by attributes:
4691.IP
4692.nf
4693\f[C]
4694[This is *some text*]{.class key=\[dq]val\[dq]}
4695\f[R]
4696.fi
4697.SS Footnotes
4698.SS Extension: \f[C]footnotes\f[R]
4699.PP
4700Pandoc\[aq]s Markdown allows footnotes, using the following syntax:
4701.IP
4702.nf
4703\f[C]
4704Here is a footnote reference,[\[ha]1] and another.[\[ha]longnote]
4706[\[ha]1]: Here is the footnote.
4708[\[ha]longnote]: Here\[aq]s one with multiple blocks.
4710 Subsequent paragraphs are indented to show that they
4711belong to the previous footnote.
4713 { some.code }
4715 The whole paragraph can be indented, or just the first
4716 line. In this way, multi-paragraph footnotes work like
4717 multi-paragraph list items.
4719This paragraph won\[aq]t be part of the note, because it
4720isn\[aq]t indented.
4721\f[R]
4722.fi
4723.PP
4724The identifiers in footnote references may not contain spaces, tabs, or
4725newlines.
4726These identifiers are used only to correlate the footnote reference with
4727the note itself; in the output, footnotes will be numbered sequentially.
4728.PP
4729The footnotes themselves need not be placed at the end of the document.
4730They may appear anywhere except inside other block elements (lists,
4731block quotes, tables, etc.).
4732Each footnote should be separated from surrounding content (including
4733other footnotes) by blank lines.
4734.SS Extension: \f[C]inline_notes\f[R]
4735.PP
4736Inline footnotes are also allowed (though, unlike regular notes, they
4737cannot contain multiple paragraphs).
4738The syntax is as follows:
4739.IP
4740.nf
4741\f[C]
4742Here is an inline note.\[ha][Inlines notes are easier to write, since
4743you don\[aq]t have to pick an identifier and move down to type the
4744note.]
4745\f[R]
4746.fi
4747.PP
4748Inline and regular footnotes may be mixed freely.
4749.SS Citations
4750.SS Extension: \f[C]citations\f[R]
4751.PP
4752Using an external filter, \f[C]pandoc-citeproc\f[R], pandoc can
4753automatically generate citations and a bibliography in a number of
4754styles.
4755Basic usage is
4756.IP
4757.nf
4758\f[C]
4759pandoc --filter pandoc-citeproc myinput.txt
4760\f[R]
4761.fi
4762.PP
4763In order to use this feature, you will need to specify a bibliography
4764file using the \f[C]bibliography\f[R] metadata field in a YAML metadata
4765section, or \f[C]--bibliography\f[R] command line argument.
4766You can supply multiple \f[C]--bibliography\f[R] arguments or set
4767\f[C]bibliography\f[R] metadata field to YAML array, if you want to use
4768multiple bibliography files.
4769The bibliography may have any of these formats:
4770.PP
4771.TS
4772tab(@);
4773l l.
4775Format
4776T}@T{
4777File extension
4781BibLaTeX
4782T}@T{
4783\&.bib
4786BibTeX
4787T}@T{
4788\&.bibtex
4791Copac
4792T}@T{
4793\&.copac
4796CSL JSON
4797T}@T{
4798\&.json
4801CSL YAML
4802T}@T{
4803\&.yaml
4806EndNote
4807T}@T{
4808\&.enl
4811EndNote XML
4812T}@T{
4813\&.xml
4816ISI
4817T}@T{
4818\&.wos
4821MEDLINE
4822T}@T{
4823\&.medline
4826MODS
4827T}@T{
4828\&.mods
4831RIS
4832T}@T{
4833\&.ris
4835.TE
4836.PP
4837Note that \f[C].bib\f[R] can be used with both BibTeX and BibLaTeX
4838files; use \f[C].bibtex\f[R] to force BibTeX.
4839.PP
4840Note that \f[C]pandoc-citeproc --bib2json\f[R] and
4841\f[C]pandoc-citeproc --bib2yaml\f[R] can produce \f[C].json\f[R] and
4842\f[C].yaml\f[R] files from any of the supported formats.
4843.PP
4844In-field markup: In BibTeX and BibLaTeX databases, pandoc-citeproc
4845parses a subset of LaTeX markup; in CSL YAML databases, pandoc Markdown;
4846and in CSL JSON databases, an HTML-like markup:
4847.TP
4848.B \f[C]<i>...</i>\f[R]
4849italics
4850.TP
4851.B \f[C]<b>...</b>\f[R]
4852bold
4853.TP
4854.B \f[C]<span style=\[dq]font-variant:small-caps;\[dq]>...</span>\f[R] or \f[C]<sc>...</sc>\f[R]
4855small capitals
4856.TP
4857.B \f[C]<sub>...</sub>\f[R]
4858subscript
4859.TP
4860.B \f[C]<sup>...</sup>\f[R]
4861superscript
4862.TP
4863.B \f[C]<span class=\[dq]nocase\[dq]>...</span>\f[R]
4864prevent a phrase from being capitalized as title case
4865.PP
4866\f[C]pandoc-citeproc -j\f[R] and \f[C]-y\f[R] interconvert the CSL JSON
4867and CSL YAML formats as far as possible.
4868.PP
4869As an alternative to specifying a bibliography file using
4870\f[C]--bibliography\f[R] or the YAML metadata field
4871\f[C]bibliography\f[R], you can include the citation data directly in
4872the \f[C]references\f[R] field of the document\[aq]s YAML metadata.
4873The field should contain an array of YAML-encoded references, for
4874example:
4875.IP
4876.nf
4877\f[C]
4878---
4879references:
4880- type: article-journal
4881 id: WatsonCrick1953
4882 author:
4883 - family: Watson
4884 given: J. D.
4885 - family: Crick
4886 given: F. H. C.
4887 issued:
4888 date-parts:
4889 - - 1953
4890 - 4
4891 - 25
4892 title: \[aq]Molecular structure of nucleic acids: a structure for deoxyribose
4893 nucleic acid\[aq]
4894 title-short: Molecular structure of nucleic acids
4895 container-title: Nature
4896 volume: 171
4897 issue: 4356
4898 page: 737-738
4899 DOI: 10.1038/171737a0
4900 URL: http://www.nature.com/nature/journal/v171/n4356/abs/171737a0.html
4901 language: en-GB
4902\&...
4903\f[R]
4904.fi
4905.PP
4906(\f[C]pandoc-citeproc --bib2yaml\f[R] can produce these from a
4907bibliography file in one of the supported formats.)
4908.PP
4909Citations and references can be formatted using any style supported by
4910the Citation Style Language, listed in the Zotero Style Repository.
4911These files are specified using the \f[C]--csl\f[R] option or the
4912\f[C]csl\f[R] metadata field.
4913By default, \f[C]pandoc-citeproc\f[R] will use the Chicago Manual of
4914Style author-date format.
4915The CSL project provides further information on finding and editing
4916styles.
4917.PP
4918To make your citations hyperlinks to the corresponding bibliography
4919entries, add \f[C]link-citations: true\f[R] to your YAML metadata.
4920.PP
4921Citations go inside square brackets and are separated by semicolons.
4922Each citation must have a key, composed of \[aq]\[at]\[aq] + the
4923citation identifier from the database, and may optionally have a prefix,
4924a locator, and a suffix.
4925The citation key must begin with a letter, digit, or \f[C]_\f[R], and
4926may contain alphanumerics, \f[C]_\f[R], and internal punctuation
4927characters (\f[C]:.#$%&-+?<>\[ti]/\f[R]).
4928Here are some examples:
4929.IP
4930.nf
4931\f[C]
4932Blah blah [see \[at]doe99, pp. 33-35; also \[at]smith04, chap. 1].
4934Blah blah [\[at]doe99, pp. 33-35, 38-39 and *passim*].
4936Blah blah [\[at]smith04; \[at]doe99].
4937\f[R]
4938.fi
4939.PP
4940\f[C]pandoc-citeproc\f[R] detects locator terms in the CSL locale files.
4941Either abbreviated or unabbreviated forms are accepted.
4942In the \f[C]en-US\f[R] locale, locator terms can be written in either
4943singular or plural forms, as \f[C]book\f[R],
4944\f[C]bk.\f[R]/\f[C]bks.\f[R]; \f[C]chapter\f[R],
4945\f[C]chap.\f[R]/\f[C]chaps.\f[R]; \f[C]column\f[R],
4946\f[C]col.\f[R]/\f[C]cols.\f[R]; \f[C]figure\f[R],
4947\f[C]fig.\f[R]/\f[C]figs.\f[R]; \f[C]folio\f[R],
4948\f[C]fol.\f[R]/\f[C]fols.\f[R]; \f[C]number\f[R],
4949\f[C]no.\f[R]/\f[C]nos.\f[R]; \f[C]line\f[R],
4950\f[C]l.\f[R]/\f[C]ll.\f[R]; \f[C]note\f[R], \f[C]n.\f[R]/\f[C]nn.\f[R];
4951\f[C]opus\f[R], \f[C]op.\f[R]/\f[C]opp.\f[R]; \f[C]page\f[R],
4952\f[C]p.\f[R]/\f[C]pp.\f[R]; \f[C]paragraph\f[R],
4953\f[C]para.\f[R]/\f[C]paras.\f[R]; \f[C]part\f[R],
4954\f[C]pt.\f[R]/\f[C]pts.\f[R]; \f[C]section\f[R],
4955\f[C]sec.\f[R]/\f[C]secs.\f[R]; \f[C]sub verbo\f[R],
4956\f[C]s.v.\f[R]/\f[C]s.vv.\f[R]; \f[C]verse\f[R],
4957\f[C]v.\f[R]/\f[C]vv.\f[R]; \f[C]volume\f[R],
4958\f[C]vol.\f[R]/\f[C]vols.\f[R]; \f[C]\[ps]\f[R]/\f[C]\[ps]\[ps]\f[R];
4959\f[C]\[sc]\f[R]/\f[C]\[sc]\[sc]\f[R].
4960If no locator term is used, \[dq]page\[dq] is assumed.
4961.PP
4962\f[C]pandoc-citeproc\f[R] will use heuristics to distinguish the locator
4963from the suffix.
4964In complex cases, the locator can be enclosed in curly braces (using
4965\f[C]pandoc-citeproc\f[R] 0.15 and higher only):
4966.IP
4967.nf
4968\f[C]
4969[\[at]smith{ii, A, D-Z}, with a suffix]
4970[\[at]smith, {pp. iv, vi-xi, (xv)-(xvii)} with suffix here]
4971\f[R]
4972.fi
4973.PP
4974A minus sign (\f[C]-\f[R]) before the \f[C]\[at]\f[R] will suppress
4975mention of the author in the citation.
4976This can be useful when the author is already mentioned in the text:
4977.IP
4978.nf
4979\f[C]
4980Smith says blah [-\[at]smith04].
4981\f[R]
4982.fi
4983.PP
4984You can also write an in-text citation, as follows:
4985.IP
4986.nf
4987\f[C]
4988\[at]smith04 says blah.
4990\[at]smith04 [p. 33] says blah.
4991\f[R]
4992.fi
4993.PP
4994If the style calls for a list of works cited, it will be placed in a div
4995with id \f[C]refs\f[R], if one exists:
4996.IP
4997.nf
4998\f[C]
4999::: {#refs}
5000:::
5001\f[R]
5002.fi
5003.PP
5004Otherwise, it will be placed at the end of the document.
5005Generation of the bibliography can be suppressed by setting
5006\f[C]suppress-bibliography: true\f[R] in the YAML metadata.
5007.PP
5008If you wish the bibliography to have a section heading, you can set
5009\f[C]reference-section-title\f[R] in the metadata, or put the heading at
5010the beginning of the div with id \f[C]refs\f[R] (if you are using it) or
5011at the end of your document:
5012.IP
5013.nf
5014\f[C]
5015last paragraph...
5017# References
5018\f[R]
5019.fi
5020.PP
5021The bibliography will be inserted after this heading.
5022Note that the \f[C]unnumbered\f[R] class will be added to this heading,
5023so that the section will not be numbered.
5024.PP
5025If you want to include items in the bibliography without actually citing
5026them in the body text, you can define a dummy \f[C]nocite\f[R] metadata
5027field and put the citations there:
5028.IP
5029.nf
5030\f[C]
5031---
5032nocite: |
5033 \[at]item1, \[at]item2
5034\&...
5036\[at]item3
5037\f[R]
5038.fi
5039.PP
5040In this example, the document will contain a citation for
5041\f[C]item3\f[R] only, but the bibliography will contain entries for
5042\f[C]item1\f[R], \f[C]item2\f[R], and \f[C]item3\f[R].
5043.PP
5044It is possible to create a bibliography with all the citations, whether
5045or not they appear in the document, by using a wildcard:
5046.IP
5047.nf
5048\f[C]
5049---
5050nocite: |
5051 \[at]*
5052\&...
5053\f[R]
5054.fi
5055.PP
5056For LaTeX output, you can also use \f[C]natbib\f[R] or
5057\f[C]biblatex\f[R] to render the bibliography.
5058In order to do so, specify bibliography files as outlined above, and add
5059\f[C]--natbib\f[R] or \f[C]--biblatex\f[R] argument to \f[C]pandoc\f[R]
5060invocation.
5061Bear in mind that bibliography files have to be in respective format
5062(either BibTeX or BibLaTeX).
5063.PP
5064For more information, see the pandoc-citeproc man page.
5065.SS Non-pandoc extensions
5066.PP
5067The following Markdown syntax extensions are not enabled by default in
5068pandoc, but may be enabled by adding \f[C]+EXTENSION\f[R] to the format
5069name, where \f[C]EXTENSION\f[R] is the name of the extension.
5070Thus, for example, \f[C]markdown+hard_line_breaks\f[R] is Markdown with
5071hard line breaks.
5072.SS Extension: \f[C]old_dashes\f[R]
5073.PP
5074Selects the pandoc <= 1.8.2.1 behavior for parsing smart dashes:
5075\f[C]-\f[R] before a numeral is an en-dash, and \f[C]--\f[R] is an
5076em-dash.
5077This option only has an effect if \f[C]smart\f[R] is enabled.
5078It is selected automatically for \f[C]textile\f[R] input.
5079.SS Extension: \f[C]angle_brackets_escapable\f[R]
5080.PP
5081Allow \f[C]<\f[R] and \f[C]>\f[R] to be backslash-escaped, as they can
5082be in GitHub flavored Markdown but not original Markdown.
5083This is implied by pandoc\[aq]s default \f[C]all_symbols_escapable\f[R].
5084.SS Extension: \f[C]lists_without_preceding_blankline\f[R]
5085.PP
5086Allow a list to occur right after a paragraph, with no intervening blank
5087space.
5088.SS Extension: \f[C]four_space_rule\f[R]
5089.PP
5090Selects the pandoc <= 2.0 behavior for parsing lists, so that four
5091spaces indent are needed for list item continuation paragraphs.
5092.SS Extension: \f[C]spaced_reference_links\f[R]
5093.PP
5094Allow whitespace between the two components of a reference link, for
5095example,
5096.IP
5097.nf
5098\f[C]
5099[foo] [bar].
5100\f[R]
5101.fi
5102.SS Extension: \f[C]hard_line_breaks\f[R]
5103.PP
5104Causes all newlines within a paragraph to be interpreted as hard line
5105breaks instead of spaces.
5106.SS Extension: \f[C]ignore_line_breaks\f[R]
5107.PP
5108Causes newlines within a paragraph to be ignored, rather than being
5109treated as spaces or as hard line breaks.
5110This option is intended for use with East Asian languages where spaces
5111are not used between words, but text is divided into lines for
5112readability.
5113.SS Extension: \f[C]east_asian_line_breaks\f[R]
5114.PP
5115Causes newlines within a paragraph to be ignored, rather than being
5116treated as spaces or as hard line breaks, when they occur between two
5117East Asian wide characters.
5118This is a better choice than \f[C]ignore_line_breaks\f[R] for texts that
5119include a mix of East Asian wide characters and other characters.
5120.SS Extension: \f[C]emoji\f[R]
5121.PP
5122Parses textual emojis like \f[C]:smile:\f[R] as Unicode emoticons.
5123.SS Extension: \f[C]tex_math_single_backslash\f[R]
5124.PP
5125Causes anything between \f[C]\[rs](\f[R] and \f[C]\[rs])\f[R] to be
5126interpreted as inline TeX math, and anything between \f[C]\[rs][\f[R]
5127and \f[C]\[rs]]\f[R] to be interpreted as display TeX math.
5128Note: a drawback of this extension is that it precludes escaping
5129\f[C](\f[R] and \f[C][\f[R].
5130.SS Extension: \f[C]tex_math_double_backslash\f[R]
5131.PP
5132Causes anything between \f[C]\[rs]\[rs](\f[R] and \f[C]\[rs]\[rs])\f[R]
5133to be interpreted as inline TeX math, and anything between
5134\f[C]\[rs]\[rs][\f[R] and \f[C]\[rs]\[rs]]\f[R] to be interpreted as
5135display TeX math.
5136.SS Extension: \f[C]markdown_attribute\f[R]
5137.PP
5138By default, pandoc interprets material inside block-level tags as
5139Markdown.
5140This extension changes the behavior so that Markdown is only parsed
5141inside block-level tags if the tags have the attribute
5142\f[C]markdown=1\f[R].
5143.SS Extension: \f[C]mmd_title_block\f[R]
5144.PP
5145Enables a MultiMarkdown style title block at the top of the document,
5146for example:
5147.IP
5148.nf
5149\f[C]
5150Title: My title
5151Author: John Doe
5152Date: September 1, 2008
5153Comment: This is a sample mmd title block, with
5154 a field spanning multiple lines.
5155\f[R]
5156.fi
5157.PP
5158See the MultiMarkdown documentation for details.
5159If \f[C]pandoc_title_block\f[R] or \f[C]yaml_metadata_block\f[R] is
5160enabled, it will take precedence over \f[C]mmd_title_block\f[R].
5161.SS Extension: \f[C]abbreviations\f[R]
5162.PP
5163Parses PHP Markdown Extra abbreviation keys, like
5164.IP
5165.nf
5166\f[C]
5167*[HTML]: Hypertext Markup Language
5168\f[R]
5169.fi
5170.PP
5171Note that the pandoc document model does not support abbreviations, so
5172if this extension is enabled, abbreviation keys are simply skipped (as
5173opposed to being parsed as paragraphs).
5174.SS Extension: \f[C]autolink_bare_uris\f[R]
5175.PP
5176Makes all absolute URIs into links, even when not surrounded by pointy
5177braces \f[C]<...>\f[R].
5178.SS Extension: \f[C]mmd_link_attributes\f[R]
5179.PP
5180Parses multimarkdown style key-value attributes on link and image
5181references.
5182This extension should not be confused with the \f[C]link_attributes\f[R]
5183extension.
5184.IP
5185.nf
5186\f[C]
5187This is a reference ![image][ref] with multimarkdown attributes.
5189[ref]: http://path.to/image \[dq]Image title\[dq] width=20px height=30px
5190 id=myId class=\[dq]myClass1 myClass2\[dq]
5191\f[R]
5192.fi
5193.SS Extension: \f[C]mmd_header_identifiers\f[R]
5194.PP
5195Parses multimarkdown style heading identifiers (in square brackets,
5196after the heading but before any trailing \f[C]#\f[R]s in an ATX
5197heading).
5198.SS Extension: \f[C]compact_definition_lists\f[R]
5199.PP
5200Activates the definition list syntax of pandoc 1.12.x and earlier.
5201This syntax differs from the one described above under Definition lists
5202in several respects:
5203.IP \[bu] 2
5204No blank line is required between consecutive items of the definition
5205list.
5206.IP \[bu] 2
5207To get a \[dq]tight\[dq] or \[dq]compact\[dq] list, omit space between
5208consecutive items; the space between a term and its definition does not
5209affect anything.
5210.IP \[bu] 2
5211Lazy wrapping of paragraphs is not allowed: the entire definition must
5212be indented four spaces.
5213.SS Markdown variants
5214.PP
5215In addition to pandoc\[aq]s extended Markdown, the following Markdown
5216variants are supported:
5217.TP
5218.B \f[C]markdown_phpextra\f[R] (PHP Markdown Extra)
5219\f[C]footnotes\f[R], \f[C]pipe_tables\f[R], \f[C]raw_html\f[R],
5220\f[C]markdown_attribute\f[R], \f[C]fenced_code_blocks\f[R],
5221\f[C]definition_lists\f[R], \f[C]intraword_underscores\f[R],
5222\f[C]header_attributes\f[R], \f[C]link_attributes\f[R],
5223\f[C]abbreviations\f[R], \f[C]shortcut_reference_links\f[R],
5224\f[C]spaced_reference_links\f[R].
5225.TP
5226.B \f[C]markdown_github\f[R] (deprecated GitHub-Flavored Markdown)
5227\f[C]pipe_tables\f[R], \f[C]raw_html\f[R], \f[C]fenced_code_blocks\f[R],
5228\f[C]auto_identifiers\f[R], \f[C]gfm_auto_identifiers\f[R],
5229\f[C]backtick_code_blocks\f[R], \f[C]autolink_bare_uris\f[R],
5230\f[C]space_in_atx_header\f[R], \f[C]intraword_underscores\f[R],
5231\f[C]strikeout\f[R], \f[C]task_lists\f[R], \f[C]emoji\f[R],
5232\f[C]shortcut_reference_links\f[R], \f[C]angle_brackets_escapable\f[R],
5233\f[C]lists_without_preceding_blankline\f[R].
5234.TP
5235.B \f[C]markdown_mmd\f[R] (MultiMarkdown)
5236\f[C]pipe_tables\f[R], \f[C]raw_html\f[R], \f[C]markdown_attribute\f[R],
5237\f[C]mmd_link_attributes\f[R], \f[C]tex_math_double_backslash\f[R],
5238\f[C]intraword_underscores\f[R], \f[C]mmd_title_block\f[R],
5239\f[C]footnotes\f[R], \f[C]definition_lists\f[R],
5240\f[C]all_symbols_escapable\f[R], \f[C]implicit_header_references\f[R],
5241\f[C]auto_identifiers\f[R], \f[C]mmd_header_identifiers\f[R],
5242\f[C]shortcut_reference_links\f[R], \f[C]implicit_figures\f[R],
5243\f[C]superscript\f[R], \f[C]subscript\f[R],
5244\f[C]backtick_code_blocks\f[R], \f[C]spaced_reference_links\f[R],
5245\f[C]raw_attribute\f[R].
5246.TP
5247.B \f[C]markdown_strict\f[R] (Markdown.pl)
5248\f[C]raw_html\f[R], \f[C]shortcut_reference_links\f[R],
5249\f[C]spaced_reference_links\f[R].
5250.PP
5251We also support \f[C]commonmark\f[R] and \f[C]gfm\f[R] (GitHub-Flavored
5252Markdown, which is implemented as a set of extensions on
5253\f[C]commonmark\f[R]).
5254.PP
5255Note, however, that \f[C]commonmark\f[R] and \f[C]gfm\f[R] have limited
5256support for extensions.
5257Only those listed below (and \f[C]smart\f[R], \f[C]raw_tex\f[R], and
5258\f[C]hard_line_breaks\f[R]) will work.
5259The extensions can, however, all be individually disabled.
5260Also, \f[C]raw_tex\f[R] only affects \f[C]gfm\f[R] output, not input.
5261.TP
5262.B \f[C]gfm\f[R] (GitHub-Flavored Markdown)
5263\f[C]pipe_tables\f[R], \f[C]raw_html\f[R], \f[C]fenced_code_blocks\f[R],
5264\f[C]auto_identifiers\f[R], \f[C]gfm_auto_identifiers\f[R],
5265\f[C]backtick_code_blocks\f[R], \f[C]autolink_bare_uris\f[R],
5266\f[C]space_in_atx_header\f[R], \f[C]intraword_underscores\f[R],
5267\f[C]strikeout\f[R], \f[C]task_lists\f[R], \f[C]emoji\f[R],
5268\f[C]shortcut_reference_links\f[R], \f[C]angle_brackets_escapable\f[R],
5269\f[C]lists_without_preceding_blankline\f[R].
5270.SH PRODUCING SLIDE SHOWS WITH PANDOC
5271.PP
5272You can use pandoc to produce an HTML + JavaScript slide presentation
5273that can be viewed via a web browser.
5274There are five ways to do this, using S5, DZSlides, Slidy, Slideous, or
5275reveal.js.
5276You can also produce a PDF slide show using LaTeX \f[C]beamer\f[R], or
5277slides shows in Microsoft PowerPoint format.
5278.PP
5279Here\[aq]s the Markdown source for a simple slide show,
5280\f[C]habits.txt\f[R]:
5281.IP
5282.nf
5283\f[C]
5284% Habits
5285% John Doe
5286% March 22, 2005
5288# In the morning
5290## Getting up
5292- Turn off alarm
5293- Get out of bed
5295## Breakfast
5297- Eat eggs
5298- Drink coffee
5300# In the evening
5302## Dinner
5304- Eat spaghetti
5305- Drink wine
5307------------------
5309![picture of spaghetti](images/spaghetti.jpg)
5311## Going to sleep
5313- Get in bed
5314- Count sheep
5315\f[R]
5316.fi
5317.PP
5318To produce an HTML/JavaScript slide show, simply type
5319.IP
5320.nf
5321\f[C]
5322pandoc -t FORMAT -s habits.txt -o habits.html
5323\f[R]
5324.fi
5325.PP
5326where \f[C]FORMAT\f[R] is either \f[C]s5\f[R], \f[C]slidy\f[R],
5327\f[C]slideous\f[R], \f[C]dzslides\f[R], or \f[C]revealjs\f[R].
5328.PP
5329For Slidy, Slideous, reveal.js, and S5, the file produced by pandoc with
5330the \f[C]-s/--standalone\f[R] option embeds a link to JavaScript and CSS
5331files, which are assumed to be available at the relative path
5332\f[C]s5/default\f[R] (for S5), \f[C]slideous\f[R] (for Slideous),
5333\f[C]reveal.js\f[R] (for reveal.js), or at the Slidy website at
5334\f[C]w3.org\f[R] (for Slidy).
5335(These paths can be changed by setting the \f[C]slidy-url\f[R],
5336\f[C]slideous-url\f[R], \f[C]revealjs-url\f[R], or \f[C]s5-url\f[R]
5337variables; see Variables for HTML slides, above.) For DZSlides, the
5338(relatively short) JavaScript and CSS are included in the file by
5339default.
5340.PP
5341With all HTML slide formats, the \f[C]--self-contained\f[R] option can
5342be used to produce a single file that contains all of the data necessary
5343to display the slide show, including linked scripts, stylesheets,
5344images, and videos.
5345.PP
5346To produce a PDF slide show using beamer, type
5347.IP
5348.nf
5349\f[C]
5350pandoc -t beamer habits.txt -o habits.pdf
5351\f[R]
5352.fi
5353.PP
5354Note that a reveal.js slide show can also be converted to a PDF by
5355printing it to a file from the browser.
5356.PP
5357To produce a Powerpoint slide show, type
5358.IP
5359.nf
5360\f[C]
5361pandoc habits.txt -o habits.pptx
5362\f[R]
5363.fi
5364.SS Structuring the slide show
5365.PP
5366By default, the \f[I]slide level\f[R] is the highest heading level in
5367the hierarchy that is followed immediately by content, and not another
5368heading, somewhere in the document.
5369In the example above, level-1 headings are always followed by level-2
5370headings, which are followed by content, so the slide level is 2.
5371This default can be overridden using the \f[C]--slide-level\f[R] option.
5372.PP
5373The document is carved up into slides according to the following rules:
5374.IP \[bu] 2
5375A horizontal rule always starts a new slide.
5376.IP \[bu] 2
5377A heading at the slide level always starts a new slide.
5378.IP \[bu] 2
5379Headings \f[I]below\f[R] the slide level in the hierarchy create
5380headings \f[I]within\f[R] a slide.
5381.IP \[bu] 2
5382Headings \f[I]above\f[R] the slide level in the hierarchy create
5383\[dq]title slides,\[dq] which just contain the section title and help to
5384break the slide show into sections.
5385Non-slide content under these headings will be included on the title
5386slide (for HTML slide shows) or in a subsequent slide with the same
5387title (for beamer).
5388.IP \[bu] 2
5389A title page is constructed automatically from the document\[aq]s title
5390block, if present.
5391(In the case of beamer, this can be disabled by commenting out some
5392lines in the default template.)
5393.PP
5394These rules are designed to support many different styles of slide show.
5395If you don\[aq]t care about structuring your slides into sections and
5396subsections, you can just use level-1 headings for all each slide.
5397(In that case, level-1 will be the slide level.) But you can also
5398structure the slide show into sections, as in the example above.
5399.PP
5400Note: in reveal.js slide shows, if slide level is 2, a two-dimensional
5401layout will be produced, with level-1 headings building horizontally and
5402level-2 headings building vertically.
5403It is not recommended that you use deeper nesting of section levels with
5404reveal.js.
5405.SS Incremental lists
5406.PP
5407By default, these writers produce lists that display \[dq]all at
5408once.\[dq] If you want your lists to display incrementally (one item at
5409a time), use the \f[C]-i\f[R] option.
5410If you want a particular list to depart from the default, put it in a
5411\f[C]div\f[R] block with class \f[C]incremental\f[R] or
5412\f[C]nonincremental\f[R].
5413So, for example, using the \f[C]fenced div\f[R] syntax, the following
5414would be incremental regardless of the document default:
5415.IP
5416.nf
5417\f[C]
5418::: incremental
5420- Eat spaghetti
5421- Drink wine
5423:::
5424\f[R]
5425.fi
5426.PP
5428.IP
5429.nf
5430\f[C]
5431::: nonincremental
5433- Eat spaghetti
5434- Drink wine
5436:::
5437\f[R]
5438.fi
5439.PP
5440While using \f[C]incremental\f[R] and \f[C]nonincremental\f[R] divs are
5441the recommended method of setting incremental lists on a per-case basis,
5442an older method is also supported: putting lists inside a blockquote
5443will depart from the document default (that is, it will display
5444incrementally without the \f[C]-i\f[R] option and all at once with the
5445\f[C]-i\f[R] option):
5446.IP
5447.nf
5448\f[C]
5449> - Eat spaghetti
5450> - Drink wine
5451\f[R]
5452.fi
5453.PP
5454Both methods allow incremental and nonincremental lists to be mixed in a
5455single document.
5456.SS Inserting pauses
5457.PP
5458You can add \[dq]pauses\[dq] within a slide by including a paragraph
5459containing three dots, separated by spaces:
5460.IP
5461.nf
5462\f[C]
5463# Slide with a pause
5465content before the pause
5467\&. . .
5469content after the pause
5470\f[R]
5471.fi
5472.SS Styling the slides
5473.PP
5474You can change the style of HTML slides by putting customized CSS files
5475in \f[C]$DATADIR/s5/default\f[R] (for S5), \f[C]$DATADIR/slidy\f[R] (for
5476Slidy), or \f[C]$DATADIR/slideous\f[R] (for Slideous), where
5477\f[C]$DATADIR\f[R] is the user data directory (see \f[C]--data-dir\f[R],
5478above).
5479The originals may be found in pandoc\[aq]s system data directory
5480(generally \f[C]$CABALDIR/pandoc-VERSION/s5/default\f[R]).
5481Pandoc will look there for any files it does not find in the user data
5482directory.
5483.PP
5484For dzslides, the CSS is included in the HTML file itself, and may be
5485modified there.
5486.PP
5487All reveal.js configuration options can be set through variables.
5488For example, themes can be used by setting the \f[C]theme\f[R] variable:
5489.IP
5490.nf
5491\f[C]
5492-V theme=moon
5493\f[R]
5494.fi
5495.PP
5496Or you can specify a custom stylesheet using the \f[C]--css\f[R] option.
5497.PP
5498To style beamer slides, you can specify a \f[C]theme\f[R],
5499\f[C]colortheme\f[R], \f[C]fonttheme\f[R], \f[C]innertheme\f[R], and
5500\f[C]outertheme\f[R], using the \f[C]-V\f[R] option:
5501.IP
5502.nf
5503\f[C]
5504pandoc -t beamer habits.txt -V theme:Warsaw -o habits.pdf
5505\f[R]
5506.fi
5507.PP
5508Note that heading attributes will turn into slide attributes (on a
5509\f[C]<div>\f[R] or \f[C]<section>\f[R]) in HTML slide formats, allowing
5510you to style individual slides.
5511In beamer, the only heading attribute that affects slides is the
5512\f[C]allowframebreaks\f[R] class, which sets the
5513\f[C]allowframebreaks\f[R] option, causing multiple slides to be created
5514if the content overfills the frame.
5515This is recommended especially for bibliographies:
5516.IP
5517.nf
5518\f[C]
5519# References {.allowframebreaks}
5520\f[R]
5521.fi
5522.SS Speaker notes
5523.PP
5524Speaker notes are supported in reveal.js and PowerPoint (pptx) output.
5525You can add notes to your Markdown document thus:
5526.IP
5527.nf
5528\f[C]
5529::: notes
5531This is my note.
5533- It can contain Markdown
5534- like this list
5536:::
5537\f[R]
5538.fi
5539.PP
5540To show the notes window in reveal.js, press \f[C]s\f[R] while viewing
5541the presentation.
5542Speaker notes in PowerPoint will be available, as usual, in handouts and
5543presenter view.
5544.PP
5545Notes are not yet supported for other slide formats, but the notes will
5546not appear on the slides themselves.
5547.SS Columns
5548.PP
5549To put material in side by side columns, you can use a native div
5550container with class \f[C]columns\f[R], containing two or more div
5551containers with class \f[C]column\f[R] and a \f[C]width\f[R] attribute:
5552.IP
5553.nf
5554\f[C]
5555:::::::::::::: {.columns}
5556::: {.column width=\[dq]40%\[dq]}
5557contents...
5558:::
5559::: {.column width=\[dq]60%\[dq]}
5560contents...
5561:::
5562::::::::::::::
5563\f[R]
5564.fi
5565.SS Frame attributes in beamer
5566.PP
5567Sometimes it is necessary to add the LaTeX \f[C][fragile]\f[R] option to
5568a frame in beamer (for example, when using the \f[C]minted\f[R]
5569environment).
5570This can be forced by adding the \f[C]fragile\f[R] class to the heading
5571introducing the slide:
5572.IP
5573.nf
5574\f[C]
5575# Fragile slide {.fragile}
5576\f[R]
5577.fi
5578.PP
5579All of the other frame attributes described in Section 8.1 of the Beamer
5580User\[aq]s Guide may also be used: \f[C]allowdisplaybreaks\f[R],
5581\f[C]allowframebreaks\f[R], \f[C]b\f[R], \f[C]c\f[R], \f[C]t\f[R],
5582\f[C]environment\f[R], \f[C]label\f[R], \f[C]plain\f[R],
5583\f[C]shrink\f[R], \f[C]standout\f[R], \f[C]noframenumbering\f[R].
5584.SS Background in reveal.js and beamer
5585.PP
5586Background images can be added to self-contained reveal.js slideshows
5587and to beamer slideshows.
5588.PP
5589For the same image on every slide, use the configuration option
5590\f[C]background-image\f[R] either in the YAML metadata block or as a
5591command-line variable.
5592(There are no other options in beamer and the rest of this section
5593concerns reveal.js slideshows.)
5594.PP
5595For reveal.js, you can instead use the reveal.js-native option
5596\f[C]parallaxBackgroundImage\f[R].
5597You can also set \f[C]parallaxBackgroundHorizontal\f[R] and
5598\f[C]parallaxBackgroundVertical\f[R] the same way and must also set
5599\f[C]parallaxBackgroundSize\f[R] to have your values take effect.
5600.PP
5601To set an image for a particular reveal.js slide, add
5602\f[C]{data-background-image=\[dq]/path/to/image\[dq]}\f[R] to the first
5603slide-level heading on the slide (which may even be empty).
5604.PP
5605In reveal.js\[aq]s overview mode, the parallaxBackgroundImage will show
5606up only on the first slide.
5607.PP
5608Other reveal.js background settings also work on individual slides,
5609including \f[C]data-background-size\f[R],
5610\f[C]data-background-repeat\f[R], \f[C]data-background-color\f[R],
5611\f[C]data-transition\f[R], and \f[C]data-transition-speed\f[R].
5612.PP
5613See the reveal.js documentation for more details.
5614.PP
5615For example in reveal.js:
5616.IP
5617.nf
5618\f[C]
5619---
5620title: My Slideshow
5621parallaxBackgroundImage: /path/to/my/background_image.png
5622---
5624## Slide One
5626Slide 1 has background_image.png as its background.
5628## {data-background-image=\[dq]/path/to/special_image.jpg\[dq]}
5630Slide 2 has a special image for its background, even though the heading has no content.
5631\f[R]
5632.fi
5633.SH CREATING EPUBS WITH PANDOC
5634.SS EPUB Metadata
5635.PP
5636EPUB metadata may be specified using the \f[C]--epub-metadata\f[R]
5637option, but if the source document is Markdown, it is better to use a
5638YAML metadata block.
5639Here is an example:
5640.IP
5641.nf
5642\f[C]
5643---
5644title:
5645- type: main
5646 text: My Book
5647- type: subtitle
5648 text: An investigation of metadata
5649creator:
5650- role: author
5651 text: John Smith
5652- role: editor
5653 text: Sarah Jones
5654identifier:
5655- scheme: DOI
5656 text: doi:10.234234.234/33
5657publisher: My Press
5658rights: \[co] 2007 John Smith, CC BY-NC
5659ibooks:
5660 version: 1.3.4
5661\&...
5662\f[R]
5663.fi
5664.PP
5665The following fields are recognized:
5666.TP
5667.B \f[C]identifier\f[R]
5668Either a string value or an object with fields \f[C]text\f[R] and
5669\f[C]scheme\f[R].
5670Valid values for \f[C]scheme\f[R] are \f[C]ISBN-10\f[R],
5671\f[C]GTIN-13\f[R], \f[C]UPC\f[R], \f[C]ISMN-10\f[R], \f[C]DOI\f[R],
5672\f[C]LCCN\f[R], \f[C]GTIN-14\f[R], \f[C]ISBN-13\f[R],
5673\f[C]Legal deposit number\f[R], \f[C]URN\f[R], \f[C]OCLC\f[R],
5674\f[C]ISMN-13\f[R], \f[C]ISBN-A\f[R], \f[C]JP\f[R], \f[C]OLCC\f[R].
5675.TP
5676.B \f[C]title\f[R]
5677Either a string value, or an object with fields \f[C]file-as\f[R] and
5678\f[C]type\f[R], or a list of such objects.
5679Valid values for \f[C]type\f[R] are \f[C]main\f[R], \f[C]subtitle\f[R],
5680\f[C]short\f[R], \f[C]collection\f[R], \f[C]edition\f[R],
5681\f[C]extended\f[R].
5682.TP
5683.B \f[C]creator\f[R]
5684Either a string value, or an object with fields \f[C]role\f[R],
5685\f[C]file-as\f[R], and \f[C]text\f[R], or a list of such objects.
5686Valid values for \f[C]role\f[R] are MARC relators, but pandoc will
5687attempt to translate the human-readable versions (like \[dq]author\[dq]
5688and \[dq]editor\[dq]) to the appropriate marc relators.
5689.TP
5690.B \f[C]contributor\f[R]
5691Same format as \f[C]creator\f[R].
5692.TP
5693.B \f[C]date\f[R]
5694A string value in \f[C]YYYY-MM-DD\f[R] format.
5695(Only the year is necessary.) Pandoc will attempt to convert other
5696common date formats.
5697.TP
5698.B \f[C]lang\f[R] (or legacy: \f[C]language\f[R])
5699A string value in BCP 47 format.
5700Pandoc will default to the local language if nothing is specified.
5701.TP
5702.B \f[C]subject\f[R]
5703A string value or a list of such values.
5704.TP
5705.B \f[C]description\f[R]
5706A string value.
5707.TP
5708.B \f[C]type\f[R]
5709A string value.
5710.TP
5711.B \f[C]format\f[R]
5712A string value.
5713.TP
5714.B \f[C]relation\f[R]
5715A string value.
5716.TP
5717.B \f[C]coverage\f[R]
5718A string value.
5719.TP
5720.B \f[C]rights\f[R]
5721A string value.
5722.TP
5723.B \f[C]cover-image\f[R]
5724A string value (path to cover image).
5725.TP
5726.B \f[C]css\f[R] (or legacy: \f[C]stylesheet\f[R])
5727A string value (path to CSS stylesheet).
5728.TP
5729.B \f[C]page-progression-direction\f[R]
5730Either \f[C]ltr\f[R] or \f[C]rtl\f[R].
5731Specifies the \f[C]page-progression-direction\f[R] attribute for the
5732\f[C]spine\f[R] element.
5733.TP
5734.B \f[C]ibooks\f[R]
5735iBooks-specific metadata, with the following fields:
5736.RS
5737.IP \[bu] 2
5738\f[C]version\f[R]: (string)
5739.IP \[bu] 2
5740\f[C]specified-fonts\f[R]: \f[C]true\f[R]|\f[C]false\f[R] (default
5741\f[C]false\f[R])
5742.IP \[bu] 2
5743\f[C]ipad-orientation-lock\f[R]:
5744\f[C]portrait-only\f[R]|\f[C]landscape-only\f[R]
5745.IP \[bu] 2
5746\f[C]iphone-orientation-lock\f[R]:
5747\f[C]portrait-only\f[R]|\f[C]landscape-only\f[R]
5748.IP \[bu] 2
5749\f[C]binding\f[R]: \f[C]true\f[R]|\f[C]false\f[R] (default
5750\f[C]true\f[R])
5751.IP \[bu] 2
5752\f[C]scroll-axis\f[R]:
5753\f[C]vertical\f[R]|\f[C]horizontal\f[R]|\f[C]default\f[R]
5754.RE
5755.SS The \f[C]epub:type\f[R] attribute
5756.PP
5757For \f[C]epub3\f[R] output, you can mark up the heading that corresponds
5758to an EPUB chapter using the \f[C]epub:type\f[R] attribute.
5759For example, to set the attribute to the value \f[C]prologue\f[R], use
5760this markdown:
5761.IP
5762.nf
5763\f[C]
5764# My chapter {epub:type=prologue}
5765\f[R]
5766.fi
5767.PP
5768Which will result in:
5769.IP
5770.nf
5771\f[C]
5772<body epub:type=\[dq]frontmatter\[dq]>
5773 <section epub:type=\[dq]prologue\[dq]>
5774 <h1>My chapter</h1>
5775\f[R]
5776.fi
5777.PP
5778Pandoc will output \f[C]<body epub:type=\[dq]bodymatter\[dq]>\f[R],
5779unless you use one of the following values, in which case either
5780\f[C]frontmatter\f[R] or \f[C]backmatter\f[R] will be output.
5781.PP
5782.TS
5783tab(@);
5784l l.
5786\f[C]epub:type\f[R] of first section
5787T}@T{
5788\f[C]epub:type\f[R] of body
5792prologue
5793T}@T{
5794frontmatter
5797abstract
5798T}@T{
5799frontmatter
5802acknowledgments
5803T}@T{
5804frontmatter
5807copyright-page
5808T}@T{
5809frontmatter
5812dedication
5813T}@T{
5814frontmatter
5817foreword
5818T}@T{
5819frontmatter
5822halftitle,
5823T}@T{
5824frontmatter
5827introduction
5828T}@T{
5829frontmatter
5832preface
5833T}@T{
5834frontmatter
5837seriespage
5838T}@T{
5839frontmatter
5842titlepage
5843T}@T{
5844frontmatter
5847afterword
5848T}@T{
5849backmatter
5852appendix
5853T}@T{
5854backmatter
5857colophon
5858T}@T{
5859backmatter
5862conclusion
5863T}@T{
5864backmatter
5867epigraph
5868T}@T{
5869backmatter
5871.TE
5872.SS Linked media
5873.PP
5874By default, pandoc will download media referenced from any
5875\f[C]<img>\f[R], \f[C]<audio>\f[R], \f[C]<video>\f[R] or
5876\f[C]<source>\f[R] element present in the generated EPUB, and include it
5877in the EPUB container, yielding a completely self-contained EPUB.
5878If you want to link to external media resources instead, use raw HTML in
5879your source and add \f[C]data-external=\[dq]1\[dq]\f[R] to the tag with
5880the \f[C]src\f[R] attribute.
5881For example:
5882.IP
5883.nf
5884\f[C]
5885<audio controls=\[dq]1\[dq]>
5886 <source src=\[dq]http://example.com/music/toccata.mp3\[dq]
5887 data-external=\[dq]1\[dq] type=\[dq]audio/mpeg\[dq]>
5888 </source>
5889</audio>
5890\f[R]
5891.fi
5892.SH CREATING JUPYTER NOTEBOOKS WITH PANDOC
5893.PP
5894When creating a Jupyter notebook, pandoc will try to infer the notebook
5895structure.
5896Code blocks with the class \f[C]code\f[R] will be taken as code cells,
5897and intervening content will be taken as Markdown cells.
5898Attachments will automatically be created for images in Markdown cells.
5899Metadata will be taken from the \f[C]jupyter\f[R] metadata field.
5900For example:
5901.IP
5902.nf
5903\f[C]
5904---
5905title: My notebook
5906jupyter:
5907 nbformat: 4
5908 nbformat_minor: 5
5909 kernelspec:
5910 display_name: Python 2
5911 language: python
5912 name: python2
5913 language_info:
5914 codemirror_mode:
5915 name: ipython
5916 version: 2
5917 file_extension: \[dq].py\[dq]
5918 mimetype: \[dq]text/x-python\[dq]
5919 name: \[dq]python\[dq]
5920 nbconvert_exporter: \[dq]python\[dq]
5921 pygments_lexer: \[dq]ipython2\[dq]
5922 version: \[dq]2.7.15\[dq]
5923---
5925# Lorem ipsum
5927**Lorem ipsum** dolor sit amet, consectetur adipiscing elit. Nunc luctus
5928bibendum felis dictum sodales.
5930\[ga]\[ga]\[ga] code
5931print(\[dq]hello\[dq])
5932\[ga]\[ga]\[ga]
5934## Pyout
5936\[ga]\[ga]\[ga] code
5937from IPython.display import HTML
5938HTML(\[dq]\[dq]\[dq]
5939<script>
5940console.log(\[dq]hello\[dq]);
5941</script>
5942<b>HTML</b>
5943\[dq]\[dq]\[dq])
5944\[ga]\[ga]\[ga]
5946## Image
5948This image ![image](myimage.png) will be
5949included as a cell attachment.
5950\f[R]
5951.fi
5952.PP
5953If you want to add cell attributes, group cells differently, or add
5954output to code cells, then you need to include divs to indicate the
5955structure.
5956You can use either fenced divs or native divs for this.
5957Here is an example:
5958.IP
5959.nf
5960\f[C]
5961:::::: {.cell .markdown}
5962# Lorem
5964**Lorem ipsum** dolor sit amet, consectetur adipiscing elit. Nunc luctus
5965bibendum felis dictum sodales.
5966::::::
5968:::::: {.cell .code execution_count=1}
5969\[ga]\[ga]\[ga] {.python}
5970print(\[dq]hello\[dq])
5971\[ga]\[ga]\[ga]
5973::: {.output .stream .stdout}
5974\[ga]\[ga]\[ga]
5975hello
5976\[ga]\[ga]\[ga]
5977:::
5978::::::
5980:::::: {.cell .code execution_count=2}
5981\[ga]\[ga]\[ga] {.python}
5982from IPython.display import HTML
5983HTML(\[dq]\[dq]\[dq]
5984<script>
5985console.log(\[dq]hello\[dq]);
5986</script>
5987<b>HTML</b>
5988\[dq]\[dq]\[dq])
5989\[ga]\[ga]\[ga]
5991::: {.output .execute_result execution_count=2}
5992\[ga]\[ga]\[ga]{=html}
5993<script>
5994console.log(\[dq]hello\[dq]);
5995</script>
5996<b>HTML</b>
5997hello
5998\[ga]\[ga]\[ga]
5999:::
6000::::::
6001\f[R]
6002.fi
6003.PP
6004If you include raw HTML or TeX in an output cell, use the [raw
6005attribute][Extension: \f[C]fenced_attribute\f[R]], as shown in the last
6006cell of the example above.
6007Although pandoc can process \[dq]bare\[dq] raw HTML and TeX, the result
6008is often interspersed raw elements and normal textual elements, and in
6009an output cell pandoc expects a single, connected raw block.
6010To avoid using raw HTML or TeX except when marked explicitly using raw
6011attributes, we recommend specifying the extensions
6012\f[C]-raw_html-raw_tex+raw_attribute\f[R] when translating between
6013Markdown and ipynb notebooks.
6014.PP
6015Note that options and extensions that affect reading and writing of
6016Markdown will also affect Markdown cells in ipynb notebooks.
6017For example, \f[C]--wrap=preserve\f[R] will preserve soft line breaks in
6018Markdown cells; \f[C]--atx-headers\f[R] will cause ATX-style headings to
6019be used; and \f[C]--preserve-tabs\f[R] will prevent tabs from being
6020turned to spaces.
6021.SH SYNTAX HIGHLIGHTING
6022.PP
6023Pandoc will automatically highlight syntax in fenced code blocks that
6024are marked with a language name.
6025The Haskell library skylighting is used for highlighting.
6026Currently highlighting is supported only for HTML, EPUB, Docx, Ms, and
6027LaTeX/PDF output.
6028To see a list of language names that pandoc will recognize, type
6029\f[C]pandoc --list-highlight-languages\f[R].
6030.PP
6031The color scheme can be selected using the \f[C]--highlight-style\f[R]
6032option.
6033The default color scheme is \f[C]pygments\f[R], which imitates the
6034default color scheme used by the Python library pygments (though
6035pygments is not actually used to do the highlighting).
6036To see a list of highlight styles, type
6037\f[C]pandoc --list-highlight-styles\f[R].
6038.PP
6039If you are not satisfied with the predefined styles, you can use
6040\f[C]--print-highlight-style\f[R] to generate a JSON \f[C].theme\f[R]
6041file which can be modified and used as the argument to
6042\f[C]--highlight-style\f[R].
6043To get a JSON version of the \f[C]pygments\f[R] style, for example:
6044.IP
6045.nf
6046\f[C]
6047pandoc --print-highlight-style pygments > my.theme
6048\f[R]
6049.fi
6050.PP
6051Then edit \f[C]my.theme\f[R] and use it like this:
6052.IP
6053.nf
6054\f[C]
6055pandoc --highlight-style my.theme
6056\f[R]
6057.fi
6058.PP
6059If you are not satisfied with the built-in highlighting, or you want
6060highlight a language that isn\[aq]t supported, you can use the
6061\f[C]--syntax-definition\f[R] option to load a KDE-style XML syntax
6062definition file.
6063Before writing your own, have a look at KDE\[aq]s repository of syntax
6064definitions.
6065.PP
6066To disable highlighting, use the \f[C]--no-highlight\f[R] option.
6067.SH CUSTOM STYLES
6068.PP
6069Custom styles can be used in the docx and ICML formats.
6070.SS Output
6071.PP
6072By default, pandoc\[aq]s docx and ICML output applies a predefined set
6073of styles for blocks such as paragraphs and block quotes, and uses
6074largely default formatting (italics, bold) for inlines.
6075This will work for most purposes, especially alongside a
6076\f[C]reference.docx\f[R] file.
6077However, if you need to apply your own styles to blocks, or match a
6078preexisting set of styles, pandoc allows you to define custom styles for
6079blocks and text using \f[C]div\f[R]s and \f[C]span\f[R]s, respectively.
6080.PP
6081If you define a \f[C]div\f[R] or \f[C]span\f[R] with the attribute
6082\f[C]custom-style\f[R], pandoc will apply your specified style to the
6083contained elements.
6084So, for example using the \f[C]bracketed_spans\f[R] syntax,
6085.IP
6086.nf
6087\f[C]
6088[Get out]{custom-style=\[dq]Emphatically\[dq]}, he said.
6089\f[R]
6090.fi
6091.PP
6092would produce a docx file with \[dq]Get out\[dq] styled with character
6093style \f[C]Emphatically\f[R].
6094Similarly, using the \f[C]fenced_divs\f[R] syntax,
6095.IP
6096.nf
6097\f[C]
6098Dickinson starts the poem simply:
6100::: {custom-style=\[dq]Poetry\[dq]}
6101| A Bird came down the Walk---
6102| He did not know I saw---
6103:::
6104\f[R]
6105.fi
6106.PP
6107would style the two contained lines with the \f[C]Poetry\f[R] paragraph
6108style.
6109.PP
6110For docx output, styles will be defined in the output file as inheriting
6111from normal text, if the styles are not yet in your reference.docx.
6112If they are already defined, pandoc will not alter the definition.
6113.PP
6114This feature allows for greatest customization in conjunction with
6115pandoc filters.
6116If you want all paragraphs after block quotes to be indented, you can
6117write a filter to apply the styles necessary.
6118If you want all italics to be transformed to the \f[C]Emphasis\f[R]
6119character style (perhaps to change their color), you can write a filter
6120which will transform all italicized inlines to inlines within an
6121\f[C]Emphasis\f[R] custom-style \f[C]span\f[R].
6122.PP
6123For docx output, you don\[aq]t need to enable any extensions for custom
6124styles to work.
6125.SS Input
6126.PP
6127The docx reader, by default, only reads those styles that it can convert
6128into pandoc elements, either by direct conversion or interpreting the
6129derivation of the input document\[aq]s styles.
6130.PP
6131By enabling the \f[C]styles\f[R] extension in the docx reader
6132(\f[C]-f docx+styles\f[R]), you can produce output that maintains the
6133styles of the input document, using the \f[C]custom-style\f[R] class.
6134Paragraph styles are interpreted as divs, while character styles are
6135interpreted as spans.
6136.PP
6137For example, using the \f[C]custom-style-reference.docx\f[R] file in the
6138test directory, we have the following different outputs:
6139.PP
6140Without the \f[C]+styles\f[R] extension:
6141.IP
6142.nf
6143\f[C]
6144$ pandoc test/docx/custom-style-reference.docx -f docx -t markdown
6145This is some text.
6147This is text with an *emphasized* text style. And this is text with a
6148**strengthened** text style.
6150> Here is a styled paragraph that inherits from Block Text.
6151\f[R]
6152.fi
6153.PP
6154And with the extension:
6155.IP
6156.nf
6157\f[C]
6158$ pandoc test/docx/custom-style-reference.docx -f docx+styles -t markdown
6160::: {custom-style=\[dq]FirstParagraph\[dq]}
6161This is some text.
6162:::
6164::: {custom-style=\[dq]BodyText\[dq]}
6165This is text with an [emphasized]{custom-style=\[dq]Emphatic\[dq]} text style.
6166And this is text with a [strengthened]{custom-style=\[dq]Strengthened\[dq]}
6167text style.
6168:::
6170::: {custom-style=\[dq]MyBlockStyle\[dq]}
6171> Here is a styled paragraph that inherits from Block Text.
6172:::
6173\f[R]
6174.fi
6175.PP
6176With these custom styles, you can use your input document as a
6177reference-doc while creating docx output (see below), and maintain the
6178same styles in your input and output files.
6179.SH CUSTOM WRITERS
6180.PP
6181Pandoc can be extended with custom writers written in lua.
6182(Pandoc includes a lua interpreter, so lua need not be installed
6183separately.)
6184.PP
6185To use a custom writer, simply specify the path to the lua script in
6186place of the output format.
6187For example:
6188.IP
6189.nf
6190\f[C]
6191pandoc -t data/sample.lua
6192\f[R]
6193.fi
6194.PP
6195Creating a custom writer requires writing a lua function for each
6196possible element in a pandoc document.
6197To get a documented example which you can modify according to your
6198needs, do
6199.IP
6200.nf
6201\f[C]
6202pandoc --print-default-data-file sample.lua
6203\f[R]
6204.fi
6205.SH A NOTE ON SECURITY
6206.PP
6207If you use pandoc to convert user-contributed content in a web
6208application, here are some things to keep in mind:
6209.IP "1." 3
6210Although pandoc itself will not create or modify any files other than
6211those you explicitly ask it create (with the exception of temporary
6212files used in producing PDFs), a filter or custom writer could in
6213principle do anything on your file system.
6214Please audit filters and custom writers very carefully before using
6215them.
6216.IP "2." 3
6217If your application uses pandoc as a Haskell library (rather than
6218shelling out to the executable), it is possible to use it in a mode that
6219fully isolates pandoc from your file system, by running the pandoc
6220operations in the \f[C]PandocPure\f[R] monad.
6221See the document Using the pandoc API for more details.
6222.IP "3." 3
6223Pandoc\[aq]s parsers can exhibit pathological performance on some corner
6224cases.
6225It is wise to put any pandoc operations under a timeout, to avoid DOS
6226attacks that exploit these issues.
6227If you are using the pandoc executable, you can add the command line
6228options \f[C]+RTS -M512M -RTS\f[R] (for example) to limit the heap size
6229to 512MB.
6230.IP "4." 3
6231The HTML generated by pandoc is not guaranteed to be safe.
6232If \f[C]raw_html\f[R] is enabled for the Markdown input, users can
6233inject arbitrary HTML.
6234Even if \f[C]raw_html\f[R] is disabled, users can include dangerous
6235content in attributes for headings, spans, and code blocks.
6236To be safe, you should run all the generated HTML through an HTML
6237sanitizer.
6238.SH AUTHORS
6239.PP
6240Copyright 2006--2019 John MacFarlane (jgm\[at]berkeley.edu).
6241Released under the GPL, version 2 or greater.
6242This software carries no warranty of any kind.
6243(See COPYRIGHT for full copyright and warranty notices.) For a full list
6244of contributors, see the file AUTHORS.md in the pandoc source code.
6245.PP
6246The Pandoc source code and all documentation may be downloaded
6247from <http://pandoc.org>.