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 convert between numerous markup and word processing formats,
17including, but not limited to, various flavors of [Markdown], [HTML],
18[LaTeX] and [Word docx]. For the full lists of input and output formats,
19see the `--from` and `--to` [options below][General options].
20Pandoc can also produce [PDF] output: see [creating a PDF], below.
22Pandoc's enhanced version of Markdown includes syntax for [tables],
23[definition lists], [metadata blocks], [footnotes], [citations], [math],
24and much more. See below under [Pandoc's Markdown].
26Pandoc has a modular design: it consists of a set of readers, which parse
27text in a given format and produce a native representation of the document
28(an _abstract syntax tree_ or AST), and a set of writers, which convert
29this native representation into a target format. Thus, adding an input
30or output format requires only adding a reader or writer. Users can also
31run custom [pandoc filters] to modify the intermediate AST.
33Because pandoc's intermediate representation of a document is less
34expressive than many of the formats it converts between, one should
35not expect perfect conversions between every format and every other.
36Pandoc attempts to preserve the structural elements of a document, but
37not formatting details such as margin size. And some document elements,
38such as complex tables, may not fit into pandoc's simple document
39model. While conversions from pandoc's Markdown to all formats aspire
40to be perfect, conversions from formats more expressive than pandoc's
41Markdown can be expected to be lossy.
46If no *input-files* are specified, input is read from *stdin*.
47Output goes to *stdout* by default. For output to a file,
50 pandoc -o output.html input.txt
52By default, pandoc produces a document fragment. To produce a standalone
53document (e.g. a valid HTML file including `<head>` and `<body>`),
54use the `-s` or `--standalone` flag:
56 pandoc -s -o output.html input.txt
58For more information on how standalone documents are produced, see
61If multiple input files are given, `pandoc` will concatenate them all (with
62blank lines between them) before parsing. (Use `--file-scope` to parse files
68The format of the input and output can be specified explicitly using
69command-line options. The input format can be specified using the
70`-f/--from` option, the output format using the `-t/--to` option.
71Thus, to convert `hello.txt` from Markdown to LaTeX, you could type:
73 pandoc -f markdown -t latex hello.txt
75To convert `hello.html` from HTML to Markdown:
77 pandoc -f html -t markdown hello.html
79Supported input and output formats are listed below under [Options]
80(see `-f` for input formats and `-t` for output formats). You
81can also use `pandoc --list-input-formats` and
82`pandoc --list-output-formats` to print lists of supported
85If the input or output format is not specified explicitly, `pandoc`
86will attempt to guess it from the extensions of the filenames.
89 pandoc -o hello.tex hello.txt
91will convert `hello.txt` from Markdown to LaTeX. If no output file
92is specified (so that output goes to *stdout*), or if the output file's
93extension is unknown, the output format will default to HTML.
94If no input file is specified (so that input comes from *stdin*), or
95if the input files' extensions are unknown, the input format will
96be assumed to be Markdown.
101Pandoc uses the UTF-8 character encoding for both input and output.
102If your local character encoding is not UTF-8, you
103should pipe input and output through [`iconv`]:
105 iconv -t utf-8 input.txt | pandoc | iconv -f utf-8
107Note that in some output formats (such as HTML, LaTeX, ConTeXt,
108RTF, OPML, DocBook, and Texinfo), information about
109the character encoding is included in the document header, which
110will only be included if you use the `-s/--standalone` option.
112[`iconv`]: http://www.gnu.org/software/libiconv/
117To produce a PDF, specify an output file with a `.pdf` extension:
119 pandoc test.txt -o test.pdf
121By default, pandoc will use LaTeX to create the PDF, which requires
122that a LaTeX engine be installed (see `--pdf-engine` below).
124Alternatively, pandoc can use [ConTeXt], `pdfroff`, or any of the
125following HTML/CSS-to-PDF-engines, to create a PDF: [`wkhtmltopdf`],
126[`weasyprint`] or [`prince`].
127To do this, specify an output file with a `.pdf` extension, as before,
128but add the `--pdf-engine` option or `-t context`, `-t html`, or `-t ms`
129to the command line (`-t html` defaults to `--pdf-engine=wkhtmltopdf`).
131PDF output can be controlled using [variables for LaTeX] (if
132LaTeX is used) and [variables for ConTeXt] (if ConTeXt is used).
133When using an HTML/CSS-to-PDF-engine, `--css` affects the output.
134If `wkhtmltopdf` is used, then the variables `margin-left`,
135`margin-right`, `margin-top`, `margin-bottom`, `footer-html`,
136`header-html` and `papersize` will affect the output.
138To debug the PDF creation, it can be useful to look at the intermediate
139representation: instead of `-o test.pdf`, use for example `-s -o test.tex`
140to output the generated LaTeX. You can then test it with `pdflatex test.tex`.
142When using LaTeX, the following packages need to be available
143(they are included with all recent versions of [TeX Live]):
144[`amsfonts`], [`amsmath`], [`lm`], [`unicode-math`],
145[`ifxetex`], [`ifluatex`], [`listings`] (if the
146`--listings` option is used), [`fancyvrb`], [`longtable`],
147[`booktabs`], [`graphicx`] and [`grffile`] (if the document
148contains images), [`hyperref`], [`xcolor`] (with `colorlinks`),
149[`ulem`], [`geometry`] (with the `geometry` variable set),
150[`setspace`] (with `linestretch`), and
151[`babel`] (with `lang`). The use of `xelatex` or `lualatex` as
152the LaTeX engine requires [`fontspec`]. `xelatex` uses
153[`polyglossia`] (with `lang`), [`xecjk`], and [`bidi`] (with the
154`dir` variable set). If the `mathspec` variable is set,
155`xelatex` will use [`mathspec`] instead of [`unicode-math`].
156The [`upquote`] and [`microtype`] packages are used if
157available, and [`csquotes`] will be used for [typography]
158if added to the template or included in any header file. The
159[`natbib`], [`biblatex`], [`bibtex`], and [`biber`] packages can
160optionally be used for [citation rendering].
162[`amsfonts`]: https://ctan.org/pkg/amsfonts
163[`amsmath`]: https://ctan.org/pkg/amsmath
164[`lm`]: https://ctan.org/pkg/lm
165[`ifxetex`]: https://ctan.org/pkg/ifxetex
166[`ifluatex`]: https://ctan.org/pkg/ifluatex
167[`listings`]: https://ctan.org/pkg/listings
168[`fancyvrb`]: https://ctan.org/pkg/fancyvrb
169[`longtable`]: https://ctan.org/pkg/longtable
170[`booktabs`]: https://ctan.org/pkg/booktabs
171[`graphicx`]: https://ctan.org/pkg/graphicx
172[`grffile`]: https://ctan.org/pkg/grffile
173[`geometry`]: https://ctan.org/pkg/geometry
174[`setspace`]: https://ctan.org/pkg/setspace
175[`xecjk`]: https://ctan.org/pkg/xecjk
176[`hyperref`]: https://ctan.org/pkg/hyperref
177[`ulem`]: https://ctan.org/pkg/ulem
178[`babel`]: https://ctan.org/pkg/babel
179[`bidi`]: https://ctan.org/pkg/bidi
180[`mathspec`]: https://ctan.org/pkg/mathspec
181[`unicode-math`]: https://ctan.org/pkg/unicode-math
182[`polyglossia`]: https://ctan.org/pkg/polyglossia
183[`fontspec`]: https://ctan.org/pkg/fontspec
184[`upquote`]: https://ctan.org/pkg/upquote
185[`microtype`]: https://ctan.org/pkg/microtype
186[`csquotes`]: https://ctan.org/pkg/csquotes
187[`natbib`]: https://ctan.org/pkg/natbib
188[`biblatex`]: https://ctan.org/pkg/biblatex
189[`bibtex`]: https://ctan.org/pkg/bibtex
190[`biber`]: https://ctan.org/pkg/biber
191[TeX Live]: http://www.tug.org/texlive/
192[`wkhtmltopdf`]: https://wkhtmltopdf.org
193[`weasyprint`]: http://weasyprint.org
194[`prince`]: https://www.princexml.com/
199Instead of an input file, an absolute URI may be given. In this case
200pandoc will fetch the content using HTTP:
202 pandoc -f html -t markdown http://www.fsf.org
204It is possible to supply a custom User-Agent string or other
205header when requesting a document from a URL:
207 pandoc -f html -t markdown --request-header User-Agent:"Mozilla/5.0" \
216`-f` *FORMAT*, `-r` *FORMAT*, `--from=`*FORMAT*, `--read=`*FORMAT*
218: Specify input format. *FORMAT* can be:
221 - `commonmark` ([CommonMark] Markdown)
222 - `creole` ([Creole 1.0])
223 - `docbook` ([DocBook])
224 - `docx` ([Word docx])
226 - `fb2` ([FictionBook2] e-book)
227 - `gfm` ([GitHub-Flavored Markdown]),
228 or `markdown_github`, which provides deprecated and less accurate
229 support for Github-Flavored Markdown; please use `gfm` instead,
230 unless you need to use extensions other than `smart`.
231 - `haddock` ([Haddock markup])
233 - `jats` ([JATS] XML)
234 - `json` (JSON version of native AST)
236 - `markdown` ([Pandoc's Markdown])
237 - `markdown_mmd` ([MultiMarkdown])
238 - `markdown_phpextra` ([PHP Markdown Extra])
239 - `markdown_strict` (original unextended [Markdown])
240 - `mediawiki` ([MediaWiki markup])
242 - `native` (native Haskell)
245 - `org` ([Emacs Org mode])
246 - `rst` ([reStructuredText])
248 - `textile` ([Textile])
249 - `tikiwiki` ([TikiWiki markup])
250 - `twiki` ([TWiki markup])
251 - `vimwiki` ([Vimwiki])
254 Extensions can be individually enabled or disabled by
255 appending `+EXTENSION` or `-EXTENSION` to the format name.
256 See [Extensions] below, for a list of extensions and
257 their names. See `--list-input-formats` and `--list-extensions`,
260`-t` *FORMAT*, `-w` *FORMAT*, `--to=`*FORMAT*, `--write=`*FORMAT*
262: Specify output format. *FORMAT* can be:
264 ::: {#output-formats}
265 - `asciidoc` ([AsciiDoc])
266 - `beamer` ([LaTeX beamer][`beamer`] slide show)
267 - `commonmark` ([CommonMark] Markdown)
268 - `context` ([ConTeXt])
269 - `docbook` or `docbook4` ([DocBook] 4)
270 - `docbook5` (DocBook 5)
271 - `docx` ([Word docx])
272 - `dokuwiki` ([DokuWiki markup])
273 - `epub` or `epub3` ([EPUB] v3 book)
275 - `fb2` ([FictionBook2] e-book)
276 - `gfm` ([GitHub-Flavored Markdown]),
277 or `markdown_github`, which provides deprecated and less accurate
278 support for Github-Flavored Markdown; please use `gfm` instead,
279 unless you use extensions that do not work with `gfm`.
280 - `haddock` ([Haddock markup])
281 - `html` or `html5` ([HTML], i.e. [HTML5]/XHTML [polyglot markup])
282 - `html4` ([XHTML] 1.0 Transitional)
283 - `icml` ([InDesign ICML])
284 - `jats` ([JATS] XML)
285 - `json` (JSON version of native AST)
287 - `man` ([groff man])
288 - `markdown` ([Pandoc's Markdown])
289 - `markdown_mmd` ([MultiMarkdown])
290 - `markdown_phpextra` ([PHP Markdown Extra])
291 - `markdown_strict` (original unextended [Markdown])
292 - `mediawiki` ([MediaWiki markup])
295 - `native` (native Haskell),
296 - `odt` ([OpenOffice text document][ODT])
298 - `opendocument` ([OpenDocument])
299 - `org` ([Emacs Org mode])
300 - `plain` (plain text),
301 - `pptx` ([PowerPoint] slide show)
302 - `rst` ([reStructuredText])
303 - `rtf` ([Rich Text Format])
304 - `texinfo` ([GNU Texinfo])
305 - `textile` ([Textile])
306 - `slideous` ([Slideous] HTML and JavaScript slide show)
307 - `slidy` ([Slidy] HTML and JavaScript slide show)
308 - `dzslides` ([DZSlides] HTML5 + JavaScript slide show),
309 - `revealjs` ([reveal.js] HTML5 + JavaScript slide show)
310 - `s5` ([S5] HTML and JavaScript slide show)
311 - `tei` ([TEI Simple])
312 - `zimwiki` ([ZimWiki markup])
313 - the path of a custom lua writer, see [Custom writers] below
316 Note that `odt`, `docx`, and `epub` output will not be directed
317 to *stdout* unless forced with `-o -`.
319 Extensions can be individually enabled or
320 disabled by appending `+EXTENSION` or `-EXTENSION` to the format
321 name. See [Extensions] below, for a list of extensions and their
322 names. See `--list-output-formats` and `--list-extensions`, below.
324`-o` *FILE*, `--output=`*FILE*
326: Write output to *FILE* instead of *stdout*. If *FILE* is
327 `-`, output will go to *stdout*, even if a non-textual format
328 (`docx`, `odt`, `epub2`, `epub3`) is specified.
330`--data-dir=`*DIRECTORY*
332: Specify the user data directory to search for pandoc data files.
333 If this option is not specified, the default user data directory
334 will be used. This is, in UNIX:
340 C:\Documents And Settings\USERNAME\Application Data\pandoc
342 and in Windows Vista or later:
344 C:\Users\USERNAME\AppData\Roaming\pandoc
346 You can find the default user data directory on your system by
347 looking at the output of `pandoc --version`.
348 A `reference.odt`, `reference.docx`, `epub.css`, `templates`,
349 `slidy`, `slideous`, or `s5` directory
350 placed in this directory will override pandoc's normal defaults.
354: Generate a bash completion script. To enable bash completion
355 with pandoc, add this to your `.bashrc`:
357 eval "$(pandoc --bash-completion)"
361: Give verbose debugging output. Currently this only has an effect
366: Suppress warning messages.
370: Exit with error status if there are any warnings.
374: Write log messages in machine-readable JSON format to
375 *FILE*. All messages above DEBUG level will be written,
376 regardless of verbosity settings (`--verbose`, `--quiet`).
378`--list-input-formats`
380: List supported input formats, one per line.
382`--list-output-formats`
384: List supported output formats, one per line.
386`--list-extensions`[`=`*FORMAT*]
388: List supported extensions, one per line, preceded
389 by a `+` or `-` indicating whether it is enabled by default
390 in *FORMAT*. If *FORMAT* is not specified, defaults for
391 pandoc's Markdown are given.
393`--list-highlight-languages`
395: List supported languages for syntax highlighting, one per
398`--list-highlight-styles`
400: List supported styles for syntax highlighting, one per line.
401 See `--highlight-style`.
411[Markdown]: http://daringfireball.net/projects/markdown/
412[CommonMark]: http://commonmark.org
413[PHP Markdown Extra]: https://michelf.ca/projects/php-markdown/extra/
414[GitHub-Flavored Markdown]: https://help.github.com/articles/github-flavored-markdown/
415[MultiMarkdown]: http://fletcherpenney.net/multimarkdown/
416[reStructuredText]: http://docutils.sourceforge.net/docs/ref/rst/introduction.html
417[S5]: http://meyerweb.com/eric/tools/s5/
418[Slidy]: http://www.w3.org/Talks/Tools/Slidy/
419[Slideous]: http://goessner.net/articles/slideous/
420[HTML]: http://www.w3.org/html/
421[HTML5]: http://www.w3.org/TR/html5/
422[polyglot markup]: https://www.w3.org/TR/html-polyglot/
423[XHTML]: http://www.w3.org/TR/xhtml1/
424[LaTeX]: http://latex-project.org
425[`beamer`]: https://ctan.org/pkg/beamer
426[Beamer User's Guide]: http://ctan.math.utah.edu/ctan/tex-archive/macros/latex/contrib/beamer/doc/beameruserguide.pdf
427[ConTeXt]: http://www.contextgarden.net/
428[Rich Text Format]: http://en.wikipedia.org/wiki/Rich_Text_Format
429[DocBook]: http://docbook.org
430[JATS]: https://jats.nlm.nih.gov
431[txt2tags]: http://txt2tags.org
432[EPUB]: http://idpf.org/epub
433[OPML]: http://dev.opml.org/spec2.html
434[OpenDocument]: http://opendocument.xml.org
435[ODT]: http://en.wikipedia.org/wiki/OpenDocument
436[Textile]: http://redcloth.org/textile
437[MediaWiki markup]: https://www.mediawiki.org/wiki/Help:Formatting
438[DokuWiki markup]: https://www.dokuwiki.org/dokuwiki
439[ZimWiki markup]: http://zim-wiki.org/manual/Help/Wiki_Syntax.html
440[TWiki markup]: http://twiki.org/cgi-bin/view/TWiki/TextFormattingRules
441[TikiWiki markup]: https://doc.tiki.org/Wiki-Syntax-Text#The_Markup_Language_Wiki-Syntax
442[Haddock markup]: https://www.haskell.org/haddock/doc/html/ch03s08.html
443[Creole 1.0]: http://www.wikicreole.org/wiki/Creole1.0
444[groff man]: http://man7.org/linux/man-pages/man7/groff_man.7.html
445[groff ms]: http://man7.org/linux/man-pages/man7/groff_ms.7.html
446[Haskell]: https://www.haskell.org
447[GNU Texinfo]: http://www.gnu.org/software/texinfo/
448[Emacs Org mode]: http://orgmode.org
449[AsciiDoc]: http://www.methods.co.nz/asciidoc/
450[DZSlides]: http://paulrouget.com/dzslides/
451[Word docx]: https://en.wikipedia.org/wiki/Office_Open_XML
452[PDF]: https://www.adobe.com/pdf/
453[reveal.js]: http://lab.hakim.se/reveal-js/
454[FictionBook2]: http://www.fictionbook.org/index.php/Eng:XML_Schema_Fictionbook_2.1
455[InDesign ICML]: http://wwwimages.adobe.com/www.adobe.com/content/dam/acom/en/devnet/indesign/sdk/cs6/idml/idml-cookbook.pdf
456[TEI Simple]: https://github.com/TEIC/TEI-Simple
457[Muse]: https://amusewiki.org/library/manual
458[PowerPoint]: https://en.wikipedia.org/wiki/Microsoft_PowerPoint
459[Vimwiki]: https://vimwiki.github.io
464`--base-header-level=`*NUMBER*
466: Specify the base level for headers (defaults to 1).
468`--strip-empty-paragraphs`
470: *Deprecated. Use the `+empty_paragraphs` extension instead.*
471 Ignore paragraphs with no content. This option is useful
472 for converting word processing documents where users have
473 used empty paragraphs to create inter-paragraph space.
475`--indented-code-classes=`*CLASSES*
477: Specify classes to use for indented code blocks--for example,
478 `perl,numberLines` or `haskell`. Multiple classes may be separated
481`--default-image-extension=`*EXTENSION*
483: Specify a default extension to use when image paths/URLs have no
484 extension. This allows you to use the same source for formats that
485 require different kinds of images. Currently this option only affects
486 the Markdown and LaTeX readers.
490: Parse each file individually before combining for multifile
491 documents. This will allow footnotes in different files with the
492 same identifiers to work as expected. If this option is set,
493 footnotes and links will not work across files. Reading binary
494 files (docx, odt, epub) implies `--file-scope`.
496`-F` *PROGRAM*, `--filter=`*PROGRAM*
498: Specify an executable to be used as a filter transforming the
499 pandoc AST after the input is parsed and before the output is
500 written. The executable should read JSON from stdin and write
501 JSON to stdout. The JSON must be formatted like pandoc's own
502 JSON input and output. The name of the output format will be
503 passed to the filter as the first argument. Hence,
505 pandoc --filter ./caps.py -t latex
509 pandoc -t json | ./caps.py latex | pandoc -f json -t latex
511 The latter form may be useful for debugging filters.
513 Filters may be written in any language. `Text.Pandoc.JSON`
514 exports `toJSONFilter` to facilitate writing filters in Haskell.
515 Those who would prefer to write filters in python can use the
516 module [`pandocfilters`], installable from PyPI. There are also
517 pandoc filter libraries in [PHP], [perl], and
518 [JavaScript/node.js].
520 In order of preference, pandoc will look for filters in
522 1. a specified full or relative path (executable or
525 2. `$DATADIR/filters` (executable or non-executable)
526 where `$DATADIR` is the user data directory (see
527 `--data-dir`, above).
529 3. `$PATH` (executable only)
531 Filters and lua-filters are applied in the order specified
534`--lua-filter=`*SCRIPT*
536: Transform the document in a similar fashion as JSON filters (see
537 `--filter`), but use pandoc's build-in lua filtering system. The given
538 lua script is expected to return a list of lua filters which will be
539 applied in order. Each lua filter must contain element-transforming
540 functions indexed by the name of the AST element on which the filter
541 function should be applied.
543 The `pandoc` lua module provides helper functions for element
544 creation. It is always loaded into the script's lua environment.
546 The following is an example lua script for macro-expansion:
548 function expand_hello_world(inline)
549 if inline.c == '{{helloworld}}' then
550 return pandoc.Emph{ pandoc.Str "Hello, World" }
556 return {{Str = expand_hello_world}}
558 In order of preference, pandoc will look for lua filters in
560 1. a specified full or relative path (executable or
563 2. `$DATADIR/filters` (executable or non-executable)
564 where `$DATADIR` is the user data directory (see
565 `--data-dir`, above).
567`-M` *KEY*[`=`*VAL*], `--metadata=`*KEY*[`:`*VAL*]
569: Set the metadata field *KEY* to the value *VAL*. A value specified
570 on the command line overrides a value specified in the document
571 using [YAML metadata blocks][Extension: `yaml_metadata_block`].
572 Values will be parsed as YAML boolean or string values. If no value is
573 specified, the value will be treated as Boolean true. Like
574 `--variable`, `--metadata` causes template variables to be set.
575 But unlike `--variable`, `--metadata` affects the metadata of the
576 underlying document (which is accessible from filters and may be
577 printed in some output formats) and metadata values will be escaped
578 when inserted into the template.
580`-p`, `--preserve-tabs`
582: Preserve tabs instead of converting them to spaces (the default).
583 Note that this will only affect tabs in literal code spans and code
584 blocks; tabs in regular text will be treated as spaces.
588: Specify the number of spaces per tab (default is 4).
590`--track-changes=accept`|`reject`|`all`
592: Specifies what to do with insertions, deletions, and comments
593 produced by the MS Word "Track Changes" feature. `accept` (the
594 default), inserts all insertions, and ignores all
595 deletions. `reject` inserts all deletions and ignores
596 insertions. Both `accept` and `reject` ignore comments. `all` puts
597 in insertions, deletions, and comments, wrapped in spans with
598 `insertion`, `deletion`, `comment-start`, and `comment-end`
599 classes, respectively. The author and time of change is
600 included. `all` is useful for scripting: only accepting changes
601 from a certain reviewer, say, or before a certain date. If a
602 paragraph is inserted or deleted, `track-changes=all` produces a
603 span with the class `paragraph-insertion`/`paragraph-deletion`
604 before the affected paragraph break. This option only affects the
607`--extract-media=`*DIR*
609: Extract images and other media contained in or linked from
610 the source document to the path *DIR*, creating it if
611 necessary, and adjust the images references in the document
612 so they point to the extracted files. If the source format is
613 a binary container (docx, epub, or odt), the media is
614 extracted from the container and the original
615 filenames are used. Otherwise the media is read from the
616 file system or downloaded, and new filenames are constructed
617 based on SHA1 hashes of the contents.
619`--abbreviations=`*FILE*
621: Specifies a custom abbreviations file, with abbreviations
622 one to a line. If this option is not specified, pandoc will
623 read the data file `abbreviations` from the user data
624 directory or fall back on a system default. To see the
626 `pandoc --print-default-data-file=abbreviations`. The only
627 use pandoc makes of this list is in the Markdown reader.
628 Strings ending in a period that are found in this list will
629 be followed by a nonbreaking space, so that the period will
630 not produce sentence-ending space in formats like LaTeX.
632[`pandocfilters`]: https://github.com/jgm/pandocfilters
633[PHP]: https://github.com/vinai/pandocfilters-php
634[perl]: https://metacpan.org/pod/Pandoc::Filter
635[JavaScript/node.js]: https://github.com/mvhenderson/pandoc-filter-node
637General writer options
638----------------------
642: Produce output with an appropriate header and footer (e.g. a
643 standalone HTML, LaTeX, TEI, or RTF file, not a fragment). This option
644 is set automatically for `pdf`, `epub`, `epub3`, `fb2`, `docx`, and `odt`
645 output. For `native` output, this option causes metadata to
646 be included; otherwise, metadata is suppressed.
648`--template=`*FILE*|*URL*
650: Use the specified file as a custom template for the generated document.
651 Implies `--standalone`. See [Templates], below, for a description
652 of template syntax. If no extension is specified, an extension
653 corresponding to the writer will be added, so that `--template=special`
654 looks for `special.html` for HTML output. If the template is not
655 found, pandoc will search for it in the `templates` subdirectory of
656 the user data directory (see `--data-dir`). If this option is not used,
657 a default template appropriate for the output format will be used (see
658 `-D/--print-default-template`).
660`-V` *KEY*[`=`*VAL*], `--variable=`*KEY*[`:`*VAL*]
662: Set the template variable *KEY* to the value *VAL* when rendering the
663 document in standalone mode. This is generally only useful when the
664 `--template` option is used to specify a custom template, since
665 pandoc automatically sets the variables used in the default
666 templates. If no *VAL* is specified, the key will be given the
669`-D` *FORMAT*, `--print-default-template=`*FORMAT*
671: Print the system default template for an output *FORMAT*. (See `-t`
672 for a list of possible *FORMAT*s.) Templates in the user data
673 directory are ignored.
675`--print-default-data-file=`*FILE*
677: Print a system default data file. Files in the user data directory
680`--eol=crlf`|`lf`|`native`
682: Manually specify line endings: `crlf` (Windows), `lf`
683 (macOS/Linux/UNIX), or `native` (line endings appropriate
684 to the OS on which pandoc is being run). The default is
689: Specify the dpi (dots per inch) value for conversion from pixels
690 to inch/centimeters and vice versa. The default is 96dpi.
691 Technically, the correct term would be ppi (pixels per inch).
693`--wrap=auto`|`none`|`preserve`
695: Determine how text is wrapped in the output (the source
696 code, not the rendered version). With `auto` (the default),
697 pandoc will attempt to wrap lines to the column width specified by
698 `--columns` (default 72). With `none`, pandoc will not wrap
699 lines at all. With `preserve`, pandoc will attempt to
700 preserve the wrapping from the source document (that is,
701 where there are nonsemantic newlines in the source, there
702 will be nonsemantic newlines in the output as well).
703 Automatic wrapping does not currently work in HTML output.
707: Specify length of lines in characters. This affects text wrapping
708 in the generated source code (see `--wrap`). It also affects
709 calculation of column widths for plain text tables (see [Tables] below).
711`--toc`, `--table-of-contents`
713: Include an automatically generated table of contents (or, in
714 the case of `latex`, `context`, `docx`, `odt`,
715 `opendocument`, `rst`, or `ms`, an instruction to create
716 one) in the output document. This option has no effect
717 unless `-s/--standalone` is used, and it has no effect
718 on `man`, `docbook4`, `docbook5`, or `jats` output.
720`--toc-depth=`*NUMBER*
722: Specify the number of section levels to include in the table
723 of contents. The default is 3 (which means that level 1, 2, and 3
724 headers will be listed in the contents).
728: Strip out HTML comments in the Markdown or Textile source,
729 rather than passing them on to Markdown, Textile or HTML
730 output as raw HTML. This does not apply to HTML comments
731 inside raw HTML blocks when the `markdown_in_html_blocks`
732 extension is not set.
736: Disables syntax highlighting for code blocks and inlines, even when
737 a language attribute is given.
739`--highlight-style=`*STYLE*|*FILE*
741: Specifies the coloring style to be used in highlighted source code.
742 Options are `pygments` (the default), `kate`, `monochrome`,
743 `breezeDark`, `espresso`, `zenburn`, `haddock`, and `tango`.
744 For more information on syntax highlighting in pandoc, see
745 [Syntax highlighting], below. See also
746 `--list-highlight-styles`.
748 Instead of a *STYLE* name, a JSON file with extension
749 `.theme` may be supplied. This will be parsed as a KDE
750 syntax highlighting theme and (if valid) used as the
753 To generate the JSON version of an existing style,
754 use `--print-highlight-style`.
756`--print-highlight-style=`*STYLE*|*FILE*
758: Prints a JSON version of a highlighting style, which can
759 be modified, saved with a `.theme` extension, and used
760 with `--highlight-style`.
762`--syntax-definition=`*FILE*
764: Instructs pandoc to load a KDE XML syntax definition file,
765 which will be used for syntax highlighting of appropriately
766 marked code blocks. This can be used to add support for
767 new languages or to use altered syntax definitions for
770`-H` *FILE*, `--include-in-header=`*FILE*
772: Include contents of *FILE*, verbatim, at the end of the header.
773 This can be used, for example, to include special
774 CSS or JavaScript in HTML documents. This option can be used
775 repeatedly to include multiple files in the header. They will be
776 included in the order specified. Implies `--standalone`.
778`-B` *FILE*, `--include-before-body=`*FILE*
780: Include contents of *FILE*, verbatim, at the beginning of the
781 document body (e.g. after the `<body>` tag in HTML, or the
782 `\begin{document}` command in LaTeX). This can be used to include
783 navigation bars or banners in HTML documents. This option can be
784 used repeatedly to include multiple files. They will be included in
785 the order specified. Implies `--standalone`.
787`-A` *FILE*, `--include-after-body=`*FILE*
789: Include contents of *FILE*, verbatim, at the end of the document
790 body (before the `</body>` tag in HTML, or the
791 `\end{document}` command in LaTeX). This option can be used
792 repeatedly to include multiple files. They will be included in the
793 order specified. Implies `--standalone`.
795`--resource-path=`*SEARCHPATH*
797: List of paths to search for images and other resources.
798 The paths should be separated by `:` on Linux, UNIX, and
799 macOS systems, and by `;` on Windows. If `--resource-path`
800 is not specified, the default resource path is the working
801 directory. Note that, if `--resource-path` is specified,
802 the working directory must be explicitly listed or it
803 will not be searched. For example:
804 `--resource-path=.:test` will search the working directory
805 and the `test` subdirectory, in that order.
807`--request-header=`*NAME*`:`*VAL*
809: Set the request header *NAME* to the value *VAL* when making
810 HTTP requests (for example, when a URL is given on the
811 command line, or when resources used in a document must be
812 downloaded). If you're behind a proxy, you also need to set
813 the environment variable `http_proxy` to `http://...`.
815Options affecting specific writers
816----------------------------------
820: Produce a standalone HTML file with no external dependencies, using
821 `data:` URIs to incorporate the contents of linked scripts, stylesheets,
822 images, and videos. Implies `--standalone`. The resulting file should be
823 "self-contained," in the sense that it needs no external files and no net
824 access to be displayed properly by a browser. This option works only with
825 HTML output formats, including `html4`, `html5`, `html+lhs`, `html5+lhs`,
826 `s5`, `slidy`, `slideous`, `dzslides`, and `revealjs`. Scripts, images,
827 and stylesheets at absolute URLs will be downloaded; those at relative
828 URLs will be sought relative to the working directory (if the first source
829 file is local) or relative to the base URL (if the first source
830 file is remote). Elements with the attribute
831 `data-external="1"` will be left alone; the documents they
832 link to will not be incorporated in the document.
833 Limitation: resources that are loaded dynamically through
834 JavaScript cannot be incorporated; as a result,
835 `--self-contained` does not work with `--mathjax`, and some
836 advanced features (e.g. zoom or speaker notes) may not work
837 in an offline "self-contained" `reveal.js` slide show.
841: Use `<q>` tags for quotes in HTML.
845: Use only ASCII characters in output. Currently supported for
846 XML and HTML formats (which use numerical entities instead of
847 UTF-8 when this option is selected) and for groff ms and man
848 (which use hexadecimal escapes).
852: Use reference-style links, rather than inline links, in writing Markdown
853 or reStructuredText. By default inline links are used. The
854 placement of link references is affected by the
855 `--reference-location` option.
857`--reference-location = block`|`section`|`document`
859: Specify whether footnotes (and references, if `reference-links` is
860 set) are placed at the end of the current (top-level) block, the
861 current section, or the document. The default is
862 `document`. Currently only affects the markdown writer.
866: Use ATX-style headers in Markdown and AsciiDoc output. The default is
867 to use setext-style headers for levels 1-2, and then ATX headers.
868 (Note: for `gfm` output, ATX headers are always used.)
870`--top-level-division=[default|section|chapter|part]`
872: Treat top-level headers as the given division type in LaTeX, ConTeXt,
873 DocBook, and TEI output. The hierarchy order is part, chapter, then section;
874 all headers are shifted such that the top-level header becomes the specified
875 type. The default behavior is to determine the best division type via
876 heuristics: unless other conditions apply, `section` is chosen. When the
877 LaTeX document class is set to `report`, `book`, or `memoir` (unless the
878 `article` option is specified), `chapter` is implied as the setting for this
879 option. If `beamer` is the output format, specifying either `chapter` or
880 `part` will cause top-level headers to become `\part{..}`, while
881 second-level headers remain as their default type.
883`-N`, `--number-sections`
885: Number section headings in LaTeX, ConTeXt, HTML, or EPUB output.
886 By default, sections are not numbered. Sections with class
887 `unnumbered` will never be numbered, even if `--number-sections`
890`--number-offset=`*NUMBER*[`,`*NUMBER*`,`*...*]
892: Offset for section headings in HTML output (ignored in other
893 output formats). The first number is added to the section number for
894 top-level headers, the second for second-level headers, and so on.
895 So, for example, if you want the first top-level header in your
896 document to be numbered "6", specify `--number-offset=5`.
897 If your document starts with a level-2 header which you want to
898 be numbered "1.5", specify `--number-offset=1,4`.
899 Offsets are 0 by default. Implies `--number-sections`.
903: Use the [`listings`] package for LaTeX code blocks
907: Make list items in slide shows display incrementally (one by one).
908 The default is for lists to be displayed all at once.
910`--slide-level=`*NUMBER*
912: Specifies that headers with the specified level create
913 slides (for `beamer`, `s5`, `slidy`, `slideous`, `dzslides`). Headers
914 above this level in the hierarchy are used to divide the
915 slide show into sections; headers below this level create
916 subheads within a slide. Note that content that is
917 not contained under slide-level headers will not appear in
918 the slide show. The default is to set the slide level based
919 on the contents of the document; see [Structuring the slide
924: Wrap sections in `<section>` tags (or `<div>` tags for `html4`),
925 and attach identifiers to the enclosing `<section>` (or `<div>`)
926 rather than the header itself. See
927 [Header identifiers], below.
929`--email-obfuscation=none`|`javascript`|`references`
931: Specify a method for obfuscating `mailto:` links in HTML documents.
932 `none` leaves `mailto:` links as they are. `javascript` obfuscates
933 them using JavaScript. `references` obfuscates them by printing their
934 letters as decimal or hexadecimal character references. The default
937`--id-prefix=`*STRING*
939: Specify a prefix to be added to all identifiers and internal links
940 in HTML and DocBook output, and to footnote numbers in Markdown
941 and Haddock output. This is useful for preventing duplicate
942 identifiers when generating fragments to be included in other pages.
944`-T` *STRING*, `--title-prefix=`*STRING*
946: Specify *STRING* as a prefix at the beginning of the title
947 that appears in the HTML header (but not in the title as it
948 appears at the beginning of the HTML body). Implies
951`-c` *URL*, `--css=`*URL*
953: Link to a CSS style sheet. This option can be used repeatedly to
954 include multiple files. They will be included in the order specified.
956 A stylesheet is required for generating EPUB. If none is
957 provided using this option (or the `stylesheet` metadata
958 field), pandoc will look for a file `epub.css` in the
959 user data directory (see `--data-dir`). If it is not
960 found there, sensible defaults will be used.
962`--reference-doc=`*FILE*
964: Use the specified file as a style reference in producing a
969 : For best results, the reference docx should be a modified
970 version of a docx file produced using pandoc. The contents
971 of the reference docx are ignored, but its stylesheets and
972 document properties (including margins, page size, header,
973 and footer) are used in the new docx. If no reference docx
974 is specified on the command line, pandoc will look for a
975 file `reference.docx` in the user data directory (see
976 `--data-dir`). If this is not found either, sensible
977 defaults will be used.
979 To produce a custom `reference.docx`, first get a copy of
980 the default `reference.docx`: `pandoc
981 --print-default-data-file reference.docx >
982 custom-reference.docx`. Then open `custom-reference.docx`
983 in Word, modify the styles as you wish, and save the file.
984 For best results, do not make changes to this file other
985 than modifying the styles used by pandoc: [paragraph]
986 Normal, Body Text, First Paragraph, Compact, Title,
987 Subtitle, Author, Date, Abstract, Bibliography, Heading 1,
988 Heading 2, Heading 3, Heading 4, Heading 5, Heading 6,
989 Heading 7, Heading 8, Heading 9, Block Text, Footnote Text,
990 Definition Term, Definition, Caption, Table Caption,
991 Image Caption, Figure, Captioned Figure, TOC Heading;
992 [character] Default Paragraph Font, Body Text Char,
993 Verbatim Char, Footnote Reference, Hyperlink; [table]
998 : For best results, the reference ODT should be a modified
999 version of an ODT produced using pandoc. The contents of
1000 the reference ODT are ignored, but its stylesheets are used
1001 in the new ODT. If no reference ODT is specified on the
1002 command line, pandoc will look for a file `reference.odt` in
1003 the user data directory (see `--data-dir`). If this is not
1004 found either, sensible defaults will be used.
1006 To produce a custom `reference.odt`, first get a copy of
1007 the default `reference.odt`: `pandoc
1008 --print-default-data-file reference.odt >
1009 custom-reference.odt`. Then open `custom-reference.odt` in
1010 LibreOffice, modify the styles as you wish, and save the
1015 : Any template included with a recent install of Microsoft
1016 PowerPoint (either with `.pptx` or `.potx` extension) should
1017 work, as will most templates derived from these.
1019 The specific requirement is that the template should contain
1020 the following four layouts as its first four layouts:
1023 2. Title and Content
1027 All templates included with a recent version of MS PowerPoint
1028 will fit these criteria. (You can click on `Layout` under the
1029 `Home` menu to check.)
1031 You can also modify the default `reference.pptx`: first run
1032 `pandoc --print-default-data-file reference.pptx >
1033 custom-reference.pptx`, and then modify
1034 `custom-reference.pptx` in MS PowerPoint (pandoc will use the
1035 first four layout slides, as mentioned above).
1037`--epub-cover-image=`*FILE*
1039: Use the specified image as the EPUB cover. It is recommended
1040 that the image be less than 1000px in width and height. Note that
1041 in a Markdown source document you can also specify `cover-image`
1042 in a YAML metadata block (see [EPUB Metadata], below).
1044`--epub-metadata=`*FILE*
1046: Look in the specified XML file for metadata for the EPUB.
1047 The file should contain a series of [Dublin Core elements].
1050 <dc:rights>Creative Commons</dc:rights>
1051 <dc:language>es-AR</dc:language>
1053 By default, pandoc will include the following metadata elements:
1054 `<dc:title>` (from the document title), `<dc:creator>` (from the
1055 document authors), `<dc:date>` (from the document date, which should
1056 be in [ISO 8601 format]), `<dc:language>` (from the `lang`
1057 variable, or, if is not set, the locale), and `<dc:identifier
1058 id="BookId">` (a randomly generated UUID). Any of these may be
1059 overridden by elements in the metadata file.
1061 Note: if the source document is Markdown, a YAML metadata block
1062 in the document can be used instead. See below under
1065`--epub-embed-font=`*FILE*
1067: Embed the specified font in the EPUB. This option can be repeated
1068 to embed multiple fonts. Wildcards can also be used: for example,
1069 `DejaVuSans-*.ttf`. However, if you use wildcards on the command
1070 line, be sure to escape them or put the whole filename in single quotes,
1071 to prevent them from being interpreted by the shell. To use the
1072 embedded fonts, you will need to add declarations like the following
1073 to your CSS (see `--css`):
1076 font-family: DejaVuSans;
1078 font-weight: normal;
1079 src:url("DejaVuSans-Regular.ttf");
1082 font-family: DejaVuSans;
1085 src:url("DejaVuSans-Bold.ttf");
1088 font-family: DejaVuSans;
1090 font-weight: normal;
1091 src:url("DejaVuSans-Oblique.ttf");
1094 font-family: DejaVuSans;
1097 src:url("DejaVuSans-BoldOblique.ttf");
1099 body { font-family: "DejaVuSans"; }
1101`--epub-chapter-level=`*NUMBER*
1103: Specify the header level at which to split the EPUB into separate
1104 "chapter" files. The default is to split into chapters at level 1
1105 headers. This option only affects the internal composition of the
1106 EPUB, not the way chapters and sections are displayed to users. Some
1107 readers may be slow if the chapter files are too large, so for large
1108 documents with few level 1 headers, one might want to use a chapter
1111`--epub-subdirectory=`*DIRNAME*
1113: Specify the subdirectory in the OCF container that is to hold
1114 the EPUB-specific contents. The default is `EPUB`. To put
1115 the EPUB contents in the top level, use an empty string.
1117`--pdf-engine=pdflatex`|`lualatex`|`xelatex`|`wkhtmltopdf`|`weasyprint`|`prince`|`context`|`pdfroff`
1119: Use the specified engine when producing PDF output.
1120 The default is `pdflatex`. If the engine is not in your PATH,
1121 the full path of the engine may be specified here.
1123`--pdf-engine-opt=`*STRING*
1125: Use the given string as a command-line argument to the `pdf-engine`.
1126 If used multiple times, the arguments are provided with spaces between
1127 them. Note that no check for duplicate options is done.
1129[Dublin Core elements]: http://dublincore.org/documents/dces/
1130[ISO 8601 format]: http://www.w3.org/TR/NOTE-datetime
1135`--bibliography=`*FILE*
1137: Set the `bibliography` field in the document's metadata to *FILE*,
1138 overriding any value set in the metadata, and process citations
1139 using `pandoc-citeproc`. (This is equivalent to
1140 `--metadata bibliography=FILE --filter pandoc-citeproc`.)
1141 If `--natbib` or `--biblatex` is also supplied, `pandoc-citeproc` is not
1142 used, making this equivalent to `--metadata bibliography=FILE`.
1143 If you supply this argument multiple times, each *FILE* will be added
1148: Set the `csl` field in the document's metadata to *FILE*,
1149 overriding any value set in the metadata. (This is equivalent to
1150 `--metadata csl=FILE`.)
1151 This option is only relevant with `pandoc-citeproc`.
1153`--citation-abbreviations=`*FILE*
1155: Set the `citation-abbreviations` field in the document's metadata to
1156 *FILE*, overriding any value set in the metadata. (This is equivalent to
1157 `--metadata citation-abbreviations=FILE`.)
1158 This option is only relevant with `pandoc-citeproc`.
1162: Use [`natbib`] for citations in LaTeX output. This option is not for use
1163 with the `pandoc-citeproc` filter or with PDF output. It is intended for
1164 use in producing a LaTeX file that can be processed with [`bibtex`].
1168: Use [`biblatex`] for citations in LaTeX output. This option is not for use
1169 with the `pandoc-citeproc` filter or with PDF output. It is intended for
1170 use in producing a LaTeX file that can be processed with [`bibtex`] or [`biber`].
1172Math rendering in HTML
1173----------------------
1175The default is to render TeX math as far as possible using Unicode characters.
1176Formulas are put inside a `span` with `class="math"`, so that they may be styled
1177differently from the surrounding text if needed. However, this gives acceptable
1178results only for basic math, usually you will want to use `--mathjax` or another
1179of the following options.
1181`--mathjax`[`=`*URL*]
1183: Use [MathJax] to display embedded TeX math in HTML output.
1184 TeX math will be put between `\(...\)` (for inline math)
1185 or `\[...\]` (for display math) and wrapped in `<span>` tags
1186 with class `math`. Then the MathJax JavaScript will render it.
1187 The *URL* should point to the `MathJax.js` load script.
1188 If a *URL* is not provided, a link to the Cloudflare CDN will
1193: Convert TeX math to [MathML] (in `epub3`, `docbook4`, `docbook5`, `jats`,
1194 `html4` and `html5`). This is the default in `odt` output. Note that
1195 currently only Firefox and Safari (and select e-book readers) natively
1200: Convert TeX formulas to `<img>` tags that link to an external script
1201 that converts formulas to images. The formula will be URL-encoded
1202 and concatenated with the URL provided. For SVG images you can for
1203 example use `--webtex https://latex.codecogs.com/svg.latex?`.
1204 If no URL is specified, the CodeCogs URL generating PNGs
1205 will be used (`https://latex.codecogs.com/png.latex?`).
1206 Note: the `--webtex` option will affect Markdown output
1207 as well as HTML, which is useful if you're targeting a
1208 version of Markdown without native math support.
1212: Use [KaTeX] to display embedded TeX math in HTML output.
1213 The *URL* is the base URL for the KaTeX library. If a *URL* is
1214 not provided, a link to the KaTeX CDN will be inserted.
1216`--katex-stylesheet=`*URL*
1218: The *URL* should point to the `katex.css` stylesheet. If this option is
1219 not specified, a link to the KaTeX CDN will be inserted. Note that this
1220 option does not imply `--katex`.
1224: Enclose TeX math in `<eq>` tags in HTML output. The resulting HTML
1225 can then be processed by [GladTeX] to produce images of the typeset
1226 formulas and an HTML file with links to these images.
1227 So, the procedure is:
1229 pandoc -s --gladtex input.md -o myfile.htex
1230 gladtex -d myfile-images myfile.htex
1231 # produces myfile.html and images in myfile-images
1233[MathML]: http://www.w3.org/Math/
1234[MathJax]: https://www.mathjax.org
1235[KaTeX]: https://github.com/Khan/KaTeX
1236[GladTeX]: http://humenda.github.io/GladTeX/
1238Options for wrapper scripts
1239---------------------------
1243: Print information about command-line arguments to *stdout*, then exit.
1244 This option is intended primarily for use in wrapper scripts.
1245 The first line of output contains the name of the output file specified
1246 with the `-o` option, or `-` (for *stdout*) if no output file was
1247 specified. The remaining lines contain the command-line arguments,
1248 one per line, in the order they appear. These do not include regular
1249 pandoc options and their arguments, but do include any options appearing
1250 after a `--` separator at the end of the line.
1254: Ignore command-line arguments (for use in wrapper scripts).
1255 Regular pandoc options are not ignored. Thus, for example,
1257 pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1
1261 pandoc -o foo.html -s
1266When the `-s/--standalone` option is used, pandoc uses a template to
1267add header and footer material that is needed for a self-standing
1268document. To see the default template that is used, just type
1272where *FORMAT* is the name of the output format. A custom template
1273can be specified using the `--template` option. You can also override
1274the system default templates for a given output format *FORMAT*
1275by putting a file `templates/default.*FORMAT*` in the user data
1276directory (see `--data-dir`, above). *Exceptions:*
1278- For `odt` output, customize the `default.opendocument`
1280- For `pdf` output, customize the `default.latex` template
1281 (or the `default.context` template, if you use `-t context`,
1282 or the `default.ms` template, if you use `-t ms`, or the
1283 `default.html` template, if you use `-t html`).
1284- `docx` has no template (however, you can use
1285 `--reference-doc` to customize the output).
1287Templates contain *variables*, which allow for the inclusion of
1288arbitrary information at any point in the file. They may be set at the
1289command line using the `-V/--variable` option. If a variable is not set,
1290pandoc will look for the key in the document's metadata – which can be set
1291using either [YAML metadata blocks][Extension: `yaml_metadata_block`]
1292or with the `--metadata` option.
1294Variables set by pandoc
1295-----------------------
1297Some variables are set automatically by pandoc. These vary somewhat
1298depending on the output format, but include the following:
1300`sourcefile`, `outputfile`
1301: source and destination filenames, as given on the command line.
1302 `sourcefile` can also be a list if input comes from multiple files, or empty
1303 if input is from stdin. You can use the following snippet in your template
1304 to distinguish them:
1314 Similarly, `outputfile` can be `-` if output goes to the terminal.
1316`title`, `author`, `date`
1317: allow identification of basic aspects of the document. Included
1318 in PDF metadata through LaTeX and ConTeXt. These can be set
1319 through a [pandoc title block][Extension: `pandoc_title_block`],
1320 which allows for multiple authors, or through a YAML metadata block:
1329: document subtitle, included in HTML, EPUB, LaTeX, ConTeXt, and Word docx;
1330 renders in LaTeX only when using a document class that supports
1331 `\subtitle`, such as `beamer` or the [KOMA-Script] series (`scrartcl`,
1332 `scrreprt`, `scrbook`).[^subtitle]
1335: author affiliations (in LaTeX and Beamer only). Can be a
1336 list, when there are multiple authors.
1339: document summary, included in LaTeX, ConTeXt, AsciiDoc, and Word docx
1342: list of keywords to be included in HTML, PDF, and AsciiDoc metadata;
1343 may be repeated as for `author`, above
1346: contents specified by `-H/--include-in-header` (may have multiple
1350: non-null value if `--toc/--table-of-contents` was specified
1353: title of table of contents (works only with EPUB,
1354 opendocument, odt, docx, pptx)
1357: contents specified by `-B/--include-before-body` (may have
1361: contents specified by `-A/--include-after-body` (may have
1368: JSON representation of all of the document's metadata. Field
1369 values are transformed to the selected output format.
1371[^subtitle]: To make `subtitle` work with other LaTeX
1372 document classes, you can add the following to `header-includes`:
1374 \providecommand{\subtitle}[1]{%
1375 \usepackage{titling}
1377 \par\large#1\end{center}}
1384: identifies the main language of the document,
1385 using a code according to [BCP 47] (e.g. `en` or `en-GB`).
1386 For some output formats, pandoc will convert it to an appropriate
1387 format stored in the additional variables `babel-lang`,
1388 `polyglossia-lang` (LaTeX) and `context-lang` (ConTeXt).
1390 Native pandoc Spans and Divs with the lang attribute
1391 (value in BCP 47) can be used to switch the language in
1392 that range. In LaTeX output, `babel-otherlangs` and
1393 `polyglossia-otherlangs` variables will be generated
1394 automatically based on the `lang` attributes of Spans
1395 and Divs in the document.
1398: the base direction of the document, either `rtl` (right-to-left)
1399 or `ltr` (left-to-right).
1401 For bidirectional documents, native pandoc `span`s and `div`s
1402 with the `dir` attribute (value `rtl` or `ltr`) can be used to
1403 override the base direction in some output formats.
1404 This may not always be necessary if the final renderer
1405 (e.g. the browser, when generating HTML) supports the
1406 [Unicode Bidirectional Algorithm].
1408 When using LaTeX for bidirectional documents, only the `xelatex` engine
1409 is fully supported (use `--pdf-engine=xelatex`).
1411[BCP 47]: https://tools.ietf.org/html/bcp47
1412[Unicode Bidirectional Algorithm]: http://www.w3.org/International/articles/inline-bidi-markup/uba-basics
1417Variables are available for [producing slide shows with pandoc],
1418including all [reveal.js configuration options].
1421: title graphic for Beamer documents
1424: logo for Beamer documents
1427: base URL for Slidy documents (defaults to
1428 `https://www.w3.org/Talks/Tools/Slidy2`)
1431: base URL for Slideous documents (defaults to `slideous`)
1434: base URL for S5 documents (defaults to `s5/default`)
1437: base URL for reveal.js documents (defaults to `reveal.js`)
1439`theme`, `colortheme`, `fonttheme`, `innertheme`, `outertheme`
1440: themes for LaTeX [`beamer`] documents
1443: options for LaTeX beamer themes (a list).
1446: controls navigation symbols in `beamer` documents
1447 (default is `empty` for no navigation symbols; other valid values
1448 are `frame`, `vertical`, and `horizontal`).
1451: enables on "title pages" for new sections in `beamer`
1452 documents (default = true).
1455: when true, the `beamerarticle` package is loaded (for
1456 producing an article from beamer slides).
1459: aspect ratio of slides (for beamer only, `1610` for 16:10, `169` for 16:9,
1460 `149` for 14:9, `141` for 1.41:1, `54` for 5:4, `43` for 4:3 which is the
1461 default, and `32` for 3:2).
1463[reveal.js configuration options]: https://github.com/hakimel/reveal.js#configuration
1468LaTeX variables are used when [creating a PDF].
1471: paper size, e.g. `letter`, `a4`
1474: font size for body text (e.g. `10pt`, `12pt`)
1477: document class, e.g. [`article`], [`report`], [`book`], [`memoir`]
1480: option for document class, e.g. `oneside`; may be repeated
1481 for multiple options
1484: In beamer, add extra beamer option with `\setbeameroption{}`
1487: option for [`geometry`] package, e.g. `margin=1in`;
1488 may be repeated for multiple options
1490`margin-left`, `margin-right`, `margin-top`, `margin-bottom`
1491: sets margins, if `geometry` is not used (otherwise `geometry`
1495: adjusts line spacing using the [`setspace`]
1496 package, e.g. `1.25`, `1.5`
1499: font package for use with `pdflatex`:
1500 [TeX Live] includes many options, documented in the [LaTeX Font Catalogue].
1501 The default is [Latin Modern][`lm`].
1504: options for package used as `fontfamily`: e.g. `osf,sc` with
1505 `fontfamily` set to [`mathpazo`] provides Palatino with old-style
1506 figures and true small caps; may be repeated for multiple options
1508`mainfont`, `sansfont`, `monofont`, `mathfont`, `CJKmainfont`
1509: font families for use with `xelatex` or
1510 `lualatex`: take the name of any system font, using the
1511 [`fontspec`] package. Note that if `CJKmainfont` is used,
1512 the [`xecjk`] package must be available.
1514`mainfontoptions`, `sansfontoptions`, `monofontoptions`, `mathfontoptions`, `CJKoptions`
1515: options to use with `mainfont`, `sansfont`, `monofont`, `mathfont`,
1516 `CJKmainfont` in `xelatex` and `lualatex`. Allow for any choices
1517 available through [`fontspec`], such as the OpenType features
1518 `Numbers=OldStyle,Numbers=Proportional`. May be repeated for multiple options.
1521: allows font encoding to be specified through `fontenc` package (with `pdflatex`);
1522 default is `T1` (see guide to [LaTeX font encodings])
1525: options to pass to the microtype package
1528: add color to link text; automatically enabled if any of `linkcolor`, `citecolor`,
1529 `urlcolor`, or `toccolor` are set
1531`linkcolor`, `citecolor`, `urlcolor`, `toccolor`
1532: color for internal links, citation links, external links, and links in table of contents:
1533 uses options allowed by [`xcolor`], including the `dvipsnames`, `svgnames`, and `x11names` lists
1536: causes links to be printed as footnotes
1539: uses document class settings for indentation (the default LaTeX template
1540 otherwise removes indentation and adds space between paragraphs)
1543: disables default behavior of LaTeX template that redefines (sub)paragraphs
1544 as sections, changing the appearance of nested headings in some classes
1547: specifies contents of acknowledgments footnote after document title.
1550: include table of contents (can also be set using `--toc/--table-of-contents`)
1553: level of section to include in table of contents
1556: numbering depth for sections, if sections are numbered
1559: include list of figures, list of tables
1562: bibliography to use for resolving references
1565: bibliography style, when used with `--natbib` and `--biblatex`.
1568: bibliography title, when used with `--natbib` and `--biblatex`.
1571: list of options for biblatex.
1574: list of options for natbib.
1577: An option for LaTeX's `\pagestyle{}`. The default article class
1578 supports 'plain' (default), 'empty', and 'headings'; headings puts
1579 section titles in the header.
1581[`article`]: https://ctan.org/pkg/article
1582[`report`]: https://ctan.org/pkg/report
1583[`book`]: https://ctan.org/pkg/book
1584[KOMA-Script]: https://ctan.org/pkg/koma-script
1585[`memoir`]: https://ctan.org/pkg/memoir
1586[`xcolor`]: https://ctan.org/pkg/xcolor
1587[LaTeX Font Catalogue]: http://www.tug.dk/FontCatalogue/
1588[`mathpazo`]: https://ctan.org/pkg/mathpazo
1589[LaTeX font encodings]: https://ctan.org/pkg/encguide
1591Variables for ConTeXt
1592---------------------
1595: paper size, e.g. `letter`, `A4`, `landscape` (see [ConTeXt Paper Setup]);
1596 may be repeated for multiple options
1599: options for page margins and text arrangement (see [ConTeXt Layout]);
1600 may be repeated for multiple options
1602`margin-left`, `margin-right`, `margin-top`, `margin-bottom`
1603: sets margins, if `layout` is not used (otherwise `layout`
1607: font size for body text (e.g. `10pt`, `12pt`)
1609`mainfont`, `sansfont`, `monofont`, `mathfont`
1610: font families: take the name of any system font (see [ConTeXt Font Switching])
1612`linkcolor`, `contrastcolor`
1613: color for links outside and inside a page, e.g. `red`, `blue` (see [ConTeXt Color])
1616: typeface style for links, e.g. `normal`, `bold`, `slanted`, `boldslanted`, `type`, `cap`, `small`
1619: controls indentation of paragraphs, e.g. `yes,small,next` (see [ConTeXt Indentation]);
1620 may be repeated for multiple options
1623: spacing between paragraphs, e.g. `none`, `small` (using [`setupwhitespace`])
1626: adjusts line spacing, e.g. `4ex` (using [`setupinterlinespace`]);
1627 may be repeated for multiple options
1629`headertext`, `footertext`
1630: text to be placed in running header or footer (see [ConTeXt Headers and Footers]);
1631 may be repeated up to four times for different placement
1634: page number style and location (using [`setuppagenumbering`]);
1635 may be repeated for multiple options
1638: include table of contents (can also be set using `--toc/--table-of-contents`)
1641: include list of figures, list of tables
1644: adds to the preamble the setup necessary to generate PDF/A-1b:2005.
1645 To successfully generate PDF/A the required ICC color profiles have to
1646 be available and the content and all included files (such as images)
1647 have to be standard conforming. The ICC profiles can be obtained
1648 from [ConTeXt ICC Profiles]. See also [ConTeXt PDFA] for more
1651[ConTeXt Paper Setup]: http://wiki.contextgarden.net/PaperSetup
1652[ConTeXt Layout]: http://wiki.contextgarden.net/Layout
1653[ConTeXt Font Switching]: http://wiki.contextgarden.net/Font_Switching
1654[ConTeXt Color]: http://wiki.contextgarden.net/Color
1655[ConTeXt Headers and Footers]: http://wiki.contextgarden.net/Headers_and_Footers
1656[ConTeXt Indentation]: http://wiki.contextgarden.net/Indentation
1657[ConTeXt ICC Profiles]: http://wiki.contextgarden.net/PDFX#ICC_profiles
1658[ConTeXt PDFA]: http://wiki.contextgarden.net/PDF/A
1659[`setupwhitespace`]: http://wiki.contextgarden.net/Command/setupwhitespace
1660[`setupinterlinespace`]: http://wiki.contextgarden.net/Command/setupinterlinespace
1661[`setuppagenumbering`]: http://wiki.contextgarden.net/Command/setuppagenumbering
1663Variables for man pages
1664-----------------------
1667: section number in man pages
1670: header in man pages
1673: footer in man pages
1676: adjusts text to left (`l`), right (`r`), center (`c`),
1677 or both (`b`) margins
1680: if `true` (the default), hyphenation will be used
1686: point size (e.g. `10p`)
1689: line height (e.g. `12p`)
1692: font family (e.g. `T` or `P`)
1695: paragraph indent (e.g. `2m`)
1697Using variables in templates
1698----------------------------
1700Variable names are sequences of alphanumerics, `-`, and `_`,
1701starting with a letter. A variable name surrounded by `$` signs
1702will be replaced by its value. For example, the string `$title$` in
1704 <title>$title$</title>
1706will be replaced by the document title.
1708To write a literal `$` in a template, use `$$`.
1710Templates may contain conditionals. The syntax is as follows:
1718This will include `X` in the template if `variable` has a truthy
1719value; otherwise it will include `Y`. Here a truthy value is any
1722- a string that is not entirely white space,
1723- a non-empty array where the first value is truthy,
1724- any number (including zero),
1726- the boolean `true` (to specify the boolean `true`
1727 value using YAML metadata or the `--metadata` flag,
1728 use `true`, `True`, or `TRUE`; with the `--variable`
1729 flag, simply omit a value for the variable, e.g.
1730 `--variable draft`).
1732`X` and `Y` are placeholders for any valid template text,
1733and may include interpolated variables or other conditionals.
1734The `$else$` section may be omitted.
1736When variables can have multiple values (for example, `author` in
1737a multi-author document), you can use the `$for$` keyword:
1740 <meta name="author" content="$author$" />
1743You can optionally specify a separator to be used between
1746 $for(author)$$author$$sep$, $endfor$
1748A dot can be used to select a field of a variable that takes
1749an object as its value. So, for example:
1751 $author.name$ ($author.affiliation$)
1753If you use custom templates, you may need to revise them as pandoc
1754changes. We recommend tracking the changes in the default templates,
1755and modifying your custom templates accordingly. An easy way to do this
1756is to fork the [pandoc-templates] repository and merge in changes after each
1759Templates may contain comments: anything on a line after `$--`
1760will be treated as a comment and ignored.
1762[pandoc-templates]: https://github.com/jgm/pandoc-templates
1767The behavior of some of the readers and writers can be adjusted by
1768enabling or disabling various extensions.
1770An extension can be enabled by adding `+EXTENSION`
1771to the format name and disabled by adding `-EXTENSION`. For example,
1772`--from markdown_strict+footnotes` is strict Markdown with footnotes
1773enabled, while `--from markdown-footnotes-pipe_tables` is pandoc's
1774Markdown without footnotes or pipe tables.
1776The markdown reader and writer make by far the most use of extensions.
1777Extensions only used by them are therefore covered in the
1778section [Pandoc's Markdown] below (See [Markdown variants] for
1779`commonmark` and `gfm`.) In the following, extensions that also work
1780for other formats are covered.
1785#### Extension: `smart` ####
1787Interpret straight quotes as curly quotes, `---` as em-dashes,
1788`--` as en-dashes, and `...` as ellipses. Nonbreaking spaces are
1789inserted after certain abbreviations, such as "Mr."
1791This extension can be enabled/disabled for the following formats:
1794: `markdown`, `commonmark`, `latex`, `mediawiki`, `org`, `rst`, `twiki`
1797: `markdown`, `latex`, `context`, `rst`
1799enabled by default in
1800: `markdown`, `latex`, `context` (both input and output)
1802Note: If you are *writing* Markdown, then the `smart` extension
1803has the reverse effect: what would have been curly quotes comes
1806In LaTeX, `smart` means to use the standard TeX ligatures
1807for quotation marks (` `` ` and ` '' ` for double quotes,
1808`` ` `` and `` ' `` for single quotes) and dashes (`--` for
1809en-dash and `---` for em-dash). If `smart` is disabled,
1810then in reading LaTeX pandoc will parse these characters
1811literally. In writing LaTeX, enabling `smart` tells pandoc
1812to use the ligatures when possible; if `smart` is disabled
1813pandoc will use unicode quotation mark and dash characters.
1818#### Extension: `auto_identifiers` ####
1820A header without an explicitly specified identifier will be
1821automatically assigned a unique identifier based on the header text.
1823This extension can be enabled/disabled for the following formats:
1826: `markdown`, `latex`, `rst`, `mediawiki`, `textile`
1831enabled by default in
1834The algorithm used to derive the identifier from the header text is:
1836 - Remove all formatting, links, etc.
1837 - Remove all footnotes.
1838 - Remove all punctuation, except underscores, hyphens, and periods.
1839 - Replace all spaces and newlines with hyphens.
1840 - Convert all alphabetic characters to lowercase.
1841 - Remove everything up to the first letter (identifiers may
1842 not begin with a number or punctuation mark).
1843 - If nothing is left after this, use the identifier `section`.
1848 ------------------------------- ----------------------------
1849 `Header identifiers in HTML` `header-identifiers-in-html`
1850 `*Dogs*?--in *my* house?` `dogs--in-my-house`
1851 `[HTML], [S5], or [RTF]?` `html-s5-or-rtf`
1852 `3. Applications` `applications`
1855These rules should, in most cases, allow one to determine the identifier
1856from the header text. The exception is when several headers have the
1857same text; in this case, the first will get an identifier as described
1858above; the second will get the same identifier with `-1` appended; the
1859third with `-2`; and so on.
1861These identifiers are used to provide link targets in the table of
1862contents generated by the `--toc|--table-of-contents` option. They
1863also make it easy to provide links from one section of a document to
1864another. A link to this section, for example, might look like this:
1867 [header identifiers](#header-identifiers-in-html-latex-and-context).
1869Note, however, that this method of providing links to sections works
1870only in HTML, LaTeX, and ConTeXt formats.
1872If the `--section-divs` option is specified, then each section will
1873be wrapped in a `section` (or a `div`, if `html4` was specified),
1874and the identifier will be attached to the enclosing `<section>`
1875(or `<div>`) tag rather than the header itself. This allows entire
1876sections to be manipulated using JavaScript or treated differently in
1879#### Extension: `ascii_identifiers` ####
1881Causes the identifiers produced by `auto_identifiers` to be pure ASCII.
1882Accents are stripped off of accented Latin letters, and non-Latin
1888The extensions [`tex_math_dollars`](#extension-tex_math_dollars),
1889[`tex_math_single_backslash`](#extension-tex_math_single_backslash), and
1890[`tex_math_double_backslash`](#extension-tex_math_double_backslash)
1891are described in the section about Pandoc's Markdown.
1893However, they can also be used with HTML input. This is handy for
1894reading web pages formatted using MathJax, for example.
1899The following extensions (especially how they affect Markdown
1900input/output) are also described in more detail in their respective
1901sections of [Pandoc's Markdown].
1903#### [Extension: `raw_html`] {#raw_html}
1905When converting from HTML, parse elements to raw HTML which are not
1906representable in pandoc's AST.
1907By default, this is disabled for HTML input.
1909#### [Extension: `raw_tex`] {#raw_tex}
1911Allows raw LaTeX, TeX, and ConTeXt to be included in a document.
1913This extension can be enabled/disabled for the following formats
1914(in addition to `markdown`):
1917: `latex`, `org`, `textile`
1922#### [Extension: `native_divs`] {#native_divs}
1924This extension is enabled by default for HTML input. This means that
1925`div`s are parsed to pandoc native elements. (Alternatively, you
1926can parse them to raw HTML using `-f html-native_divs+raw_html`.)
1928When converting HTML to Markdown, for example, you may want to drop all
1931 pandoc -f html-native_divs-native_spans -t markdown
1933#### [Extension: `native_spans`] {#native_spans}
1935Analogous to `native_divs` above.
1938Literate Haskell support
1939------------------------
1941#### Extension: `literate_haskell` ####
1943Treat the document as literate Haskell source.
1945This extension can be enabled/disabled for the following formats:
1948: `markdown`, `rst`, `latex`
1951: `markdown`, `rst`, `latex`, `html`
1953If you append `+lhs` (or `+literate_haskell`) to one of the formats
1954above, pandoc will treat the document as literate Haskell source.
1957 - In Markdown input, "bird track" sections will be parsed as Haskell
1958 code rather than block quotations. Text between `\begin{code}`
1959 and `\end{code}` will also be treated as Haskell code. For
1960 ATX-style headers the character '=' will be used instead of '#'.
1962 - In Markdown output, code blocks with classes `haskell` and `literate`
1963 will be rendered using bird tracks, and block quotations will be
1964 indented one space, so they will not be treated as Haskell code.
1965 In addition, headers will be rendered setext-style (with underlines)
1966 rather than ATX-style (with '#' characters). (This is because ghc
1967 treats '#' characters in column 1 as introducing line numbers.)
1969 - In restructured text input, "bird track" sections will be parsed
1972 - In restructured text output, code blocks with class `haskell` will
1973 be rendered using bird tracks.
1975 - In LaTeX input, text in `code` environments will be parsed as
1978 - In LaTeX output, code blocks with class `haskell` will be rendered
1979 inside `code` environments.
1981 - In HTML output, code blocks with class `haskell` will be rendered
1982 with class `literatehaskell` and bird tracks.
1986 pandoc -f markdown+lhs -t html
1988reads literate Haskell source formatted with Markdown conventions and writes
1989ordinary HTML (without bird tracks).
1991 pandoc -f markdown+lhs -t html+lhs
1993writes HTML with the Haskell code in bird tracks, so it can be copied
1994and pasted as literate Haskell source.
1996Note that GHC expects the bird tracks in the first column, so indented
1997literate code blocks (e.g. inside an itemized environment) will not be
1998picked up by the Haskell compiler.
2003#### Extension: `empty_paragraphs` ####
2005Allows empty paragraphs. By default empty paragraphs are
2008This extension can be enabled/disabled for the following formats:
2014: `docx`, `odt`, `opendocument`, `html`
2016#### Extension: `styles` #### {#ext-styles}
2018Read all docx styles as divs (for paragraph styles) and spans (for
2019character styles) regardless of whether pandoc understands the meaning
2020of these styles. This can be used with [docx custom
2021styles](#custom-styles-in-docx). Disabled by default.
2026#### Extension: `amuse` ####
2028In the `muse` input format, this enables Text::Amuse
2029extensions to Emacs Muse markup.
2031#### Extension: `citations` {#org-citations}
2033Some aspects of [Pandoc's Markdown citation syntax](#citations) are also accepted
2036#### Extension: `ntb` ####
2038In the `context` output format this enables the use of [Natural Tables
2039(TABLE)](http://wiki.contextgarden.net/TABLE) instead of the default
2040[Extreme Tables (xtables)](http://wiki.contextgarden.net/xtables).
2041Natural tables allow more fine-grained global customization but come
2042at a performance penalty compared to extreme tables.
2048Pandoc understands an extended and slightly revised version of
2049John Gruber's [Markdown] syntax. This document explains the syntax,
2050noting differences from standard Markdown. Except where noted, these
2051differences can be suppressed by using the `markdown_strict` format instead
2052of `markdown`. Extensions can be enabled or disabled to specify the
2053behavior more granularly. They are described in the following. See also
2054[Extensions] above, for extensions that work also on other formats.
2059Markdown is designed to be easy to write, and, even more importantly,
2062> A Markdown-formatted document should be publishable as-is, as plain
2063> text, without looking like it's been marked up with tags or formatting
2065> -- [John Gruber](http://daringfireball.net/projects/markdown/syntax#philosophy)
2067This principle has guided pandoc's decisions in finding syntax for
2068tables, footnotes, and other extensions.
2070There is, however, one respect in which pandoc's aims are different
2071from the original aims of Markdown. Whereas Markdown was originally
2072designed with HTML generation in mind, pandoc is designed for multiple
2073output formats. Thus, while pandoc allows the embedding of raw HTML,
2074it discourages it, and provides other, non-HTMLish ways of representing
2075important document elements like definition lists, tables, mathematics, and
2081A paragraph is one or more lines of text followed by one or more blank lines.
2082Newlines are treated as spaces, so you can reflow your paragraphs as you like.
2083If you need a hard line break, put two or more spaces at the end of a line.
2085#### Extension: `escaped_line_breaks` ####
2087A backslash followed by a newline is also a hard line break.
2088Note: in multiline and grid table cells, this is the only way
2089to create a hard line break, since trailing spaces in the cells
2095There are two kinds of headers: Setext and ATX.
2097### Setext-style headers ###
2099A setext-style header is a line of text "underlined" with a row of `=` signs
2100(for a level one header) or `-` signs (for a level two header):
2108The header text can contain inline formatting, such as emphasis (see
2109[Inline formatting], below).
2112### ATX-style headers ###
2114An ATX-style header consists of one to six `#` signs and a line of
2115text, optionally followed by any number of `#` signs. The number of
2116`#` signs at the beginning of the line is the header level:
2118 ## A level-two header
2120 ### A level-three header ###
2122As with setext-style headers, the header text can contain formatting:
2124 # A level-one header with a [link](/url) and *emphasis*
2126#### Extension: `blank_before_header` ####
2128Standard Markdown syntax does not require a blank line before a header.
2129Pandoc does require this (except, of course, at the beginning of the
2130document). The reason for the requirement is that it is all too easy for a
2131`#` to end up at the beginning of a line by accident (perhaps through line
2132wrapping). Consider, for example:
2134 I like several of their flavors of ice cream:
2135 #22, for example, and #5.
2137#### Extension: `space_in_atx_header` ####
2139Many Markdown implementations do not require a space between the
2140opening `#`s of an ATX header and the header text, so that
2141`#5 bolt` and `#hashtag` count as headers. With this extension,
2142pandoc does require the space.
2144### Header identifiers ###
2146See also the [`auto_identifiers` extension](#extension-auto_identifiers) above.
2148#### Extension: `header_attributes` ####
2150Headers can be assigned attributes using this syntax at the end
2151of the line containing the header text:
2153 {#identifier .class .class key=value key=value}
2155Thus, for example, the following headers will all be assigned the identifier
2160 ## My header ## {#foo}
2162 My other header {#foo}
2165(This syntax is compatible with [PHP Markdown Extra].)
2167Note that although this syntax allows assignment of classes and key/value
2168attributes, writers generally don't use all of this information. Identifiers,
2169classes, and key/value attributes are used in HTML and HTML-based formats such
2170as EPUB and slidy. Identifiers are used for labels and link anchors in the
2171LaTeX, ConTeXt, Textile, and AsciiDoc writers.
2173Headers with the class `unnumbered` will not be numbered, even if
2174`--number-sections` is specified. A single hyphen (`-`) in an attribute
2175context is equivalent to `.unnumbered`, and preferable in non-English
2182 # My header {.unnumbered}
2184#### Extension: `implicit_header_references` ####
2186Pandoc behaves as if reference links have been defined for each header.
2187So, to link to a header
2189 # Header identifiers in HTML
2193 [Header identifiers in HTML]
2197 [Header identifiers in HTML][]
2201 [the section on header identifiers][header identifiers in
2204instead of giving the identifier explicitly:
2206 [Header identifiers in HTML](#header-identifiers-in-html)
2208If there are multiple headers with identical text, the corresponding
2209reference will link to the first one only, and you will need to use explicit
2210links to link to the others, as described above.
2212Like regular reference links, these references are case-insensitive.
2214Explicit link reference definitions always take priority over
2215implicit header references. So, in the following example, the
2216link will point to `bar`, not to `#foo`:
2227Markdown uses email conventions for quoting blocks of text.
2228A block quotation is one or more paragraphs or other block elements
2229(such as lists or headers), with each line preceded by a `>` character
2230and an optional space. (The `>` need not start at the left margin, but
2231it should not be indented more than three spaces.)
2233 > This is a block quote. This
2234 > paragraph has two lines.
2236 > 1. This is a list inside a block quote.
2239A "lazy" form, which requires the `>` character only on the first
2240line of each block, is also allowed:
2242 > This is a block quote. This
2243 paragraph has two lines.
2245 > 1. This is a list inside a block quote.
2248Among the block elements that can be contained in a block quote are
2249other block quotes. That is, block quotes can be nested:
2251 > This is a block quote.
2253 > > A block quote within a block quote.
2255If the `>` character is followed by an optional space, that space
2256will be considered part of the block quote marker and not part of
2257the indentation of the contents. Thus, to put an indented code
2258block in a block quote, you need five spaces after the `>`:
2262#### Extension: `blank_before_blockquote` ####
2264Standard Markdown syntax does not require a blank line before a block
2265quote. Pandoc does require this (except, of course, at the beginning of the
2266document). The reason for the requirement is that it is all too easy for a
2267`>` to end up at the beginning of a line by accident (perhaps through line
2268wrapping). So, unless the `markdown_strict` format is used, the following does
2269not produce a nested block quote in pandoc:
2271 > This is a block quote.
2275Verbatim (code) blocks
2276----------------------
2278### Indented code blocks ###
2280A block of text indented four spaces (or one tab) is treated as verbatim
2281text: that is, special characters do not trigger special formatting,
2282and all spaces and line breaks are preserved. For example,
2285 moveShip(5 * gravity, DOWN);
2288The initial (four space or one tab) indentation is not considered part
2289of the verbatim text, and is removed in the output.
2291Note: blank lines in the verbatim text need not begin with four spaces.
2294### Fenced code blocks ###
2296#### Extension: `fenced_code_blocks` ####
2298In addition to standard indented code blocks, pandoc supports
2299*fenced* code blocks. These begin with a row of three or more
2300tildes (`~`) and end with a row of tildes that must be at least as long as
2301the starting row. Everything between these lines is treated as code. No
2302indentation is necessary:
2306 moveShip(5 * gravity, DOWN);
2310Like regular code blocks, fenced code blocks must be separated
2311from surrounding text by blank lines.
2313If the code itself contains a row of tildes or backticks, just use a longer
2314row of tildes or backticks at the start and end:
2318 code including tildes
2322#### Extension: `backtick_code_blocks` ####
2324Same as `fenced_code_blocks`, but uses backticks (`` ` ``) instead of tildes
2327#### Extension: `fenced_code_attributes` ####
2329Optionally, you may attach attributes to fenced or backtick code block using
2332 ~~~~ {#mycode .haskell .numberLines startFrom="100"}
2334 qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
2335 qsort (filter (>= x) xs)
2336 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2338Here `mycode` is an identifier, `haskell` and `numberLines` are classes, and
2339`startFrom` is an attribute with value `100`. Some output formats can use this
2340information to do syntax highlighting. Currently, the only output formats
2341that uses this information are HTML, LaTeX, Docx, Ms, and PowerPoint. If
2342highlighting is supported for your output format and language, then the code
2343block above will appear highlighted, with numbered lines. (To see which
2344languages are supported, type `pandoc --list-highlight-languages`.) Otherwise,
2345the code block above will appear as follows:
2347 <pre id="mycode" class="haskell numberLines" startFrom="100">
2353The `numberLines` (or `number-lines`) class will cause the lines
2354of the code block to be numbered, starting with `1` or the value
2355of the `startFrom` attribute. The `lineAnchors` (or
2356`line-anchors`) class will cause the lines to be clickable
2357anchors in HTML output.
2359A shortcut form can also be used for specifying the language of
2366This is equivalent to:
2372If the `fenced_code_attributes` extension is disabled, but
2373input contains class attribute(s) for the code block, the first
2374class attribute will be printed after the opening fence as a bare
2377To prevent all highlighting, use the `--no-highlight` flag.
2378To set the highlighting style, use `--highlight-style`.
2379For more information on highlighting, see [Syntax highlighting],
2385#### Extension: `line_blocks` ####
2387A line block is a sequence of lines beginning with a vertical bar (`|`)
2388followed by a space. The division into lines will be preserved in
2389the output, as will any leading spaces; otherwise, the lines will
2390be formatted as Markdown. This is useful for verse and addresses:
2392 | The limerick packs laughs anatomical
2393 | In space that is quite economical.
2394 | But the good ones I've seen
2395 | So seldom are clean
2396 | And the clean ones so seldom are comical
2399 | Berkeley, CA 94718
2401The lines can be hard-wrapped if needed, but the continuation
2402line must begin with a space.
2404 | The Right Honorable Most Venerable and Righteous Samuel L.
2407 | Berkeley, CA 94718
2409This syntax is borrowed from [reStructuredText].
2416A bullet list is a list of bulleted list items. A bulleted list
2417item begins with a bullet (`*`, `+`, or `-`). Here is a simple
2424This will produce a "compact" list. If you want a "loose" list, in which
2425each item is formatted as a paragraph, put spaces between the items:
2433The bullets need not be flush with the left margin; they may be
2434indented one, two, or three spaces. The bullet must be followed
2437List items look best if subsequent lines are flush with the first
2438line (after the bullet):
2444But Markdown also allows a "lazy" format:
2450### Block content in list items ###
2452A list item may contain multiple paragraphs and other block-level
2453content. However, subsequent paragraphs must be preceded by a blank line
2454and indented to line up with the first non-space content after
2461 * Second paragraph. With a code block, which must be indented
2466Exception: if the list marker is followed by an indented code
2467block, which must begin 5 spaces after the list marker, then
2468subsequent paragraphs must begin two columns after the last
2469character of the list marker:
2473 continuation paragraph
2475List items may include other lists. In this case the preceding blank
2476line is optional. The nested list must be indented to line up with
2477the first non-space character after the list marker of the
2478containing list item.
2490As noted above, Markdown allows you to write list items "lazily," instead of
2491indenting continuation lines. However, if there are multiple paragraphs or
2492other blocks in a list item, the first line of each must be indented.
2494 + A lazy, lazy, list
2497 + Another one; this looks
2500 Second paragraph of second
2503### Ordered lists ###
2505Ordered lists work just like bulleted lists, except that the items
2506begin with enumerators rather than bullets.
2508In standard Markdown, enumerators are decimal numbers followed
2509by a period and a space. The numbers themselves are ignored, so
2510there is no difference between this list:
2522#### Extension: `fancy_lists` ####
2524Unlike standard Markdown, pandoc allows ordered list items to be marked
2525with uppercase and lowercase letters and roman numerals, in addition to
2526Arabic numerals. List markers may be enclosed in parentheses or followed by a
2527single right-parentheses or period. They must be separated from the
2528text that follows by at least one space, and, if the list marker is a
2529capital letter with a period, by at least two spaces.[^2]
2531[^2]: The point of this rule is to ensure that normal paragraphs
2532 starting with people's initials, like
2534 B. Russell was an English philosopher.
2536 do not get treated as list items.
2538 This rule will not prevent
2542 from being interpreted as a list item. In this case, a backslash
2547The `fancy_lists` extension also allows '`#`' to be used as an
2548ordered list marker in place of a numeral:
2553#### Extension: `startnum` ####
2555Pandoc also pays attention to the type of list marker used, and to the
2556starting number, and both of these are preserved where possible in the
2557output format. Thus, the following yields a list with numbers followed
2558by a single parenthesis, starting with 9, and a sublist with lowercase
2568Pandoc will start a new list each time a different type of list
2569marker is used. So, the following will create three lists:
2576If default list markers are desired, use `#.`:
2583### Definition lists ###
2585#### Extension: `definition_lists` ####
2587Pandoc supports definition lists, using the syntax of
2588[PHP Markdown Extra] with some extensions.[^3]
2594 Term 2 with *inline markup*
2598 { some code, part of Definition 2 }
2600 Third paragraph of definition 2.
2602Each term must fit on one line, which may optionally be followed by
2603a blank line, and must be followed by one or more definitions.
2604A definition begins with a colon or tilde, which may be indented one
2607A term may have multiple definitions, and each definition may consist of one or
2608more block elements (paragraph, code block, list, etc.), each indented four
2609spaces or one tab stop. The body of the definition (including the first line,
2610aside from the colon or tilde) should be indented four spaces. However,
2611as with other Markdown lists, you can "lazily" omit indentation except
2612at the beginning of a paragraph or other block element:
2617 with lazy continuation.
2619 Second paragraph of the definition.
2621If you leave space before the definition (as in the example above),
2622the text of the definition will be treated as a paragraph. In some
2623output formats, this will mean greater spacing between term/definition
2624pairs. For a more compact definition list, omit the space before the
2634Note that space between items in a definition list is required.
2635(A variant that loosens this requirement, but disallows "lazy"
2636hard wrapping, can be activated with `compact_definition_lists`: see
2637[Non-pandoc extensions], below.)
2639[^3]: I have been influenced by the suggestions of [David Wheeler](http://www.justatheory.com/computers/markup/modest-markdown-proposal.html).
2641### Numbered example lists ###
2643#### Extension: `example_lists` ####
2645The special list marker `@` can be used for sequentially numbered
2646examples. The first list item with a `@` marker will be numbered '1',
2647the next '2', and so on, throughout the document. The numbered examples
2648need not occur in a single list; each new list using `@` will take up
2649where the last stopped. So, for example:
2651 (@) My first example will be numbered (1).
2652 (@) My second example will be numbered (2).
2654 Explanation of examples.
2656 (@) My third example will be numbered (3).
2658Numbered examples can be labeled and referred to elsewhere in the
2661 (@good) This is a good example.
2663 As (@good) illustrates, ...
2665The label can be any string of alphanumeric characters, underscores,
2668Note: continuation paragraphs in example lists must always
2669be indented four spaces, regardless of the length of the
2670list marker. That is, example lists always behave as if the
2671`four_space_rule` extension is set. This is because example
2672labels tend to be long, and indenting content to the
2673first non-space character after the label would be awkward.
2675### Compact and loose lists ###
2677Pandoc behaves differently from `Markdown.pl` on some "edge
2678cases" involving lists. Consider this source:
2688Pandoc transforms this into a "compact list" (with no `<p>` tags around
2689"First", "Second", or "Third"), while Markdown puts `<p>` tags around
2690"Second" and "Third" (but not "First"), because of the blank space
2691around "Third". Pandoc follows a simple rule: if the text is followed by
2692a blank line, it is treated as a paragraph. Since "Second" is followed
2693by a list, and not a blank line, it isn't treated as a paragraph. The
2694fact that the list is followed by a blank line is irrelevant. (Note:
2695Pandoc works this way even when the `markdown_strict` format is specified. This
2696behavior is consistent with the official Markdown syntax description,
2697even though it is different from that of `Markdown.pl`.)
2700### Ending a list ###
2702What if you want to put an indented code block after a list?
2709Trouble! Here pandoc (like other Markdown implementations) will treat
2710`{ my code block }` as the second paragraph of item two, and not as
2713To "cut off" the list after item two, you can insert some non-indented
2714content, like an HTML comment, which won't produce visible output in
2720 <!-- end of list -->
2724You can use the same trick if you want two consecutive lists instead
2740A line containing a row of three or more `*`, `-`, or `_` characters
2741(optionally separated by spaces) produces a horizontal rule:
2751Four kinds of tables may be used. The first three kinds presuppose the use of
2752a fixed-width font, such as Courier. The fourth kind can be used with
2753proportionally spaced fonts, as it does not require lining up columns.
2755#### Extension: `table_captions` ####
2757A caption may optionally be provided with all 4 kinds of tables (as
2758illustrated in the examples below). A caption is a paragraph beginning
2759with the string `Table:` (or just `:`), which will be stripped off.
2760It may appear either before or after the table.
2762#### Extension: `simple_tables` ####
2764Simple tables look like this:
2766 Right Left Center Default
2767 ------- ------ ---------- -------
2772 Table: Demonstration of simple table syntax.
2774The headers and table rows must each fit on one line. Column
2775alignments are determined by the position of the header text relative
2776to the dashed line below it:[^4]
2778 - If the dashed line is flush with the header text on the right side
2779 but extends beyond it on the left, the column is right-aligned.
2780 - If the dashed line is flush with the header text on the left side
2781 but extends beyond it on the right, the column is left-aligned.
2782 - If the dashed line extends beyond the header text on both sides,
2783 the column is centered.
2784 - If the dashed line is flush with the header text on both sides,
2785 the default alignment is used (in most cases, this will be left).
2787[^4]: This scheme is due to Michel Fortin, who proposed it on the
2788 [Markdown discussion list](http://six.pairlist.net/pipermail/markdown-discuss/2005-March/001097.html).
2790The table must end with a blank line, or a line of dashes followed by
2793The column headers may be omitted, provided a dashed line is used
2794to end the table. For example:
2796 ------- ------ ---------- -------
2800 ------- ------ ---------- -------
2802When headers are omitted, column alignments are determined on the basis
2803of the first line of the table body. So, in the tables above, the columns
2804would be right, left, center, and right aligned, respectively.
2806#### Extension: `multiline_tables` ####
2808Multiline tables allow headers and table rows to span multiple lines
2809of text (but cells that span multiple columns or rows of the table are
2810not supported). Here is an example:
2812 -------------------------------------------------------------
2813 Centered Default Right Left
2814 Header Aligned Aligned Aligned
2815 ----------- ------- --------------- -------------------------
2816 First row 12.0 Example of a row that
2817 spans multiple lines.
2819 Second row 5.0 Here's another one. Note
2820 the blank line between
2822 -------------------------------------------------------------
2824 Table: Here's the caption. It, too, may span
2827These work like simple tables, but with the following differences:
2829 - They must begin with a row of dashes, before the header text
2830 (unless the headers are omitted).
2831 - They must end with a row of dashes, then a blank line.
2832 - The rows must be separated by blank lines.
2834In multiline tables, the table parser pays attention to the widths of
2835the columns, and the writers try to reproduce these relative widths in
2836the output. So, if you find that one of the columns is too narrow in the
2837output, try widening it in the Markdown source.
2839Headers may be omitted in multiline tables as well as simple tables:
2841 ----------- ------- --------------- -------------------------
2842 First row 12.0 Example of a row that
2843 spans multiple lines.
2845 Second row 5.0 Here's another one. Note
2846 the blank line between
2848 ----------- ------- --------------- -------------------------
2850 : Here's a multiline table without headers.
2852It is possible for a multiline table to have just one row, but the row
2853should be followed by a blank line (and then the row of dashes that ends
2854the table), or the table may be interpreted as a simple table.
2856#### Extension: `grid_tables` ####
2858Grid tables look like this:
2860 : Sample grid table.
2862 +---------------+---------------+--------------------+
2863 | Fruit | Price | Advantages |
2864 +===============+===============+====================+
2865 | Bananas | $1.34 | - built-in wrapper |
2866 | | | - bright color |
2867 +---------------+---------------+--------------------+
2868 | Oranges | $2.10 | - cures scurvy |
2870 +---------------+---------------+--------------------+
2872The row of `=`s separates the header from the table body, and can be
2873omitted for a headerless table. The cells of grid tables may contain
2874arbitrary block elements (multiple paragraphs, code blocks, lists,
2875etc.). Cells that span multiple columns or rows are not
2876supported. Grid tables can be created easily using [Emacs table mode].
2878[Emacs table mode]: http://table.sourceforge.net/
2880Alignments can be specified as with pipe tables, by putting
2881colons at the boundaries of the separator line after the
2884 +---------------+---------------+--------------------+
2885 | Right | Left | Centered |
2886 +==============:+:==============+:==================:+
2887 | Bananas | $1.34 | built-in wrapper |
2888 +---------------+---------------+--------------------+
2890For headerless tables, the colons go on the top line instead:
2892 +--------------:+:--------------+:------------------:+
2893 | Right | Left | Centered |
2894 +---------------+---------------+--------------------+
2896##### Grid Table Limitations #####
2898Pandoc does not support grid tables with row spans or column spans.
2899This means that neither variable numbers of columns across rows nor
2900variable numbers of rows across columns are supported by Pandoc.
2901All grid tables must have the same number of columns in each row,
2902and the same number of rows in each column. For example, the
2903Docutils [sample grid tables] will not render as expected with
2906[sample grid tables]: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#grid-tables
2909#### Extension: `pipe_tables` ####
2911Pipe tables look like this:
2913 | Right | Left | Default | Center |
2914 |------:|:-----|---------|:------:|
2915 | 12 | 12 | 12 | 12 |
2916 | 123 | 123 | 123 | 123 |
2919 : Demonstration of pipe table syntax.
2921The syntax is identical to [PHP Markdown Extra tables]. The beginning and
2922ending pipe characters are optional, but pipes are required between all
2923columns. The colons indicate column alignment as shown. The header
2924cannot be omitted. To simulate a headerless table, include a header
2927Since the pipes indicate column boundaries, columns need not be vertically
2928aligned, as they are in the above example. So, this is a perfectly
2929legal (though ugly) pipe table:
2937The cells of pipe tables cannot contain block elements like paragraphs
2938and lists, and cannot span multiple lines. If a pipe table contains a
2939row whose printable content is wider than the column width (see
2940`--columns`), then the table will take up the full text width and
2941the cell contents will wrap, with the relative cell widths determined
2942by the number of dashes in the line separating the table header from
2943the table body. (For example `---|-` would make the first column 3/4
2944and the second column 1/4 of the full text width.)
2945On the other hand, if no lines are wider than column width, then
2946cell contents will not be wrapped, and the cells will be sized
2949Note: pandoc also recognizes pipe tables of the following
2950form, as can be produced by Emacs' orgtbl-mode:
2957The difference is that `+` is used instead of `|`. Other orgtbl features
2958are not supported. In particular, to get non-default column alignment,
2959you'll need to add colons as above.
2961[PHP Markdown Extra tables]: https://michelf.ca/projects/php-markdown/extra/#table
2966#### Extension: `pandoc_title_block` ####
2968If the file begins with a title block
2971 % author(s) (separated by semicolons)
2974it will be parsed as bibliographic information, not regular text. (It
2975will be used, for example, in the title of standalone LaTeX or HTML
2976output.) The block may contain just a title, a title and an author,
2977or all three elements. If you want to include an author but no
2978title, or a title and a date but no author, you need a blank line:
2987The title may occupy multiple lines, but continuation lines must
2988begin with leading space, thus:
2993If a document has multiple authors, the authors may be put on
2994separate lines with leading space, or separated by semicolons, or
2995both. So, all of the following are equivalent:
3000 % Author One; Author Two
3005The date must fit on one line.
3007All three metadata fields may contain standard inline formatting
3008(italics, links, footnotes, etc.).
3010Title blocks will always be parsed, but they will affect the output only
3011when the `--standalone` (`-s`) option is chosen. In HTML output, titles
3012will appear twice: once in the document head -- this is the title that
3013will appear at the top of the window in a browser -- and once at the
3014beginning of the document body. The title in the document head can have
3015an optional prefix attached (`--title-prefix` or `-T` option). The title
3016in the body appears as an H1 element with class "title", so it can be
3017suppressed or reformatted with CSS. If a title prefix is specified with
3018`-T` and no title block appears in the document, the title prefix will
3019be used by itself as the HTML title.
3021The man page writer extracts a title, man page section number, and
3022other header and footer information from the title line. The title
3023is assumed to be the first word on the title line, which may optionally
3024end with a (single-digit) section number in parentheses. (There should
3025be no space between the title and the parentheses.) Anything after
3026this is assumed to be additional footer and header text. A single pipe
3027character (`|`) should be used to separate the footer text from the header
3032will yield a man page with the title `PANDOC` and section 1.
3034 % PANDOC(1) Pandoc User Manuals
3036will also have "Pandoc User Manuals" in the footer.
3038 % PANDOC(1) Pandoc User Manuals | Version 4.0
3040will also have "Version 4.0" in the header.
3042#### Extension: `yaml_metadata_block` ####
3044A YAML metadata block is a valid YAML object, delimited by a line of three
3045hyphens (`---`) at the top and a line of three hyphens (`---`) or three dots
3046(`...`) at the bottom. A YAML metadata block may occur anywhere in the
3047document, but if it is not at the beginning, it must be preceded by a blank
3048line. (Note that, because of the way pandoc concatenates input files when
3049several are provided, you may also keep the metadata in a separate YAML file
3050and pass it to pandoc as an argument, along with your Markdown files:
3052 pandoc chap1.md chap2.md chap3.md metadata.yaml -s -o book.html
3054Just be sure that the YAML file begins with `---` and ends with `---` or
3057Metadata will be taken from the fields of the YAML object and added to any
3058existing document metadata. Metadata can contain lists and objects (nested
3059arbitrarily), but all string scalars will be interpreted as Markdown. Fields
3060with names ending in an underscore will be ignored by pandoc. (They may be
3061given a role by external processors.) Field names must not be
3062interpretable as YAML numbers or boolean values (so, for
3063example, `yes`, `True`, and `15` cannot be used as field names).
3065A document may contain multiple metadata blocks. The metadata fields will
3066be combined through a *left-biased union*: if two metadata blocks attempt
3067to set the same field, the value from the first block will be taken.
3069When pandoc is used with `-t markdown` to create a Markdown document,
3070a YAML metadata block will be produced only if the `-s/--standalone`
3071option is used. All of the metadata will appear in a single block
3072at the beginning of the document.
3074Note that YAML escaping rules must be followed. Thus, for example,
3075if a title contains a colon, it must be quoted. The pipe character
3076(`|`) can be used to begin an indented block that will be interpreted
3077literally, without need for escaping. This form is necessary
3078when the field contains blank lines or block-level formatting:
3081 title: 'This is the title: it contains a colon'
3085 tags: [nothing, nothingness]
3087 This is the abstract.
3089 It consists of two paragraphs.
3092Template variables will be set automatically from the metadata. Thus, for
3093example, in writing HTML, the variable `abstract` will be set to the HTML
3094equivalent of the Markdown in the `abstract` field:
3096 <p>This is the abstract.</p>
3097 <p>It consists of two paragraphs.</p>
3099Variables can contain arbitrary YAML structures, but the template must match
3100this structure. The `author` variable in the default templates expects a
3101simple list or string, but can be changed to support more complicated
3102structures. The following combination, for example, would add an affiliation
3103to the author if one is given:
3106 title: The document title
3109 affiliation: University of Somewhere
3111 affiliation: University of Nowhere
3114To use the structured authors in the example above, you would need a custom
3119 $author.name$$if(author.affiliation)$ ($author.affiliation$)$endif$
3125Raw content to include in the document's header may be specified
3126using `header-includes`; however, it is important to mark up
3127this content as raw code for a particular output format, using
3128the [`raw_attribute` extension](#extension-raw_attribute)), or it
3129will be interpreted as markdown. For example:
3134 \let\oldsection\section
3135 \renewcommand{\section}[1]{\clearpage\oldsection{#1}}
3141#### Extension: `all_symbols_escapable` ####
3143Except inside a code block or inline code, any punctuation or space
3144character preceded by a backslash will be treated literally, even if it
3145would normally indicate formatting. Thus, for example, if one writes
3155 <strong>hello</strong>
3157This rule is easier to remember than standard Markdown's rule,
3158which allows only the following characters to be backslash-escaped:
3162(However, if the `markdown_strict` format is used, the standard Markdown rule
3165A backslash-escaped space is parsed as a nonbreaking space. It will
3166appear in TeX output as `~` and in HTML and XML as `\ ` or
3169A backslash-escaped newline (i.e. a backslash occurring at the end of
3170a line) is parsed as a hard line break. It will appear in TeX output as
3171`\\` and in HTML as `<br />`. This is a nice alternative to
3172Markdown's "invisible" way of indicating hard line breaks using
3173two trailing spaces on a line.
3175Backslash escapes do not work in verbatim contexts.
3182To *emphasize* some text, surround it with `*`s or `_`, like this:
3184 This text is _emphasized with underscores_, and this
3185 is *emphasized with asterisks*.
3187Double `*` or `_` produces **strong emphasis**:
3189 This is **strong emphasis** and __with underscores__.
3191A `*` or `_` character surrounded by spaces, or backslash-escaped,
3192will not trigger emphasis:
3194 This is * not emphasized *, and \*neither is this\*.
3196#### Extension: `intraword_underscores` ####
3198Because `_` is sometimes used inside words and identifiers,
3199pandoc does not interpret a `_` surrounded by alphanumeric
3200characters as an emphasis marker. If you want to emphasize
3201just part of a word, use `*`:
3203 feas*ible*, not feas*able*.
3208#### Extension: `strikeout` ####
3210To strikeout a section of text with a horizontal line, begin and end it
3211with `~~`. Thus, for example,
3213 This ~~is deleted text.~~
3216### Superscripts and subscripts ###
3218#### Extension: `superscript`, `subscript` ####
3220Superscripts may be written by surrounding the superscripted text by `^`
3221characters; subscripts may be written by surrounding the subscripted
3222text by `~` characters. Thus, for example,
3224 H~2~O is a liquid. 2^10^ is 1024.
3226If the superscripted or subscripted text contains spaces, these spaces
3227must be escaped with backslashes. (This is to prevent accidental
3228superscripting and subscripting through the ordinary use of `~` and `^`.)
3229Thus, if you want the letter P with 'a cat' in subscripts, use
3230`P~a\ cat~`, not `P~a cat~`.
3235To make a short span of text verbatim, put it inside backticks:
3237 What is the difference between `>>=` and `>>`?
3239If the verbatim text includes a backtick, use double backticks:
3241 Here is a literal backtick `` ` ``.
3243(The spaces after the opening backticks and before the closing
3244backticks will be ignored.)
3246The general rule is that a verbatim span starts with a string
3247of consecutive backticks (optionally followed by a space)
3248and ends with a string of the same number of backticks (optionally
3249preceded by a space).
3251Note that backslash-escapes (and other Markdown constructs) do not
3252work in verbatim contexts:
3254 This is a backslash followed by an asterisk: `\*`.
3256#### Extension: `inline_code_attributes` ####
3258Attributes can be attached to verbatim text, just as with
3259[fenced code blocks]:
3265To write small caps, use the `smallcaps` class:
3267 [Small caps]{.smallcaps}
3269Or, without the `bracketed_spans` extension:
3271 <span class="smallcaps">Small caps</span>
3273For compatibility with other Markdown flavors, CSS is also supported:
3275 <span style="font-variant:small-caps;">Small caps</span>
3277This will work in all output formats that support small caps.
3283#### Extension: `tex_math_dollars` ####
3285Anything between two `$` characters will be treated as TeX math. The
3286opening `$` must have a non-space character immediately to its right,
3287while the closing `$` must have a non-space character immediately to its
3288left, and must not be followed immediately by a digit. Thus,
3289`$20,000 and $30,000` won't parse as math. If for some reason
3290you need to enclose text in literal `$` characters, backslash-escape
3291them and they won't be treated as math delimiters.
3293TeX math will be printed in all output formats. How it is rendered
3294depends on the output format:
3297 ~ It will appear verbatim surrounded by `\(...\)` (for inline
3298 math) or `\[...\]` (for display math).
3300Markdown, Emacs Org mode, ConTeXt, ZimWiki
3301 ~ It will appear verbatim surrounded by `$...$` (for inline
3302 math) or `$$...$$` (for display math).
3305 ~ It will be rendered using an [interpreted text role `:math:`].
3308 ~ It will be rendered as `latexmath:[...]`.
3311 ~ It will be rendered inside a `@math` command.
3314 ~ It will be rendered verbatim without `$`'s.
3317 ~ It will be rendered inside `<math>` tags.
3320 ~ It will be rendered inside `<span class="math">` tags.
3323 ~ It will be rendered, if possible, using Unicode characters,
3324 and will otherwise appear verbatim.
3327 ~ It will be rendered, if possible, using MathML.
3330 ~ If the `--mathml` flag is used, it will be rendered using MathML
3331 in an `inlineequation` or `informalequation` tag. Otherwise it
3332 will be rendered, if possible, using Unicode characters.
3335 ~ It will be rendered using OMML math markup.
3338 ~ If the `--webtex` option is used, formulas are rendered as images
3339 using CodeCogs or other compatible web service, downloaded
3340 and embedded in the e-book. Otherwise, they will appear verbatim.
3342HTML, Slidy, DZSlides, S5, EPUB
3343 ~ The way math is rendered in HTML will depend on the
3344 command-line options selected. Therefore see [Math rendering in HTML]
3347[interpreted text role `:math:`]: http://docutils.sourceforge.net/docs/ref/rst/roles.html#math
3352#### Extension: `raw_html` ####
3354Markdown allows you to insert raw HTML (or DocBook) anywhere in a document
3355(except verbatim contexts, where `<`, `>`, and `&` are interpreted
3356literally). (Technically this is not an extension, since standard
3357Markdown allows it, but it has been made an extension so that it can
3358be disabled if desired.)
3360The raw HTML is passed through unchanged in HTML, S5, Slidy, Slideous,
3361DZSlides, EPUB, Markdown, Emacs Org mode, and Textile output, and suppressed
3364#### Extension: `markdown_in_html_blocks` ####
3366Standard Markdown allows you to include HTML "blocks": blocks
3367of HTML between balanced tags that are separated from the surrounding text
3368with blank lines, and start and end at the left margin. Within
3369these blocks, everything is interpreted as HTML, not Markdown;
3370so (for example), `*` does not signify emphasis.
3372Pandoc behaves this way when the `markdown_strict` format is used; but
3373by default, pandoc interprets material between HTML block tags as Markdown.
3374Thus, for example, pandoc will turn
3379 <td>[a link](http://google.com)</td>
3387 <td><em>one</em></td>
3388 <td><a href="http://google.com">a link</a></td>
3392whereas `Markdown.pl` will preserve it as is.
3394There is one exception to this rule: text between `<script>` and
3395`<style>` tags is not interpreted as Markdown.
3397This departure from standard Markdown should make it easier to mix
3398Markdown with HTML block elements. For example, one can surround
3399a block of Markdown text with `<div>` tags without preventing it
3400from being interpreted as Markdown.
3402#### Extension: `native_divs` ####
3404Use native pandoc `Div` blocks for content inside `<div>` tags.
3405For the most part this should give the same output as
3406`markdown_in_html_blocks`, but it makes it easier to write pandoc
3407filters to manipulate groups of blocks.
3409#### Extension: `native_spans` ####
3411Use native pandoc `Span` blocks for content inside `<span>` tags.
3412For the most part this should give the same output as `raw_html`,
3413but it makes it easier to write pandoc filters to manipulate groups
3416#### Extension: `raw_tex` ####
3418In addition to raw HTML, pandoc allows raw LaTeX, TeX, and ConTeXt to be
3419included in a document. Inline TeX commands will be preserved and passed
3420unchanged to the LaTeX and ConTeXt writers. Thus, for example, you can use
3421LaTeX to include BibTeX citations:
3423 This result was proved in \cite{jones.1967}.
3425Note that in LaTeX environments, like
3427 \begin{tabular}{|l|l|}\hline
3428 Age & Frequency \\ \hline
3431 36--45 & 22 \\ \hline
3434the material between the begin and end tags will be interpreted as raw
3435LaTeX, not as Markdown.
3437Inline LaTeX is ignored in output formats other than Markdown, LaTeX,
3438Emacs Org mode, and ConTeXt.
3440### Generic raw attribute ###
3442#### Extension: `raw_attribute` ####
3444Inline spans and fenced code blocks with a special
3445kind of attribute will be parsed as raw content with the
3446designated format. For example, the following produces a raw
3453And the following produces a raw `html` inline element:
3455 This is `<a>html</a>`{=html}
3457This can be useful to insert raw xml into `docx` documents, e.g.
3463 <w:br w:type="page"/>
3468The format name should match the target format name (see
3469`-t/--to`, above, for a list, or use `pandoc
3470--list-output-formats`). Use `openxml` for `docx` output,
3471`opendocument` for `odt` output, `html5` for `epub3` output,
3472`html4` for `epub2` output, and `latex`, `beamer`,
3473`ms`, or `html5` for `pdf` output (depending on what you
3474use for `--pdf-engine`).
3476This extension presupposes that the relevant kind of
3477inline code or fenced code block is enabled. Thus, for
3478example, to use a raw attribute with a backtick code block,
3479`backtick_code_blocks` must be enabled.
3481The raw attribute cannot be combined with regular attributes.
3486#### Extension: `latex_macros` ####
3488For output formats other than LaTeX, pandoc will parse LaTeX
3489macro definitions and apply the resulting macros to all LaTeX
3490math and raw LaTeX. So, for example, the following will work in
3491all output formats, not just LaTeX:
3493 \newcommand{\tuple}[1]{\langle #1 \rangle}
3497Note that LaTeX macros will not be applied if they occur
3498inside inside a raw span or block marked with the
3499[`raw_attribute` extension](#extension-raw_attribute).
3501When `latex_macros` is disabled, the raw LaTeX and math will
3502not have macros applied. This is usually a better approach when
3503you are targeting LaTeX or PDF.
3505Whether or not `latex_macros` is enabled, the macro definitions
3506will still be passed through as raw LaTeX.
3511Markdown allows links to be specified in several ways.
3513### Automatic links ###
3515If you enclose a URL or email address in pointy brackets, it
3519 <sam@green.eggs.ham>
3523An inline link consists of the link text in square brackets,
3524followed by the URL in parentheses. (Optionally, the URL can
3525be followed by a link title, in quotes.)
3527 This is an [inline link](/url), and here's [one with
3528 a title](http://fsf.org "click here for a good time!").
3530There can be no space between the bracketed part and the parenthesized part.
3531The link text can contain formatting (such as emphasis), but the title cannot.
3533Email addresses in inline links are not autodetected, so they have to be
3534prefixed with `mailto`:
3536 [Write me!](mailto:sam@green.eggs.ham)
3538### Reference links ###
3540An *explicit* reference link has two parts, the link itself and the link
3541definition, which may occur elsewhere in the document (either
3542before or after the link).
3544The link consists of link text in square brackets, followed by a label in
3545square brackets. (There cannot be space between the two unless the
3546`spaced_reference_links` extension is enabled.) The link definition
3547consists of the bracketed label, followed by a colon and a space, followed by
3548the URL, and optionally (after a space) a link title either in quotes or in
3549parentheses. The label must not be parseable as a citation (assuming
3550the `citations` extension is enabled): citations take precedence over
3553Here are some examples:
3555 [my label 1]: /foo/bar.html "My title, optional"
3557 [my label 3]: http://fsf.org (The free software foundation)
3558 [my label 4]: /bar#special 'A title in single quotes'
3560The URL may optionally be surrounded by angle brackets:
3562 [my label 5]: <http://foo.bar.baz>
3564The title may go on the next line:
3566 [my label 3]: http://fsf.org
3567 "The free software foundation"
3569Note that link labels are not case sensitive. So, this will work:
3571 Here is [my link][FOO]
3575In an *implicit* reference link, the second pair of brackets is
3580 [my website]: http://foo.bar.baz
3582Note: In `Markdown.pl` and most other Markdown implementations,
3583reference link definitions cannot occur in nested constructions
3584such as list items or block quotes. Pandoc lifts this arbitrary
3585seeming restriction. So the following is fine in pandoc, though
3586not in most other implementations:
3592#### Extension: `shortcut_reference_links` ####
3594In a *shortcut* reference link, the second pair of brackets may
3599 [my website]: http://foo.bar.baz
3601### Internal links ###
3603To link to another section of the same document, use the automatically
3604generated identifier (see [Header identifiers]). For example:
3606 See the [Introduction](#introduction).
3610 See the [Introduction].
3612 [Introduction]: #introduction
3614Internal links are currently supported for HTML formats (including
3615HTML slide shows and EPUB), LaTeX, and ConTeXt.
3620A link immediately preceded by a `!` will be treated as an image.
3621The link text will be used as the image's alt text:
3623 
3627 [movie reel]: movie.gif
3629#### Extension: `implicit_figures` ####
3631An image with nonempty alt text, occurring by itself in a
3632paragraph, will be rendered as a figure with a caption. The
3633image's alt text will be used as the caption.
3635 
3637How this is rendered depends on the output format. Some output
3638formats (e.g. RTF) do not yet support figures. In those
3639formats, you'll just get an image in a paragraph by itself, with
3642If you just want a regular inline image, just make sure it is not
3643the only thing in the paragraph. One way to do this is to insert a
3644nonbreaking space after the image:
3646 \
3648Note that in reveal.js slide shows, an image in a paragraph
3649by itself that has the `stretch` class will fill the screen,
3650and the caption and figure tags will be omitted.
3652#### Extension: `link_attributes` ####
3654Attributes can be set on links and images:
3656 An inline {#id .class width=30 height=20px}
3657 and a reference ![image][ref] with attributes.
3659 [ref]: foo.jpg "optional title" {#id .class key=val key2="val 2"}
3661(This syntax is compatible with [PHP Markdown Extra] when only `#id`
3662and `.class` are used.)
3664For HTML and EPUB, all attributes except `width` and `height` (but
3665including `srcset` and `sizes`) are passed through as is. The other
3666writers ignore attributes that are not supported by their output
3669The `width` and `height` attributes on images are treated specially. When
3670used without a unit, the unit is assumed to be pixels. However, any of
3671the following unit identifiers can be used: `px`, `cm`, `mm`, `in`, `inch`
3672and `%`. There must not be any spaces between the number and the unit.
3676{ width=50% }
3679- Dimensions are converted to inches for output in page-based formats like
3680 LaTeX. Dimensions are converted to pixels for output in HTML-like
3681 formats. Use the `--dpi` option to specify the number of pixels per
3682 inch. The default is 96dpi.
3683- The `%` unit is generally relative to some available space.
3684 For example the above example will render to
3685 `<img href="file.jpg" style="width: 50%;" />` (HTML),
3686 `\includegraphics[width=0.5\textwidth]{file.jpg}` (LaTeX), or
3687 `\externalfigure[file.jpg][width=0.5\textwidth]` (ConTeXt).
3688- Some output formats have a notion of a class
3689 ([ConTeXt](http://wiki.contextgarden.net/Using_Graphics#Multiple_Image_Settings))
3690 or a unique identifier (LaTeX `\caption`), or both (HTML).
3691- When no `width` or `height` attributes are specified, the fallback
3692 is to look at the image resolution and the dpi metadata embedded in
3698Using the `native_divs` and `native_spans` extensions
3699(see [above][Extension: `native_divs`]), HTML syntax can
3700be used as part of markdown to create native `Div` and `Span`
3701elements in the pandoc AST (as opposed to raw HTML).
3702However, there is also nicer syntax available:
3704#### Extension: `fenced_divs` ####
3706Allow special fenced syntax for native `Div` blocks. A Div
3707starts with a fence containing at least three consecutive
3708colons plus some attributes. The attributes may optionally
3709be followed by another string of consecutive colons.
3710The attribute syntax is exactly as in fenced code blocks (see
3711[Extension: `fenced_code_attributes`]). As with fenced
3712code blocks, one can use either attributes in curly braces
3713or a single unbraced word, which will be treated as a class
3714name. The Div ends with another line containing a string of at
3715least three consecutive colons. The fenced Div should be
3716separated by blank lines from preceding and following blocks.
3720 ::::: {#special .sidebar}
3721 Here is a paragraph.
3726Fenced divs can be nested. Opening fences are distinguished
3727because they *must* have attributes:
3733 This is a warning within a warning.
3737Fences without attributes are always closing fences. Unlike
3738with fenced code blocks, the number of colons in the closing
3739fence need not match the number in the opening fence. However,
3740it can be helpful for visual clarity to use fences of different
3741lengths to distinguish nested divs from their parents.
3744#### Extension: `bracketed_spans` ####
3746A bracketed sequence of inlines, as one would use to begin
3747a link, will be treated as a `Span` with attributes if it is
3748followed immediately by attributes:
3750 [This is *some text*]{.class key="val"}
3755#### Extension: `footnotes` ####
3757Pandoc's Markdown allows footnotes, using the following syntax:
3759 Here is a footnote reference,[^1] and another.[^longnote]
3761 [^1]: Here is the footnote.
3763 [^longnote]: Here's one with multiple blocks.
3765 Subsequent paragraphs are indented to show that they
3766 belong to the previous footnote.
3770 The whole paragraph can be indented, or just the first
3771 line. In this way, multi-paragraph footnotes work like
3772 multi-paragraph list items.
3774 This paragraph won't be part of the note, because it
3777The identifiers in footnote references may not contain spaces, tabs,
3778or newlines. These identifiers are used only to correlate the
3779footnote reference with the note itself; in the output, footnotes
3780will be numbered sequentially.
3782The footnotes themselves need not be placed at the end of the
3783document. They may appear anywhere except inside other block elements
3784(lists, block quotes, tables, etc.). Each footnote should be
3785separated from surrounding content (including other footnotes)
3788#### Extension: `inline_notes` ####
3790Inline footnotes are also allowed (though, unlike regular notes,
3791they cannot contain multiple paragraphs). The syntax is as follows:
3793 Here is an inline note.^[Inlines notes are easier to write, since
3794 you don't have to pick an identifier and move down to type the
3797Inline and regular footnotes may be mixed freely.
3802#### Extension: `citations` ####
3804Using an external filter, `pandoc-citeproc`, pandoc can automatically generate
3805citations and a bibliography in a number of styles. Basic usage is
3807 pandoc --filter pandoc-citeproc myinput.txt
3809In order to use this feature, you will need to specify a bibliography file
3810using the `bibliography` metadata field in a YAML metadata section, or
3811`--bibliography` command line argument. You can supply multiple `--bibliography`
3812arguments or set `bibliography` metadata field to YAML array, if you want to
3813use multiple bibliography files. The bibliography may have any of these
3816 Format File extension
3817 ------------ --------------
3830Note that `.bib` can be used with both BibTeX and BibLaTeX files;
3831use `.bibtex` to force BibTeX.
3833Note that `pandoc-citeproc --bib2json` and `pandoc-citeproc --bib2yaml`
3834can produce `.json` and `.yaml` files from any of the supported formats.
3836In-field markup: In BibTeX and BibLaTeX databases, pandoc-citeproc parses
3837a subset of LaTeX markup; in CSL YAML databases, pandoc Markdown; and in CSL JSON databases, an [HTML-like markup][CSL markup specs]:
3845`<span style="font-variant:small-caps;">...</span>` or `<sc>...</sc>`
3854`<span class="nocase">...</span>`
3855: prevent a phrase from being capitalized as title case
3857`pandoc-citeproc -j` and `-y` interconvert the CSL JSON
3858and CSL YAML formats as far as possible.
3860As an alternative to specifying a bibliography file using `--bibliography`
3861or the YAML metadata field `bibliography`, you can include
3862the citation data directly in the `references` field of the
3863document's YAML metadata. The field should contain an array of
3864YAML-encoded references, for example:
3868 - type: article-journal
3880 title: 'Molecular structure of nucleic acids: a structure for deoxyribose
3882 title-short: Molecular structure of nucleic acids
3883 container-title: Nature
3887 DOI: 10.1038/171737a0
3888 URL: http://www.nature.com/nature/journal/v171/n4356/abs/171737a0.html
3892(`pandoc-citeproc --bib2yaml` can produce these from a bibliography file in one
3893of the supported formats.)
3895Citations and references can be formatted using any style supported by the
3896[Citation Style Language], listed in the [Zotero Style Repository].
3897These files are specified using the `--csl` option or the `csl` metadata field.
3898By default, `pandoc-citeproc` will use the [Chicago Manual of Style] author-date
3899format. The CSL project provides further information on [finding and editing styles].
3901To make your citations hyperlinks to the corresponding bibliography
3902entries, add `link-citations: true` to your YAML metadata.
3904Citations go inside square brackets and are separated by semicolons.
3905Each citation must have a key, composed of '@' + the citation
3906identifier from the database, and may optionally have a prefix,
3907a locator, and a suffix. The citation key must begin with a letter, digit,
3908or `_`, and may contain alphanumerics, `_`, and internal punctuation
3909characters (`:.#$%&-+?<>~/`). Here are some examples:
3911 Blah blah [see @doe99, pp. 33-35; also @smith04, chap. 1].
3913 Blah blah [@doe99, pp. 33-35, 38-39 and *passim*].
3915 Blah blah [@smith04; @doe99].
3917`pandoc-citeproc` detects locator terms in the [CSL locale files].
3918Either abbreviated or unabbreviated forms are accepted. In the `en-US`
3919locale, locator terms can be written in either singular or plural forms,
3920as `book`, `bk.`/`bks.`; `chapter`, `chap.`/`chaps.`; `column`,
3921`col.`/`cols.`; `figure`, `fig.`/`figs.`; `folio`, `fol.`/`fols.`;
3922`number`, `no.`/`nos.`; `line`, `l.`/`ll.`; `note`, `n.`/`nn.`; `opus`,
3923`op.`/`opp.`; `page`, `p.`/`pp.`; `paragraph`, `para.`/`paras.`; `part`,
3924`pt.`/`pts.`; `section`, `sec.`/`secs.`; `sub verbo`, `s.v.`/`s.vv.`;
3925`verse`, `v.`/`vv.`; `volume`, `vol.`/`vols.`; `¶`/`¶¶`; `§`/`§§`. If no
3926locator term is used, "page" is assumed.
3928A minus sign (`-`) before the `@` will suppress mention of
3929the author in the citation. This can be useful when the
3930author is already mentioned in the text:
3932 Smith says blah [-@smith04].
3934You can also write an in-text citation, as follows:
3938 @smith04 [p. 33] says blah.
3940If the style calls for a list of works cited, it will be placed
3941at the end of the document. Normally, you will want to end your
3942document with an appropriate header:
3948The bibliography will be inserted after this header. Note that
3949the `unnumbered` class will be added to this header, so that the
3950section will not be numbered.
3952If you want to include items in the bibliography without actually
3953citing them in the body text, you can define a dummy `nocite` metadata
3954field and put the citations there:
3963In this example, the document will contain a citation for `item3`
3964only, but the bibliography will contain entries for `item1`, `item2`, and
3967It is possible to create a bibliography with all the citations,
3968whether or not they appear in the document, by using a wildcard:
3975For LaTeX or PDF output, you can also use [`natbib`] or [`biblatex`]
3976to render bibliography. In order to do so, specify bibliography files as
3977outlined above, and add `--natbib` or `--biblatex` argument to `pandoc`
3978invocation. Bear in mind that bibliography files have to be in respective
3979format (either BibTeX or BibLaTeX).
3981For more information, see the [pandoc-citeproc man page].
3983[CSL markup specs]: http://docs.citationstyles.org/en/1.0/release-notes.html#rich-text-markup-within-fields
3984[Chicago Manual of Style]: http://chicagomanualofstyle.org
3985[Citation Style Language]: http://citationstyles.org
3986[Zotero Style Repository]: https://www.zotero.org/styles
3987[finding and editing styles]: https://citationstyles.org/authors/
3988[CSL locale files]: https://github.com/citation-style-language/locales
3989[pandoc-citeproc man page]: https://github.com/jgm/pandoc-citeproc/blob/master/man/pandoc-citeproc.1.md
3991Non-pandoc extensions
3992---------------------
3994The following Markdown syntax extensions are not enabled by default
3995in pandoc, but may be enabled by adding `+EXTENSION` to the format
3996name, where `EXTENSION` is the name of the extension. Thus, for
3997example, `markdown+hard_line_breaks` is Markdown with hard line breaks.
3999#### Extension: `old_dashes` ####
4001Selects the pandoc <= 1.8.2.1 behavior for parsing smart dashes:
4002`-` before a numeral is an en-dash, and `--` is an em-dash.
4003This option only has an effect if `smart` is enabled. It is
4004selected automatically for `textile` input.
4006#### Extension: `angle_brackets_escapable` ####
4008Allow `<` and `>` to be backslash-escaped, as they can be in
4009GitHub flavored Markdown but not original Markdown. This is
4010implied by pandoc's default `all_symbols_escapable`.
4012#### Extension: `lists_without_preceding_blankline` ####
4014Allow a list to occur right after a paragraph, with no intervening
4017#### Extension: `four_space_rule` ####
4019Selects the pandoc <= 2.0 behavior for parsing lists, so that
4020four spaces indent are needed for list item continuation
4023#### Extension: `spaced_reference_links` ####
4025Allow whitespace between the two components of a reference link,
4030#### Extension: `hard_line_breaks` ####
4032Causes all newlines within a paragraph to be interpreted as hard line
4033breaks instead of spaces.
4035#### Extension: `ignore_line_breaks` ####
4037Causes newlines within a paragraph to be ignored, rather than being
4038treated as spaces or as hard line breaks. This option is intended for
4039use with East Asian languages where spaces are not used between words,
4040but text is divided into lines for readability.
4042#### Extension: `east_asian_line_breaks` ####
4044Causes newlines within a paragraph to be ignored, rather than
4045being treated as spaces or as hard line breaks, when they occur
4046between two East Asian wide characters. This is a better choice
4047than `ignore_line_breaks` for texts that include a mix of East
4048Asian wide characters and other characters.
4050#### Extension: `emoji` ####
4052Parses textual emojis like `:smile:` as Unicode emoticons.
4054#### Extension: `tex_math_single_backslash` ####
4056Causes anything between `\(` and `\)` to be interpreted as inline
4057TeX math, and anything between `\[` and `\]` to be interpreted
4058as display TeX math. Note: a drawback of this extension is that
4059it precludes escaping `(` and `[`.
4061#### Extension: `tex_math_double_backslash` ####
4063Causes anything between `\\(` and `\\)` to be interpreted as inline
4064TeX math, and anything between `\\[` and `\\]` to be interpreted
4067#### Extension: `markdown_attribute` ####
4069By default, pandoc interprets material inside block-level tags as Markdown.
4070This extension changes the behavior so that Markdown is only parsed
4071inside block-level tags if the tags have the attribute `markdown=1`.
4073#### Extension: `mmd_title_block` ####
4075Enables a [MultiMarkdown] style title block at the top of
4076the document, for example:
4080 Date: September 1, 2008
4081 Comment: This is a sample mmd title block, with
4082 a field spanning multiple lines.
4084See the MultiMarkdown documentation for details. If `pandoc_title_block` or
4085`yaml_metadata_block` is enabled, it will take precedence over
4088#### Extension: `abbreviations` ####
4090Parses PHP Markdown Extra abbreviation keys, like
4092 *[HTML]: Hypertext Markup Language
4094Note that the pandoc document model does not support
4095abbreviations, so if this extension is enabled, abbreviation keys are
4096simply skipped (as opposed to being parsed as paragraphs).
4098#### Extension: `autolink_bare_uris` ####
4100Makes all absolute URIs into links, even when not surrounded by
4101pointy braces `<...>`.
4103#### Extension: `mmd_link_attributes` ####
4105Parses multimarkdown style key-value attributes on link
4106and image references. This extension should not be confused with the
4107[`link_attributes`](#extension-link_attributes) extension.
4109 This is a reference ![image][ref] with multimarkdown attributes.
4111 [ref]: http://path.to/image "Image title" width=20px height=30px
4112 id=myId class="myClass1 myClass2"
4114#### Extension: `mmd_header_identifiers` ####
4116Parses multimarkdown style header identifiers (in square brackets,
4117after the header but before any trailing `#`s in an ATX header).
4119#### Extension: `compact_definition_lists` ####
4121Activates the definition list syntax of pandoc 1.12.x and earlier.
4122This syntax differs from the one described above under [Definition lists]
4125 - No blank line is required between consecutive items of the
4127 - To get a "tight" or "compact" list, omit space between consecutive
4128 items; the space between a term and its definition does not affect
4130 - Lazy wrapping of paragraphs is not allowed: the entire definition must
4131 be indented four spaces.[^6]
4133[^6]: To see why laziness is incompatible with relaxing the requirement
4134 of a blank line between items, consider the following example:
4141 Is this a single list item with two definitions of "bar," the first of
4142 which is lazily wrapped, or two list items? To remove the ambiguity
4143 we must either disallow lazy wrapping or require a blank line between
4149In addition to pandoc's extended Markdown, the following Markdown
4150variants are supported:
4152`markdown_phpextra` (PHP Markdown Extra)
4153: `footnotes`, `pipe_tables`, `raw_html`, `markdown_attribute`,
4154 `fenced_code_blocks`, `definition_lists`, `intraword_underscores`,
4155 `header_attributes`, `link_attributes`, `abbreviations`,
4156 `shortcut_reference_links`, `spaced_reference_links`.
4158`markdown_github` (deprecated GitHub-Flavored Markdown)
4159: `pipe_tables`, `raw_html`, `fenced_code_blocks`, `gfm_auto_identifiers`,
4160 `ascii_identifiers`, `backtick_code_blocks`, `autolink_bare_uris`,
4161 `space_in_atx_header`, `intraword_underscores`, `strikeout`,
4162 `emoji`, `shortcut_reference_links`, `angle_brackets_escapable`,
4163 `lists_without_preceding_blankline`.
4165`markdown_mmd` (MultiMarkdown)
4166: `pipe_tables`, `raw_html`, `markdown_attribute`, `mmd_link_attributes`,
4167 `tex_math_double_backslash`, `intraword_underscores`,
4168 `mmd_title_block`, `footnotes`, `definition_lists`,
4169 `all_symbols_escapable`, `implicit_header_references`,
4170 `auto_identifiers`, `mmd_header_identifiers`,
4171 `shortcut_reference_links`, `implicit_figures`,
4172 `superscript`, `subscript`, `backtick_code_blocks`,
4173 `spaced_reference_links`, `raw_attribute`.
4175`markdown_strict` (Markdown.pl)
4176: `raw_html`, `shortcut_reference_links`,
4177 `spaced_reference_links`.
4179We also support `commonmark` and `gfm` (GitHub-Flavored Markdown,
4180which is implemented as a set of extensions on `commonmark`).
4182Note, however, that `commonmark` and `gfm` have limited support
4183for extensions. Only those listed below (and `smart` and
4184`raw_tex`) will work. The extensions can, however, all be
4185individually disabled.
4186Also, `raw_tex` only affects `gfm` output, not input.
4188`gfm` (GitHub-Flavored Markdown)
4189: `pipe_tables`, `raw_html`, `fenced_code_blocks`, `auto_identifiers`,
4190 `ascii_identifiers`, `backtick_code_blocks`, `autolink_bare_uris`,
4191 `intraword_underscores`, `strikeout`, `hard_line_breaks`, `emoji`,
4192 `shortcut_reference_links`, `angle_brackets_escapable`.
4194Producing slide shows with pandoc
4195=================================
4197You can use pandoc to produce an HTML + JavaScript slide presentation
4198that can be viewed via a web browser. There are five ways to do this,
4199using [S5], [DZSlides], [Slidy], [Slideous], or [reveal.js].
4200You can also produce a PDF slide show using LaTeX [`beamer`], or
4201slides shows in Microsoft [PowerPoint] format.
4203Here's the Markdown source for a simple slide show, `habits.txt`:
4230 
4237To produce an HTML/JavaScript slide show, simply type
4239 pandoc -t FORMAT -s habits.txt -o habits.html
4241where `FORMAT` is either `s5`, `slidy`, `slideous`, `dzslides`, or `revealjs`.
4243For Slidy, Slideous, reveal.js, and S5, the file produced by pandoc with the
4244`-s/--standalone` option embeds a link to JavaScript and CSS files, which are
4245assumed to be available at the relative path `s5/default` (for S5), `slideous`
4246(for Slideous), `reveal.js` (for reveal.js), or at the Slidy website at
4247`w3.org` (for Slidy). (These paths can be changed by setting the `slidy-url`,
4248`slideous-url`, `revealjs-url`, or `s5-url` variables; see [Variables for slides],
4249above.) For DZSlides, the (relatively short) JavaScript and CSS are included in
4252With all HTML slide formats, the `--self-contained` option can be used to
4253produce a single file that contains all of the data necessary to display the
4254slide show, including linked scripts, stylesheets, images, and videos.
4256To produce a PDF slide show using beamer, type
4258 pandoc -t beamer habits.txt -o habits.pdf
4260Note that a reveal.js slide show can also be converted to a PDF
4261by printing it to a file from the browser.
4263To produce a Powerpoint slide show, type
4265 pandoc habits.txt -o habits.pptx
4267Structuring the slide show
4268--------------------------
4270By default, the *slide level* is the highest header level in
4271the hierarchy that is followed immediately by content, and not another
4272header, somewhere in the document. In the example above, level 1 headers
4273are always followed by level 2 headers, which are followed by content,
4274so 2 is the slide level. This default can be overridden using
4275the `--slide-level` option.
4277The document is carved up into slides according to the following
4280 * A horizontal rule always starts a new slide.
4282 * A header at the slide level always starts a new slide.
4284 * Headers *below* the slide level in the hierarchy create
4285 headers *within* a slide.
4287 * Headers *above* the slide level in the hierarchy create
4288 "title slides," which just contain the section title
4289 and help to break the slide show into sections.
4291 * Content *above* the slide level will not appear in the slide
4294 * A title page is constructed automatically from the document's title
4295 block, if present. (In the case of beamer, this can be disabled
4296 by commenting out some lines in the default template.)
4298These rules are designed to support many different styles of slide show. If
4299you don't care about structuring your slides into sections and subsections,
4300you can just use level 1 headers for all each slide. (In that case, level 1
4301will be the slide level.) But you can also structure the slide show into
4302sections, as in the example above.
4304Note: in reveal.js slide shows, if slide level is 2, a two-dimensional
4305layout will be produced, with level 1 headers building horizontally
4306and level 2 headers building vertically. It is not recommended that
4307you use deeper nesting of section levels with reveal.js.
4312By default, these writers produce lists that display "all at once."
4313If you want your lists to display incrementally (one item at a time),
4314use the `-i` option. If you want a particular list to depart from the
4315default, put it in a `div` block with class `incremental` or
4316`nonincremental`. So, for example, using the `fenced div` syntax, the
4317following would be incremental regardless of the document default:
4335While using `incremental` and `nonincremental` divs are the
4336recommended method of setting incremental lists on a per-case basis,
4337an older method is also supported: putting lists inside a blockquote
4338will depart from the document default (that is, it will display
4339incrementally without the `-i` option and all at once with the `-i`
4345Both methods allow incremental and nonincremental lists to be mixed
4346in a single document.
4351You can add "pauses" within a slide by including a paragraph containing
4352three dots, separated by spaces:
4354 # Slide with a pause
4356 content before the pause
4360 content after the pause
4365You can change the style of HTML slides by putting customized CSS files
4366in `$DATADIR/s5/default` (for S5), `$DATADIR/slidy` (for Slidy),
4367or `$DATADIR/slideous` (for Slideous),
4368where `$DATADIR` is the user data directory (see `--data-dir`, above).
4369The originals may be found in pandoc's system data directory (generally
4370`$CABALDIR/pandoc-VERSION/s5/default`). Pandoc will look there for any
4371files it does not find in the user data directory.
4373For dzslides, the CSS is included in the HTML file itself, and may
4376All [reveal.js configuration options] can be set through variables.
4377For example, themes can be used by setting the `theme` variable:
4381Or you can specify a custom stylesheet using the `--css` option.
4383To style beamer slides, you can specify a `theme`, `colortheme`,
4384`fonttheme`, `innertheme`, and `outertheme`, using the `-V` option:
4386 pandoc -t beamer habits.txt -V theme:Warsaw -o habits.pdf
4388Note that header attributes will turn into slide attributes
4389(on a `<div>` or `<section>`) in HTML slide formats, allowing you
4390to style individual slides. In beamer, the only header attribute
4391that affects slides is the `allowframebreaks` class, which sets the
4392`allowframebreaks` option, causing multiple slides to be created
4393if the content overfills the frame. This is recommended especially for
4396 # References {.allowframebreaks}
4401Speaker notes are supported in reveal.js and PowerPoint (pptx)
4402output. You can add notes to your Markdown document thus:
4408 - It can contain Markdown
4413To show the notes window in reveal.js, press `s` while viewing the
4414presentation. Speaker notes in PowerPoint will be available, as usual,
4415in handouts and presenter view.
4417Notes are not yet supported for other slide formats, but the notes
4418will not appear on the slides themselves.
4423To put material in side by side columns, you can use a native
4424div container with class `columns`, containing two or more div
4425containers with class `column` and a `width` attribute:
4427 :::::::::::::: {.columns}
4428 ::: {.column width="40%"}
4431 ::: {.column width="60%"}
4436Frame attributes in beamer
4437--------------------------
4439Sometimes it is necessary to add the LaTeX `[fragile]` option to
4440a frame in beamer (for example, when using the `minted` environment).
4441This can be forced by adding the `fragile` class to the header
4442introducing the slide:
4444 # Fragile slide {.fragile}
4446All of the other frame attributes described in Section 8.1 of
4447the [Beamer User's Guide] may also be used: `allowdisplaybreaks`,
4448`allowframebreaks`, `b`, `c`, `t`, `environment`, `label`, `plain`,
4449`shrink`, `standout`, `noframenumbering`.
4451Background in reveal.js
4452-----------------------
4454Background images can be added to self-contained reveal.js slideshows.
4456For the same image on every slide, use the reveal.js configuration
4457option `parallaxBackgroundImage` either in the YAML metadata block
4458or as a command-line variable. You can also set
4459`parallaxBackgroundHorizontal` and `parallaxBackgroundVertical` the same
4460way and must also set `parallaxBackgroundSize` to have your values
4463To set an image for a particular slide, add
4464`{data-background-image="/path/to/image"}`
4465to the first slide-level header on the slide (which may even be empty).
4467In reveal.js's overview mode, the parallaxBackgroundImage will show up
4468only on the first slide.
4470Other background settings also work on individual slides, including
4471`data-background-size`, `data-background-repeat`, `data-background-color`,
4472`data-transition`, and `data-transition-speed`.
4475documentation](https://github.com/hakimel/reveal.js#slide-backgrounds)
4483parallaxBackgroundImage: /path/to/my/background_image.png
4488Slide 1 has background_image.png as its background.
4490## {data-background-image="/path/to/special_image.jpg"}
4492Slide 2 has a special image for its background, even though the header has no content.
4495Creating EPUBs with pandoc
4496==========================
4501EPUB metadata may be specified using the `--epub-metadata` option, but
4502if the source document is Markdown, it is better to use a [YAML metadata
4503block][Extension: `yaml_metadata_block`]. Here is an example:
4510 text: An investigation of metadata
4518 text: doi:10.234234.234/33
4520 rights: © 2007 John Smith, CC BY-NC
4525The following fields are recognized:
4528 ~ Either a string value or an object with fields `text` and
4529 `scheme`. Valid values for `scheme` are `ISBN-10`,
4530 `GTIN-13`, `UPC`, `ISMN-10`, `DOI`, `LCCN`, `GTIN-14`,
4531 `ISBN-13`, `Legal deposit number`, `URN`, `OCLC`,
4532 `ISMN-13`, `ISBN-A`, `JP`, `OLCC`.
4535 ~ Either a string value, or an object with fields `file-as` and
4536 `type`, or a list of such objects. Valid values for `type` are
4537 `main`, `subtitle`, `short`, `collection`, `edition`, `extended`.
4540 ~ Either a string value, or an object with fields `role`, `file-as`,
4541 and `text`, or a list of such objects. Valid values for `role` are
4542 [MARC relators], but
4543 pandoc will attempt to translate the human-readable versions
4544 (like "author" and "editor") to the appropriate marc relators.
4547 ~ Same format as `creator`.
4550 ~ A string value in `YYYY-MM-DD` format. (Only the year is necessary.)
4551 Pandoc will attempt to convert other common date formats.
4553`lang` (or legacy: `language`)
4554 ~ A string value in [BCP 47] format. Pandoc will default to the local
4555 language if nothing is specified.
4558 ~ A string value or a list of such values.
4579 ~ A string value (path to cover image).
4582 ~ A string value (path to CSS stylesheet).
4584`page-progression-direction`
4585 ~ Either `ltr` or `rtl`. Specifies the `page-progression-direction`
4586 attribute for the [`spine` element].
4589 ~ iBooks-specific metadata, with the following fields:
4591 - `version`: (string)
4592 - `specified-fonts`: `true`|`false` (default `false`)
4593 - `ipad-orientation-lock`: `portrait-only`|`landscape-only`
4594 - `iphone-orientation-lock`: `portrait-only`|`landscape-only`
4595 - `binding`: `true`|`false` (default `true`)
4596 - `scroll-axis`: `vertical`|`horizontal`|`default`
4598[MARC relators]: http://loc.gov/marc/relators/relaterm.html
4599[`spine` element]: http://idpf.org/epub/301/spec/epub-publications.html#sec-spine-elem
4604By default, pandoc will download media referenced from any `<img>`, `<audio>`,
4605`<video>` or `<source>` element present in the generated EPUB,
4606and include it in the EPUB container, yielding a completely
4607self-contained EPUB. If you want to link to external media resources
4608instead, use raw HTML in your source and add `data-external="1"` to the tag
4609with the `src` attribute. For example:
4611 <audio controls="1">
4612 <source src="http://example.com/music/toccata.mp3"
4613 data-external="1" type="audio/mpeg">
4620Pandoc will automatically highlight syntax in [fenced code blocks] that
4621are marked with a language name. The Haskell library [skylighting] is
4622used for highlighting, which works in HTML, Docx, Ms, and LaTeX/PDF output.
4623To see a list of language names that pandoc will recognize, type
4624`pandoc --list-highlight-languages`.
4626The color scheme can be selected using the `--highlight-style` option.
4627The default color scheme is `pygments`, which imitates the default color
4628scheme used by the Python library pygments (though pygments is not actually
4629used to do the highlighting). To see a list of highlight styles,
4630type `pandoc --list-highlight-styles`.
4632To disable highlighting, use the `--no-highlight` option.
4634[skylighting]: https://github.com/jgm/skylighting
4636Custom Styles in Docx
4637=====================
4642The docx reader, by default, only reads those styles that it can
4643convert into pandoc elements, either by direct conversion or
4644interpreting the derivation of the input document's styles.
4646By enabling the [`styles` extension](#ext-styles) in the docx reader
4647(`-f docx+styles`), you can produce output that maintains the styles
4648of the input document, using the `custom-style` class. Paragraph
4649styles are interpreted as divs, while character styles are interpreted
4652For example, using the `custom-style-reference.docx` file in the test
4653directory, we have the following different outputs:
4655Without the `+styles` extension:
4657 $ pandoc test/docx/custom-style-reference.docx -f docx -t markdown
4660 This is text with an *emphasized* text style. And this is text with a
4661 **strengthened** text style.
4663 > Here is a styled paragraph that inherits from Block Text.
4665And with the extension:
4667 $ pandoc test/docx/custom-style-reference.docx -f docx+styles -t markdown
4669 ::: {custom-style="FirstParagraph"}
4673 ::: {custom-style="BodyText"}
4674 This is text with an [emphasized]{custom-style="Emphatic"} text style.
4675 And this is text with a [strengthened]{custom-style="Strengthened"}
4679 ::: {custom-style="MyBlockStyle"}
4680 > Here is a styled paragraph that inherits from Block Text.
4683With these custom styles, you can use your input document as a
4684reference-doc while creating docx output (see below), and maintain the
4685same styles in your input and output files.
4690By default, pandoc's docx output applies a predefined set of styles for
4691blocks such as paragraphs and block quotes, and uses largely default
4692formatting (italics, bold) for inlines. This will work for most
4693purposes, especially alongside a `reference.docx` file. However, if you
4694need to apply your own styles to blocks, or match a preexisting set of
4695styles, pandoc allows you to define custom styles for blocks and text
4696using `div`s and `span`s, respectively.
4698If you define a `div` or `span` with the attribute `custom-style`,
4699pandoc will apply your specified style to the contained elements. So,
4700for example using the `bracketed_spans` syntax,
4702 [Get out]{custom-style="Emphatically"}, he said.
4704would produce a docx file with "Get out" styled with character
4705style `Emphatically`. Similarly, using the `fenced_divs` syntax,
4707 Dickinson starts the poem simply:
4709 ::: {custom-style="Poetry"}
4710 | A Bird came down the Walk---
4711 | He did not know I saw---
4714would style the two contained lines with the `Poetry` paragraph style.
4716If the styles are not yet in your reference.docx, they will be defined
4717in the output file as inheriting from normal text. If they are already
4718defined, pandoc will not alter the definition.
4720This feature allows for greatest customization in conjunction with
4721[pandoc filters]. If you want all paragraphs after block quotes to be
4722indented, you can write a filter to apply the styles necessary. If you
4723want all italics to be transformed to the `Emphasis` character style
4724(perhaps to change their color), you can write a filter which will
4725transform all italicized inlines to inlines within an `Emphasis`
4728[pandoc filters]: http://pandoc.org/filters.html
4733Pandoc can be extended with custom writers written in [lua]. (Pandoc
4734includes a lua interpreter, so lua need not be installed separately.)
4736To use a custom writer, simply specify the path to the lua script
4737in place of the output format. For example:
4739 pandoc -t data/sample.lua
4741Creating a custom writer requires writing a lua function for each
4742possible element in a pandoc document. To get a documented example
4743which you can modify according to your needs, do
4745 pandoc --print-default-data-file sample.lua
4747[lua]: http://www.lua.org
4752Copyright 2006-2017 John MacFarlane (jgm@berkeley.edu). Released
4753under the [GPL], version 2 or greater. This software carries no
4754warranty of any kind. (See COPYRIGHT for full copyright and
4755warranty notices.) For a full list of contributors, see the file
4756AUTHORS.md in the pandoc source code.
4758[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