8`pandoc` [*options*] [*input-file*]...
13Pandoc is a [Haskell] library for converting from one markup format to
14another, and a command-line tool that uses this library.
16Pandoc can read [Markdown], [CommonMark], [PHP Markdown Extra],
17[GitHub-Flavored Markdown], [MultiMarkdown], and (subsets of) [Textile],
18[reStructuredText], [HTML], [LaTeX], [MediaWiki markup], [TWiki
19markup], [TikiWiki markup], [Creole 1.0], [Haddock markup], [OPML],
20[Emacs Org mode], [DocBook], [JATS], [Muse], [txt2tags], [Vimwiki],
21[EPUB], [ODT], and [Word docx].
23Pandoc can write plain text, [Markdown],
24[CommonMark], [PHP Markdown Extra], [GitHub-Flavored Markdown],
25[MultiMarkdown], [reStructuredText], [XHTML], [HTML5], [LaTeX]
26\(including [`beamer`] slide shows\), [ConTeXt], [RTF], [OPML],
27[DocBook], [JATS], [OpenDocument], [ODT], [Word docx], [GNU Texinfo],
28[MediaWiki markup], [DokuWiki markup], [ZimWiki markup], [Haddock
29markup], [EPUB] \(v2 or v3\), [FictionBook2], [Textile], [groff man],
30[groff ms], [Emacs Org mode], [AsciiDoc], [InDesign ICML], [TEI
31Simple], [Muse], [PowerPoint] slide shows and [Slidy], [Slideous],
32[DZSlides], [reveal.js] or [S5] HTML slide shows. It can also produce
33[PDF] output on systems where LaTeX, ConTeXt, `pdfroff`,
34`wkhtmltopdf`, `prince`, or `weasyprint` is installed.
36Pandoc's enhanced version of Markdown includes syntax for [tables],
37[definition lists], [metadata blocks], [`Div` blocks][Extension:
38`fenced_divs`], [footnotes] and [citations], embedded
39[LaTeX][Extension: `raw_tex`] (including [math]), [Markdown inside HTML
40block elements][Extension: `markdown_in_html_blocks`], and much more.
41These enhancements, described further under [Pandoc's Markdown],
42can be disabled using the `markdown_strict` format.
44Pandoc has a modular design: it consists of a set of readers, which parse
45text in a given format and produce a native representation of the document
46(like an _abstract syntax tree_ or AST), and a set of writers, which convert
47this native representation into a target format. Thus, adding an input
48or output format requires only adding a reader or writer. Users can also
49run custom [pandoc filters] to modify the intermediate AST.
51Because pandoc's intermediate representation of a document is less
52expressive than many of the formats it converts between, one should
53not expect perfect conversions between every format and every other.
54Pandoc attempts to preserve the structural elements of a document, but
55not formatting details such as margin size. And some document elements,
56such as complex tables, may not fit into pandoc's simple document
57model. While conversions from pandoc's Markdown to all formats aspire
58to be perfect, conversions from formats more expressive than pandoc's
59Markdown can be expected to be lossy.
61[Markdown]: http://daringfireball.net/projects/markdown/
62[CommonMark]: http://commonmark.org
63[PHP Markdown Extra]: https://michelf.ca/projects/php-markdown/extra/
64[GitHub-Flavored Markdown]: https://help.github.com/articles/github-flavored-markdown/
65[MultiMarkdown]: http://fletcherpenney.net/multimarkdown/
66[reStructuredText]: http://docutils.sourceforge.net/docs/ref/rst/introduction.html
67[S5]: http://meyerweb.com/eric/tools/s5/
68[Slidy]: http://www.w3.org/Talks/Tools/Slidy/
69[Slideous]: http://goessner.net/articles/slideous/
70[HTML]: http://www.w3.org/html/
71[HTML5]: http://www.w3.org/TR/html5/
72[polyglot markup]: https://www.w3.org/TR/html-polyglot/
73[XHTML]: http://www.w3.org/TR/xhtml1/
74[LaTeX]: http://latex-project.org
75[`beamer`]: https://ctan.org/pkg/beamer
76[Beamer User's Guide]: http://ctan.math.utah.edu/ctan/tex-archive/macros/latex/contrib/beamer/doc/beameruserguide.pdf
77[ConTeXt]: http://www.contextgarden.net/
78[RTF]: http://en.wikipedia.org/wiki/Rich_Text_Format
79[DocBook]: http://docbook.org
80[JATS]: https://jats.nlm.nih.gov
81[txt2tags]: http://txt2tags.org
82[EPUB]: http://idpf.org/epub
83[OPML]: http://dev.opml.org/spec2.html
84[OpenDocument]: http://opendocument.xml.org
85[ODT]: http://en.wikipedia.org/wiki/OpenDocument
86[Textile]: http://redcloth.org/textile
87[MediaWiki markup]: https://www.mediawiki.org/wiki/Help:Formatting
88[DokuWiki markup]: https://www.dokuwiki.org/dokuwiki
89[ZimWiki markup]: http://zim-wiki.org/manual/Help/Wiki_Syntax.html
90[TWiki markup]: http://twiki.org/cgi-bin/view/TWiki/TextFormattingRules
91[TikiWiki markup]: https://doc.tiki.org/Wiki-Syntax-Text#The_Markup_Language_Wiki-Syntax
92[Haddock markup]: https://www.haskell.org/haddock/doc/html/ch03s08.html
93[Creole 1.0]: http://www.wikicreole.org/wiki/Creole1.0
94[groff man]: http://man7.org/linux/man-pages/man7/groff_man.7.html
95[groff ms]: http://man7.org/linux/man-pages/man7/groff_ms.7.html
96[Haskell]: https://www.haskell.org
97[GNU Texinfo]: http://www.gnu.org/software/texinfo/
98[Emacs Org mode]: http://orgmode.org
99[AsciiDoc]: http://www.methods.co.nz/asciidoc/
100[DZSlides]: http://paulrouget.com/dzslides/
101[Word docx]: https://en.wikipedia.org/wiki/Office_Open_XML
102[PDF]: https://www.adobe.com/pdf/
103[reveal.js]: http://lab.hakim.se/reveal-js/
104[FictionBook2]: http://www.fictionbook.org/index.php/Eng:XML_Schema_Fictionbook_2.1
105[InDesign ICML]: http://wwwimages.adobe.com/www.adobe.com/content/dam/acom/en/devnet/indesign/sdk/cs6/idml/idml-cookbook.pdf
106[TEI Simple]: https://github.com/TEIC/TEI-Simple
107[Muse]: https://amusewiki.org/library/manual
108[PowerPoint]: https://en.wikipedia.org/wiki/Microsoft_PowerPoint
109[Vimwiki]: https://vimwiki.github.io
114If no *input-files* are specified, input is read from *stdin*.
115Output goes to *stdout* by default. For output to a file,
118 pandoc -o output.html input.txt
120By default, pandoc produces a document fragment. To produce a standalone
121document (e.g. a valid HTML file including `<head>` and `<body>`),
122use the `-s` or `--standalone` flag:
124 pandoc -s -o output.html input.txt
126For more information on how standalone documents are produced, see
129If multiple input files are given, `pandoc` will concatenate them all (with
130blank lines between them) before parsing. (Use `--file-scope` to parse files
136The format of the input and output can be specified explicitly using
137command-line options. The input format can be specified using the
138`-f/--from` option, the output format using the `-t/--to` option.
139Thus, to convert `hello.txt` from Markdown to LaTeX, you could type:
141 pandoc -f markdown -t latex hello.txt
143To convert `hello.html` from HTML to Markdown:
145 pandoc -f html -t markdown hello.html
147Supported input and output formats are listed below under [Options]
148(see `-f` for input formats and `-t` for output formats). You
149can also use `pandoc --list-input-formats` and
150`pandoc --list-output-formats` to print lists of supported
153If the input or output format is not specified explicitly, `pandoc`
154will attempt to guess it from the extensions of the filenames.
157 pandoc -o hello.tex hello.txt
159will convert `hello.txt` from Markdown to LaTeX. If no output file
160is specified (so that output goes to *stdout*), or if the output file's
161extension is unknown, the output format will default to HTML.
162If no input file is specified (so that input comes from *stdin*), or
163if the input files' extensions are unknown, the input format will
164be assumed to be Markdown.
169Pandoc uses the UTF-8 character encoding for both input and output.
170If your local character encoding is not UTF-8, you
171should pipe input and output through [`iconv`]:
173 iconv -t utf-8 input.txt | pandoc | iconv -f utf-8
175Note that in some output formats (such as HTML, LaTeX, ConTeXt,
176RTF, OPML, DocBook, and Texinfo), information about
177the character encoding is included in the document header, which
178will only be included if you use the `-s/--standalone` option.
180[`iconv`]: http://www.gnu.org/software/libiconv/
185To produce a PDF, specify an output file with a `.pdf` extension:
187 pandoc test.txt -o test.pdf
189By default, pandoc will use LaTeX to create the PDF, which requires
190that a LaTeX engine be installed (see `--pdf-engine` below).
192Alternatively, pandoc can use [ConTeXt], `pdfroff`, or any of the
193following HTML/CSS-to-PDF-engines, to create a PDF: [`wkhtmltopdf`],
194[`weasyprint`] or [`prince`].
195To do this, specify an output file with a `.pdf` extension, as before,
196but add the `--pdf-engine` option or `-t context`, `-t html`, or `-t ms`
197to the command line (`-t html` defaults to `--pdf-engine=wkhtmltopdf`).
199PDF output can be controlled using [variables for LaTeX] (if
200LaTeX is used) and [variables for ConTeXt] (if ConTeXt is used).
201When using an HTML/CSS-to-PDF-engine, `--css` affects the output.
202If `wkhtmltopdf` is used, then the variables `margin-left`,
203`margin-right`, `margin-top`, `margin-bottom`, `footer-html`,
204`header-html` and `papersize` will affect the output.
206To debug the PDF creation, it can be useful to look at the intermediate
207representation: instead of `-o test.pdf`, use for example `-s -o test.tex`
208to output the generated LaTeX. You can then test it with `pdflatex test.tex`.
210When using LaTeX, the following packages need to be available
211(they are included with all recent versions of [TeX Live]):
212[`amsfonts`], [`amsmath`], [`lm`], [`unicode-math`],
213[`ifxetex`], [`ifluatex`], [`listings`] (if the
214`--listings` option is used), [`fancyvrb`], [`longtable`],
215[`booktabs`], [`graphicx`] and [`grffile`] (if the document
216contains images), [`hyperref`], [`xcolor`] (with `colorlinks`),
217[`ulem`], [`geometry`] (with the `geometry` variable set),
218[`setspace`] (with `linestretch`), and
219[`babel`] (with `lang`). The use of `xelatex` or `lualatex` as
220the LaTeX engine requires [`fontspec`]. `xelatex` uses
221[`polyglossia`] (with `lang`), [`xecjk`], and [`bidi`] (with the
222`dir` variable set). If the `mathspec` variable is set,
223`xelatex` will use [`mathspec`] instead of [`unicode-math`].
224The [`upquote`] and [`microtype`] packages are used if
225available, and [`csquotes`] will be used for [typography]
226if added to the template or included in any header file. The
227[`natbib`], [`biblatex`], [`bibtex`], and [`biber`] packages can
228optionally be used for [citation rendering].
230[`amsfonts`]: https://ctan.org/pkg/amsfonts
231[`amsmath`]: https://ctan.org/pkg/amsmath
232[`lm`]: https://ctan.org/pkg/lm
233[`ifxetex`]: https://ctan.org/pkg/ifxetex
234[`ifluatex`]: https://ctan.org/pkg/ifluatex
235[`listings`]: https://ctan.org/pkg/listings
236[`fancyvrb`]: https://ctan.org/pkg/fancyvrb
237[`longtable`]: https://ctan.org/pkg/longtable
238[`booktabs`]: https://ctan.org/pkg/booktabs
239[`graphicx`]: https://ctan.org/pkg/graphicx
240[`grffile`]: https://ctan.org/pkg/grffile
241[`geometry`]: https://ctan.org/pkg/geometry
242[`setspace`]: https://ctan.org/pkg/setspace
243[`xecjk`]: https://ctan.org/pkg/xecjk
244[`hyperref`]: https://ctan.org/pkg/hyperref
245[`ulem`]: https://ctan.org/pkg/ulem
246[`babel`]: https://ctan.org/pkg/babel
247[`bidi`]: https://ctan.org/pkg/bidi
248[`mathspec`]: https://ctan.org/pkg/mathspec
249[`unicode-math`]: https://ctan.org/pkg/unicode-math
250[`polyglossia`]: https://ctan.org/pkg/polyglossia
251[`fontspec`]: https://ctan.org/pkg/fontspec
252[`upquote`]: https://ctan.org/pkg/upquote
253[`microtype`]: https://ctan.org/pkg/microtype
254[`csquotes`]: https://ctan.org/pkg/csquotes
255[`natbib`]: https://ctan.org/pkg/natbib
256[`biblatex`]: https://ctan.org/pkg/biblatex
257[`bibtex`]: https://ctan.org/pkg/bibtex
258[`biber`]: https://ctan.org/pkg/biber
259[TeX Live]: http://www.tug.org/texlive/
260[`wkhtmltopdf`]: https://wkhtmltopdf.org
261[`weasyprint`]: http://weasyprint.org
262[`prince`]: https://www.princexml.com/
267Instead of an input file, an absolute URI may be given. In this case
268pandoc will fetch the content using HTTP:
270 pandoc -f html -t markdown http://www.fsf.org
272It is possible to supply a custom User-Agent string or other
273header when requesting a document from a URL:
275 pandoc -f html -t markdown --request-header User-Agent:"Mozilla/5.0" \
284`-f` *FORMAT*, `-r` *FORMAT*, `--from=`*FORMAT*, `--read=`*FORMAT*
286: Specify input format. *FORMAT* can be `native` (native Haskell),
287 `json` (JSON version of native AST), `markdown` (pandoc's
288 extended Markdown), `markdown_strict` (original unextended
289 Markdown), `markdown_phpextra` (PHP Markdown Extra),
290 `markdown_mmd` (MultiMarkdown), `gfm` (GitHub-Flavored Markdown),
291 `commonmark` (CommonMark Markdown), `textile` (Textile), `rst`
292 (reStructuredText), `html` (HTML), `docbook` (DocBook), `t2t`
293 (txt2tags), `docx` (docx), `odt` (ODT), `epub` (EPUB), `opml` (OPML),
294 `org` (Emacs Org mode), `mediawiki` (MediaWiki markup), `twiki` (TWiki
295 markup), `tikiwiki` (TikiWiki markup), `creole` (Creole 1.0),
296 `haddock` (Haddock markup), or `latex` (LaTeX).
297 (`markdown_github` provides deprecated and less accurate support
298 for Github-Flavored Markdown; please use `gfm` instead, unless you
299 need to use extensions other than `smart`.)
300 Extensions can be individually enabled or disabled by
301 appending `+EXTENSION` or `-EXTENSION` to the format name.
302 See [Extensions] below, for a list of extensions and
303 their names. See `--list-input-formats` and `--list-extensions`,
306`-t` *FORMAT*, `-w` *FORMAT*, `--to=`*FORMAT*, `--write=`*FORMAT*
308: Specify output format. *FORMAT* can be `native` (native Haskell),
309 `json` (JSON version of native AST), `plain` (plain text),
310 `markdown` (pandoc's extended Markdown), `markdown_strict`
311 (original unextended Markdown), `markdown_phpextra` (PHP Markdown
312 Extra), `markdown_mmd` (MultiMarkdown), `gfm` (GitHub-Flavored
313 Markdown), `commonmark` (CommonMark Markdown), `rst`
314 (reStructuredText), `html4` (XHTML 1.0 Transitional), `html` or
315 `html5` (HTML5/XHTML [polyglot markup]), `latex` (LaTeX), `beamer`
316 (LaTeX beamer slide show), `context` (ConTeXt), `man` (groff man),
317 `mediawiki` (MediaWiki markup), `dokuwiki` (DokuWiki markup),
318 `zimwiki` (ZimWiki markup), `textile` (Textile), `org` (Emacs Org
319 mode), `texinfo` (GNU Texinfo), `opml` (OPML), `docbook` or
320 `docbook4` (DocBook 4), `docbook5` (DocBook 5), `jats` (JATS XML),
321 `opendocument` (OpenDocument), `odt` (OpenOffice text document),
322 `docx` (Word docx), `haddock` (Haddock markup), `rtf` (rich text
323 format), `epub2` (EPUB v2 book), `epub` or `epub3` (EPUB v3),
324 `fb2` (FictionBook2 e-book), `asciidoc` (AsciiDoc), `icml`
325 (InDesign ICML), `tei` (TEI Simple), `slidy` (Slidy HTML and
326 JavaScript slide show), `slideous` (Slideous HTML and JavaScript
327 slide show), `dzslides` (DZSlides HTML5 + JavaScript slide show),
328 `revealjs` (reveal.js HTML5 + JavaScript slide show), `s5` (S5
329 HTML and JavaScript slide show), `pptx` (PowerPoint slide show) or
330 the path of a custom lua writer (see [Custom writers],
331 below). (`markdown_github` provides deprecated and less accurate
332 support for Github-Flavored Markdown; please use `gfm` instead,
333 unless you use extensions that do not work with `gfm`.) Note that
334 `odt`, `docx`, and `epub` output will not be directed to *stdout*
335 unless forced with `-o -`. Extensions can be individually enabled or
336 disabled by appending `+EXTENSION` or `-EXTENSION` to the format
337 name. See [Extensions] below, for a list of extensions and their
338 names. See `--list-output-formats` and `--list-extensions`, below.
340`-o` *FILE*, `--output=`*FILE*
342: Write output to *FILE* instead of *stdout*. If *FILE* is
343 `-`, output will go to *stdout*, even if a non-textual format
344 (`docx`, `odt`, `epub2`, `epub3`) is specified.
346`--data-dir=`*DIRECTORY*
348: Specify the user data directory to search for pandoc data files.
349 If this option is not specified, the default user data directory
350 will be used. This is, in UNIX:
356 C:\Documents And Settings\USERNAME\Application Data\pandoc
358 and in Windows Vista or later:
360 C:\Users\USERNAME\AppData\Roaming\pandoc
362 You can find the default user data directory on your system by
363 looking at the output of `pandoc --version`.
364 A `reference.odt`, `reference.docx`, `epub.css`, `templates`,
365 `slidy`, `slideous`, or `s5` directory
366 placed in this directory will override pandoc's normal defaults.
370: Generate a bash completion script. To enable bash completion
371 with pandoc, add this to your `.bashrc`:
373 eval "$(pandoc --bash-completion)"
377: Give verbose debugging output. Currently this only has an effect
382: Suppress warning messages.
386: Exit with error status if there are any warnings.
390: Write log messages in machine-readable JSON format to
391 *FILE*. All messages above DEBUG level will be written,
392 regardless of verbosity settings (`--verbose`, `--quiet`).
394`--list-input-formats`
396: List supported input formats, one per line.
398`--list-output-formats`
400: List supported output formats, one per line.
402`--list-extensions`[`=`*FORMAT*]
404: List supported extensions, one per line, preceded
405 by a `+` or `-` indicating whether it is enabled by default
406 in *FORMAT*. If *FORMAT* is not specified, defaults for
407 pandoc's Markdown are given.
409`--list-highlight-languages`
411: List supported languages for syntax highlighting, one per
414`--list-highlight-styles`
416: List supported styles for syntax highlighting, one per line.
417 See `--highlight-style`.
430`--base-header-level=`*NUMBER*
432: Specify the base level for headers (defaults to 1).
434`--strip-empty-paragraphs`
436: *Deprecated. Use the `+empty_paragraphs` extension instead.*
437 Ignore paragraphs with no content. This option is useful
438 for converting word processing documents where users have
439 used empty paragraphs to create inter-paragraph space.
441`--indented-code-classes=`*CLASSES*
443: Specify classes to use for indented code blocks--for example,
444 `perl,numberLines` or `haskell`. Multiple classes may be separated
447`--default-image-extension=`*EXTENSION*
449: Specify a default extension to use when image paths/URLs have no
450 extension. This allows you to use the same source for formats that
451 require different kinds of images. Currently this option only affects
452 the Markdown and LaTeX readers.
456: Parse each file individually before combining for multifile
457 documents. This will allow footnotes in different files with the
458 same identifiers to work as expected. If this option is set,
459 footnotes and links will not work across files. Reading binary
460 files (docx, odt, epub) implies `--file-scope`.
464: Specify an executable to be used as a filter transforming the
465 pandoc AST after the input is parsed and before the output is
466 written. The executable should read JSON from stdin and write
467 JSON to stdout. The JSON must be formatted like pandoc's own
468 JSON input and output. The name of the output format will be
469 passed to the filter as the first argument. Hence,
471 pandoc --filter ./caps.py -t latex
475 pandoc -t json | ./caps.py latex | pandoc -f json -t latex
477 The latter form may be useful for debugging filters.
479 Filters may be written in any language. `Text.Pandoc.JSON`
480 exports `toJSONFilter` to facilitate writing filters in Haskell.
481 Those who would prefer to write filters in python can use the
482 module [`pandocfilters`], installable from PyPI. There are also
483 pandoc filter libraries in [PHP], [perl], and
484 [JavaScript/node.js].
486 In order of preference, pandoc will look for filters in
488 1. a specified full or relative path (executable or
491 2. `$DATADIR/filters` (executable or non-executable)
492 where `$DATADIR` is the user data directory (see
493 `--data-dir`, above).
495 3. `$PATH` (executable only)
497 Filters and lua-filters are applied in the order specified
500`--lua-filter=`*SCRIPT*
502: Transform the document in a similar fashion as JSON filters (see
503 `--filter`), but use pandoc's build-in lua filtering system. The given
504 lua script is expected to return a list of lua filters which will be
505 applied in order. Each lua filter must contain element-transforming
506 functions indexed by the name of the AST element on which the filter
507 function should be applied.
509 The `pandoc` lua module provides helper functions for element
510 creation. It is always loaded into the script's lua environment.
512 The following is an example lua script for macro-expansion:
514 function expand_hello_world(inline)
515 if inline.c == '{{helloworld}}' then
516 return pandoc.Emph{ pandoc.Str "Hello, World" }
522 return {{Str = expand_hello_world}}
525`-M` *KEY*[`=`*VAL*], `--metadata=`*KEY*[`:`*VAL*]
527: Set the metadata field *KEY* to the value *VAL*. A value specified
528 on the command line overrides a value specified in the document.
529 Values will be parsed as YAML boolean or string values. If no value is
530 specified, the value will be treated as Boolean true. Like
531 `--variable`, `--metadata` causes template variables to be set.
532 But unlike `--variable`, `--metadata` affects the metadata of the
533 underlying document (which is accessible from filters and may be
534 printed in some output formats).
536`-p`, `--preserve-tabs`
538: Preserve tabs instead of converting them to spaces (the default).
539 Note that this will only affect tabs in literal code spans and code
540 blocks; tabs in regular text will be treated as spaces.
544: Specify the number of spaces per tab (default is 4).
546`--track-changes=accept`|`reject`|`all`
548: Specifies what to do with insertions, deletions, and comments
549 produced by the MS Word "Track Changes" feature. `accept` (the
550 default), inserts all insertions, and ignores all
551 deletions. `reject` inserts all deletions and ignores
552 insertions. Both `accept` and `reject` ignore comments. `all` puts
553 in insertions, deletions, and comments, wrapped in spans with
554 `insertion`, `deletion`, `comment-start`, and `comment-end`
555 classes, respectively. The author and time of change is
556 included. `all` is useful for scripting: only accepting changes
557 from a certain reviewer, say, or before a certain date. If a
558 paragraph is inserted or deleted, `track-changes=all` produces a
559 span with the class `paragraph-insertion`/`paragraph-deletion`
560 before the affected paragraph break. This option only affects the
563`--extract-media=`*DIR*
565: Extract images and other media contained in or linked from
566 the source document to the path *DIR*, creating it if
567 necessary, and adjust the images references in the document
568 so they point to the extracted files. If the source format is
569 a binary container (docx, epub, or odt), the media is
570 extracted from the container and the original
571 filenames are used. Otherwise the media is read from the
572 file system or downloaded, and new filenames are constructed
573 based on SHA1 hashes of the contents.
575`--abbreviations=`*FILE*
577: Specifies a custom abbreviations file, with abbreviations
578 one to a line. If this option is not specified, pandoc will
579 read the data file `abbreviations` from the user data
580 directory or fall back on a system default. To see the
582 `pandoc --print-default-data-file=abbreviations`. The only
583 use pandoc makes of this list is in the Markdown reader.
584 Strings ending in a period that are found in this list will
585 be followed by a nonbreaking space, so that the period will
586 not produce sentence-ending space in formats like LaTeX.
588[`pandocfilters`]: https://github.com/jgm/pandocfilters
589[PHP]: https://github.com/vinai/pandocfilters-php
590[perl]: https://metacpan.org/pod/Pandoc::Filter
591[JavaScript/node.js]: https://github.com/mvhenderson/pandoc-filter-node
593General writer options
594----------------------
598: Produce output with an appropriate header and footer (e.g. a
599 standalone HTML, LaTeX, TEI, or RTF file, not a fragment). This option
600 is set automatically for `pdf`, `epub`, `epub3`, `fb2`, `docx`, and `odt`
605: Use *FILE* as a custom template for the generated document. Implies
606 `--standalone`. See [Templates], below, for a description
607 of template syntax. If no extension is specified, an extension
608 corresponding to the writer will be added, so that `--template=special`
609 looks for `special.html` for HTML output. If the template is not
610 found, pandoc will search for it in the `templates` subdirectory of
611 the user data directory (see `--data-dir`). If this option is not used,
612 a default template appropriate for the output format will be used (see
613 `-D/--print-default-template`).
615`-V` *KEY*[`=`*VAL*], `--variable=`*KEY*[`:`*VAL*]
617: Set the template variable *KEY* to the value *VAL* when rendering the
618 document in standalone mode. This is generally only useful when the
619 `--template` option is used to specify a custom template, since
620 pandoc automatically sets the variables used in the default
621 templates. If no *VAL* is specified, the key will be given the
624`-D` *FORMAT*, `--print-default-template=`*FORMAT*
626: Print the system default template for an output *FORMAT*. (See `-t`
627 for a list of possible *FORMAT*s.) Templates in the user data
628 directory are ignored.
630`--print-default-data-file=`*FILE*
632: Print a system default data file. Files in the user data directory
635`--eol=crlf`|`lf`|`native`
637: Manually specify line endings: `crlf` (Windows), `lf`
638 (macOS/Linux/UNIX), or `native` (line endings appropriate
639 to the OS on which pandoc is being run). The default is
644: Specify the dpi (dots per inch) value for conversion from pixels
645 to inch/centimeters and vice versa. The default is 96dpi.
646 Technically, the correct term would be ppi (pixels per inch).
648`--wrap=auto`|`none`|`preserve`
650: Determine how text is wrapped in the output (the source
651 code, not the rendered version). With `auto` (the default),
652 pandoc will attempt to wrap lines to the column width specified by
653 `--columns` (default 72). With `none`, pandoc will not wrap
654 lines at all. With `preserve`, pandoc will attempt to
655 preserve the wrapping from the source document (that is,
656 where there are nonsemantic newlines in the source, there
657 will be nonsemantic newlines in the output as well).
658 Automatic wrapping does not currently work in HTML output.
662: Specify length of lines in characters. This affects text wrapping
663 in the generated source code (see `--wrap`). It also affects
664 calculation of column widths for plain text tables (see [Tables] below).
666`--toc`, `--table-of-contents`
668: Include an automatically generated table of contents (or, in
669 the case of `latex`, `context`, `docx`, `odt`,
670 `opendocument`, `rst`, or `ms`, an instruction to create
671 one) in the output document. This option has no effect on
672 `man`, `docbook4`, `docbook5`, or `jats` output.
674`--toc-depth=`*NUMBER*
676: Specify the number of section levels to include in the table
677 of contents. The default is 3 (which means that level 1, 2, and 3
678 headers will be listed in the contents).
682: Strip out HTML comments in the Markdown or Textile source,
683 rather than passing them on to Markdown, Textile or HTML
684 output as raw HTML. This does not apply to HTML comments
685 inside raw HTML blocks when the `markdown_in_html_blocks`
686 extension is not set.
690: Disables syntax highlighting for code blocks and inlines, even when
691 a language attribute is given.
693`--highlight-style=`*STYLE*|*FILE*
695: Specifies the coloring style to be used in highlighted source code.
696 Options are `pygments` (the default), `kate`, `monochrome`,
697 `breezeDark`, `espresso`, `zenburn`, `haddock`, and `tango`.
698 For more information on syntax highlighting in pandoc, see
699 [Syntax highlighting], below. See also
700 `--list-highlight-styles`.
702 Instead of a *STYLE* name, a JSON file with extension
703 `.theme` may be supplied. This will be parsed as a KDE
704 syntax highlighting theme and (if valid) used as the
707 To generate the JSON version of an existing style,
708 use `--print-highlight-style`.
710`--print-highlight-style=`*STYLE*|*FILE*
712: Prints a JSON version of a highlighting style, which can
713 be modified, saved with a `.theme` extension, and used
714 with `--highlight-style`.
716`--syntax-definition=`*FILE*
718: Instructs pandoc to load a KDE XML syntax definition file,
719 which will be used for syntax highlighting of appropriately
720 marked code blocks. This can be used to add support for
721 new languages or to use altered syntax definitions for
724`-H` *FILE*, `--include-in-header=`*FILE*
726: Include contents of *FILE*, verbatim, at the end of the header.
727 This can be used, for example, to include special
728 CSS or JavaScript in HTML documents. This option can be used
729 repeatedly to include multiple files in the header. They will be
730 included in the order specified. Implies `--standalone`.
732`-B` *FILE*, `--include-before-body=`*FILE*
734: Include contents of *FILE*, verbatim, at the beginning of the
735 document body (e.g. after the `<body>` tag in HTML, or the
736 `\begin{document}` command in LaTeX). This can be used to include
737 navigation bars or banners in HTML documents. This option can be
738 used repeatedly to include multiple files. They will be included in
739 the order specified. Implies `--standalone`.
741`-A` *FILE*, `--include-after-body=`*FILE*
743: Include contents of *FILE*, verbatim, at the end of the document
744 body (before the `</body>` tag in HTML, or the
745 `\end{document}` command in LaTeX). This option can be used
746 repeatedly to include multiple files. They will be included in the
747 order specified. Implies `--standalone`.
749`--resource-path=`*SEARCHPATH*
751: List of paths to search for images and other resources.
752 The paths should be separated by `:` on Linux, UNIX, and
753 macOS systems, and by `;` on Windows. If `--resource-path`
754 is not specified, the default resource path is the working
755 directory. Note that, if `--resource-path` is specified,
756 the working directory must be explicitly listed or it
757 will not be searched. For example:
758 `--resource-path=.:test` will search the working directory
759 and the `test` subdirectory, in that order.
761`--request-header=`*NAME*`:`*VAL*
763: Set the request header *NAME* to the value *VAL* when making
764 HTTP requests (for example, when a URL is given on the
765 command line, or when resources used in a document must be
768Options affecting specific writers
769----------------------------------
773: Produce a standalone HTML file with no external dependencies, using
774 `data:` URIs to incorporate the contents of linked scripts, stylesheets,
775 images, and videos. Implies `--standalone`. The resulting file should be
776 "self-contained," in the sense that it needs no external files and no net
777 access to be displayed properly by a browser. This option works only with
778 HTML output formats, including `html4`, `html5`, `html+lhs`, `html5+lhs`,
779 `s5`, `slidy`, `slideous`, `dzslides`, and `revealjs`. Scripts, images,
780 and stylesheets at absolute URLs will be downloaded; those at relative
781 URLs will be sought relative to the working directory (if the first source
782 file is local) or relative to the base URL (if the first source
783 file is remote). Elements with the attribute
784 `data-external="1"` will be left alone; the documents they
785 link to will not be incorporated in the document.
786 Limitation: resources that are loaded dynamically through
787 JavaScript cannot be incorporated; as a result,
788 `--self-contained` does not work with `--mathjax`, and some
789 advanced features (e.g. zoom or speaker notes) may not work
790 in an offline "self-contained" `reveal.js` slide show.
794: Use `<q>` tags for quotes in HTML.
798: Use only ASCII characters in output. Currently supported only for
799 HTML and DocBook output (which uses numerical entities instead of
800 UTF-8 when this option is selected).
804: Use reference-style links, rather than inline links, in writing Markdown
805 or reStructuredText. By default inline links are used. The
806 placement of link references is affected by the
807 `--reference-location` option.
809`--reference-location = block`|`section`|`document`
811: Specify whether footnotes (and references, if `reference-links` is
812 set) are placed at the end of the current (top-level) block, the
813 current section, or the document. The default is
814 `document`. Currently only affects the markdown writer.
818: Use ATX-style headers in Markdown and AsciiDoc output. The default is
819 to use setext-style headers for levels 1-2, and then ATX headers.
820 (Note: for `gfm` output, ATX headers are always used.)
822`--top-level-division=[default|section|chapter|part]`
824: Treat top-level headers as the given division type in LaTeX, ConTeXt,
825 DocBook, and TEI output. The hierarchy order is part, chapter, then section;
826 all headers are shifted such that the top-level header becomes the specified
827 type. The default behavior is to determine the best division type via
828 heuristics: unless other conditions apply, `section` is chosen. When the
829 LaTeX document class is set to `report`, `book`, or `memoir` (unless the
830 `article` option is specified), `chapter` is implied as the setting for this
831 option. If `beamer` is the output format, specifying either `chapter` or
832 `part` will cause top-level headers to become `\part{..}`, while
833 second-level headers remain as their default type.
835`-N`, `--number-sections`
837: Number section headings in LaTeX, ConTeXt, HTML, or EPUB output.
838 By default, sections are not numbered. Sections with class
839 `unnumbered` will never be numbered, even if `--number-sections`
842`--number-offset=`*NUMBER*[`,`*NUMBER*`,`*...*]
844: Offset for section headings in HTML output (ignored in other
845 output formats). The first number is added to the section number for
846 top-level headers, the second for second-level headers, and so on.
847 So, for example, if you want the first top-level header in your
848 document to be numbered "6", specify `--number-offset=5`.
849 If your document starts with a level-2 header which you want to
850 be numbered "1.5", specify `--number-offset=1,4`.
851 Offsets are 0 by default. Implies `--number-sections`.
855: Use the [`listings`] package for LaTeX code blocks
859: Make list items in slide shows display incrementally (one by one).
860 The default is for lists to be displayed all at once.
862`--slide-level=`*NUMBER*
864: Specifies that headers with the specified level create
865 slides (for `beamer`, `s5`, `slidy`, `slideous`, `dzslides`). Headers
866 above this level in the hierarchy are used to divide the
867 slide show into sections; headers below this level create
868 subheads within a slide. Note that content that is
869 not contained under slide-level headers will not appear in
870 the slide show. The default is to set the slide level based
871 on the contents of the document; see [Structuring the slide
876: Wrap sections in `<section>` tags (or `<div>` tags for `html4`),
877 and attach identifiers to the enclosing `<section>` (or `<div>`)
878 rather than the header itself. See
879 [Header identifiers], below.
881`--email-obfuscation=none`|`javascript`|`references`
883: Specify a method for obfuscating `mailto:` links in HTML documents.
884 `none` leaves `mailto:` links as they are. `javascript` obfuscates
885 them using JavaScript. `references` obfuscates them by printing their
886 letters as decimal or hexadecimal character references. The default
889`--id-prefix=`*STRING*
891: Specify a prefix to be added to all identifiers and internal links
892 in HTML and DocBook output, and to footnote numbers in Markdown
893 and Haddock output. This is useful for preventing duplicate
894 identifiers when generating fragments to be included in other pages.
896`-T` *STRING*, `--title-prefix=`*STRING*
898: Specify *STRING* as a prefix at the beginning of the title
899 that appears in the HTML header (but not in the title as it
900 appears at the beginning of the HTML body). Implies
903`-c` *URL*, `--css=`*URL*
905: Link to a CSS style sheet. This option can be used repeatedly to
906 include multiple files. They will be included in the order specified.
908 A stylesheet is required for generating EPUB. If none is
909 provided using this option (or the `stylesheet` metadata
910 field), pandoc will look for a file `epub.css` in the
911 user data directory (see `--data-dir`). If it is not
912 found there, sensible defaults will be used.
914`--reference-doc=`*FILE*
916: Use the specified file as a style reference in producing a
921 : For best results, the reference docx should be a modified
922 version of a docx file produced using pandoc. The contents
923 of the reference docx are ignored, but its stylesheets and
924 document properties (including margins, page size, header,
925 and footer) are used in the new docx. If no reference docx
926 is specified on the command line, pandoc will look for a
927 file `reference.docx` in the user data directory (see
928 `--data-dir`). If this is not found either, sensible
929 defaults will be used.
931 To produce a custom `reference.docx`, first get a copy of
932 the default `reference.docx`: `pandoc
933 --print-default-data-file reference.docx >
934 custom-reference.docx`. Then open `custom-reference.docx`
935 in Word, modify the styles as you wish, and save the file.
936 For best results, do not make changes to this file other
937 than modifying the styles used by pandoc: [paragraph]
938 Normal, Body Text, First Paragraph, Compact, Title,
939 Subtitle, Author, Date, Abstract, Bibliography, Heading 1,
940 Heading 2, Heading 3, Heading 4, Heading 5, Heading 6,
941 Heading 7, Heading 8, Heading 9, Block Text, Footnote Text,
942 Definition Term, Definition, Caption, Table Caption,
943 Image Caption, Figure, Captioned Figure, TOC Heading;
944 [character] Default Paragraph Font, Body Text Char,
945 Verbatim Char, Footnote Reference, Hyperlink; [table]
950 : For best results, the reference ODT should be a modified
951 version of an ODT produced using pandoc. The contents of
952 the reference ODT are ignored, but its stylesheets are used
953 in the new ODT. If no reference ODT is specified on the
954 command line, pandoc will look for a file `reference.odt` in
955 the user data directory (see `--data-dir`). If this is not
956 found either, sensible defaults will be used.
958 To produce a custom `reference.odt`, first get a copy of
959 the default `reference.odt`: `pandoc
960 --print-default-data-file reference.odt >
961 custom-reference.odt`. Then open `custom-reference.odt` in
962 LibreOffice, modify the styles as you wish, and save the
967 : Any template included with a recent install of Microsoft
968 PowerPoint (either with `.pptx` or `.potx` extension) should
969 work, as will most templates derived from these.
971 The specific requirement is that the template should contain
972 the following four layouts as its first four layouts:
979 All templates included with a recent version of MS PowerPoint
980 will fit these criteria. (You can click on `Layout` under the
981 `Home` menu to check.)
983 You can also modify the default `reference.pptx`: first run
984 `pandoc --print-default-data-file reference.pptx >
985 custom-reference.pptx`, and then modify
986 `custom-reference.pptx` in MS PowerPoint (pandoc will use the
987 first four layout slides, as mentioned above).
989`--epub-cover-image=`*FILE*
991: Use the specified image as the EPUB cover. It is recommended
992 that the image be less than 1000px in width and height. Note that
993 in a Markdown source document you can also specify `cover-image`
994 in a YAML metadata block (see [EPUB Metadata], below).
996`--epub-metadata=`*FILE*
998: Look in the specified XML file for metadata for the EPUB.
999 The file should contain a series of [Dublin Core elements].
1002 <dc:rights>Creative Commons</dc:rights>
1003 <dc:language>es-AR</dc:language>
1005 By default, pandoc will include the following metadata elements:
1006 `<dc:title>` (from the document title), `<dc:creator>` (from the
1007 document authors), `<dc:date>` (from the document date, which should
1008 be in [ISO 8601 format]), `<dc:language>` (from the `lang`
1009 variable, or, if is not set, the locale), and `<dc:identifier
1010 id="BookId">` (a randomly generated UUID). Any of these may be
1011 overridden by elements in the metadata file.
1013 Note: if the source document is Markdown, a YAML metadata block
1014 in the document can be used instead. See below under
1017`--epub-embed-font=`*FILE*
1019: Embed the specified font in the EPUB. This option can be repeated
1020 to embed multiple fonts. Wildcards can also be used: for example,
1021 `DejaVuSans-*.ttf`. However, if you use wildcards on the command
1022 line, be sure to escape them or put the whole filename in single quotes,
1023 to prevent them from being interpreted by the shell. To use the
1024 embedded fonts, you will need to add declarations like the following
1025 to your CSS (see `--css`):
1028 font-family: DejaVuSans;
1030 font-weight: normal;
1031 src:url("DejaVuSans-Regular.ttf");
1034 font-family: DejaVuSans;
1037 src:url("DejaVuSans-Bold.ttf");
1040 font-family: DejaVuSans;
1042 font-weight: normal;
1043 src:url("DejaVuSans-Oblique.ttf");
1046 font-family: DejaVuSans;
1049 src:url("DejaVuSans-BoldOblique.ttf");
1051 body { font-family: "DejaVuSans"; }
1053`--epub-chapter-level=`*NUMBER*
1055: Specify the header level at which to split the EPUB into separate
1056 "chapter" files. The default is to split into chapters at level 1
1057 headers. This option only affects the internal composition of the
1058 EPUB, not the way chapters and sections are displayed to users. Some
1059 readers may be slow if the chapter files are too large, so for large
1060 documents with few level 1 headers, one might want to use a chapter
1063`--epub-subdirectory=`*DIRNAME*
1065: Specify the subdirectory in the OCF container that is to hold
1066 the EPUB-specific contents. The default is `EPUB`. To put
1067 the EPUB contents in the top level, use an empty string.
1069`--pdf-engine=pdflatex`|`lualatex`|`xelatex`|`wkhtmltopdf`|`weasyprint`|`prince`|`context`|`pdfroff`
1071: Use the specified engine when producing PDF output.
1072 The default is `pdflatex`. If the engine is not in your PATH,
1073 the full path of the engine may be specified here.
1075`--pdf-engine-opt=`*STRING*
1077: Use the given string as a command-line argument to the `pdf-engine`.
1078 If used multiple times, the arguments are provided with spaces between
1079 them. Note that no check for duplicate options is done.
1081[Dublin Core elements]: http://dublincore.org/documents/dces/
1082[ISO 8601 format]: http://www.w3.org/TR/NOTE-datetime
1087`--bibliography=`*FILE*
1089: Set the `bibliography` field in the document's metadata to *FILE*,
1090 overriding any value set in the metadata, and process citations
1091 using `pandoc-citeproc`. (This is equivalent to
1092 `--metadata bibliography=FILE --filter pandoc-citeproc`.)
1093 If `--natbib` or `--biblatex` is also supplied, `pandoc-citeproc` is not
1094 used, making this equivalent to `--metadata bibliography=FILE`.
1095 If you supply this argument multiple times, each *FILE* will be added
1100: Set the `csl` field in the document's metadata to *FILE*,
1101 overriding any value set in the metadata. (This is equivalent to
1102 `--metadata csl=FILE`.)
1103 This option is only relevant with `pandoc-citeproc`.
1105`--citation-abbreviations=`*FILE*
1107: Set the `citation-abbreviations` field in the document's metadata to
1108 *FILE*, overriding any value set in the metadata. (This is equivalent to
1109 `--metadata citation-abbreviations=FILE`.)
1110 This option is only relevant with `pandoc-citeproc`.
1114: Use [`natbib`] for citations in LaTeX output. This option is not for use
1115 with the `pandoc-citeproc` filter or with PDF output. It is intended for
1116 use in producing a LaTeX file that can be processed with [`bibtex`].
1120: Use [`biblatex`] for citations in LaTeX output. This option is not for use
1121 with the `pandoc-citeproc` filter or with PDF output. It is intended for
1122 use in producing a LaTeX file that can be processed with [`bibtex`] or [`biber`].
1124Math rendering in HTML
1125----------------------
1127The default is to render TeX math as far as possible using Unicode characters.
1128Formulas are put inside a `span` with `class="math"`, so that they may be styled
1129differently from the surrounding text if needed. However, this gives acceptable
1130results only for basic math, usually you will want to use `--mathjax` or another
1131of the following options.
1133`--mathjax`[`=`*URL*]
1135: Use [MathJax] to display embedded TeX math in HTML output.
1136 TeX math will be put between `\(...\)` (for inline math)
1137 or `\[...\]` (for display math) and wrapped in `<span>` tags
1138 with class `math`. Then the MathJax JavaScript will render it.
1139 The *URL* should point to the `MathJax.js` load script.
1140 If a *URL* is not provided, a link to the Cloudflare CDN will
1145: Convert TeX math to [MathML] (in `epub3`, `docbook4`, `docbook5`, `jats`,
1146 `html4` and `html5`). This is the default in `odt` output. Note that
1147 currently only Firefox and Safari (and select e-book readers) natively
1152: Convert TeX formulas to `<img>` tags that link to an external script
1153 that converts formulas to images. The formula will be URL-encoded
1154 and concatenated with the URL provided. For SVG images you can for
1155 example use `--webtex https://latex.codecogs.com/svg.latex?`.
1156 If no URL is specified, the CodeCogs URL generating PNGs
1157 will be used (`https://latex.codecogs.com/png.latex?`).
1158 Note: the `--webtex` option will affect Markdown output
1159 as well as HTML, which is useful if you're targeting a
1160 version of Markdown without native math support.
1164: Use [KaTeX] to display embedded TeX math in HTML output.
1165 The *URL* is the base URL for the KaTeX library. If a *URL* is
1166 not provided, a link to the KaTeX CDN will be inserted.
1168`--katex-stylesheet=`*URL*
1170: The *URL* should point to the `katex.css` stylesheet. If this option is
1171 not specified, a link to the KaTeX CDN will be inserted. Note that this
1172 option does not imply `--katex`.
1174`-m` [*URL*], `--latexmathml`[`=`*URL*]
1177 Use the [LaTeXMathML] script to display embedded TeX math in HTML output.
1178 TeX math will be displayed between `$` or `$$` characters and put in
1179 `<span>` tags with class `LaTeX`. The LaTeXMathML JavaScript will then
1180 change it to MathML. Note that currently only Firefox and Safari
1181 (and select e-book readers) natively support MathML.
1182 To insert a link the `LaTeXMathML.js` script, provide a *URL*.
1187 Use [jsMath] (the predecessor of MathJax) to display embedded TeX
1188 math in HTML output. TeX math will be put inside `<span>` tags
1189 (for inline math) or `<div>` tags (for display math) with class
1190 `math` and rendered by the jsMath script. The *URL* should point to
1191 the script (e.g. `jsMath/easy/load.js`); if provided, it will be linked
1192 to in the header of standalone HTML documents. If a *URL* is not provided,
1193 no link to the jsMath load script will be inserted; it is then
1194 up to the author to provide such a link in the HTML template.
1199 Enclose TeX math in `<eq>` tags in HTML output. The resulting HTML
1200 can then be processed by [gladTeX] to produce images of the typeset
1201 formulas and an HTML file with links to these images.
1202 So, the procedure is:
1204 pandoc -s --gladtex input.md -o myfile.htex
1205 gladtex -d myfile-images myfile.htex
1206 # produces myfile.html and images in myfile-images
1208`--mimetex`[`=`*URL*]
1211 Render TeX math using the [mimeTeX] CGI script, which generates an
1212 image for each TeX formula. This should work in all browsers. If
1213 *URL* is not specified, it is assumed that the script is at
1214 `/cgi-bin/mimetex.cgi`.
1216[MathML]: http://www.w3.org/Math/
1217[LaTeXMathML]: http://math.etsu.edu/LaTeXMathML/
1218[jsMath]: http://www.math.union.edu/~dpvc/jsmath/
1219[MathJax]: https://www.mathjax.org
1220[gladTeX]: http://ans.hsh.no/home/mgg/gladtex/
1221[mimeTeX]: http://www.forkosh.com/mimetex.html
1222[KaTeX]: https://github.com/Khan/KaTeX
1224Options for wrapper scripts
1225---------------------------
1229: Print information about command-line arguments to *stdout*, then exit.
1230 This option is intended primarily for use in wrapper scripts.
1231 The first line of output contains the name of the output file specified
1232 with the `-o` option, or `-` (for *stdout*) if no output file was
1233 specified. The remaining lines contain the command-line arguments,
1234 one per line, in the order they appear. These do not include regular
1235 pandoc options and their arguments, but do include any options appearing
1236 after a `--` separator at the end of the line.
1240: Ignore command-line arguments (for use in wrapper scripts).
1241 Regular pandoc options are not ignored. Thus, for example,
1243 pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1
1247 pandoc -o foo.html -s
1252When the `-s/--standalone` option is used, pandoc uses a template to
1253add header and footer material that is needed for a self-standing
1254document. To see the default template that is used, just type
1258where *FORMAT* is the name of the output format. A custom template
1259can be specified using the `--template` option. You can also override
1260the system default templates for a given output format *FORMAT*
1261by putting a file `templates/default.*FORMAT*` in the user data
1262directory (see `--data-dir`, above). *Exceptions:*
1264- For `odt` output, customize the `default.opendocument`
1266- For `pdf` output, customize the `default.latex` template
1267 (or the `default.context` template, if you use `-t context`,
1268 or the `default.ms` template, if you use `-t ms`, or the
1269 `default.html5` template, if you use `-t html5`).
1270- `docx` has no template (however, you can use
1271 `--reference-doc` to customize the output).
1273Templates contain *variables*, which allow for the inclusion of
1274arbitrary information at any point in the file. Variables may be set
1275within the document using [YAML metadata blocks][Extension:
1276`yaml_metadata_block`]. They may also be set at the
1277command line using the `-V/--variable` option: variables set in this
1278way override metadata fields with the same name.
1280Variables set by pandoc
1281-----------------------
1283Some variables are set automatically by pandoc. These vary somewhat
1284depending on the output format, but include metadata fields as well
1287`sourcefile`, `outputfile`
1288: source and destination filenames, as given on the command line.
1289 `sourcefile` can also be a list if input comes from multiple files, or empty
1290 if input is from stdin. You can use the following snippet in your template
1291 to distinguish them:
1301 Similarly, `outputfile` can be `-` if output goes to the terminal.
1303`title`, `author`, `date`
1304: allow identification of basic aspects of the document. Included
1305 in PDF metadata through LaTeX and ConTeXt. These can be set
1306 through a [pandoc title block][Extension: `pandoc_title_block`],
1307 which allows for multiple authors, or through a YAML metadata block:
1316: document subtitle, included in HTML, EPUB, LaTeX, ConTeXt, and Word docx;
1317 renders in LaTeX only when using a document class that supports
1318 `\subtitle`, such as `beamer` or the [KOMA-Script] series (`scrartcl`,
1319 `scrreprt`, `scrbook`).[^subtitle]
1322: author affiliations (in LaTeX and Beamer only). Can be a
1323 list, when there are multiple authors.
1326: document summary, included in LaTeX, ConTeXt, AsciiDoc, and Word docx
1329: list of keywords to be included in HTML, PDF, and AsciiDoc metadata;
1330 may be repeated as for `author`, above
1333: contents specified by `-H/--include-in-header` (may have multiple
1337: non-null value if `--toc/--table-of-contents` was specified
1340: title of table of contents (works only with EPUB,
1341 opendocument, odt, docx, pptx)
1344: contents specified by `-B/--include-before-body` (may have
1348: contents specified by `-A/--include-after-body` (may have
1355: JSON representation of all of the document's metadata. Field
1356 values are transformed to the selected output format.
1358[^subtitle]: To make `subtitle` work with other LaTeX
1359 document classes, you can add the following to `header-includes`:
1361 \providecommand{\subtitle}[1]{%
1362 \usepackage{titling}
1364 \par\large#1\end{center}}
1371: identifies the main language of the document,
1372 using a code according to [BCP 47] (e.g. `en` or `en-GB`).
1373 For some output formats, pandoc will convert it to an appropriate
1374 format stored in the additional variables `babel-lang`,
1375 `polyglossia-lang` (LaTeX) and `context-lang` (ConTeXt).
1377 Native pandoc Spans and Divs with the lang attribute
1378 (value in BCP 47) can be used to switch the language in
1379 that range. In LaTeX output, `babel-otherlangs` and
1380 `polyglossia-otherlangs` variables will be generated
1381 automatically based on the `lang` attributes of Spans
1382 and Divs in the document.
1385: the base direction of the document, either `rtl` (right-to-left)
1386 or `ltr` (left-to-right).
1388 For bidirectional documents, native pandoc `span`s and `div`s
1389 with the `dir` attribute (value `rtl` or `ltr`) can be used to
1390 override the base direction in some output formats.
1391 This may not always be necessary if the final renderer
1392 (e.g. the browser, when generating HTML) supports the
1393 [Unicode Bidirectional Algorithm].
1395 When using LaTeX for bidirectional documents, only the `xelatex` engine
1396 is fully supported (use `--pdf-engine=xelatex`).
1398[BCP 47]: https://tools.ietf.org/html/bcp47
1399[Unicode Bidirectional Algorithm]: http://www.w3.org/International/articles/inline-bidi-markup/uba-basics
1404Variables are available for [producing slide shows with pandoc],
1405including all [reveal.js configuration options].
1408: title graphic for Beamer documents
1411: logo for Beamer documents
1414: base URL for Slidy documents (defaults to
1415 `https://www.w3.org/Talks/Tools/Slidy2`)
1418: base URL for Slideous documents (defaults to `slideous`)
1421: base URL for S5 documents (defaults to `s5/default`)
1424: base URL for reveal.js documents (defaults to `reveal.js`)
1426`theme`, `colortheme`, `fonttheme`, `innertheme`, `outertheme`
1427: themes for LaTeX [`beamer`] documents
1430: options for LaTeX beamer themes (a list).
1433: controls navigation symbols in `beamer` documents
1434 (default is `empty` for no navigation symbols; other valid values
1435 are `frame`, `vertical`, and `horizontal`).
1438: enables on "title pages" for new sections in `beamer`
1439 documents (default = true).
1442: when true, the `beamerarticle` package is loaded (for
1443 producing an article from beamer slides).
1446: aspect ratio of slides (for beamer only, `1610` for 16:10, `169` for 16:9,
1447 `149` for 14:9, `141` for 1.41:1, `54` for 5:4, `43` for 4:3 which is the
1448 default, and `32` for 3:2).
1450[reveal.js configuration options]: https://github.com/hakimel/reveal.js#configuration
1455LaTeX variables are used when [creating a PDF].
1458: paper size, e.g. `letter`, `a4`
1461: font size for body text (e.g. `10pt`, `12pt`)
1464: document class, e.g. [`article`], [`report`], [`book`], [`memoir`]
1467: option for document class, e.g. `oneside`; may be repeated
1468 for multiple options
1471: option for [`geometry`] package, e.g. `margin=1in`;
1472 may be repeated for multiple options
1474`margin-left`, `margin-right`, `margin-top`, `margin-bottom`
1475: sets margins, if `geometry` is not used (otherwise `geometry`
1479: adjusts line spacing using the [`setspace`]
1480 package, e.g. `1.25`, `1.5`
1483: font package for use with `pdflatex`:
1484 [TeX Live] includes many options, documented in the [LaTeX Font Catalogue].
1485 The default is [Latin Modern][`lm`].
1488: options for package used as `fontfamily`: e.g. `osf,sc` with
1489 `fontfamily` set to [`mathpazo`] provides Palatino with old-style
1490 figures and true small caps; may be repeated for multiple options
1492`mainfont`, `sansfont`, `monofont`, `mathfont`, `CJKmainfont`
1493: font families for use with `xelatex` or
1494 `lualatex`: take the name of any system font, using the
1495 [`fontspec`] package. Note that if `CJKmainfont` is used,
1496 the [`xecjk`] package must be available.
1498`mainfontoptions`, `sansfontoptions`, `monofontoptions`, `mathfontoptions`, `CJKoptions`
1499: options to use with `mainfont`, `sansfont`, `monofont`, `mathfont`,
1500 `CJKmainfont` in `xelatex` and `lualatex`. Allow for any choices
1501 available through [`fontspec`], such as the OpenType features
1502 `Numbers=OldStyle,Numbers=Proportional`. May be repeated for multiple options.
1505: allows font encoding to be specified through `fontenc` package (with `pdflatex`);
1506 default is `T1` (see guide to [LaTeX font encodings])
1509: options to pass to the microtype package
1512: add color to link text; automatically enabled if any of `linkcolor`, `citecolor`,
1513 `urlcolor`, or `toccolor` are set
1515`linkcolor`, `citecolor`, `urlcolor`, `toccolor`
1516: color for internal links, citation links, external links, and links in table of contents:
1517 uses options allowed by [`xcolor`], including the `dvipsnames`, `svgnames`, and `x11names` lists
1520: causes links to be printed as footnotes
1523: uses document class settings for indentation (the default LaTeX template
1524 otherwise removes indentation and adds space between paragraphs)
1527: disables default behavior of LaTeX template that redefines (sub)paragraphs
1528 as sections, changing the appearance of nested headings in some classes
1531: specifies contents of acknowledgments footnote after document title.
1534: include table of contents (can also be set using `--toc/--table-of-contents`)
1537: level of section to include in table of contents
1540: numbering depth for sections, if sections are numbered
1543: include list of figures, list of tables
1546: bibliography to use for resolving references
1549: bibliography style, when used with `--natbib` and `--biblatex`.
1552: bibliography title, when used with `--natbib` and `--biblatex`.
1555: list of options for biblatex.
1558: list of options for natbib.
1561: An option for LaTeX's `\pagestyle{}`. The default article class
1562 supports 'plain' (default), 'empty', and 'headings'; headings puts
1563 section titles in the header.
1565[`article`]: https://ctan.org/pkg/article
1566[`report`]: https://ctan.org/pkg/report
1567[`book`]: https://ctan.org/pkg/book
1568[KOMA-Script]: https://ctan.org/pkg/koma-script
1569[`memoir`]: https://ctan.org/pkg/memoir
1570[`xcolor`]: https://ctan.org/pkg/xcolor
1571[LaTeX Font Catalogue]: http://www.tug.dk/FontCatalogue/
1572[`mathpazo`]: https://ctan.org/pkg/mathpazo
1573[LaTeX font encodings]: https://ctan.org/pkg/encguide
1575Variables for ConTeXt
1576---------------------
1579: paper size, e.g. `letter`, `A4`, `landscape` (see [ConTeXt Paper Setup]);
1580 may be repeated for multiple options
1583: options for page margins and text arrangement (see [ConTeXt Layout]);
1584 may be repeated for multiple options
1586`margin-left`, `margin-right`, `margin-top`, `margin-bottom`
1587: sets margins, if `layout` is not used (otherwise `layout`
1591: font size for body text (e.g. `10pt`, `12pt`)
1593`mainfont`, `sansfont`, `monofont`, `mathfont`
1594: font families: take the name of any system font (see [ConTeXt Font Switching])
1596`linkcolor`, `contrastcolor`
1597: color for links outside and inside a page, e.g. `red`, `blue` (see [ConTeXt Color])
1600: typeface style for links, e.g. `normal`, `bold`, `slanted`, `boldslanted`, `type`, `cap`, `small`
1603: controls indentation of paragraphs, e.g. `yes,small,next` (see [ConTeXt Indentation]);
1604 may be repeated for multiple options
1607: spacing between paragraphs, e.g. `none`, `small` (using [`setupwhitespace`])
1610: adjusts line spacing, e.g. `4ex` (using [`setupinterlinespace`]);
1611 may be repeated for multiple options
1613`headertext`, `footertext`
1614: text to be placed in running header or footer (see [ConTeXt Headers and Footers]);
1615 may be repeated up to four times for different placement
1618: page number style and location (using [`setuppagenumbering`]);
1619 may be repeated for multiple options
1622: include table of contents (can also be set using `--toc/--table-of-contents`)
1625: include list of figures, list of tables
1628: adds to the preamble the setup necessary to generate PDF/A-1b:2005.
1629 To successfully generate PDF/A the required ICC color profiles have to
1630 be available and the content and all included files (such as images)
1631 have to be standard conforming. The ICC profiles can be obtained
1632 from [ConTeXt ICC Profiles]. See also [ConTeXt PDFA] for more
1635[ConTeXt Paper Setup]: http://wiki.contextgarden.net/PaperSetup
1636[ConTeXt Layout]: http://wiki.contextgarden.net/Layout
1637[ConTeXt Font Switching]: http://wiki.contextgarden.net/Font_Switching
1638[ConTeXt Color]: http://wiki.contextgarden.net/Color
1639[ConTeXt Headers and Footers]: http://wiki.contextgarden.net/Headers_and_Footers
1640[ConTeXt Indentation]: http://wiki.contextgarden.net/Indentation
1641[ConTeXt ICC Profiles]: http://wiki.contextgarden.net/PDFX#ICC_profiles
1642[ConTeXt PDFA]: http://wiki.contextgarden.net/PDF/A
1643[`setupwhitespace`]: http://wiki.contextgarden.net/Command/setupwhitespace
1644[`setupinterlinespace`]: http://wiki.contextgarden.net/Command/setupinterlinespace
1645[`setuppagenumbering`]: http://wiki.contextgarden.net/Command/setuppagenumbering
1647Variables for man pages
1648-----------------------
1651: section number in man pages
1654: header in man pages
1657: footer in man pages
1660: adjusts text to left (`l`), right (`r`), center (`c`),
1661 or both (`b`) margins
1664: if `true` (the default), hyphenation will be used
1670: point size (e.g. `10p`)
1673: line height (e.g. `12p`)
1676: font family (e.g. `T` or `P`)
1679: paragraph indent (e.g. `2m`)
1681Using variables in templates
1682----------------------------
1684Variable names are sequences of alphanumerics, `-`, and `_`,
1685starting with a letter. A variable name surrounded by `$` signs
1686will be replaced by its value. For example, the string `$title$` in
1688 <title>$title$</title>
1690will be replaced by the document title.
1692To write a literal `$` in a template, use `$$`.
1694Templates may contain conditionals. The syntax is as follows:
1702This will include `X` in the template if `variable` has a non-null
1703value; otherwise it will include `Y`. `X` and `Y` are placeholders for
1704any valid template text, and may include interpolated variables or other
1705conditionals. The `$else$` section may be omitted.
1707When variables can have multiple values (for example, `author` in
1708a multi-author document), you can use the `$for$` keyword:
1711 <meta name="author" content="$author$" />
1714You can optionally specify a separator to be used between
1717 $for(author)$$author$$sep$, $endfor$
1719A dot can be used to select a field of a variable that takes
1720an object as its value. So, for example:
1722 $author.name$ ($author.affiliation$)
1724If you use custom templates, you may need to revise them as pandoc
1725changes. We recommend tracking the changes in the default templates,
1726and modifying your custom templates accordingly. An easy way to do this
1727is to fork the [pandoc-templates] repository and merge in changes after each
1730Templates may contain comments: anything on a line after `$--`
1731will be treated as a comment and ignored.
1733[pandoc-templates]: https://github.com/jgm/pandoc-templates
1738The behavior of some of the readers and writers can be adjusted by
1739enabling or disabling various extensions.
1741An extension can be enabled by adding `+EXTENSION`
1742to the format name and disabled by adding `-EXTENSION`. For example,
1743`--from markdown_strict+footnotes` is strict Markdown with footnotes
1744enabled, while `--from markdown-footnotes-pipe_tables` is pandoc's
1745Markdown without footnotes or pipe tables.
1747The markdown reader and writer make by far the most use of extensions.
1748Extensions only used by them are therefore covered in the
1749section [Pandoc's Markdown] below (See [Markdown variants] for
1750`commonmark` and `gfm`.) In the following, extensions that also work
1751for other formats are covered.
1756#### Extension: `smart` ####
1758Interpret straight quotes as curly quotes, `---` as em-dashes,
1759`--` as en-dashes, and `...` as ellipses. Nonbreaking spaces are
1760inserted after certain abbreviations, such as "Mr."
1762This extension can be enabled/disabled for the following formats:
1765: `markdown`, `commonmark`, `latex`, `mediawiki`, `org`, `rst`, `twiki`
1768: `markdown`, `latex`, `context`, `rst`
1770enabled by default in
1771: `markdown`, `latex`, `context` (both input and output)
1773Note: If you are *writing* Markdown, then the `smart` extension
1774has the reverse effect: what would have been curly quotes comes
1777In LaTeX, `smart` means to use the standard TeX ligatures
1778for quotation marks (` `` ` and ` '' ` for double quotes,
1779`` ` `` and `` ' `` for single quotes) and dashes (`--` for
1780en-dash and `---` for em-dash). If `smart` is disabled,
1781then in reading LaTeX pandoc will parse these characters
1782literally. In writing LaTeX, enabling `smart` tells pandoc
1783to use the ligatures when possible; if `smart` is disabled
1784pandoc will use unicode quotation mark and dash characters.
1789#### Extension: `auto_identifiers` ####
1791A header without an explicitly specified identifier will be
1792automatically assigned a unique identifier based on the header text.
1794This extension can be enabled/disabled for the following formats:
1797: `markdown`, `latex`, `rst`, `mediawiki`, `textile`
1802enabled by default in
1805The algorithm used to derive the identifier from the header text is:
1807 - Remove all formatting, links, etc.
1808 - Remove all footnotes.
1809 - Remove all punctuation, except underscores, hyphens, and periods.
1810 - Replace all spaces and newlines with hyphens.
1811 - Convert all alphabetic characters to lowercase.
1812 - Remove everything up to the first letter (identifiers may
1813 not begin with a number or punctuation mark).
1814 - If nothing is left after this, use the identifier `section`.
1819 ------------------------------- ----------------------------
1820 `Header identifiers in HTML` `header-identifiers-in-html`
1821 `*Dogs*?--in *my* house?` `dogs--in-my-house`
1822 `[HTML], [S5], or [RTF]?` `html-s5-or-rtf`
1823 `3. Applications` `applications`
1826These rules should, in most cases, allow one to determine the identifier
1827from the header text. The exception is when several headers have the
1828same text; in this case, the first will get an identifier as described
1829above; the second will get the same identifier with `-1` appended; the
1830third with `-2`; and so on.
1832These identifiers are used to provide link targets in the table of
1833contents generated by the `--toc|--table-of-contents` option. They
1834also make it easy to provide links from one section of a document to
1835another. A link to this section, for example, might look like this:
1838 [header identifiers](#header-identifiers-in-html-latex-and-context).
1840Note, however, that this method of providing links to sections works
1841only in HTML, LaTeX, and ConTeXt formats.
1843If the `--section-divs` option is specified, then each section will
1844be wrapped in a `section` (or a `div`, if `html4` was specified),
1845and the identifier will be attached to the enclosing `<section>`
1846(or `<div>`) tag rather than the header itself. This allows entire
1847sections to be manipulated using JavaScript or treated differently in
1850#### Extension: `ascii_identifiers` ####
1852Causes the identifiers produced by `auto_identifiers` to be pure ASCII.
1853Accents are stripped off of accented Latin letters, and non-Latin
1859The extensions [`tex_math_dollars`](#extension-tex_math_dollars),
1860[`tex_math_single_backslash`](#extension-tex_math_single_backslash), and
1861[`tex_math_double_backslash`](#extension-tex_math_double_backslash)
1862are described in the section about Pandoc's Markdown.
1864However, they can also be used with HTML input. This is handy for
1865reading web pages formatted using MathJax, for example.
1870The following extensions (especially how they affect Markdown
1871input/output) are also described in more detail in their respective
1872sections of [Pandoc's Markdown].
1874#### [Extension: `raw_html`] {#raw_html}
1876When converting from HTML, parse elements to raw HTML which are not
1877representable in pandoc's AST.
1878By default, this is disabled for HTML input.
1880#### [Extension: `raw_tex`] {#raw_tex}
1882Allows raw LaTeX, TeX, and ConTeXt to be included in a document.
1884This extension can be enabled/disabled for the following formats
1885(in addition to `markdown`):
1888: `latex`, `org`, `textile`
1893#### [Extension: `native_divs`] {#native_divs}
1895This extension is enabled by default for HTML input. This means that
1896`div`s are parsed to pandoc native elements. (Alternatively, you
1897can parse them to raw HTML using `-f html-native_divs+raw_html`.)
1899When converting HTML to Markdown, for example, you may want to drop all
1902 pandoc -f html-native_divs-native_spans -t markdown
1904#### [Extension: `native_spans`] {#native_spans}
1906Analogous to `native_divs` above.
1909Literate Haskell support
1910------------------------
1912#### Extension: `literate_haskell` ####
1914Treat the document as literate Haskell source.
1916This extension can be enabled/disabled for the following formats:
1919: `markdown`, `rst`, `latex`
1922: `markdown`, `rst`, `latex`, `html`
1924If you append `+lhs` (or `+literate_haskell`) to one of the formats
1925above, pandoc will treat the document as literate Haskell source.
1928 - In Markdown input, "bird track" sections will be parsed as Haskell
1929 code rather than block quotations. Text between `\begin{code}`
1930 and `\end{code}` will also be treated as Haskell code. For
1931 ATX-style headers the character '=' will be used instead of '#'.
1933 - In Markdown output, code blocks with classes `haskell` and `literate`
1934 will be rendered using bird tracks, and block quotations will be
1935 indented one space, so they will not be treated as Haskell code.
1936 In addition, headers will be rendered setext-style (with underlines)
1937 rather than ATX-style (with '#' characters). (This is because ghc
1938 treats '#' characters in column 1 as introducing line numbers.)
1940 - In restructured text input, "bird track" sections will be parsed
1943 - In restructured text output, code blocks with class `haskell` will
1944 be rendered using bird tracks.
1946 - In LaTeX input, text in `code` environments will be parsed as
1949 - In LaTeX output, code blocks with class `haskell` will be rendered
1950 inside `code` environments.
1952 - In HTML output, code blocks with class `haskell` will be rendered
1953 with class `literatehaskell` and bird tracks.
1957 pandoc -f markdown+lhs -t html
1959reads literate Haskell source formatted with Markdown conventions and writes
1960ordinary HTML (without bird tracks).
1962 pandoc -f markdown+lhs -t html+lhs
1964writes HTML with the Haskell code in bird tracks, so it can be copied
1965and pasted as literate Haskell source.
1967Note that GHC expects the bird tracks in the first column, so indentend literate
1968code blocks (e.g. inside an itemized environment) will not be picked up by the
1974#### Extension: `empty_paragraphs` ####
1976Allows empty paragraphs. By default empty paragraphs are
1979This extension can be enabled/disabled for the following formats:
1985: `markdown`, `docx`, `odt`, `opendocument`, `html`
1987#### Extension: `styles` #### {#ext-styles}
1989Read all docx styles as divs (for paragraph styles) and spans (for
1990character styles) regardless of whether pandoc understands the meaning
1991of these styles. This can be used with [docx custom
1992styles](#custom-styles-in-docx). Disabled by default.
1997#### Extension: `amuse` ####
1999In the `muse` input format, this enables Text::Amuse
2000extensions to Emacs Muse markup.
2002#### Extension: `citations` {#org-citations}
2004Some aspects of [Pandoc's Markdown citation syntax](#citations) are also accepted
2007#### Extension: `ntb` ####
2009In the `context` output format this enables the use of [Natural Tables
2010(TABLE)](http://wiki.contextgarden.net/TABLE) instead of the default
2011[Extreme Tables (xtables)](http://wiki.contextgarden.net/xtables).
2012Natural tables allow more fine-grained global customization but come
2013at a performance penalty compared to extreme tables.
2019Pandoc understands an extended and slightly revised version of
2020John Gruber's [Markdown] syntax. This document explains the syntax,
2021noting differences from standard Markdown. Except where noted, these
2022differences can be suppressed by using the `markdown_strict` format instead
2023of `markdown`. Extensions can be enabled or disabled to specify the
2024behavior more granularly. They are described in the following. See also
2025[Extensions] above, for extensions that work also on other formats.
2030Markdown is designed to be easy to write, and, even more importantly,
2033> A Markdown-formatted document should be publishable as-is, as plain
2034> text, without looking like it's been marked up with tags or formatting
2036> -- [John Gruber](http://daringfireball.net/projects/markdown/syntax#philosophy)
2038This principle has guided pandoc's decisions in finding syntax for
2039tables, footnotes, and other extensions.
2041There is, however, one respect in which pandoc's aims are different
2042from the original aims of Markdown. Whereas Markdown was originally
2043designed with HTML generation in mind, pandoc is designed for multiple
2044output formats. Thus, while pandoc allows the embedding of raw HTML,
2045it discourages it, and provides other, non-HTMLish ways of representing
2046important document elements like definition lists, tables, mathematics, and
2052A paragraph is one or more lines of text followed by one or more blank lines.
2053Newlines are treated as spaces, so you can reflow your paragraphs as you like.
2054If you need a hard line break, put two or more spaces at the end of a line.
2056#### Extension: `escaped_line_breaks` ####
2058A backslash followed by a newline is also a hard line break.
2059Note: in multiline and grid table cells, this is the only way
2060to create a hard line break, since trailing spaces in the cells
2066There are two kinds of headers: Setext and ATX.
2068### Setext-style headers ###
2070A setext-style header is a line of text "underlined" with a row of `=` signs
2071(for a level one header) or `-` signs (for a level two header):
2079The header text can contain inline formatting, such as emphasis (see
2080[Inline formatting], below).
2083### ATX-style headers ###
2085An ATX-style header consists of one to six `#` signs and a line of
2086text, optionally followed by any number of `#` signs. The number of
2087`#` signs at the beginning of the line is the header level:
2089 ## A level-two header
2091 ### A level-three header ###
2093As with setext-style headers, the header text can contain formatting:
2095 # A level-one header with a [link](/url) and *emphasis*
2097#### Extension: `blank_before_header` ####
2099Standard Markdown syntax does not require a blank line before a header.
2100Pandoc does require this (except, of course, at the beginning of the
2101document). The reason for the requirement is that it is all too easy for a
2102`#` to end up at the beginning of a line by accident (perhaps through line
2103wrapping). Consider, for example:
2105 I like several of their flavors of ice cream:
2106 #22, for example, and #5.
2108#### Extension: `space_in_atx_header` ####
2110Many Markdown implementations do not require a space between the
2111opening `#`s of an ATX header and the header text, so that
2112`#5 bolt` and `#hashtag` count as headers. With this extension,
2113pandoc does require the space.
2115### Header identifiers ###
2117See also the [`auto_identifiers` extension](#extension-auto_identifiers) above.
2119#### Extension: `header_attributes` ####
2121Headers can be assigned attributes using this syntax at the end
2122of the line containing the header text:
2124 {#identifier .class .class key=value key=value}
2126Thus, for example, the following headers will all be assigned the identifier
2131 ## My header ## {#foo}
2133 My other header {#foo}
2136(This syntax is compatible with [PHP Markdown Extra].)
2138Note that although this syntax allows assignment of classes and key/value
2139attributes, writers generally don't use all of this information. Identifiers,
2140classes, and key/value attributes are used in HTML and HTML-based formats such
2141as EPUB and slidy. Identifiers are used for labels and link anchors in the
2142LaTeX, ConTeXt, Textile, and AsciiDoc writers.
2144Headers with the class `unnumbered` will not be numbered, even if
2145`--number-sections` is specified. A single hyphen (`-`) in an attribute
2146context is equivalent to `.unnumbered`, and preferable in non-English
2153 # My header {.unnumbered}
2155#### Extension: `implicit_header_references` ####
2157Pandoc behaves as if reference links have been defined for each header.
2158So, to link to a header
2160 # Header identifiers in HTML
2164 [Header identifiers in HTML]
2168 [Header identifiers in HTML][]
2172 [the section on header identifiers][header identifiers in
2175instead of giving the identifier explicitly:
2177 [Header identifiers in HTML](#header-identifiers-in-html)
2179If there are multiple headers with identical text, the corresponding
2180reference will link to the first one only, and you will need to use explicit
2181links to link to the others, as described above.
2183Like regular reference links, these references are case-insensitive.
2185Explicit link reference definitions always take priority over
2186implicit header references. So, in the following example, the
2187link will point to `bar`, not to `#foo`:
2198Markdown uses email conventions for quoting blocks of text.
2199A block quotation is one or more paragraphs or other block elements
2200(such as lists or headers), with each line preceded by a `>` character
2201and an optional space. (The `>` need not start at the left margin, but
2202it should not be indented more than three spaces.)
2204 > This is a block quote. This
2205 > paragraph has two lines.
2207 > 1. This is a list inside a block quote.
2210A "lazy" form, which requires the `>` character only on the first
2211line of each block, is also allowed:
2213 > This is a block quote. This
2214 paragraph has two lines.
2216 > 1. This is a list inside a block quote.
2219Among the block elements that can be contained in a block quote are
2220other block quotes. That is, block quotes can be nested:
2222 > This is a block quote.
2224 > > A block quote within a block quote.
2226If the `>` character is followed by an optional space, that space
2227will be considered part of the block quote marker and not part of
2228the indentation of the contents. Thus, to put an indented code
2229block in a block quote, you need five spaces after the `>`:
2233#### Extension: `blank_before_blockquote` ####
2235Standard Markdown syntax does not require a blank line before a block
2236quote. Pandoc does require this (except, of course, at the beginning of the
2237document). The reason for the requirement is that it is all too easy for a
2238`>` to end up at the beginning of a line by accident (perhaps through line
2239wrapping). So, unless the `markdown_strict` format is used, the following does
2240not produce a nested block quote in pandoc:
2242 > This is a block quote.
2246Verbatim (code) blocks
2247----------------------
2249### Indented code blocks ###
2251A block of text indented four spaces (or one tab) is treated as verbatim
2252text: that is, special characters do not trigger special formatting,
2253and all spaces and line breaks are preserved. For example,
2256 moveShip(5 * gravity, DOWN);
2259The initial (four space or one tab) indentation is not considered part
2260of the verbatim text, and is removed in the output.
2262Note: blank lines in the verbatim text need not begin with four spaces.
2265### Fenced code blocks ###
2267#### Extension: `fenced_code_blocks` ####
2269In addition to standard indented code blocks, pandoc supports
2270*fenced* code blocks. These begin with a row of three or more
2271tildes (`~`) and end with a row of tildes that must be at least as long as
2272the starting row. Everything between these lines is treated as code. No
2273indentation is necessary:
2277 moveShip(5 * gravity, DOWN);
2281Like regular code blocks, fenced code blocks must be separated
2282from surrounding text by blank lines.
2284If the code itself contains a row of tildes or backticks, just use a longer
2285row of tildes or backticks at the start and end:
2289 code including tildes
2293#### Extension: `backtick_code_blocks` ####
2295Same as `fenced_code_blocks`, but uses backticks (`` ` ``) instead of tildes
2298#### Extension: `fenced_code_attributes` ####
2300Optionally, you may attach attributes to fenced or backtick code block using
2303 ~~~~ {#mycode .haskell .numberLines startFrom="100"}
2305 qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
2306 qsort (filter (>= x) xs)
2307 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2309Here `mycode` is an identifier, `haskell` and `numberLines` are classes, and
2310`startFrom` is an attribute with value `100`. Some output formats can use this
2311information to do syntax highlighting. Currently, the only output formats
2312that uses this information are HTML, LaTeX, Docx, Ms, and PowerPoint. If
2313highlighting is supported for your output format and language, then the code
2314block above will appear highlighted, with numbered lines. (To see which
2315languages are supported, type `pandoc --list-highlight-languages`.) Otherwise,
2316the code block above will appear as follows:
2318 <pre id="mycode" class="haskell numberLines" startFrom="100">
2324The `numberLines` (or `number-lines`) class will cause the lines
2325of the code block to be numbered, starting with `1` or the value
2326of the `startFrom` attribute. The `lineAnchors` (or
2327`line-anchors`) class will cause the lines to be clickable
2328anchors in HTML output.
2330A shortcut form can also be used for specifying the language of
2337This is equivalent to:
2343If the `fenced_code_attributes` extension is disabled, but
2344input contains class attribute(s) for the code block, the first
2345class attribute will be printed after the opening fence as a bare
2348To prevent all highlighting, use the `--no-highlight` flag.
2349To set the highlighting style, use `--highlight-style`.
2350For more information on highlighting, see [Syntax highlighting],
2356#### Extension: `line_blocks` ####
2358A line block is a sequence of lines beginning with a vertical bar (`|`)
2359followed by a space. The division into lines will be preserved in
2360the output, as will any leading spaces; otherwise, the lines will
2361be formatted as Markdown. This is useful for verse and addresses:
2363 | The limerick packs laughs anatomical
2364 | In space that is quite economical.
2365 | But the good ones I've seen
2366 | So seldom are clean
2367 | And the clean ones so seldom are comical
2370 | Berkeley, CA 94718
2372The lines can be hard-wrapped if needed, but the continuation
2373line must begin with a space.
2375 | The Right Honorable Most Venerable and Righteous Samuel L.
2378 | Berkeley, CA 94718
2380This syntax is borrowed from [reStructuredText].
2387A bullet list is a list of bulleted list items. A bulleted list
2388item begins with a bullet (`*`, `+`, or `-`). Here is a simple
2395This will produce a "compact" list. If you want a "loose" list, in which
2396each item is formatted as a paragraph, put spaces between the items:
2404The bullets need not be flush with the left margin; they may be
2405indented one, two, or three spaces. The bullet must be followed
2408List items look best if subsequent lines are flush with the first
2409line (after the bullet):
2415But Markdown also allows a "lazy" format:
2421### Block content in list items ###
2423A list item may contain multiple paragraphs and other block-level
2424content. However, subsequent paragraphs must be preceded by a blank line
2425and indented to line up with the first non-space content after
2432 * Second paragraph. With a code block, which must be indented
2437Exception: if the list marker is followed by an indented code
2438block, which must begin 5 spaces after the list marker, then
2439subsequent paragraphs must begin two columns after the last
2440character of the list marker:
2444 continuation paragraph
2446List items may include other lists. In this case the preceding blank
2447line is optional. The nested list must be indented to line up with
2448the first non-space character after the list marker of the
2449containing list item.
2461As noted above, Markdown allows you to write list items "lazily," instead of
2462indenting continuation lines. However, if there are multiple paragraphs or
2463other blocks in a list item, the first line of each must be indented.
2465 + A lazy, lazy, list
2468 + Another one; this looks
2471 Second paragraph of second
2474### Ordered lists ###
2476Ordered lists work just like bulleted lists, except that the items
2477begin with enumerators rather than bullets.
2479In standard Markdown, enumerators are decimal numbers followed
2480by a period and a space. The numbers themselves are ignored, so
2481there is no difference between this list:
2493#### Extension: `fancy_lists` ####
2495Unlike standard Markdown, pandoc allows ordered list items to be marked
2496with uppercase and lowercase letters and roman numerals, in addition to
2497Arabic numerals. List markers may be enclosed in parentheses or followed by a
2498single right-parentheses or period. They must be separated from the
2499text that follows by at least one space, and, if the list marker is a
2500capital letter with a period, by at least two spaces.[^2]
2502[^2]: The point of this rule is to ensure that normal paragraphs
2503 starting with people's initials, like
2505 B. Russell was an English philosopher.
2507 do not get treated as list items.
2509 This rule will not prevent
2513 from being interpreted as a list item. In this case, a backslash
2518The `fancy_lists` extension also allows '`#`' to be used as an
2519ordered list marker in place of a numeral:
2524#### Extension: `startnum` ####
2526Pandoc also pays attention to the type of list marker used, and to the
2527starting number, and both of these are preserved where possible in the
2528output format. Thus, the following yields a list with numbers followed
2529by a single parenthesis, starting with 9, and a sublist with lowercase
2539Pandoc will start a new list each time a different type of list
2540marker is used. So, the following will create three lists:
2547If default list markers are desired, use `#.`:
2554### Definition lists ###
2556#### Extension: `definition_lists` ####
2558Pandoc supports definition lists, using the syntax of
2559[PHP Markdown Extra] with some extensions.[^3]
2565 Term 2 with *inline markup*
2569 { some code, part of Definition 2 }
2571 Third paragraph of definition 2.
2573Each term must fit on one line, which may optionally be followed by
2574a blank line, and must be followed by one or more definitions.
2575A definition begins with a colon or tilde, which may be indented one
2578A term may have multiple definitions, and each definition may consist of one or
2579more block elements (paragraph, code block, list, etc.), each indented four
2580spaces or one tab stop. The body of the definition (including the first line,
2581aside from the colon or tilde) should be indented four spaces. However,
2582as with other Markdown lists, you can "lazily" omit indentation except
2583at the beginning of a paragraph or other block element:
2588 with lazy continuation.
2590 Second paragraph of the definition.
2592If you leave space before the definition (as in the example above),
2593the text of the definition will be treated as a paragraph. In some
2594output formats, this will mean greater spacing between term/definition
2595pairs. For a more compact definition list, omit the space before the
2605Note that space between items in a definition list is required.
2606(A variant that loosens this requirement, but disallows "lazy"
2607hard wrapping, can be activated with `compact_definition_lists`: see
2608[Non-pandoc extensions], below.)
2610[^3]: I have been influenced by the suggestions of [David Wheeler](http://www.justatheory.com/computers/markup/modest-markdown-proposal.html).
2612### Numbered example lists ###
2614#### Extension: `example_lists` ####
2616The special list marker `@` can be used for sequentially numbered
2617examples. The first list item with a `@` marker will be numbered '1',
2618the next '2', and so on, throughout the document. The numbered examples
2619need not occur in a single list; each new list using `@` will take up
2620where the last stopped. So, for example:
2622 (@) My first example will be numbered (1).
2623 (@) My second example will be numbered (2).
2625 Explanation of examples.
2627 (@) My third example will be numbered (3).
2629Numbered examples can be labeled and referred to elsewhere in the
2632 (@good) This is a good example.
2634 As (@good) illustrates, ...
2636The label can be any string of alphanumeric characters, underscores,
2639Note: continuation paragraphs in example lists must always
2640be indented four spaces, regardless of the length of the
2641list marker. That is, example lists always behave as if the
2642`four_space_rule` extension is set. This is because example
2643labels tend to be long, and indenting content to the
2644first non-space character after the label would be awkward.
2646### Compact and loose lists ###
2648Pandoc behaves differently from `Markdown.pl` on some "edge
2649cases" involving lists. Consider this source:
2659Pandoc transforms this into a "compact list" (with no `<p>` tags around
2660"First", "Second", or "Third"), while Markdown puts `<p>` tags around
2661"Second" and "Third" (but not "First"), because of the blank space
2662around "Third". Pandoc follows a simple rule: if the text is followed by
2663a blank line, it is treated as a paragraph. Since "Second" is followed
2664by a list, and not a blank line, it isn't treated as a paragraph. The
2665fact that the list is followed by a blank line is irrelevant. (Note:
2666Pandoc works this way even when the `markdown_strict` format is specified. This
2667behavior is consistent with the official Markdown syntax description,
2668even though it is different from that of `Markdown.pl`.)
2671### Ending a list ###
2673What if you want to put an indented code block after a list?
2680Trouble! Here pandoc (like other Markdown implementations) will treat
2681`{ my code block }` as the second paragraph of item two, and not as
2684To "cut off" the list after item two, you can insert some non-indented
2685content, like an HTML comment, which won't produce visible output in
2691 <!-- end of list -->
2695You can use the same trick if you want two consecutive lists instead
2711A line containing a row of three or more `*`, `-`, or `_` characters
2712(optionally separated by spaces) produces a horizontal rule:
2722Four kinds of tables may be used. The first three kinds presuppose the use of
2723a fixed-width font, such as Courier. The fourth kind can be used with
2724proportionally spaced fonts, as it does not require lining up columns.
2726#### Extension: `table_captions` ####
2728A caption may optionally be provided with all 4 kinds of tables (as
2729illustrated in the examples below). A caption is a paragraph beginning
2730with the string `Table:` (or just `:`), which will be stripped off.
2731It may appear either before or after the table.
2733#### Extension: `simple_tables` ####
2735Simple tables look like this:
2737 Right Left Center Default
2738 ------- ------ ---------- -------
2743 Table: Demonstration of simple table syntax.
2745The headers and table rows must each fit on one line. Column
2746alignments are determined by the position of the header text relative
2747to the dashed line below it:[^4]
2749 - If the dashed line is flush with the header text on the right side
2750 but extends beyond it on the left, the column is right-aligned.
2751 - If the dashed line is flush with the header text on the left side
2752 but extends beyond it on the right, the column is left-aligned.
2753 - If the dashed line extends beyond the header text on both sides,
2754 the column is centered.
2755 - If the dashed line is flush with the header text on both sides,
2756 the default alignment is used (in most cases, this will be left).
2758[^4]: This scheme is due to Michel Fortin, who proposed it on the
2759 [Markdown discussion list](http://six.pairlist.net/pipermail/markdown-discuss/2005-March/001097.html).
2761The table must end with a blank line, or a line of dashes followed by
2764The column headers may be omitted, provided a dashed line is used
2765to end the table. For example:
2767 ------- ------ ---------- -------
2771 ------- ------ ---------- -------
2773When headers are omitted, column alignments are determined on the basis
2774of the first line of the table body. So, in the tables above, the columns
2775would be right, left, center, and right aligned, respectively.
2777#### Extension: `multiline_tables` ####
2779Multiline tables allow headers and table rows to span multiple lines
2780of text (but cells that span multiple columns or rows of the table are
2781not supported). Here is an example:
2783 -------------------------------------------------------------
2784 Centered Default Right Left
2785 Header Aligned Aligned Aligned
2786 ----------- ------- --------------- -------------------------
2787 First row 12.0 Example of a row that
2788 spans multiple lines.
2790 Second row 5.0 Here's another one. Note
2791 the blank line between
2793 -------------------------------------------------------------
2795 Table: Here's the caption. It, too, may span
2798These work like simple tables, but with the following differences:
2800 - They must begin with a row of dashes, before the header text
2801 (unless the headers are omitted).
2802 - They must end with a row of dashes, then a blank line.
2803 - The rows must be separated by blank lines.
2805In multiline tables, the table parser pays attention to the widths of
2806the columns, and the writers try to reproduce these relative widths in
2807the output. So, if you find that one of the columns is too narrow in the
2808output, try widening it in the Markdown source.
2810Headers may be omitted in multiline tables as well as simple tables:
2812 ----------- ------- --------------- -------------------------
2813 First row 12.0 Example of a row that
2814 spans multiple lines.
2816 Second row 5.0 Here's another one. Note
2817 the blank line between
2819 ----------- ------- --------------- -------------------------
2821 : Here's a multiline table without headers.
2823It is possible for a multiline table to have just one row, but the row
2824should be followed by a blank line (and then the row of dashes that ends
2825the table), or the table may be interpreted as a simple table.
2827#### Extension: `grid_tables` ####
2829Grid tables look like this:
2831 : Sample grid table.
2833 +---------------+---------------+--------------------+
2834 | Fruit | Price | Advantages |
2835 +===============+===============+====================+
2836 | Bananas | $1.34 | - built-in wrapper |
2837 | | | - bright color |
2838 +---------------+---------------+--------------------+
2839 | Oranges | $2.10 | - cures scurvy |
2841 +---------------+---------------+--------------------+
2843The row of `=`s separates the header from the table body, and can be
2844omitted for a headerless table. The cells of grid tables may contain
2845arbitrary block elements (multiple paragraphs, code blocks, lists,
2846etc.). Cells that span multiple columns or rows are not
2847supported. Grid tables can be created easily using [Emacs table mode].
2849[Emacs table mode]: http://table.sourceforge.net/
2851Alignments can be specified as with pipe tables, by putting
2852colons at the boundaries of the separator line after the
2855 +---------------+---------------+--------------------+
2856 | Right | Left | Centered |
2857 +==============:+:==============+:==================:+
2858 | Bananas | $1.34 | built-in wrapper |
2859 +---------------+---------------+--------------------+
2861For headerless tables, the colons go on the top line instead:
2863 +--------------:+:--------------+:------------------:+
2864 | Right | Left | Centered |
2865 +---------------+---------------+--------------------+
2867##### Grid Table Limitations #####
2869Pandoc does not support grid tables with row spans or column spans.
2870This means that neither variable numbers of columns across rows nor
2871variable numbers of rows across columns are supported by Pandoc.
2872All grid tables must have the same number of columns in each row,
2873and the same number of rows in each column. For example, the
2874Docutils [sample grid tables] will not render as expected with
2877[sample grid tables]: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#grid-tables
2880#### Extension: `pipe_tables` ####
2882Pipe tables look like this:
2884 | Right | Left | Default | Center |
2885 |------:|:-----|---------|:------:|
2886 | 12 | 12 | 12 | 12 |
2887 | 123 | 123 | 123 | 123 |
2890 : Demonstration of pipe table syntax.
2892The syntax is identical to [PHP Markdown Extra tables]. The beginning and
2893ending pipe characters are optional, but pipes are required between all
2894columns. The colons indicate column alignment as shown. The header
2895cannot be omitted. To simulate a headerless table, include a header
2898Since the pipes indicate column boundaries, columns need not be vertically
2899aligned, as they are in the above example. So, this is a perfectly
2900legal (though ugly) pipe table:
2908The cells of pipe tables cannot contain block elements like paragraphs
2909and lists, and cannot span multiple lines. If a pipe table contains a
2910row whose printable content is wider than the column width (see
2911`--columns`), then the cell contents will wrap, with the
2912relative cell widths determined by the widths of the separator
2913lines. (In this case, the table will take up the full text
2914width.) If no lines are wider than column width, then
2915cell contents will not be wrapped, and the cells will be sized
2918Note: pandoc also recognizes pipe tables of the following
2919form, as can be produced by Emacs' orgtbl-mode:
2926The difference is that `+` is used instead of `|`. Other orgtbl features
2927are not supported. In particular, to get non-default column alignment,
2928you'll need to add colons as above.
2930[PHP Markdown Extra tables]: https://michelf.ca/projects/php-markdown/extra/#table
2935#### Extension: `pandoc_title_block` ####
2937If the file begins with a title block
2940 % author(s) (separated by semicolons)
2943it will be parsed as bibliographic information, not regular text. (It
2944will be used, for example, in the title of standalone LaTeX or HTML
2945output.) The block may contain just a title, a title and an author,
2946or all three elements. If you want to include an author but no
2947title, or a title and a date but no author, you need a blank line:
2956The title may occupy multiple lines, but continuation lines must
2957begin with leading space, thus:
2962If a document has multiple authors, the authors may be put on
2963separate lines with leading space, or separated by semicolons, or
2964both. So, all of the following are equivalent:
2969 % Author One; Author Two
2974The date must fit on one line.
2976All three metadata fields may contain standard inline formatting
2977(italics, links, footnotes, etc.).
2979Title blocks will always be parsed, but they will affect the output only
2980when the `--standalone` (`-s`) option is chosen. In HTML output, titles
2981will appear twice: once in the document head -- this is the title that
2982will appear at the top of the window in a browser -- and once at the
2983beginning of the document body. The title in the document head can have
2984an optional prefix attached (`--title-prefix` or `-T` option). The title
2985in the body appears as an H1 element with class "title", so it can be
2986suppressed or reformatted with CSS. If a title prefix is specified with
2987`-T` and no title block appears in the document, the title prefix will
2988be used by itself as the HTML title.
2990The man page writer extracts a title, man page section number, and
2991other header and footer information from the title line. The title
2992is assumed to be the first word on the title line, which may optionally
2993end with a (single-digit) section number in parentheses. (There should
2994be no space between the title and the parentheses.) Anything after
2995this is assumed to be additional footer and header text. A single pipe
2996character (`|`) should be used to separate the footer text from the header
3001will yield a man page with the title `PANDOC` and section 1.
3003 % PANDOC(1) Pandoc User Manuals
3005will also have "Pandoc User Manuals" in the footer.
3007 % PANDOC(1) Pandoc User Manuals | Version 4.0
3009will also have "Version 4.0" in the header.
3011#### Extension: `yaml_metadata_block` ####
3013A YAML metadata block is a valid YAML object, delimited by a line of three
3014hyphens (`---`) at the top and a line of three hyphens (`---`) or three dots
3015(`...`) at the bottom. A YAML metadata block may occur anywhere in the
3016document, but if it is not at the beginning, it must be preceded by a blank
3017line. (Note that, because of the way pandoc concatenates input files when
3018several are provided, you may also keep the metadata in a separate YAML file
3019and pass it to pandoc as an argument, along with your Markdown files:
3021 pandoc chap1.md chap2.md chap3.md metadata.yaml -s -o book.html
3023Just be sure that the YAML file begins with `---` and ends with `---` or
3026Metadata will be taken from the fields of the YAML object and added to any
3027existing document metadata. Metadata can contain lists and objects (nested
3028arbitrarily), but all string scalars will be interpreted as Markdown. Fields
3029with names ending in an underscore will be ignored by pandoc. (They may be
3030given a role by external processors.)
3032A document may contain multiple metadata blocks. The metadata fields will
3033be combined through a *left-biased union*: if two metadata blocks attempt
3034to set the same field, the value from the first block will be taken.
3036When pandoc is used with `-t markdown` to create a Markdown document,
3037a YAML metadata block will be produced only if the `-s/--standalone`
3038option is used. All of the metadata will appear in a single block
3039at the beginning of the document.
3041Note that YAML escaping rules must be followed. Thus, for example,
3042if a title contains a colon, it must be quoted. The pipe character
3043(`|`) can be used to begin an indented block that will be interpreted
3044literally, without need for escaping. This form is necessary
3045when the field contains blank lines or block-level formatting:
3048 title: 'This is the title: it contains a colon'
3052 tags: [nothing, nothingness]
3054 This is the abstract.
3056 It consists of two paragraphs.
3059Template variables will be set automatically from the metadata. Thus, for
3060example, in writing HTML, the variable `abstract` will be set to the HTML
3061equivalent of the Markdown in the `abstract` field:
3063 <p>This is the abstract.</p>
3064 <p>It consists of two paragraphs.</p>
3066Variables can contain arbitrary YAML structures, but the template must match
3067this structure. The `author` variable in the default templates expects a
3068simple list or string, but can be changed to support more complicated
3069structures. The following combination, for example, would add an affiliation
3070to the author if one is given:
3073 title: The document title
3076 affiliation: University of Somewhere
3078 affiliation: University of Nowhere
3081To use the structured authors in the example above, you would need a custom
3086 $author.name$$if(author.affiliation)$ ($author.affiliation$)$endif$
3092Raw content to include in the document's header may be specified
3093using `header-includes`; however, it is important to mark up
3094this content as raw code for a particular output format, using
3095the [`raw_attribute` extension](#extension-raw_attribute)), or it
3096will be interpreted as markdown. For example:
3100 \let\oldsection\section
3101 \renewcommand{\section}[1]{\clearpage\oldsection{#1}}
3107#### Extension: `all_symbols_escapable` ####
3109Except inside a code block or inline code, any punctuation or space
3110character preceded by a backslash will be treated literally, even if it
3111would normally indicate formatting. Thus, for example, if one writes
3121 <strong>hello</strong>
3123This rule is easier to remember than standard Markdown's rule,
3124which allows only the following characters to be backslash-escaped:
3128(However, if the `markdown_strict` format is used, the standard Markdown rule
3131A backslash-escaped space is parsed as a nonbreaking space. It will
3132appear in TeX output as `~` and in HTML and XML as `\ ` or
3135A backslash-escaped newline (i.e. a backslash occurring at the end of
3136a line) is parsed as a hard line break. It will appear in TeX output as
3137`\\` and in HTML as `<br />`. This is a nice alternative to
3138Markdown's "invisible" way of indicating hard line breaks using
3139two trailing spaces on a line.
3141Backslash escapes do not work in verbatim contexts.
3148To *emphasize* some text, surround it with `*`s or `_`, like this:
3150 This text is _emphasized with underscores_, and this
3151 is *emphasized with asterisks*.
3153Double `*` or `_` produces **strong emphasis**:
3155 This is **strong emphasis** and __with underscores__.
3157A `*` or `_` character surrounded by spaces, or backslash-escaped,
3158will not trigger emphasis:
3160 This is * not emphasized *, and \*neither is this\*.
3162#### Extension: `intraword_underscores` ####
3164Because `_` is sometimes used inside words and identifiers,
3165pandoc does not interpret a `_` surrounded by alphanumeric
3166characters as an emphasis marker. If you want to emphasize
3167just part of a word, use `*`:
3169 feas*ible*, not feas*able*.
3174#### Extension: `strikeout` ####
3176To strikeout a section of text with a horizontal line, begin and end it
3177with `~~`. Thus, for example,
3179 This ~~is deleted text.~~
3182### Superscripts and subscripts ###
3184#### Extension: `superscript`, `subscript` ####
3186Superscripts may be written by surrounding the superscripted text by `^`
3187characters; subscripts may be written by surrounding the subscripted
3188text by `~` characters. Thus, for example,
3190 H~2~O is a liquid. 2^10^ is 1024.
3192If the superscripted or subscripted text contains spaces, these spaces
3193must be escaped with backslashes. (This is to prevent accidental
3194superscripting and subscripting through the ordinary use of `~` and `^`.)
3195Thus, if you want the letter P with 'a cat' in subscripts, use
3196`P~a\ cat~`, not `P~a cat~`.
3201To make a short span of text verbatim, put it inside backticks:
3203 What is the difference between `>>=` and `>>`?
3205If the verbatim text includes a backtick, use double backticks:
3207 Here is a literal backtick `` ` ``.
3209(The spaces after the opening backticks and before the closing
3210backticks will be ignored.)
3212The general rule is that a verbatim span starts with a string
3213of consecutive backticks (optionally followed by a space)
3214and ends with a string of the same number of backticks (optionally
3215preceded by a space).
3217Note that backslash-escapes (and other Markdown constructs) do not
3218work in verbatim contexts:
3220 This is a backslash followed by an asterisk: `\*`.
3222#### Extension: `inline_code_attributes` ####
3224Attributes can be attached to verbatim text, just as with
3225[fenced code blocks]:
3231To write small caps, use the `smallcaps` class:
3233 [Small caps]{.smallcaps}
3235Or, without the `bracketed_spans` extension:
3237 <span class="smallcaps">Small caps</span>
3239For compatibility with other Markdown flavors, CSS is also supported:
3241 <span style="font-variant:small-caps;">Small caps</span>
3243This will work in all output formats that support small caps.
3249#### Extension: `tex_math_dollars` ####
3251Anything between two `$` characters will be treated as TeX math. The
3252opening `$` must have a non-space character immediately to its right,
3253while the closing `$` must have a non-space character immediately to its
3254left, and must not be followed immediately by a digit. Thus,
3255`$20,000 and $30,000` won't parse as math. If for some reason
3256you need to enclose text in literal `$` characters, backslash-escape
3257them and they won't be treated as math delimiters.
3259TeX math will be printed in all output formats. How it is rendered
3260depends on the output format:
3262Markdown, LaTeX, Emacs Org mode, ConTeXt, ZimWiki
3263 ~ It will appear verbatim between `$` characters.
3266 ~ It will be rendered using an [interpreted text role `:math:`].
3269 ~ It will be rendered as `latexmath:[...]`.
3272 ~ It will be rendered inside a `@math` command.
3275 ~ It will be rendered verbatim without `$`'s.
3278 ~ It will be rendered inside `<math>` tags.
3281 ~ It will be rendered inside `<span class="math">` tags.
3284 ~ It will be rendered, if possible, using Unicode characters,
3285 and will otherwise appear verbatim.
3288 ~ It will be rendered, if possible, using MathML.
3291 ~ If the `--mathml` flag is used, it will be rendered using MathML
3292 in an `inlineequation` or `informalequation` tag. Otherwise it
3293 will be rendered, if possible, using Unicode characters.
3296 ~ It will be rendered using OMML math markup.
3299 ~ If the `--webtex` option is used, formulas are rendered as images
3300 using CodeCogs or other compatible web service, downloaded
3301 and embedded in the e-book. Otherwise, they will appear verbatim.
3303HTML, Slidy, DZSlides, S5, EPUB
3304 ~ The way math is rendered in HTML will depend on the
3305 command-line options selected. Therefore see [Math rendering in HTML]
3308[interpreted text role `:math:`]: http://docutils.sourceforge.net/docs/ref/rst/roles.html#math
3313#### Extension: `raw_html` ####
3315Markdown allows you to insert raw HTML (or DocBook) anywhere in a document
3316(except verbatim contexts, where `<`, `>`, and `&` are interpreted
3317literally). (Technically this is not an extension, since standard
3318Markdown allows it, but it has been made an extension so that it can
3319be disabled if desired.)
3321The raw HTML is passed through unchanged in HTML, S5, Slidy, Slideous,
3322DZSlides, EPUB, Markdown, Emacs Org mode, and Textile output, and suppressed
3325#### Extension: `markdown_in_html_blocks` ####
3327Standard Markdown allows you to include HTML "blocks": blocks
3328of HTML between balanced tags that are separated from the surrounding text
3329with blank lines, and start and end at the left margin. Within
3330these blocks, everything is interpreted as HTML, not Markdown;
3331so (for example), `*` does not signify emphasis.
3333Pandoc behaves this way when the `markdown_strict` format is used; but
3334by default, pandoc interprets material between HTML block tags as Markdown.
3335Thus, for example, pandoc will turn
3340 <td>[a link](http://google.com)</td>
3348 <td><em>one</em></td>
3349 <td><a href="http://google.com">a link</a></td>
3353whereas `Markdown.pl` will preserve it as is.
3355There is one exception to this rule: text between `<script>` and
3356`<style>` tags is not interpreted as Markdown.
3358This departure from standard Markdown should make it easier to mix
3359Markdown with HTML block elements. For example, one can surround
3360a block of Markdown text with `<div>` tags without preventing it
3361from being interpreted as Markdown.
3363#### Extension: `native_divs` ####
3365Use native pandoc `Div` blocks for content inside `<div>` tags.
3366For the most part this should give the same output as
3367`markdown_in_html_blocks`, but it makes it easier to write pandoc
3368filters to manipulate groups of blocks.
3370#### Extension: `native_spans` ####
3372Use native pandoc `Span` blocks for content inside `<span>` tags.
3373For the most part this should give the same output as `raw_html`,
3374but it makes it easier to write pandoc filters to manipulate groups
3377#### Extension: `raw_tex` ####
3379In addition to raw HTML, pandoc allows raw LaTeX, TeX, and ConTeXt to be
3380included in a document. Inline TeX commands will be preserved and passed
3381unchanged to the LaTeX and ConTeXt writers. Thus, for example, you can use
3382LaTeX to include BibTeX citations:
3384 This result was proved in \cite{jones.1967}.
3386Note that in LaTeX environments, like
3388 \begin{tabular}{|l|l|}\hline
3389 Age & Frequency \\ \hline
3392 36--45 & 22 \\ \hline
3395the material between the begin and end tags will be interpreted as raw
3396LaTeX, not as Markdown.
3398Inline LaTeX is ignored in output formats other than Markdown, LaTeX,
3399Emacs Org mode, and ConTeXt.
3401### Generic raw attribute ###
3403#### Extension: `raw_attribute` ####
3405Inline spans and fenced code blocks with a special
3406kind of attribute will be parsed as raw content with the
3407designated format. For example, the following produces a raw
3414And the following produces a raw `html` inline element:
3416 This is `<a>html</a>`{=html}
3418The format name should match the target format name (see
3419`-t/--to`, above, for a list, or use `pandoc
3420--list-output-formats`).
3422This extension presupposes that the relevant kind of
3423inline code or fenced code block is enabled. Thus, for
3424example, to use a raw attribute with a backtick code block,
3425`backtick_code_blocks` must be enabled.
3427The raw attribute cannot be combined with regular attributes.
3432#### Extension: `latex_macros` ####
3434For output formats other than LaTeX, pandoc will parse LaTeX
3435macro definitions and apply the resulting macros to all LaTeX
3436math and raw LaTeX. So, for example, the following will work in
3437all output formats, not just LaTeX:
3439 \newcommand{\tuple}[1]{\langle #1 \rangle}
3443Note that LaTeX macros will not be applied if they occur
3444inside inside a raw span or block marked with the
3445[`raw_attribute` extension](#extension-raw_attribute).
3447When `latex_macros` is disabled, the raw LaTeX and math will
3448not have macros applied. This is usually a better approach when
3449you are targeting LaTeX or PDF.
3451Whether or not `latex_macros` is enabled, the macro definitions
3452will still be passed through as raw LaTeX.
3457Markdown allows links to be specified in several ways.
3459### Automatic links ###
3461If you enclose a URL or email address in pointy brackets, it
3465 <sam@green.eggs.ham>
3469An inline link consists of the link text in square brackets,
3470followed by the URL in parentheses. (Optionally, the URL can
3471be followed by a link title, in quotes.)
3473 This is an [inline link](/url), and here's [one with
3474 a title](http://fsf.org "click here for a good time!").
3476There can be no space between the bracketed part and the parenthesized part.
3477The link text can contain formatting (such as emphasis), but the title cannot.
3479Email addresses in inline links are not autodetected, so they have to be
3480prefixed with `mailto`:
3482 [Write me!](mailto:sam@green.eggs.ham)
3484### Reference links ###
3486An *explicit* reference link has two parts, the link itself and the link
3487definition, which may occur elsewhere in the document (either
3488before or after the link).
3490The link consists of link text in square brackets, followed by a label in
3491square brackets. (There cannot be space between the two unless the
3492`spaced_reference_links` extension is enabled.) The link definition
3493consists of the bracketed label, followed by a colon and a space, followed by
3494the URL, and optionally (after a space) a link title either in quotes or in
3495parentheses. The label must not be parseable as a citation (assuming
3496the `citations` extension is enabled): citations take precedence over
3499Here are some examples:
3501 [my label 1]: /foo/bar.html "My title, optional"
3503 [my label 3]: http://fsf.org (The free software foundation)
3504 [my label 4]: /bar#special 'A title in single quotes'
3506The URL may optionally be surrounded by angle brackets:
3508 [my label 5]: <http://foo.bar.baz>
3510The title may go on the next line:
3512 [my label 3]: http://fsf.org
3513 "The free software foundation"
3515Note that link labels are not case sensitive. So, this will work:
3517 Here is [my link][FOO]
3521In an *implicit* reference link, the second pair of brackets is
3526 [my website]: http://foo.bar.baz
3528Note: In `Markdown.pl` and most other Markdown implementations,
3529reference link definitions cannot occur in nested constructions
3530such as list items or block quotes. Pandoc lifts this arbitrary
3531seeming restriction. So the following is fine in pandoc, though
3532not in most other implementations:
3538#### Extension: `shortcut_reference_links` ####
3540In a *shortcut* reference link, the second pair of brackets may
3545 [my website]: http://foo.bar.baz
3547### Internal links ###
3549To link to another section of the same document, use the automatically
3550generated identifier (see [Header identifiers]). For example:
3552 See the [Introduction](#introduction).
3556 See the [Introduction].
3558 [Introduction]: #introduction
3560Internal links are currently supported for HTML formats (including
3561HTML slide shows and EPUB), LaTeX, and ConTeXt.
3566A link immediately preceded by a `!` will be treated as an image.
3567The link text will be used as the image's alt text:
3569 
3573 [movie reel]: movie.gif
3575#### Extension: `implicit_figures` ####
3577An image with nonempty alt text, occurring by itself in a
3578paragraph, will be rendered as a figure with a caption. The
3579image's alt text will be used as the caption.
3581 
3583How this is rendered depends on the output format. Some output
3584formats (e.g. RTF) do not yet support figures. In those
3585formats, you'll just get an image in a paragraph by itself, with
3588If you just want a regular inline image, just make sure it is not
3589the only thing in the paragraph. One way to do this is to insert a
3590nonbreaking space after the image:
3592 \
3594Note that in reveal.js slide shows, an image in a paragraph
3595by itself that has the `stretch` class will fill the screen,
3596and the caption and figure tags will be omitted.
3598#### Extension: `link_attributes` ####
3600Attributes can be set on links and images:
3602 An inline {#id .class width=30 height=20px}
3603 and a reference ![image][ref] with attributes.
3605 [ref]: foo.jpg "optional title" {#id .class key=val key2="val 2"}
3607(This syntax is compatible with [PHP Markdown Extra] when only `#id`
3608and `.class` are used.)
3610For HTML and EPUB, all attributes except `width` and `height` (but
3611including `srcset` and `sizes`) are passed through as is. The other
3612writers ignore attributes that are not supported by their output
3615The `width` and `height` attributes on images are treated specially. When
3616used without a unit, the unit is assumed to be pixels. However, any of
3617the following unit identifiers can be used: `px`, `cm`, `mm`, `in`, `inch`
3618and `%`. There must not be any spaces between the number and the unit.
3622{ width=50% }
3625- Dimensions are converted to inches for output in page-based formats like
3626 LaTeX. Dimensions are converted to pixels for output in HTML-like
3627 formats. Use the `--dpi` option to specify the number of pixels per
3628 inch. The default is 96dpi.
3629- The `%` unit is generally relative to some available space.
3630 For example the above example will render to
3631 `<img href="file.jpg" style="width: 50%;" />` (HTML),
3632 `\includegraphics[width=0.5\textwidth]{file.jpg}` (LaTeX), or
3633 `\externalfigure[file.jpg][width=0.5\textwidth]` (ConTeXt).
3634- Some output formats have a notion of a class
3635 ([ConTeXt](http://wiki.contextgarden.net/Using_Graphics#Multiple_Image_Settings))
3636 or a unique identifier (LaTeX `\caption`), or both (HTML).
3637- When no `width` or `height` attributes are specified, the fallback
3638 is to look at the image resolution and the dpi metadata embedded in
3644Using the `native_divs` and `native_spans` extensions
3645(see [above][Extension: `native_divs`]), HTML syntax can
3646be used as part of markdown to create native `Div` and `Span`
3647elements in the pandoc AST (as opposed to raw HTML).
3648However, there is also nicer syntax available:
3650#### Extension: `fenced_divs` ####
3652Allow special fenced syntax for native `Div` blocks. A Div
3653starts with a fence containing at least three consecutive
3654colons plus some attributes. The attributes may optionally
3655be followed by another string of consecutive colons.
3656The attribute syntax is exactly as in fenced code blocks (see
3657[Extension: `fenced_code_attributes`]). As with fenced
3658code blocks, one can use either attributes in curly braces
3659or a single unbraced word, which will be treated as a class
3660name. The Div ends with another line containing a string of at
3661least three consecutive colons. The fenced Div should be
3662separated by blank lines from preceding and following blocks.
3666 ::::: {#special .sidebar}
3667 Here is a paragraph.
3672Fenced divs can be nested. Opening fences are distinguished
3673because they *must* have attributes:
3679 This is a warning within a warning.
3683Fences without attributes are always closing fences. Unlike
3684with fenced code blocks, the number of colons in the closing
3685fence need not match the number in the opening fence. However,
3686it can be helpful for visual clarity to use fences of different
3687lengths to distinguish nested divs from their parents.
3690#### Extension: `bracketed_spans` ####
3692A bracketed sequence of inlines, as one would use to begin
3693a link, will be treated as a `Span` with attributes if it is
3694followed immediately by attributes:
3696 [This is *some text*]{.class key="val"}
3701#### Extension: `footnotes` ####
3703Pandoc's Markdown allows footnotes, using the following syntax:
3705 Here is a footnote reference,[^1] and another.[^longnote]
3707 [^1]: Here is the footnote.
3709 [^longnote]: Here's one with multiple blocks.
3711 Subsequent paragraphs are indented to show that they
3712 belong to the previous footnote.
3716 The whole paragraph can be indented, or just the first
3717 line. In this way, multi-paragraph footnotes work like
3718 multi-paragraph list items.
3720 This paragraph won't be part of the note, because it
3723The identifiers in footnote references may not contain spaces, tabs,
3724or newlines. These identifiers are used only to correlate the
3725footnote reference with the note itself; in the output, footnotes
3726will be numbered sequentially.
3728The footnotes themselves need not be placed at the end of the
3729document. They may appear anywhere except inside other block elements
3730(lists, block quotes, tables, etc.). Each footnote should be
3731separated from surrounding content (including other footnotes)
3734#### Extension: `inline_notes` ####
3736Inline footnotes are also allowed (though, unlike regular notes,
3737they cannot contain multiple paragraphs). The syntax is as follows:
3739 Here is an inline note.^[Inlines notes are easier to write, since
3740 you don't have to pick an identifier and move down to type the
3743Inline and regular footnotes may be mixed freely.
3748#### Extension: `citations` ####
3750Using an external filter, `pandoc-citeproc`, pandoc can automatically generate
3751citations and a bibliography in a number of styles. Basic usage is
3753 pandoc --filter pandoc-citeproc myinput.txt
3755In order to use this feature, you will need to specify a bibliography file
3756using the `bibliography` metadata field in a YAML metadata section, or
3757`--bibliography` command line argument. You can supply multiple `--bibliography`
3758arguments or set `bibliography` metadata field to YAML array, if you want to
3759use multiple bibliography files. The bibliography may have any of these
3762 Format File extension
3763 ------------ --------------
3776Note that `.bib` can be used with both BibTeX and BibLaTeX files;
3777use `.bibtex` to force BibTeX.
3779Note that `pandoc-citeproc --bib2json` and `pandoc-citeproc --bib2yaml`
3780can produce `.json` and `.yaml` files from any of the supported formats.
3782In-field markup: In BibTeX and BibLaTeX databases, pandoc-citeproc parses
3783a subset of LaTeX markup; in CSL YAML databases, pandoc Markdown; and in CSL JSON databases, an [HTML-like markup][CSL markup specs]:
3791`<span style="font-variant:small-caps;">...</span>` or `<sc>...</sc>`
3800`<span class="nocase">...</span>`
3801: prevent a phrase from being capitalized as title case
3803`pandoc-citeproc -j` and `-y` interconvert the CSL JSON
3804and CSL YAML formats as far as possible.
3806As an alternative to specifying a bibliography file using `--bibliography`
3807or the YAML metadata field `bibliography`, you can include
3808the citation data directly in the `references` field of the
3809document's YAML metadata. The field should contain an array of
3810YAML-encoded references, for example:
3814 - type: article-journal
3826 title: 'Molecular structure of nucleic acids: a structure for deoxyribose
3828 title-short: Molecular structure of nucleic acids
3829 container-title: Nature
3833 DOI: 10.1038/171737a0
3834 URL: http://www.nature.com/nature/journal/v171/n4356/abs/171737a0.html
3838(`pandoc-citeproc --bib2yaml` can produce these from a bibliography file in one
3839of the supported formats.)
3841Citations and references can be formatted using any style supported by the
3842[Citation Style Language], listed in the [Zotero Style Repository].
3843These files are specified using the `--csl` option or the `csl` metadata field.
3844By default, `pandoc-citeproc` will use the [Chicago Manual of Style] author-date
3845format. The CSL project provides further information on [finding and editing styles].
3847To make your citations hyperlinks to the corresponding bibliography
3848entries, add `link-citations: true` to your YAML metadata.
3850Citations go inside square brackets and are separated by semicolons.
3851Each citation must have a key, composed of '@' + the citation
3852identifier from the database, and may optionally have a prefix,
3853a locator, and a suffix. The citation key must begin with a letter, digit,
3854or `_`, and may contain alphanumerics, `_`, and internal punctuation
3855characters (`:.#$%&-+?<>~/`). Here are some examples:
3857 Blah blah [see @doe99, pp. 33-35; also @smith04, chap. 1].
3859 Blah blah [@doe99, pp. 33-35, 38-39 and *passim*].
3861 Blah blah [@smith04; @doe99].
3863`pandoc-citeproc` detects locator terms in the [CSL locale files].
3864Either abbreviated or unabbreviated forms are accepted. In the `en-US`
3865locale, locator terms can be written in either singular or plural forms,
3866as `book`, `bk.`/`bks.`; `chapter`, `chap.`/`chaps.`; `column`,
3867`col.`/`cols.`; `figure`, `fig.`/`figs.`; `folio`, `fol.`/`fols.`;
3868`number`, `no.`/`nos.`; `line`, `l.`/`ll.`; `note`, `n.`/`nn.`; `opus`,
3869`op.`/`opp.`; `page`, `p.`/`pp.`; `paragraph`, `para.`/`paras.`; `part`,
3870`pt.`/`pts.`; `section`, `sec.`/`secs.`; `sub verbo`, `s.v.`/`s.vv.`;
3871`verse`, `v.`/`vv.`; `volume`, `vol.`/`vols.`; `¶`/`¶¶`; `§`/`§§`. If no
3872locator term is used, "page" is assumed.
3874A minus sign (`-`) before the `@` will suppress mention of
3875the author in the citation. This can be useful when the
3876author is already mentioned in the text:
3878 Smith says blah [-@smith04].
3880You can also write an in-text citation, as follows:
3884 @smith04 [p. 33] says blah.
3886If the style calls for a list of works cited, it will be placed
3887at the end of the document. Normally, you will want to end your
3888document with an appropriate header:
3894The bibliography will be inserted after this header. Note that
3895the `unnumbered` class will be added to this header, so that the
3896section will not be numbered.
3898If you want to include items in the bibliography without actually
3899citing them in the body text, you can define a dummy `nocite` metadata
3900field and put the citations there:
3909In this example, the document will contain a citation for `item3`
3910only, but the bibliography will contain entries for `item1`, `item2`, and
3913It is possible to create a bibliography with all the citations,
3914whether or not they appear in the document, by using a wildcard:
3921For LaTeX or PDF output, you can also use [`natbib`] or [`biblatex`]
3922to render bibliography. In order to do so, specify bibliography files as
3923outlined above, and add `--natbib` or `--biblatex` argument to `pandoc`
3924invocation. Bear in mind that bibliography files have to be in respective
3925format (either BibTeX or BibLaTeX).
3927For more information, see the [pandoc-citeproc man page].
3929[CSL markup specs]: http://docs.citationstyles.org/en/1.0/release-notes.html#rich-text-markup-within-fields
3930[Chicago Manual of Style]: http://chicagomanualofstyle.org
3931[Citation Style Language]: http://citationstyles.org
3932[Zotero Style Repository]: https://www.zotero.org/styles
3933[finding and editing styles]: http://citationstyles.org/styles/
3934[CSL locale files]: https://github.com/citation-style-language/locales
3935[pandoc-citeproc man page]: https://github.com/jgm/pandoc-citeproc/blob/master/man/pandoc-citeproc.1.md
3937Non-pandoc extensions
3938---------------------
3940The following Markdown syntax extensions are not enabled by default
3941in pandoc, but may be enabled by adding `+EXTENSION` to the format
3942name, where `EXTENSION` is the name of the extension. Thus, for
3943example, `markdown+hard_line_breaks` is Markdown with hard line breaks.
3945#### Extension: `old_dashes` ####
3947Selects the pandoc <= 1.8.2.1 behavior for parsing smart dashes:
3948`-` before a numeral is an en-dash, and `--` is an em-dash.
3949This option only has an effect if `smart` is enabled. It is
3950selected automatically for `textile` input.
3952#### Extension: `angle_brackets_escapable` ####
3954Allow `<` and `>` to be backslash-escaped, as they can be in
3955GitHub flavored Markdown but not original Markdown. This is
3956implied by pandoc's default `all_symbols_escapable`.
3958#### Extension: `lists_without_preceding_blankline` ####
3960Allow a list to occur right after a paragraph, with no intervening
3963#### Extension: `four_space_rule` ####
3965Selects the pandoc <= 2.0 behavior for parsing lists, so that
3966four spaces indent are needed for list item continuation
3969#### Extension: `spaced_reference_links` ####
3971Allow whitespace between the two components of a reference link,
3976#### Extension: `hard_line_breaks` ####
3978Causes all newlines within a paragraph to be interpreted as hard line
3979breaks instead of spaces.
3981#### Extension: `ignore_line_breaks` ####
3983Causes newlines within a paragraph to be ignored, rather than being
3984treated as spaces or as hard line breaks. This option is intended for
3985use with East Asian languages where spaces are not used between words,
3986but text is divided into lines for readability.
3988#### Extension: `east_asian_line_breaks` ####
3990Causes newlines within a paragraph to be ignored, rather than
3991being treated as spaces or as hard line breaks, when they occur
3992between two East Asian wide characters. This is a better choice
3993than `ignore_line_breaks` for texts that include a mix of East
3994Asian wide characters and other characters.
3996#### Extension: `emoji` ####
3998Parses textual emojis like `:smile:` as Unicode emoticons.
4000#### Extension: `tex_math_single_backslash` ####
4002Causes anything between `\(` and `\)` to be interpreted as inline
4003TeX math, and anything between `\[` and `\]` to be interpreted
4004as display TeX math. Note: a drawback of this extension is that
4005it precludes escaping `(` and `[`.
4007#### Extension: `tex_math_double_backslash` ####
4009Causes anything between `\\(` and `\\)` to be interpreted as inline
4010TeX math, and anything between `\\[` and `\\]` to be interpreted
4013#### Extension: `markdown_attribute` ####
4015By default, pandoc interprets material inside block-level tags as Markdown.
4016This extension changes the behavior so that Markdown is only parsed
4017inside block-level tags if the tags have the attribute `markdown=1`.
4019#### Extension: `mmd_title_block` ####
4021Enables a [MultiMarkdown] style title block at the top of
4022the document, for example:
4026 Date: September 1, 2008
4027 Comment: This is a sample mmd title block, with
4028 a field spanning multiple lines.
4030See the MultiMarkdown documentation for details. If `pandoc_title_block` or
4031`yaml_metadata_block` is enabled, it will take precedence over
4034#### Extension: `abbreviations` ####
4036Parses PHP Markdown Extra abbreviation keys, like
4038 *[HTML]: Hypertext Markup Language
4040Note that the pandoc document model does not support
4041abbreviations, so if this extension is enabled, abbreviation keys are
4042simply skipped (as opposed to being parsed as paragraphs).
4044#### Extension: `autolink_bare_uris` ####
4046Makes all absolute URIs into links, even when not surrounded by
4047pointy braces `<...>`.
4049#### Extension: `mmd_link_attributes` ####
4051Parses multimarkdown style key-value attributes on link
4052and image references. This extension should not be confused with the
4053[`link_attributes`](#extension-link_attributes) extension.
4055 This is a reference ![image][ref] with multimarkdown attributes.
4057 [ref]: http://path.to/image "Image title" width=20px height=30px
4058 id=myId class="myClass1 myClass2"
4060#### Extension: `mmd_header_identifiers` ####
4062Parses multimarkdown style header identifiers (in square brackets,
4063after the header but before any trailing `#`s in an ATX header).
4065#### Extension: `compact_definition_lists` ####
4067Activates the definition list syntax of pandoc 1.12.x and earlier.
4068This syntax differs from the one described above under [Definition lists]
4071 - No blank line is required between consecutive items of the
4073 - To get a "tight" or "compact" list, omit space between consecutive
4074 items; the space between a term and its definition does not affect
4076 - Lazy wrapping of paragraphs is not allowed: the entire definition must
4077 be indented four spaces.[^6]
4079[^6]: To see why laziness is incompatible with relaxing the requirement
4080 of a blank line between items, consider the following example:
4087 Is this a single list item with two definitions of "bar," the first of
4088 which is lazily wrapped, or two list items? To remove the ambiguity
4089 we must either disallow lazy wrapping or require a blank line between
4095In addition to pandoc's extended Markdown, the following Markdown
4096variants are supported:
4098`markdown_phpextra` (PHP Markdown Extra)
4099: `footnotes`, `pipe_tables`, `raw_html`, `markdown_attribute`,
4100 `fenced_code_blocks`, `definition_lists`, `intraword_underscores`,
4101 `header_attributes`, `link_attributes`, `abbreviations`,
4102 `shortcut_reference_links`, `spaced_reference_links`.
4104`markdown_github` (deprecated GitHub-Flavored Markdown)
4105: `pipe_tables`, `raw_html`, `fenced_code_blocks`, `gfm_auto_identifiers`,
4106 `ascii_identifiers`, `backtick_code_blocks`, `autolink_bare_uris`,
4107 `space_in_atx_header`, `intraword_underscores`, `strikeout`,
4108 `emoji`, `shortcut_reference_links`, `angle_brackets_escapable`,
4109 `lists_without_preceding_blankline`.
4111`markdown_mmd` (MultiMarkdown)
4112: `pipe_tables`, `raw_html`, `markdown_attribute`, `mmd_link_attributes`,
4113 `tex_math_double_backslash`, `intraword_underscores`,
4114 `mmd_title_block`, `footnotes`, `definition_lists`,
4115 `all_symbols_escapable`, `implicit_header_references`,
4116 `auto_identifiers`, `mmd_header_identifiers`,
4117 `shortcut_reference_links`, `implicit_figures`,
4118 `superscript`, `subscript`, `backtick_code_blocks`,
4119 `spaced_reference_links`, `raw_attribute`.
4121`markdown_strict` (Markdown.pl)
4122: `raw_html`, `shortcut_reference_links`,
4123 `spaced_reference_links`.
4125We also support `commonmark` and `gfm` (GitHub-Flavored Markdown,
4126which is implemented as a set of extensions on `commonmark`).
4128Note, however, that `commonmark` and `gfm` have limited support
4129for extensions. Only those listed below (and `smart` and
4130`raw_tex`) will work. The extensions can, however, all be
4131individually disabled.
4132Also, `raw_tex` only affects `gfm` output, not input.
4134`gfm` (GitHub-Flavored Markdown)
4135: `pipe_tables`, `raw_html`, `fenced_code_blocks`, `auto_identifiers`,
4136 `ascii_identifiers`, `backtick_code_blocks`, `autolink_bare_uris`,
4137 `intraword_underscores`, `strikeout`, `hard_line_breaks`, `emoji`,
4138 `shortcut_reference_links`, `angle_brackets_escapable`.
4140Producing slide shows with pandoc
4141=================================
4143You can use pandoc to produce an HTML + JavaScript slide presentation
4144that can be viewed via a web browser. There are five ways to do this,
4145using [S5], [DZSlides], [Slidy], [Slideous], or [reveal.js].
4146You can also produce a PDF slide show using LaTeX [`beamer`], or
4147slides shows in Microsoft [PowerPoint] format.
4149Here's the Markdown source for a simple slide show, `habits.txt`:
4176 
4183To produce an HTML/JavaScript slide show, simply type
4185 pandoc -t FORMAT -s habits.txt -o habits.html
4187where `FORMAT` is either `s5`, `slidy`, `slideous`, `dzslides`, or `revealjs`.
4189For Slidy, Slideous, reveal.js, and S5, the file produced by pandoc with the
4190`-s/--standalone` option embeds a link to JavaScript and CSS files, which are
4191assumed to be available at the relative path `s5/default` (for S5), `slideous`
4192(for Slideous), `reveal.js` (for reveal.js), or at the Slidy website at
4193`w3.org` (for Slidy). (These paths can be changed by setting the `slidy-url`,
4194`slideous-url`, `revealjs-url`, or `s5-url` variables; see [Variables for slides],
4195above.) For DZSlides, the (relatively short) JavaScript and CSS are included in
4198With all HTML slide formats, the `--self-contained` option can be used to
4199produce a single file that contains all of the data necessary to display the
4200slide show, including linked scripts, stylesheets, images, and videos.
4202To produce a PDF slide show using beamer, type
4204 pandoc -t beamer habits.txt -o habits.pdf
4206Note that a reveal.js slide show can also be converted to a PDF
4207by printing it to a file from the browser.
4209To produce a Powerpoint slide show, type
4211 pandoc habits.txt -o habits.pptx
4213Structuring the slide show
4214--------------------------
4216By default, the *slide level* is the highest header level in
4217the hierarchy that is followed immediately by content, and not another
4218header, somewhere in the document. In the example above, level 1 headers
4219are always followed by level 2 headers, which are followed by content,
4220so 2 is the slide level. This default can be overridden using
4221the `--slide-level` option.
4223The document is carved up into slides according to the following
4226 * A horizontal rule always starts a new slide.
4228 * A header at the slide level always starts a new slide.
4230 * Headers *below* the slide level in the hierarchy create
4231 headers *within* a slide.
4233 * Headers *above* the slide level in the hierarchy create
4234 "title slides," which just contain the section title
4235 and help to break the slide show into sections.
4237 * Content *above* the slide level will not appear in the slide
4240 * A title page is constructed automatically from the document's title
4241 block, if present. (In the case of beamer, this can be disabled
4242 by commenting out some lines in the default template.)
4244These rules are designed to support many different styles of slide show. If
4245you don't care about structuring your slides into sections and subsections,
4246you can just use level 1 headers for all each slide. (In that case, level 1
4247will be the slide level.) But you can also structure the slide show into
4248sections, as in the example above.
4250Note: in reveal.js slide shows, if slide level is 2, a two-dimensional
4251layout will be produced, with level 1 headers building horizontally
4252and level 2 headers building vertically. It is not recommended that
4253you use deeper nesting of section levels with reveal.js.
4258By default, these writers produce lists that display "all at once."
4259If you want your lists to display incrementally (one item at a time),
4260use the `-i` option. If you want a particular list to depart from the
4261default, put it in a `div` block with class `incremental` or
4262`nonincremental`. So, for example, using the `fenced div` syntax, the
4263following would be incremental regardless of the document default:
4281While using `incremental` and `nonincremental` divs are the
4282recommended method of setting incremental lists on a per-case basis,
4283an older method is also supported: putting lists inside a blockquote
4284will depart from the document default (that is, it will display
4285incrementally without the `-i` option and all at once with the `-i`
4291Both methods allow incremental and nonincremental lists to be mixed
4292in a single document.
4297You can add "pauses" within a slide by including a paragraph containing
4298three dots, separated by spaces:
4300 # Slide with a pause
4302 content before the pause
4306 content after the pause
4311You can change the style of HTML slides by putting customized CSS files
4312in `$DATADIR/s5/default` (for S5), `$DATADIR/slidy` (for Slidy),
4313or `$DATADIR/slideous` (for Slideous),
4314where `$DATADIR` is the user data directory (see `--data-dir`, above).
4315The originals may be found in pandoc's system data directory (generally
4316`$CABALDIR/pandoc-VERSION/s5/default`). Pandoc will look there for any
4317files it does not find in the user data directory.
4319For dzslides, the CSS is included in the HTML file itself, and may
4322All [reveal.js configuration options] can be set through variables.
4323For example, themes can be used by setting the `theme` variable:
4327Or you can specify a custom stylesheet using the `--css` option.
4329To style beamer slides, you can specify a `theme`, `colortheme`,
4330`fonttheme`, `innertheme`, and `outertheme`, using the `-V` option:
4332 pandoc -t beamer habits.txt -V theme:Warsaw -o habits.pdf
4334Note that header attributes will turn into slide attributes
4335(on a `<div>` or `<section>`) in HTML slide formats, allowing you
4336to style individual slides. In beamer, the only header attribute
4337that affects slides is the `allowframebreaks` class, which sets the
4338`allowframebreaks` option, causing multiple slides to be created
4339if the content overfills the frame. This is recommended especially for
4342 # References {.allowframebreaks}
4347Speaker notes are supported in reveal.js and PowerPoint (pptx)
4348output. You can add notes to your Markdown document thus:
4354 - It can contain Markdown
4359To show the notes window in reveal.js, press `s` while viewing the
4360presentation. Speaker notes in PowerPoint will be available, as usual,
4361in handouts and presenter view.
4363Notes are not yet supported for other slide formats, but the notes
4364will not appear on the slides themselves.
4369To put material in side by side columns, you can use a native
4370div container with class `columns`, containing two or more div
4371containers with class `column` and a `width` attribute:
4373 :::::::::::::: {.columns}
4374 ::: {.column width="40%"}
4377 ::: {.column width="60%"}
4382Frame attributes in beamer
4383--------------------------
4385Sometimes it is necessary to add the LaTeX `[fragile]` option to
4386a frame in beamer (for example, when using the `minted` environment).
4387This can be forced by adding the `fragile` class to the header
4388introducing the slide:
4390 # Fragile slide {.fragile}
4392All of the other frame attributes described in Section 8.1 of
4393the [Beamer User's Guide] may also be used: `allowdisplaybreaks`,
4394`allowframebreaks`, `b`, `c`, `t`, `environment`, `label`, `plain`,
4397Background in reveal.js
4398-----------------------
4400Background images can be added to self-contained reveal.js slideshows.
4402For the same image on every slide, use the reveal.js configuration
4403option `parallaxBackgroundImage` either in the YAML metadata block
4404or as a command-line variable. You can also set
4405`parallaxBackgroundHorizontal` and `parallaxBackgroundVertical` the same
4406way and must also set `parallaxBackgroundSize` to have your values
4409To set an image for a particular slide, add
4410`{data-background-image="/path/to/image"}`
4411to the first slide-level header on the slide (which may even be empty).
4413In reveal.js's overview mode, the parallaxBackgroundImage will show up
4414only on the first slide.
4416Other background settings also work on individual slides, including
4417`data-background-size`, `data-background-repeat`, `data-background-color`,
4418`data-transition`, and `data-transition-speed`.
4421documentation](https://github.com/hakimel/reveal.js#slide-backgrounds)
4429parallaxBackgroundImage: /path/to/my/background_image.png
4434Slide 1 has background_image.png as its background.
4436## {data-background-image="/path/to/special_image.jpg"}
4438Slide 2 has a special image for its background, even though the header has no content.
4441Creating EPUBs with pandoc
4442==========================
4447EPUB metadata may be specified using the `--epub-metadata` option, but
4448if the source document is Markdown, it is better to use a [YAML metadata
4449block][Extension: `yaml_metadata_block`]. Here is an example:
4456 text: An investigation of metadata
4464 text: doi:10.234234.234/33
4466 rights: © 2007 John Smith, CC BY-NC
4471The following fields are recognized:
4474 ~ Either a string value or an object with fields `text` and
4475 `scheme`. Valid values for `scheme` are `ISBN-10`,
4476 `GTIN-13`, `UPC`, `ISMN-10`, `DOI`, `LCCN`, `GTIN-14`,
4477 `ISBN-13`, `Legal deposit number`, `URN`, `OCLC`,
4478 `ISMN-13`, `ISBN-A`, `JP`, `OLCC`.
4481 ~ Either a string value, or an object with fields `file-as` and
4482 `type`, or a list of such objects. Valid values for `type` are
4483 `main`, `subtitle`, `short`, `collection`, `edition`, `extended`.
4486 ~ Either a string value, or an object with fields `role`, `file-as`,
4487 and `text`, or a list of such objects. Valid values for `role` are
4488 [MARC relators], but
4489 pandoc will attempt to translate the human-readable versions
4490 (like "author" and "editor") to the appropriate marc relators.
4493 ~ Same format as `creator`.
4496 ~ A string value in `YYYY-MM-DD` format. (Only the year is necessary.)
4497 Pandoc will attempt to convert other common date formats.
4499`lang` (or legacy: `language`)
4500 ~ A string value in [BCP 47] format. Pandoc will default to the local
4501 language if nothing is specified.
4504 ~ A string value or a list of such values.
4525 ~ A string value (path to cover image).
4528 ~ A string value (path to CSS stylesheet).
4530`page-progression-direction`
4531 ~ Either `ltr` or `rtl`. Specifies the `page-progression-direction`
4532 attribute for the [`spine` element].
4535 ~ iBooks-specific metadata, with the following fields:
4537 - `version`: (string)
4538 - `specified-fonts`: `true`|`false` (default `false`)
4539 - `ipad-orientation-lock`: `portrait-only`|`landscape-only`
4540 - `iphone-orientation-lock`: `portrait-only`|`landscape-only`
4541 - `binding`: `true`|`false` (default `true`)
4542 - `scroll-axis`: `vertical`|`horizontal`|`default`
4544[MARC relators]: http://loc.gov/marc/relators/relaterm.html
4545[`spine` element]: http://idpf.org/epub/301/spec/epub-publications.html#sec-spine-elem
4550By default, pandoc will download linked media (including audio and
4551video) and include it in the EPUB container, yielding a completely
4552self-contained EPUB. If you want to link to external media resources
4553instead, use raw HTML in your source and add `data-external="1"` to the tag
4554with the `src` attribute. For example:
4556 <audio controls="1">
4557 <source src="http://example.com/music/toccata.mp3"
4558 data-external="1" type="audio/mpeg">
4565Pandoc will automatically highlight syntax in [fenced code blocks] that
4566are marked with a language name. The Haskell library [skylighting] is
4567used for highlighting, which works in HTML, Docx, Ms, and LaTeX/PDF output.
4568To see a list of language names that pandoc will recognize, type
4569`pandoc --list-highlight-languages`.
4571The color scheme can be selected using the `--highlight-style` option.
4572The default color scheme is `pygments`, which imitates the default color
4573scheme used by the Python library pygments (though pygments is not actually
4574used to do the highlighting). To see a list of highlight styles,
4575type `pandoc --list-highlight-styles`.
4577To disable highlighting, use the `--no-highlight` option.
4579[skylighting]: https://github.com/jgm/skylighting
4581Custom Styles in Docx
4582=====================
4587The docx reader, by default, only reads those styles that it can
4588convert into pandoc elements, either by direct conversion or
4589interpreting the derivation of the input document's styles.
4591By enabling the [`styles` extension](#ext-styles) in the docx reader
4592(`-f docx+styles`), you can produce output that maintains the styles
4593of the input document, using the `custom-style` class. Paragraph
4594styles are interpreted as divs, while character styles are interpreted
4597For example, using the `custom-style-reference.docx` file in the test
4598directory, we have the following different outputs:
4600Without the `+styles` extension:
4602 $ pandoc test/docx/custom-style-reference.docx -f docx -t markdown
4605 This is text with an *emphasized* text style. And this is text with a
4606 **strengthened** text style.
4608 > Here is a styled paragraph that inherits from Block Text.
4610And with the extension:
4612 $ pandoc test/docx/custom-style-reference.docx -f docx+styles -t markdown
4614 ::: {custom-style="FirstParagraph"}
4618 ::: {custom-style="BodyText"}
4619 This is text with an [emphasized]{custom-style="Emphatic"} text style.
4620 And this is text with a [strengthened]{custom-style="Strengthened"}
4624 ::: {custom-style="MyBlockStyle"}
4625 > Here is a styled paragraph that inherits from Block Text.
4628With these custom styles, you can use your input document as a
4629reference-doc while creating docx output (see below), and maintain the
4630same styles in your input and output files.
4635By default, pandoc's docx output applies a predefined set of styles for
4636blocks such as paragraphs and block quotes, and uses largely default
4637formatting (italics, bold) for inlines. This will work for most
4638purposes, especially alongside a `reference.docx` file. However, if you
4639need to apply your own styles to blocks, or match a preexisting set of
4640styles, pandoc allows you to define custom styles for blocks and text
4641using `div`s and `span`s, respectively.
4643If you define a `div` or `span` with the attribute `custom-style`,
4644pandoc will apply your specified style to the contained elements. So,
4645for example using the `bracketed_spans` syntax,
4647 [Get out]{custom-style="Emphatically"}, he said.
4649would produce a docx file with "Get out" styled with character
4650style `Emphatically`. Similarly, using the `fenced_divs` syntax,
4652 Dickinson starts the poem simply:
4654 ::: {custom-style="Poetry"}
4655 | A Bird came down the Walk---
4656 | He did not know I saw---
4659would style the two contained lines with the `Poetry` paragraph style.
4661If the styles are not yet in your reference.docx, they will be defined
4662in the output file as inheriting from normal text. If they are already
4663defined, pandoc will not alter the definition.
4665This feature allows for greatest customization in conjunction with
4666[pandoc filters]. If you want all paragraphs after block quotes to be
4667indented, you can write a filter to apply the styles necessary. If you
4668want all italics to be transformed to the `Emphasis` character style
4669(perhaps to change their color), you can write a filter which will
4670transform all italicized inlines to inlines within an `Emphasis`
4673[pandoc filters]: http://pandoc.org/filters.html
4678Pandoc can be extended with custom writers written in [lua]. (Pandoc
4679includes a lua interpreter, so lua need not be installed separately.)
4681To use a custom writer, simply specify the path to the lua script
4682in place of the output format. For example:
4684 pandoc -t data/sample.lua
4686Creating a custom writer requires writing a lua function for each
4687possible element in a pandoc document. To get a documented example
4688which you can modify according to your needs, do
4690 pandoc --print-default-data-file sample.lua
4692[lua]: http://www.lua.org
4697Copyright 2006-2017 John MacFarlane (jgm@berkeley.edu). Released
4698under the [GPL], version 2 or greater. This software carries no
4699warranty of any kind. (See COPYRIGHT for full copyright and
4700warranty notices.) For a full list of contributors, see the file
4701AUTHORS.md in the pandoc source code.
4703[GPL]: http://www.gnu.org/copyleft/gpl.html "GNU General Public License"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list