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