git.iko.soy/typeable/pandoc
on 2.2.3 help sign in
typeable/pandoc/MANUAL.txt
4763 lines 165 kB history raw
1% Pandoc User's Guide
2% John MacFarlane
3% August 5, 2018
5Synopsis
6========
8`pandoc` [*options*] [*input-file*]...
10Description
11===========
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.
43Using `pandoc`
44--------------
46If no *input-files* are specified, input is read from *stdin*.
47Output goes to *stdout* by default. For output to a file,
48use the `-o` option:
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
59[Templates] below.
61If multiple input files are given, `pandoc` will concatenate them all (with
62blank lines between them) before parsing. (Use `--file-scope` to parse files
63individually.)
65Specifying formats
66------------------
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
83formats.
85If the input or output format is not specified explicitly, `pandoc`
86will attempt to guess it from the extensions of the filenames.
87Thus, for example,
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.
98Character encoding
99------------------
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/
114Creating a PDF
115--------------
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 `\usepackage{csquotes}` is present in the template or
159included via `/H/--include-in-header`. The [`natbib`],
160[`biblatex`], [`bibtex`], and [`biber`] packages can optionally
161be used for [citation rendering].
163[`amsfonts`]: https://ctan.org/pkg/amsfonts
164[`amsmath`]: https://ctan.org/pkg/amsmath
165[`lm`]: https://ctan.org/pkg/lm
166[`ifxetex`]: https://ctan.org/pkg/ifxetex
167[`ifluatex`]: https://ctan.org/pkg/ifluatex
168[`listings`]: https://ctan.org/pkg/listings
169[`fancyvrb`]: https://ctan.org/pkg/fancyvrb
170[`longtable`]: https://ctan.org/pkg/longtable
171[`booktabs`]: https://ctan.org/pkg/booktabs
172[`graphicx`]: https://ctan.org/pkg/graphicx
173[`grffile`]: https://ctan.org/pkg/grffile
174[`geometry`]: https://ctan.org/pkg/geometry
175[`setspace`]: https://ctan.org/pkg/setspace
176[`xecjk`]: https://ctan.org/pkg/xecjk
177[`hyperref`]: https://ctan.org/pkg/hyperref
178[`ulem`]: https://ctan.org/pkg/ulem
179[`babel`]: https://ctan.org/pkg/babel
180[`bidi`]: https://ctan.org/pkg/bidi
181[`mathspec`]: https://ctan.org/pkg/mathspec
182[`unicode-math`]: https://ctan.org/pkg/unicode-math
183[`polyglossia`]: https://ctan.org/pkg/polyglossia
184[`fontspec`]: https://ctan.org/pkg/fontspec
185[`upquote`]: https://ctan.org/pkg/upquote
186[`microtype`]: https://ctan.org/pkg/microtype
187[`csquotes`]: https://ctan.org/pkg/csquotes
188[`natbib`]: https://ctan.org/pkg/natbib
189[`biblatex`]: https://ctan.org/pkg/biblatex
190[`bibtex`]: https://ctan.org/pkg/bibtex
191[`biber`]: https://ctan.org/pkg/biber
192[TeX Live]: http://www.tug.org/texlive/
193[`wkhtmltopdf`]: https://wkhtmltopdf.org
194[`weasyprint`]: http://weasyprint.org
195[`prince`]: https://www.princexml.com/
197Reading from the Web
198--------------------
200Instead of an input file, an absolute URI may be given. In this case
201pandoc will fetch the content using HTTP:
203 pandoc -f html -t markdown http://www.fsf.org
205It is possible to supply a custom User-Agent string or other
206header when requesting a document from a URL:
208 pandoc -f html -t markdown --request-header User-Agent:"Mozilla/5.0" \
209 http://www.fsf.org
211Options
212=======
214General options
215---------------
217`-f` *FORMAT*, `-r` *FORMAT*, `--from=`*FORMAT*, `--read=`*FORMAT*
219: Specify input format. *FORMAT* can be:
221 ::: {#input-formats}
222 - `commonmark` ([CommonMark] Markdown)
223 - `creole` ([Creole 1.0])
224 - `docbook` ([DocBook])
225 - `docx` ([Word docx])
226 - `epub` ([EPUB])
227 - `fb2` ([FictionBook2] e-book)
228 - `gfm` ([GitHub-Flavored Markdown]),
229 or the deprecated and less accurate `markdown_github`;
230 use [`markdown_github`](#markdown-variants) only
231 if you need extensions not supported in [`gfm`](#markdown-variants).
232 - `haddock` ([Haddock markup])
233 - `html` ([HTML])
234 - `jats` ([JATS] XML)
235 - `json` (JSON version of native AST)
236 - `latex` ([LaTeX])
237 - `markdown` ([Pandoc's Markdown])
238 - `markdown_mmd` ([MultiMarkdown])
239 - `markdown_phpextra` ([PHP Markdown Extra])
240 - `markdown_strict` (original unextended [Markdown])
241 - `mediawiki` ([MediaWiki markup])
242 - `muse` ([Muse])
243 - `native` (native Haskell)
244 - `odt` ([ODT])
245 - `opml` ([OPML])
246 - `org` ([Emacs Org mode])
247 - `rst` ([reStructuredText])
248 - `t2t` ([txt2tags])
249 - `textile` ([Textile])
250 - `tikiwiki` ([TikiWiki markup])
251 - `twiki` ([TWiki markup])
252 - `vimwiki` ([Vimwiki])
253 :::
255 Extensions can be individually enabled or disabled by
256 appending `+EXTENSION` or `-EXTENSION` to the format name.
257 See [Extensions] below, for a list of extensions and
258 their names. See `--list-input-formats` and `--list-extensions`,
259 below.
261`-t` *FORMAT*, `-w` *FORMAT*, `--to=`*FORMAT*, `--write=`*FORMAT*
263: Specify output format. *FORMAT* can be:
265 ::: {#output-formats}
266 - `asciidoc` ([AsciiDoc])
267 - `beamer` ([LaTeX beamer][`beamer`] slide show)
268 - `commonmark` ([CommonMark] Markdown)
269 - `context` ([ConTeXt])
270 - `docbook` or `docbook4` ([DocBook] 4)
271 - `docbook5` (DocBook 5)
272 - `docx` ([Word docx])
273 - `dokuwiki` ([DokuWiki markup])
274 - `epub` or `epub3` ([EPUB] v3 book)
275 - `epub2` (EPUB v2)
276 - `fb2` ([FictionBook2] e-book)
277 - `gfm` ([GitHub-Flavored Markdown]),
278 or the deprecated and less accurate `markdown_github`;
279 use [`markdown_github`](#markdown-variants) only
280 if you need extensions not supported in [`gfm`](#markdown-variants).
281 - `haddock` ([Haddock markup])
282 - `html` or `html5` ([HTML], i.e. [HTML5]/XHTML [polyglot markup])
283 - `html4` ([XHTML] 1.0 Transitional)
284 - `icml` ([InDesign ICML])
285 - `jats` ([JATS] XML)
286 - `json` (JSON version of native AST)
287 - `latex` ([LaTeX])
288 - `man` ([groff man])
289 - `markdown` ([Pandoc's Markdown])
290 - `markdown_mmd` ([MultiMarkdown])
291 - `markdown_phpextra` ([PHP Markdown Extra])
292 - `markdown_strict` (original unextended [Markdown])
293 - `mediawiki` ([MediaWiki markup])
294 - `ms` ([groff ms])
295 - `muse` ([Muse]),
296 - `native` (native Haskell),
297 - `odt` ([OpenOffice text document][ODT])
298 - `opml` ([OPML])
299 - `opendocument` ([OpenDocument])
300 - `org` ([Emacs Org mode])
301 - `plain` (plain text),
302 - `pptx` ([PowerPoint] slide show)
303 - `rst` ([reStructuredText])
304 - `rtf` ([Rich Text Format])
305 - `texinfo` ([GNU Texinfo])
306 - `textile` ([Textile])
307 - `slideous` ([Slideous] HTML and JavaScript slide show)
308 - `slidy` ([Slidy] HTML and JavaScript slide show)
309 - `dzslides` ([DZSlides] HTML5 + JavaScript slide show),
310 - `revealjs` ([reveal.js] HTML5 + JavaScript slide show)
311 - `s5` ([S5] HTML and JavaScript slide show)
312 - `tei` ([TEI Simple])
313 - `zimwiki` ([ZimWiki markup])
314 - the path of a custom lua writer, see [Custom writers] below
315 :::
317 Note that `odt`, `docx`, and `epub` output will not be directed
318 to *stdout* unless forced with `-o -`.
320 Extensions can be individually enabled or
321 disabled by appending `+EXTENSION` or `-EXTENSION` to the format
322 name. See [Extensions] below, for a list of extensions and their
323 names. See `--list-output-formats` and `--list-extensions`, below.
325`-o` *FILE*, `--output=`*FILE*
327: Write output to *FILE* instead of *stdout*. If *FILE* is
328 `-`, output will go to *stdout*, even if a non-textual format
329 (`docx`, `odt`, `epub2`, `epub3`) is specified.
331`--data-dir=`*DIRECTORY*
333: Specify the user data directory to search for pandoc data files.
334 If this option is not specified, the default user data directory
335 will be used. This is, in UNIX:
337 $HOME/.pandoc
339 in Windows XP:
341 C:\Documents And Settings\USERNAME\Application Data\pandoc
343 and in Windows Vista or later:
345 C:\Users\USERNAME\AppData\Roaming\pandoc
347 You can find the default user data directory on your system by
348 looking at the output of `pandoc --version`.
349 A `reference.odt`, `reference.docx`, `epub.css`, `templates`,
350 `slidy`, `slideous`, or `s5` directory
351 placed in this directory will override pandoc's normal defaults.
353`--bash-completion`
355: Generate a bash completion script. To enable bash completion
356 with pandoc, add this to your `.bashrc`:
358 eval "$(pandoc --bash-completion)"
360`--verbose`
362: Give verbose debugging output. Currently this only has an effect
363 with PDF output.
365`--quiet`
367: Suppress warning messages.
369`--fail-if-warnings`
371: Exit with error status if there are any warnings.
373`--log=`*FILE*
375: Write log messages in machine-readable JSON format to
376 *FILE*. All messages above DEBUG level will be written,
377 regardless of verbosity settings (`--verbose`, `--quiet`).
379`--list-input-formats`
381: List supported input formats, one per line.
383`--list-output-formats`
385: List supported output formats, one per line.
387`--list-extensions`[`=`*FORMAT*]
389: List supported extensions, one per line, preceded
390 by a `+` or `-` indicating whether it is enabled by default
391 in *FORMAT*. If *FORMAT* is not specified, defaults for
392 pandoc's Markdown are given.
394`--list-highlight-languages`
396: List supported languages for syntax highlighting, one per
397 line.
399`--list-highlight-styles`
401: List supported styles for syntax highlighting, one per line.
402 See `--highlight-style`.
404`-v`, `--version`
406: Print version.
408`-h`, `--help`
410: Show usage message.
412[Markdown]: http://daringfireball.net/projects/markdown/
413[CommonMark]: http://commonmark.org
414[PHP Markdown Extra]: https://michelf.ca/projects/php-markdown/extra/
415[GitHub-Flavored Markdown]: https://help.github.com/articles/github-flavored-markdown/
416[MultiMarkdown]: http://fletcherpenney.net/multimarkdown/
417[reStructuredText]: http://docutils.sourceforge.net/docs/ref/rst/introduction.html
418[S5]: http://meyerweb.com/eric/tools/s5/
419[Slidy]: http://www.w3.org/Talks/Tools/Slidy/
420[Slideous]: http://goessner.net/articles/slideous/
421[HTML]: http://www.w3.org/html/
422[HTML5]: http://www.w3.org/TR/html5/
423[polyglot markup]: https://www.w3.org/TR/html-polyglot/
424[XHTML]: http://www.w3.org/TR/xhtml1/
425[LaTeX]: http://latex-project.org
426[`beamer`]: https://ctan.org/pkg/beamer
427[Beamer User's Guide]: http://ctan.math.utah.edu/ctan/tex-archive/macros/latex/contrib/beamer/doc/beameruserguide.pdf
428[ConTeXt]: http://www.contextgarden.net/
429[Rich Text Format]: http://en.wikipedia.org/wiki/Rich_Text_Format
430[DocBook]: http://docbook.org
431[JATS]: https://jats.nlm.nih.gov
432[txt2tags]: http://txt2tags.org
433[EPUB]: http://idpf.org/epub
434[OPML]: http://dev.opml.org/spec2.html
435[OpenDocument]: http://opendocument.xml.org
436[ODT]: http://en.wikipedia.org/wiki/OpenDocument
437[Textile]: http://redcloth.org/textile
438[MediaWiki markup]: https://www.mediawiki.org/wiki/Help:Formatting
439[DokuWiki markup]: https://www.dokuwiki.org/dokuwiki
440[ZimWiki markup]: http://zim-wiki.org/manual/Help/Wiki_Syntax.html
441[TWiki markup]: http://twiki.org/cgi-bin/view/TWiki/TextFormattingRules
442[TikiWiki markup]: https://doc.tiki.org/Wiki-Syntax-Text#The_Markup_Language_Wiki-Syntax
443[Haddock markup]: https://www.haskell.org/haddock/doc/html/ch03s08.html
444[Creole 1.0]: http://www.wikicreole.org/wiki/Creole1.0
445[groff man]: http://man7.org/linux/man-pages/man7/groff_man.7.html
446[groff ms]: http://man7.org/linux/man-pages/man7/groff_ms.7.html
447[Haskell]: https://www.haskell.org
448[GNU Texinfo]: http://www.gnu.org/software/texinfo/
449[Emacs Org mode]: http://orgmode.org
450[AsciiDoc]: http://www.methods.co.nz/asciidoc/
451[DZSlides]: http://paulrouget.com/dzslides/
452[Word docx]: https://en.wikipedia.org/wiki/Office_Open_XML
453[PDF]: https://www.adobe.com/pdf/
454[reveal.js]: http://lab.hakim.se/reveal-js/
455[FictionBook2]: http://www.fictionbook.org/index.php/Eng:XML_Schema_Fictionbook_2.1
456[InDesign ICML]: http://wwwimages.adobe.com/www.adobe.com/content/dam/acom/en/devnet/indesign/sdk/cs6/idml/idml-cookbook.pdf
457[TEI Simple]: https://github.com/TEIC/TEI-Simple
458[Muse]: https://amusewiki.org/library/manual
459[PowerPoint]: https://en.wikipedia.org/wiki/Microsoft_PowerPoint
460[Vimwiki]: https://vimwiki.github.io
462Reader options
463--------------
465`--base-header-level=`*NUMBER*
467: Specify the base level for headers (defaults to 1).
469`--strip-empty-paragraphs`
471: *Deprecated. Use the `+empty_paragraphs` extension instead.*
472 Ignore paragraphs with no content. This option is useful
473 for converting word processing documents where users have
474 used empty paragraphs to create inter-paragraph space.
476`--indented-code-classes=`*CLASSES*
478: Specify classes to use for indented code blocks--for example,
479 `perl,numberLines` or `haskell`. Multiple classes may be separated
480 by spaces or commas.
482`--default-image-extension=`*EXTENSION*
484: Specify a default extension to use when image paths/URLs have no
485 extension. This allows you to use the same source for formats that
486 require different kinds of images. Currently this option only affects
487 the Markdown and LaTeX readers.
489`--file-scope`
491: Parse each file individually before combining for multifile
492 documents. This will allow footnotes in different files with the
493 same identifiers to work as expected. If this option is set,
494 footnotes and links will not work across files. Reading binary
495 files (docx, odt, epub) implies `--file-scope`.
497`-F` *PROGRAM*, `--filter=`*PROGRAM*
499: Specify an executable to be used as a filter transforming the
500 pandoc AST after the input is parsed and before the output is
501 written. The executable should read JSON from stdin and write
502 JSON to stdout. The JSON must be formatted like pandoc's own
503 JSON input and output. The name of the output format will be
504 passed to the filter as the first argument. Hence,
506 pandoc --filter ./caps.py -t latex
508 is equivalent to
510 pandoc -t json | ./caps.py latex | pandoc -f json -t latex
512 The latter form may be useful for debugging filters.
514 Filters may be written in any language. `Text.Pandoc.JSON`
515 exports `toJSONFilter` to facilitate writing filters in Haskell.
516 Those who would prefer to write filters in python can use the
517 module [`pandocfilters`], installable from PyPI. There are also
518 pandoc filter libraries in [PHP], [perl], and
519 [JavaScript/node.js].
521 In order of preference, pandoc will look for filters in
523 1. a specified full or relative path (executable or
524 non-executable)
526 2. `$DATADIR/filters` (executable or non-executable)
527 where `$DATADIR` is the user data directory (see
528 `--data-dir`, above).
530 3. `$PATH` (executable only)
532 Filters and lua-filters are applied in the order specified
533 on the command line.
535`--lua-filter=`*SCRIPT*
537: Transform the document in a similar fashion as JSON filters (see
538 `--filter`), but use pandoc's build-in lua filtering system. The given
539 lua script is expected to return a list of lua filters which will be
540 applied in order. Each lua filter must contain element-transforming
541 functions indexed by the name of the AST element on which the filter
542 function should be applied.
544 The `pandoc` lua module provides helper functions for element
545 creation. It is always loaded into the script's lua environment.
547 The following is an example lua script for macro-expansion:
549 function expand_hello_world(inline)
550 if inline.c == '{{helloworld}}' then
551 return pandoc.Emph{ pandoc.Str "Hello, World" }
552 else
553 return inline
554 end
555 end
557 return {{Str = expand_hello_world}}
559 In order of preference, pandoc will look for lua filters in
561 1. a specified full or relative path (executable or
562 non-executable)
564 2. `$DATADIR/filters` (executable or non-executable)
565 where `$DATADIR` is the user data directory (see
566 `--data-dir`, above).
568`-M` *KEY*[`=`*VAL*], `--metadata=`*KEY*[`:`*VAL*]
570: Set the metadata field *KEY* to the value *VAL*. A value specified
571 on the command line overrides a value specified in the document
572 using [YAML metadata blocks][Extension: `yaml_metadata_block`].
573 Values will be parsed as YAML boolean or string values. If no value is
574 specified, the value will be treated as Boolean true. Like
575 `--variable`, `--metadata` causes template variables to be set.
576 But unlike `--variable`, `--metadata` affects the metadata of the
577 underlying document (which is accessible from filters and may be
578 printed in some output formats) and metadata values will be escaped
579 when inserted into the template.
581`-p`, `--preserve-tabs`
583: Preserve tabs instead of converting them to spaces (the default).
584 Note that this will only affect tabs in literal code spans and code
585 blocks; tabs in regular text will be treated as spaces.
587`--tab-stop=`*NUMBER*
589: Specify the number of spaces per tab (default is 4).
591`--track-changes=accept`|`reject`|`all`
593: Specifies what to do with insertions, deletions, and comments
594 produced by the MS Word "Track Changes" feature. `accept` (the
595 default), inserts all insertions, and ignores all
596 deletions. `reject` inserts all deletions and ignores
597 insertions. Both `accept` and `reject` ignore comments. `all` puts
598 in insertions, deletions, and comments, wrapped in spans with
599 `insertion`, `deletion`, `comment-start`, and `comment-end`
600 classes, respectively. The author and time of change is
601 included. `all` is useful for scripting: only accepting changes
602 from a certain reviewer, say, or before a certain date. If a
603 paragraph is inserted or deleted, `track-changes=all` produces a
604 span with the class `paragraph-insertion`/`paragraph-deletion`
605 before the affected paragraph break. This option only affects the
606 docx reader.
608`--extract-media=`*DIR*
610: Extract images and other media contained in or linked from
611 the source document to the path *DIR*, creating it if
612 necessary, and adjust the images references in the document
613 so they point to the extracted files. If the source format is
614 a binary container (docx, epub, or odt), the media is
615 extracted from the container and the original
616 filenames are used. Otherwise the media is read from the
617 file system or downloaded, and new filenames are constructed
618 based on SHA1 hashes of the contents.
620`--abbreviations=`*FILE*
622: Specifies a custom abbreviations file, with abbreviations
623 one to a line. If this option is not specified, pandoc will
624 read the data file `abbreviations` from the user data
625 directory or fall back on a system default. To see the
626 system default, use
627 `pandoc --print-default-data-file=abbreviations`. The only
628 use pandoc makes of this list is in the Markdown reader.
629 Strings ending in a period that are found in this list will
630 be followed by a nonbreaking space, so that the period will
631 not produce sentence-ending space in formats like LaTeX.
633[`pandocfilters`]: https://github.com/jgm/pandocfilters
634[PHP]: https://github.com/vinai/pandocfilters-php
635[perl]: https://metacpan.org/pod/Pandoc::Filter
636[JavaScript/node.js]: https://github.com/mvhenderson/pandoc-filter-node
638General writer options
639----------------------
641`-s`, `--standalone`
643: Produce output with an appropriate header and footer (e.g. a
644 standalone HTML, LaTeX, TEI, or RTF file, not a fragment). This option
645 is set automatically for `pdf`, `epub`, `epub3`, `fb2`, `docx`, and `odt`
646 output. For `native` output, this option causes metadata to
647 be included; otherwise, metadata is suppressed.
649`--template=`*FILE*|*URL*
651: Use the specified file as a custom template for the generated document.
652 Implies `--standalone`. See [Templates], below, for a description
653 of template syntax. If no extension is specified, an extension
654 corresponding to the writer will be added, so that `--template=special`
655 looks for `special.html` for HTML output. If the template is not
656 found, pandoc will search for it in the `templates` subdirectory of
657 the user data directory (see `--data-dir`). If this option is not used,
658 a default template appropriate for the output format will be used (see
659 `-D/--print-default-template`).
661`-V` *KEY*[`=`*VAL*], `--variable=`*KEY*[`:`*VAL*]
663: Set the template variable *KEY* to the value *VAL* when rendering the
664 document in standalone mode. This is generally only useful when the
665 `--template` option is used to specify a custom template, since
666 pandoc automatically sets the variables used in the default
667 templates. If no *VAL* is specified, the key will be given the
668 value `true`.
670`-D` *FORMAT*, `--print-default-template=`*FORMAT*
672: Print the system default template for an output *FORMAT*. (See `-t`
673 for a list of possible *FORMAT*s.) Templates in the user data
674 directory are ignored.
676`--print-default-data-file=`*FILE*
678: Print a system default data file. Files in the user data directory
679 are ignored.
681`--eol=crlf`|`lf`|`native`
683: Manually specify line endings: `crlf` (Windows), `lf`
684 (macOS/Linux/UNIX), or `native` (line endings appropriate
685 to the OS on which pandoc is being run). The default is
686 `native`.
688`--dpi`=*NUMBER*
690: Specify the dpi (dots per inch) value for conversion from pixels
691 to inch/centimeters and vice versa. The default is 96dpi.
692 Technically, the correct term would be ppi (pixels per inch).
694`--wrap=auto`|`none`|`preserve`
696: Determine how text is wrapped in the output (the source
697 code, not the rendered version). With `auto` (the default),
698 pandoc will attempt to wrap lines to the column width specified by
699 `--columns` (default 72). With `none`, pandoc will not wrap
700 lines at all. With `preserve`, pandoc will attempt to
701 preserve the wrapping from the source document (that is,
702 where there are nonsemantic newlines in the source, there
703 will be nonsemantic newlines in the output as well).
704 Automatic wrapping does not currently work in HTML output.
706`--columns=`*NUMBER*
708: Specify length of lines in characters. This affects text wrapping
709 in the generated source code (see `--wrap`). It also affects
710 calculation of column widths for plain text tables (see [Tables] below).
712`--toc`, `--table-of-contents`
714: Include an automatically generated table of contents (or, in
715 the case of `latex`, `context`, `docx`, `odt`,
716 `opendocument`, `rst`, or `ms`, an instruction to create
717 one) in the output document. This option has no effect
718 unless `-s/--standalone` is used, and it has no effect
719 on `man`, `docbook4`, `docbook5`, or `jats` output.
721`--toc-depth=`*NUMBER*
723: Specify the number of section levels to include in the table
724 of contents. The default is 3 (which means that level 1, 2, and 3
725 headers will be listed in the contents).
727`--strip-comments`
729: Strip out HTML comments in the Markdown or Textile source,
730 rather than passing them on to Markdown, Textile or HTML
731 output as raw HTML. This does not apply to HTML comments
732 inside raw HTML blocks when the `markdown_in_html_blocks`
733 extension is not set.
735`--no-highlight`
737: Disables syntax highlighting for code blocks and inlines, even when
738 a language attribute is given.
740`--highlight-style=`*STYLE*|*FILE*
742: Specifies the coloring style to be used in highlighted source code.
743 Options are `pygments` (the default), `kate`, `monochrome`,
744 `breezeDark`, `espresso`, `zenburn`, `haddock`, and `tango`.
745 For more information on syntax highlighting in pandoc, see
746 [Syntax highlighting], below. See also
747 `--list-highlight-styles`.
749 Instead of a *STYLE* name, a JSON file with extension
750 `.theme` may be supplied. This will be parsed as a KDE
751 syntax highlighting theme and (if valid) used as the
752 highlighting style.
754 To generate the JSON version of an existing style,
755 use `--print-highlight-style`.
757`--print-highlight-style=`*STYLE*|*FILE*
759: Prints a JSON version of a highlighting style, which can
760 be modified, saved with a `.theme` extension, and used
761 with `--highlight-style`.
763`--syntax-definition=`*FILE*
765: Instructs pandoc to load a KDE XML syntax definition file,
766 which will be used for syntax highlighting of appropriately
767 marked code blocks. This can be used to add support for
768 new languages or to use altered syntax definitions for
769 existing languages.
771`-H` *FILE*, `--include-in-header=`*FILE*
773: Include contents of *FILE*, verbatim, at the end of the header.
774 This can be used, for example, to include special
775 CSS or JavaScript in HTML documents. This option can be used
776 repeatedly to include multiple files in the header. They will be
777 included in the order specified. Implies `--standalone`.
779`-B` *FILE*, `--include-before-body=`*FILE*
781: Include contents of *FILE*, verbatim, at the beginning of the
782 document body (e.g. after the `<body>` tag in HTML, or the
783 `\begin{document}` command in LaTeX). This can be used to include
784 navigation bars or banners in HTML documents. This option can be
785 used repeatedly to include multiple files. They will be included in
786 the order specified. Implies `--standalone`.
788`-A` *FILE*, `--include-after-body=`*FILE*
790: Include contents of *FILE*, verbatim, at the end of the document
791 body (before the `</body>` tag in HTML, or the
792 `\end{document}` command in LaTeX). This option can be used
793 repeatedly to include multiple files. They will be included in the
794 order specified. Implies `--standalone`.
796`--resource-path=`*SEARCHPATH*
798: List of paths to search for images and other resources.
799 The paths should be separated by `:` on Linux, UNIX, and
800 macOS systems, and by `;` on Windows. If `--resource-path`
801 is not specified, the default resource path is the working
802 directory. Note that, if `--resource-path` is specified,
803 the working directory must be explicitly listed or it
804 will not be searched. For example:
805 `--resource-path=.:test` will search the working directory
806 and the `test` subdirectory, in that order.
808`--request-header=`*NAME*`:`*VAL*
810: Set the request header *NAME* to the value *VAL* when making
811 HTTP requests (for example, when a URL is given on the
812 command line, or when resources used in a document must be
813 downloaded). If you're behind a proxy, you also need to set
814 the environment variable `http_proxy` to `http://...`.
816Options affecting specific writers
817----------------------------------
819`--self-contained`
821: Produce a standalone HTML file with no external dependencies, using
822 `data:` URIs to incorporate the contents of linked scripts, stylesheets,
823 images, and videos. Implies `--standalone`. The resulting file should be
824 "self-contained," in the sense that it needs no external files and no net
825 access to be displayed properly by a browser. This option works only with
826 HTML output formats, including `html4`, `html5`, `html+lhs`, `html5+lhs`,
827 `s5`, `slidy`, `slideous`, `dzslides`, and `revealjs`. Scripts, images,
828 and stylesheets at absolute URLs will be downloaded; those at relative
829 URLs will be sought relative to the working directory (if the first source
830 file is local) or relative to the base URL (if the first source
831 file is remote). Elements with the attribute
832 `data-external="1"` will be left alone; the documents they
833 link to will not be incorporated in the document.
834 Limitation: resources that are loaded dynamically through
835 JavaScript cannot be incorporated; as a result,
836 `--self-contained` does not work with `--mathjax`, and some
837 advanced features (e.g. zoom or speaker notes) may not work
838 in an offline "self-contained" `reveal.js` slide show.
840`--html-q-tags`
842: Use `<q>` tags for quotes in HTML.
844`--ascii`
846: Use only ASCII characters in output. Currently supported for
847 XML and HTML formats (which use numerical entities instead of
848 UTF-8 when this option is selected) and for groff ms and man
849 (which use hexadecimal escapes).
851`--reference-links`
853: Use reference-style links, rather than inline links, in writing Markdown
854 or reStructuredText. By default inline links are used. The
855 placement of link references is affected by the
856 `--reference-location` option.
858`--reference-location = block`|`section`|`document`
860: Specify whether footnotes (and references, if `reference-links` is
861 set) are placed at the end of the current (top-level) block, the
862 current section, or the document. The default is
863 `document`. Currently only affects the markdown writer.
865`--atx-headers`
867: Use ATX-style headers in Markdown and AsciiDoc output. The default is
868 to use setext-style headers for levels 1-2, and then ATX headers.
869 (Note: for `gfm` output, ATX headers are always used.)
871`--top-level-division=[default|section|chapter|part]`
873: Treat top-level headers as the given division type in LaTeX, ConTeXt,
874 DocBook, and TEI output. The hierarchy order is part, chapter, then section;
875 all headers are shifted such that the top-level header becomes the specified
876 type. The default behavior is to determine the best division type via
877 heuristics: unless other conditions apply, `section` is chosen. When the
878 LaTeX document class is set to `report`, `book`, or `memoir` (unless the
879 `article` option is specified), `chapter` is implied as the setting for this
880 option. If `beamer` is the output format, specifying either `chapter` or
881 `part` will cause top-level headers to become `\part{..}`, while
882 second-level headers remain as their default type.
884`-N`, `--number-sections`
886: Number section headings in LaTeX, ConTeXt, HTML, or EPUB output.
887 By default, sections are not numbered. Sections with class
888 `unnumbered` will never be numbered, even if `--number-sections`
889 is specified.
891`--number-offset=`*NUMBER*[`,`*NUMBER*`,`*...*]
893: Offset for section headings in HTML output (ignored in other
894 output formats). The first number is added to the section number for
895 top-level headers, the second for second-level headers, and so on.
896 So, for example, if you want the first top-level header in your
897 document to be numbered "6", specify `--number-offset=5`.
898 If your document starts with a level-2 header which you want to
899 be numbered "1.5", specify `--number-offset=1,4`.
900 Offsets are 0 by default. Implies `--number-sections`.
902`--listings`
904: Use the [`listings`] package for LaTeX code blocks
906`-i`, `--incremental`
908: Make list items in slide shows display incrementally (one by one).
909 The default is for lists to be displayed all at once.
911`--slide-level=`*NUMBER*
913: Specifies that headers with the specified level create
914 slides (for `beamer`, `s5`, `slidy`, `slideous`, `dzslides`). Headers
915 above this level in the hierarchy are used to divide the
916 slide show into sections; headers below this level create
917 subheads within a slide. Note that content that is
918 not contained under slide-level headers will not appear in
919 the slide show. The default is to set the slide level based
920 on the contents of the document; see [Structuring the slide
921 show].
923`--section-divs`
925: Wrap sections in `<section>` tags (or `<div>` tags for `html4`),
926 and attach identifiers to the enclosing `<section>` (or `<div>`)
927 rather than the header itself. See
928 [Header identifiers], below.
930`--email-obfuscation=none`|`javascript`|`references`
932: Specify a method for obfuscating `mailto:` links in HTML documents.
933 `none` leaves `mailto:` links as they are. `javascript` obfuscates
934 them using JavaScript. `references` obfuscates them by printing their
935 letters as decimal or hexadecimal character references. The default
936 is `none`.
938`--id-prefix=`*STRING*
940: Specify a prefix to be added to all identifiers and internal links
941 in HTML and DocBook output, and to footnote numbers in Markdown
942 and Haddock output. This is useful for preventing duplicate
943 identifiers when generating fragments to be included in other pages.
945`-T` *STRING*, `--title-prefix=`*STRING*
947: Specify *STRING* as a prefix at the beginning of the title
948 that appears in the HTML header (but not in the title as it
949 appears at the beginning of the HTML body). Implies
950 `--standalone`.
952`-c` *URL*, `--css=`*URL*
954: Link to a CSS style sheet. This option can be used repeatedly to
955 include multiple files. They will be included in the order specified.
957 A stylesheet is required for generating EPUB. If none is
958 provided using this option (or the `stylesheet` metadata
959 field), pandoc will look for a file `epub.css` in the
960 user data directory (see `--data-dir`). If it is not
961 found there, sensible defaults will be used.
963`--reference-doc=`*FILE*
965: Use the specified file as a style reference in producing a
966 docx or ODT file.
968 Docx
970 : For best results, the reference docx should be a modified
971 version of a docx file produced using pandoc. The contents
972 of the reference docx are ignored, but its stylesheets and
973 document properties (including margins, page size, header,
974 and footer) are used in the new docx. If no reference docx
975 is specified on the command line, pandoc will look for a
976 file `reference.docx` in the user data directory (see
977 `--data-dir`). If this is not found either, sensible
978 defaults will be used.
980 To produce a custom `reference.docx`, first get a copy of
981 the default `reference.docx`: `pandoc
982 --print-default-data-file reference.docx >
983 custom-reference.docx`. Then open `custom-reference.docx`
984 in Word, modify the styles as you wish, and save the file.
985 For best results, do not make changes to this file other
986 than modifying the styles used by pandoc: [paragraph]
987 Normal, Body Text, First Paragraph, Compact, Title,
988 Subtitle, Author, Date, Abstract, Bibliography, Heading 1,
989 Heading 2, Heading 3, Heading 4, Heading 5, Heading 6,
990 Heading 7, Heading 8, Heading 9, Block Text, Footnote Text,
991 Definition Term, Definition, Caption, Table Caption,
992 Image Caption, Figure, Captioned Figure, TOC Heading;
993 [character] Default Paragraph Font, Body Text Char,
994 Verbatim Char, Footnote Reference, Hyperlink; [table]
995 Table.
997 ODT
999 : For best results, the reference ODT should be a modified
1000 version of an ODT produced using pandoc. The contents of
1001 the reference ODT are ignored, but its stylesheets are used
1002 in the new ODT. If no reference ODT is specified on the
1003 command line, pandoc will look for a file `reference.odt` in
1004 the user data directory (see `--data-dir`). If this is not
1005 found either, sensible defaults will be used.
1007 To produce a custom `reference.odt`, first get a copy of
1008 the default `reference.odt`: `pandoc
1009 --print-default-data-file reference.odt >
1010 custom-reference.odt`. Then open `custom-reference.odt` in
1011 LibreOffice, modify the styles as you wish, and save the
1012 file.
1014 PowerPoint
1016 : Any template included with a recent install of Microsoft
1017 PowerPoint (either with `.pptx` or `.potx` extension) should
1018 work, as will most templates derived from these.
1020 The specific requirement is that the template should contain
1021 the following four layouts as its first four layouts:
1023 1. Title Slide
1024 2. Title and Content
1025 3. Section Header
1026 4. Two Content
1028 All templates included with a recent version of MS PowerPoint
1029 will fit these criteria. (You can click on `Layout` under the
1030 `Home` menu to check.)
1032 You can also modify the default `reference.pptx`: first run
1033 `pandoc --print-default-data-file reference.pptx >
1034 custom-reference.pptx`, and then modify
1035 `custom-reference.pptx` in MS PowerPoint (pandoc will use the
1036 first four layout slides, as mentioned above).
1038`--epub-cover-image=`*FILE*
1040: Use the specified image as the EPUB cover. It is recommended
1041 that the image be less than 1000px in width and height. Note that
1042 in a Markdown source document you can also specify `cover-image`
1043 in a YAML metadata block (see [EPUB Metadata], below).
1045`--epub-metadata=`*FILE*
1047: Look in the specified XML file for metadata for the EPUB.
1048 The file should contain a series of [Dublin Core elements].
1049 For example:
1051 <dc:rights>Creative Commons</dc:rights>
1052 <dc:language>es-AR</dc:language>
1054 By default, pandoc will include the following metadata elements:
1055 `<dc:title>` (from the document title), `<dc:creator>` (from the
1056 document authors), `<dc:date>` (from the document date, which should
1057 be in [ISO 8601 format]), `<dc:language>` (from the `lang`
1058 variable, or, if is not set, the locale), and `<dc:identifier
1059 id="BookId">` (a randomly generated UUID). Any of these may be
1060 overridden by elements in the metadata file.
1062 Note: if the source document is Markdown, a YAML metadata block
1063 in the document can be used instead. See below under
1064 [EPUB Metadata].
1066`--epub-embed-font=`*FILE*
1068: Embed the specified font in the EPUB. This option can be repeated
1069 to embed multiple fonts. Wildcards can also be used: for example,
1070 `DejaVuSans-*.ttf`. However, if you use wildcards on the command
1071 line, be sure to escape them or put the whole filename in single quotes,
1072 to prevent them from being interpreted by the shell. To use the
1073 embedded fonts, you will need to add declarations like the following
1074 to your CSS (see `--css`):
1076 @font-face {
1077 font-family: DejaVuSans;
1078 font-style: normal;
1079 font-weight: normal;
1080 src:url("DejaVuSans-Regular.ttf");
1082 @font-face {
1083 font-family: DejaVuSans;
1084 font-style: normal;
1085 font-weight: bold;
1086 src:url("DejaVuSans-Bold.ttf");
1088 @font-face {
1089 font-family: DejaVuSans;
1090 font-style: italic;
1091 font-weight: normal;
1092 src:url("DejaVuSans-Oblique.ttf");
1094 @font-face {
1095 font-family: DejaVuSans;
1096 font-style: italic;
1097 font-weight: bold;
1098 src:url("DejaVuSans-BoldOblique.ttf");
1100 body { font-family: "DejaVuSans"; }
1102`--epub-chapter-level=`*NUMBER*
1104: Specify the header level at which to split the EPUB into separate
1105 "chapter" files. The default is to split into chapters at level 1
1106 headers. This option only affects the internal composition of the
1107 EPUB, not the way chapters and sections are displayed to users. Some
1108 readers may be slow if the chapter files are too large, so for large
1109 documents with few level 1 headers, one might want to use a chapter
1110 level of 2 or 3.
1112`--epub-subdirectory=`*DIRNAME*
1114: Specify the subdirectory in the OCF container that is to hold
1115 the EPUB-specific contents. The default is `EPUB`. To put
1116 the EPUB contents in the top level, use an empty string.
1118`--pdf-engine=pdflatex`|`lualatex`|`xelatex`|`wkhtmltopdf`|`weasyprint`|`prince`|`context`|`pdfroff`
1120: Use the specified engine when producing PDF output.
1121 The default is `pdflatex`. If the engine is not in your PATH,
1122 the full path of the engine may be specified here.
1124`--pdf-engine-opt=`*STRING*
1126: Use the given string as a command-line argument to the `pdf-engine`.
1127 If used multiple times, the arguments are provided with spaces between
1128 them. Note that no check for duplicate options is done.
1130[Dublin Core elements]: http://dublincore.org/documents/dces/
1131[ISO 8601 format]: http://www.w3.org/TR/NOTE-datetime
1133Citation rendering
1134------------------
1136`--bibliography=`*FILE*
1138: Set the `bibliography` field in the document's metadata to *FILE*,
1139 overriding any value set in the metadata, and process citations
1140 using `pandoc-citeproc`. (This is equivalent to
1141 `--metadata bibliography=FILE --filter pandoc-citeproc`.)
1142 If `--natbib` or `--biblatex` is also supplied, `pandoc-citeproc` is not
1143 used, making this equivalent to `--metadata bibliography=FILE`.
1144 If you supply this argument multiple times, each *FILE* will be added
1145 to bibliography.
1147`--csl=`*FILE*
1149: Set the `csl` field in the document's metadata to *FILE*,
1150 overriding any value set in the metadata. (This is equivalent to
1151 `--metadata csl=FILE`.)
1152 This option is only relevant with `pandoc-citeproc`.
1154`--citation-abbreviations=`*FILE*
1156: Set the `citation-abbreviations` field in the document's metadata to
1157 *FILE*, overriding any value set in the metadata. (This is equivalent to
1158 `--metadata citation-abbreviations=FILE`.)
1159 This option is only relevant with `pandoc-citeproc`.
1161`--natbib`
1163: Use [`natbib`] for citations in LaTeX output. This option is not for use
1164 with the `pandoc-citeproc` filter or with PDF output. It is intended for
1165 use in producing a LaTeX file that can be processed with [`bibtex`].
1167`--biblatex`
1169: Use [`biblatex`] for citations in LaTeX output. This option is not for use
1170 with the `pandoc-citeproc` filter or with PDF output. It is intended for
1171 use in producing a LaTeX file that can be processed with [`bibtex`] or [`biber`].
1173Math rendering in HTML
1174----------------------
1176The default is to render TeX math as far as possible using Unicode characters.
1177Formulas are put inside a `span` with `class="math"`, so that they may be styled
1178differently from the surrounding text if needed. However, this gives acceptable
1179results only for basic math, usually you will want to use `--mathjax` or another
1180of the following options.
1182`--mathjax`[`=`*URL*]
1184: Use [MathJax] to display embedded TeX math in HTML output.
1185 TeX math will be put between `\(...\)` (for inline math)
1186 or `\[...\]` (for display math) and wrapped in `<span>` tags
1187 with class `math`. Then the MathJax JavaScript will render it.
1188 The *URL* should point to the `MathJax.js` load script.
1189 If a *URL* is not provided, a link to the Cloudflare CDN will
1190 be inserted.
1192`--mathml`
1194: Convert TeX math to [MathML] (in `epub3`, `docbook4`, `docbook5`, `jats`,
1195 `html4` and `html5`). This is the default in `odt` output. Note that
1196 currently only Firefox and Safari (and select e-book readers) natively
1197 support MathML.
1199`--webtex`[`=`*URL*]
1201: Convert TeX formulas to `<img>` tags that link to an external script
1202 that converts formulas to images. The formula will be URL-encoded
1203 and concatenated with the URL provided. For SVG images you can for
1204 example use `--webtex https://latex.codecogs.com/svg.latex?`.
1205 If no URL is specified, the CodeCogs URL generating PNGs
1206 will be used (`https://latex.codecogs.com/png.latex?`).
1207 Note: the `--webtex` option will affect Markdown output
1208 as well as HTML, which is useful if you're targeting a
1209 version of Markdown without native math support.
1211`--katex`[`=`*URL*]
1213: Use [KaTeX] to display embedded TeX math in HTML output.
1214 The *URL* is the base URL for the KaTeX library. If a *URL* is
1215 not provided, a link to the KaTeX CDN will be inserted.
1217`--katex-stylesheet=`*URL*
1219: The *URL* should point to the `katex.css` stylesheet. If this option is
1220 not specified, a link to the KaTeX CDN will be inserted. Note that this
1221 option does not imply `--katex`.
1223`--gladtex`
1225: Enclose TeX math in `<eq>` tags in HTML output. The resulting HTML
1226 can then be processed by [GladTeX] to produce images of the typeset
1227 formulas and an HTML file with links to these images.
1228 So, the procedure is:
1230 pandoc -s --gladtex input.md -o myfile.htex
1231 gladtex -d myfile-images myfile.htex
1232 # produces myfile.html and images in myfile-images
1234[MathML]: http://www.w3.org/Math/
1235[MathJax]: https://www.mathjax.org
1236[KaTeX]: https://github.com/Khan/KaTeX
1237[GladTeX]: http://humenda.github.io/GladTeX/
1239Options for wrapper scripts
1240---------------------------
1242`--dump-args`
1244: Print information about command-line arguments to *stdout*, then exit.
1245 This option is intended primarily for use in wrapper scripts.
1246 The first line of output contains the name of the output file specified
1247 with the `-o` option, or `-` (for *stdout*) if no output file was
1248 specified. The remaining lines contain the command-line arguments,
1249 one per line, in the order they appear. These do not include regular
1250 pandoc options and their arguments, but do include any options appearing
1251 after a `--` separator at the end of the line.
1253`--ignore-args`
1255: Ignore command-line arguments (for use in wrapper scripts).
1256 Regular pandoc options are not ignored. Thus, for example,
1258 pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1
1260 is equivalent to
1262 pandoc -o foo.html -s
1264Templates
1265=========
1267When the `-s/--standalone` option is used, pandoc uses a template to
1268add header and footer material that is needed for a self-standing
1269document. To see the default template that is used, just type
1271 pandoc -D *FORMAT*
1273where *FORMAT* is the name of the output format. A custom template
1274can be specified using the `--template` option. You can also override
1275the system default templates for a given output format *FORMAT*
1276by putting a file `templates/default.*FORMAT*` in the user data
1277directory (see `--data-dir`, above). *Exceptions:*
1279- For `odt` output, customize the `default.opendocument`
1280 template.
1281- For `pdf` output, customize the `default.latex` template
1282 (or the `default.context` template, if you use `-t context`,
1283 or the `default.ms` template, if you use `-t ms`, or the
1284 `default.html` template, if you use `-t html`).
1285- `docx` has no template (however, you can use
1286 `--reference-doc` to customize the output).
1288Templates contain *variables*, which allow for the inclusion of
1289arbitrary information at any point in the file. They may be set at the
1290command line using the `-V/--variable` option. If a variable is not set,
1291pandoc will look for the key in the document's metadata – which can be set
1292using either [YAML metadata blocks][Extension: `yaml_metadata_block`]
1293or with the `--metadata` option.
1295Variables set by pandoc
1296-----------------------
1298Some variables are set automatically by pandoc. These vary somewhat
1299depending on the output format, but include the following:
1301`sourcefile`, `outputfile`
1302: source and destination filenames, as given on the command line.
1303 `sourcefile` can also be a list if input comes from multiple files, or empty
1304 if input is from stdin. You can use the following snippet in your template
1305 to distinguish them:
1307 $if(sourcefile)$
1308 $for(sourcefile)$
1309 $sourcefile$
1310 $endfor$
1311 $else$
1312 (stdin)
1313 $endif$
1315 Similarly, `outputfile` can be `-` if output goes to the terminal.
1317`title`, `author`, `date`
1318: allow identification of basic aspects of the document. Included
1319 in PDF metadata through LaTeX and ConTeXt. These can be set
1320 through a [pandoc title block][Extension: `pandoc_title_block`],
1321 which allows for multiple authors, or through a YAML metadata block:
1323 ---
1324 author:
1325 - Aristotle
1326 - Peter Abelard
1327 ...
1329`subtitle`
1330: document subtitle, included in HTML, EPUB, LaTeX, ConTeXt, and Word docx;
1331 renders in LaTeX only when using a document class that supports
1332 `\subtitle`, such as `beamer` or the [KOMA-Script] series (`scrartcl`,
1333 `scrreprt`, `scrbook`).[^subtitle]
1335`institute`
1336: author affiliations (in LaTeX and Beamer only). Can be a
1337 list, when there are multiple authors.
1339`abstract`
1340: document summary, included in LaTeX, ConTeXt, AsciiDoc, and Word docx
1342`keywords`
1343: list of keywords to be included in HTML, PDF, and AsciiDoc metadata;
1344 may be repeated as for `author`, above
1346`header-includes`
1347: contents specified by `-H/--include-in-header` (may have multiple
1348 values)
1350`toc`
1351: non-null value if `--toc/--table-of-contents` was specified
1353`toc-title`
1354: title of table of contents (works only with EPUB,
1355 opendocument, odt, docx, pptx)
1357`include-before`
1358: contents specified by `-B/--include-before-body` (may have
1359 multiple values)
1361`include-after`
1362: contents specified by `-A/--include-after-body` (may have
1363 multiple values)
1365`body`
1366: body of document
1368`meta-json`
1369: JSON representation of all of the document's metadata. Field
1370 values are transformed to the selected output format.
1372[^subtitle]: To make `subtitle` work with other LaTeX
1373 document classes, you can add the following to `header-includes`:
1375 \providecommand{\subtitle}[1]{%
1376 \usepackage{titling}
1377 \posttitle{%
1378 \par\large#1\end{center}}
1381Language variables
1382------------------
1384`lang`
1385: identifies the main language of the document,
1386 using a code according to [BCP 47] (e.g. `en` or `en-GB`).
1387 For some output formats, pandoc will convert it to an appropriate
1388 format stored in the additional variables `babel-lang`,
1389 `polyglossia-lang` (LaTeX) and `context-lang` (ConTeXt).
1391 Native pandoc Spans and Divs with the lang attribute
1392 (value in BCP 47) can be used to switch the language in
1393 that range. In LaTeX output, `babel-otherlangs` and
1394 `polyglossia-otherlangs` variables will be generated
1395 automatically based on the `lang` attributes of Spans
1396 and Divs in the document.
1398`dir`
1399: the base direction of the document, either `rtl` (right-to-left)
1400 or `ltr` (left-to-right).
1402 For bidirectional documents, native pandoc `span`s and `div`s
1403 with the `dir` attribute (value `rtl` or `ltr`) can be used to
1404 override the base direction in some output formats.
1405 This may not always be necessary if the final renderer
1406 (e.g. the browser, when generating HTML) supports the
1407 [Unicode Bidirectional Algorithm].
1409 When using LaTeX for bidirectional documents, only the `xelatex` engine
1410 is fully supported (use `--pdf-engine=xelatex`).
1412[BCP 47]: https://tools.ietf.org/html/bcp47
1413[Unicode Bidirectional Algorithm]: http://www.w3.org/International/articles/inline-bidi-markup/uba-basics
1415Variables for slides
1416--------------------
1418Variables are available for [producing slide shows with pandoc],
1419including all [reveal.js configuration options].
1421`titlegraphic`
1422: title graphic for Beamer documents
1424`logo`
1425: logo for Beamer documents
1427`slidy-url`
1428: base URL for Slidy documents (defaults to
1429 `https://www.w3.org/Talks/Tools/Slidy2`)
1431`slideous-url`
1432: base URL for Slideous documents (defaults to `slideous`)
1434`s5-url`
1435: base URL for S5 documents (defaults to `s5/default`)
1437`revealjs-url`
1438: base URL for reveal.js documents (defaults to `reveal.js`)
1440`theme`, `colortheme`, `fonttheme`, `innertheme`, `outertheme`
1441: themes for LaTeX [`beamer`] documents
1443`themeoptions`
1444: options for LaTeX beamer themes (a list).
1446`navigation`
1447: controls navigation symbols in `beamer` documents
1448 (default is `empty` for no navigation symbols; other valid values
1449 are `frame`, `vertical`, and `horizontal`).
1451`section-titles`
1452: enables on "title pages" for new sections in `beamer`
1453 documents (default = true).
1455`beamerarticle`
1456: when true, the `beamerarticle` package is loaded (for
1457 producing an article from beamer slides).
1459`aspectratio`
1460: aspect ratio of slides (for beamer only, `1610` for 16:10, `169` for 16:9,
1461 `149` for 14:9, `141` for 1.41:1, `54` for 5:4, `43` for 4:3 which is the
1462 default, and `32` for 3:2).
1464[reveal.js configuration options]: https://github.com/hakimel/reveal.js#configuration
1466Variables for LaTeX
1467-------------------
1469LaTeX variables are used when [creating a PDF].
1471`papersize`
1472: paper size, e.g. `letter`, `a4`
1474`fontsize`
1475: font size for body text (e.g. `10pt`, `12pt`)
1477`documentclass`
1478: document class, e.g. [`article`], [`report`], [`book`], [`memoir`]
1480`classoption`
1481: option for document class, e.g. `oneside`; may be repeated
1482 for multiple options
1484`beameroption`
1485: In beamer, add extra beamer option with `\setbeameroption{}`
1487`geometry`
1488: option for [`geometry`] package, e.g. `margin=1in`;
1489 may be repeated for multiple options
1491`margin-left`, `margin-right`, `margin-top`, `margin-bottom`
1492: sets margins, if `geometry` is not used (otherwise `geometry`
1493 overrides these)
1495`linestretch`
1496: adjusts line spacing using the [`setspace`]
1497 package, e.g. `1.25`, `1.5`
1499`fontfamily`
1500: font package for use with `pdflatex`:
1501 [TeX Live] includes many options, documented in the [LaTeX Font Catalogue].
1502 The default is [Latin Modern][`lm`].
1504`fontfamilyoptions`
1505: options for package used as `fontfamily`: e.g. `osf,sc` with
1506 `fontfamily` set to [`mathpazo`] provides Palatino with old-style
1507 figures and true small caps; may be repeated for multiple options
1509`mainfont`, `sansfont`, `monofont`, `mathfont`, `CJKmainfont`
1510: font families for use with `xelatex` or
1511 `lualatex`: take the name of any system font, using the
1512 [`fontspec`] package. Note that if `CJKmainfont` is used,
1513 the [`xecjk`] package must be available.
1515`mainfontoptions`, `sansfontoptions`, `monofontoptions`, `mathfontoptions`, `CJKoptions`
1516: options to use with `mainfont`, `sansfont`, `monofont`, `mathfont`,
1517 `CJKmainfont` in `xelatex` and `lualatex`. Allow for any choices
1518 available through [`fontspec`], such as the OpenType features
1519 `Numbers=OldStyle,Numbers=Proportional`. May be repeated for multiple options.
1521`fontenc`
1522: allows font encoding to be specified through `fontenc` package (with `pdflatex`);
1523 default is `T1` (see guide to [LaTeX font encodings])
1525`microtypeoptions`
1526: options to pass to the microtype package
1528`colorlinks`
1529: add color to link text; automatically enabled if any of `linkcolor`, `citecolor`,
1530 `urlcolor`, or `toccolor` are set
1532`linkcolor`, `citecolor`, `urlcolor`, `toccolor`
1533: color for internal links, citation links, external links, and links in table of contents:
1534 uses options allowed by [`xcolor`], including the `dvipsnames`, `svgnames`, and `x11names` lists
1536`links-as-notes`
1537: causes links to be printed as footnotes
1539`indent`
1540: uses document class settings for indentation (the default LaTeX template
1541 otherwise removes indentation and adds space between paragraphs)
1543`subparagraph`
1544: disables default behavior of LaTeX template that redefines (sub)paragraphs
1545 as sections, changing the appearance of nested headings in some classes
1547`thanks`
1548: specifies contents of acknowledgments footnote after document title.
1550`toc`
1551: include table of contents (can also be set using `--toc/--table-of-contents`)
1553`toc-depth`
1554: level of section to include in table of contents
1556`secnumdepth`
1557: numbering depth for sections, if sections are numbered
1559`lof`, `lot`
1560: include list of figures, list of tables
1562`bibliography`
1563: bibliography to use for resolving references
1565`biblio-style`
1566: bibliography style, when used with `--natbib` and `--biblatex`.
1568`biblio-title`
1569: bibliography title, when used with `--natbib` and `--biblatex`.
1571`biblatexoptions`
1572: list of options for biblatex.
1574`natbiboptions`
1575: list of options for natbib.
1577`pagestyle`
1578: An option for LaTeX's `\pagestyle{}`. The default article class
1579 supports 'plain' (default), 'empty', and 'headings'; headings puts
1580 section titles in the header.
1582[`article`]: https://ctan.org/pkg/article
1583[`report`]: https://ctan.org/pkg/report
1584[`book`]: https://ctan.org/pkg/book
1585[KOMA-Script]: https://ctan.org/pkg/koma-script
1586[`memoir`]: https://ctan.org/pkg/memoir
1587[`xcolor`]: https://ctan.org/pkg/xcolor
1588[LaTeX Font Catalogue]: http://www.tug.dk/FontCatalogue/
1589[`mathpazo`]: https://ctan.org/pkg/mathpazo
1590[LaTeX font encodings]: https://ctan.org/pkg/encguide
1592Variables for ConTeXt
1593---------------------
1595`papersize`
1596: paper size, e.g. `letter`, `A4`, `landscape` (see [ConTeXt Paper Setup]);
1597 may be repeated for multiple options
1599`layout`
1600: options for page margins and text arrangement (see [ConTeXt Layout]);
1601 may be repeated for multiple options
1603`margin-left`, `margin-right`, `margin-top`, `margin-bottom`
1604: sets margins, if `layout` is not used (otherwise `layout`
1605 overrides these)
1607`fontsize`
1608: font size for body text (e.g. `10pt`, `12pt`)
1610`mainfont`, `sansfont`, `monofont`, `mathfont`
1611: font families: take the name of any system font (see [ConTeXt Font Switching])
1613`linkcolor`, `contrastcolor`
1614: color for links outside and inside a page, e.g. `red`, `blue` (see [ConTeXt Color])
1616`linkstyle`
1617: typeface style for links, e.g. `normal`, `bold`, `slanted`, `boldslanted`, `type`, `cap`, `small`
1619`indenting`
1620: controls indentation of paragraphs, e.g. `yes,small,next` (see [ConTeXt Indentation]);
1621 may be repeated for multiple options
1623`whitespace`
1624: spacing between paragraphs, e.g. `none`, `small` (using [`setupwhitespace`])
1626`interlinespace`
1627: adjusts line spacing, e.g. `4ex` (using [`setupinterlinespace`]);
1628 may be repeated for multiple options
1630`headertext`, `footertext`
1631: text to be placed in running header or footer (see [ConTeXt Headers and Footers]);
1632 may be repeated up to four times for different placement
1634`pagenumbering`
1635: page number style and location (using [`setuppagenumbering`]);
1636 may be repeated for multiple options
1638`toc`
1639: include table of contents (can also be set using `--toc/--table-of-contents`)
1641`lof`, `lot`
1642: include list of figures, list of tables
1644`pdfa`
1645: adds to the preamble the setup necessary to generate PDF/A-1b:2005.
1646 To successfully generate PDF/A the required ICC color profiles have to
1647 be available and the content and all included files (such as images)
1648 have to be standard conforming. The ICC profiles can be obtained
1649 from [ConTeXt ICC Profiles]. See also [ConTeXt PDFA] for more
1650 details.
1652[ConTeXt Paper Setup]: http://wiki.contextgarden.net/PaperSetup
1653[ConTeXt Layout]: http://wiki.contextgarden.net/Layout
1654[ConTeXt Font Switching]: http://wiki.contextgarden.net/Font_Switching
1655[ConTeXt Color]: http://wiki.contextgarden.net/Color
1656[ConTeXt Headers and Footers]: http://wiki.contextgarden.net/Headers_and_Footers
1657[ConTeXt Indentation]: http://wiki.contextgarden.net/Indentation
1658[ConTeXt ICC Profiles]: http://wiki.contextgarden.net/PDFX#ICC_profiles
1659[ConTeXt PDFA]: http://wiki.contextgarden.net/PDF/A
1660[`setupwhitespace`]: http://wiki.contextgarden.net/Command/setupwhitespace
1661[`setupinterlinespace`]: http://wiki.contextgarden.net/Command/setupinterlinespace
1662[`setuppagenumbering`]: http://wiki.contextgarden.net/Command/setuppagenumbering
1664Variables for man pages
1665-----------------------
1667`section`
1668: section number in man pages
1670`header`
1671: header in man pages
1673`footer`
1674: footer in man pages
1676`adjusting`
1677: adjusts text to left (`l`), right (`r`), center (`c`),
1678 or both (`b`) margins
1680`hyphenate`
1681: if `true` (the default), hyphenation will be used
1683Variables for ms
1684----------------
1686`pointsize`
1687: point size (e.g. `10p`)
1689`lineheight`
1690: line height (e.g. `12p`)
1692`fontfamily`
1693: font family (e.g. `T` or `P`)
1695`indent`
1696: paragraph indent (e.g. `2m`)
1698Using variables in templates
1699----------------------------
1701Variable names are sequences of alphanumerics, `-`, and `_`,
1702starting with a letter. A variable name surrounded by `$` signs
1703will be replaced by its value. For example, the string `$title$` in
1705 <title>$title$</title>
1707will be replaced by the document title.
1709To write a literal `$` in a template, use `$$`.
1711Templates may contain conditionals. The syntax is as follows:
1713 $if(variable)$
1715 $else$
1717 $endif$
1719This will include `X` in the template if `variable` has a truthy
1720value; otherwise it will include `Y`. Here a truthy value is any
1721of the following:
1723- a string that is not entirely white space,
1724- a non-empty array where the first value is truthy,
1725- any number (including zero),
1726- any object,
1727- the boolean `true` (to specify the boolean `true`
1728 value using YAML metadata or the `--metadata` flag,
1729 use `true`, `True`, or `TRUE`; with the `--variable`
1730 flag, simply omit a value for the variable, e.g.
1731 `--variable draft`).
1733`X` and `Y` are placeholders for any valid template text,
1734and may include interpolated variables or other conditionals.
1735The `$else$` section may be omitted.
1737When variables can have multiple values (for example, `author` in
1738a multi-author document), you can use the `$for$` keyword:
1740 $for(author)$
1741 <meta name="author" content="$author$" />
1742 $endfor$
1744You can optionally specify a separator to be used between
1745consecutive items:
1747 $for(author)$$author$$sep$, $endfor$
1749A dot can be used to select a field of a variable that takes
1750an object as its value. So, for example:
1752 $author.name$ ($author.affiliation$)
1754If you use custom templates, you may need to revise them as pandoc
1755changes. We recommend tracking the changes in the default templates,
1756and modifying your custom templates accordingly. An easy way to do this
1757is to fork the [pandoc-templates] repository and merge in changes after each
1758pandoc release.
1760Templates may contain comments: anything on a line after `$--`
1761will be treated as a comment and ignored.
1763[pandoc-templates]: https://github.com/jgm/pandoc-templates
1765Extensions
1766==========
1768The behavior of some of the readers and writers can be adjusted by
1769enabling or disabling various extensions.
1771An extension can be enabled by adding `+EXTENSION`
1772to the format name and disabled by adding `-EXTENSION`. For example,
1773`--from markdown_strict+footnotes` is strict Markdown with footnotes
1774enabled, while `--from markdown-footnotes-pipe_tables` is pandoc's
1775Markdown without footnotes or pipe tables.
1777The markdown reader and writer make by far the most use of extensions.
1778Extensions only used by them are therefore covered in the
1779section [Pandoc's Markdown] below (See [Markdown variants] for
1780`commonmark` and `gfm`.) In the following, extensions that also work
1781for other formats are covered.
1783Typography
1784----------
1786#### Extension: `smart` ####
1788Interpret straight quotes as curly quotes, `---` as em-dashes,
1789`--` as en-dashes, and `...` as ellipses. Nonbreaking spaces are
1790inserted after certain abbreviations, such as "Mr."
1792This extension can be enabled/disabled for the following formats:
1794input formats
1795: `markdown`, `commonmark`, `latex`, `mediawiki`, `org`, `rst`, `twiki`
1797output formats
1798: `markdown`, `latex`, `context`, `rst`
1800enabled by default in
1801: `markdown`, `latex`, `context` (both input and output)
1803Note: If you are *writing* Markdown, then the `smart` extension
1804has the reverse effect: what would have been curly quotes comes
1805out straight.
1807In LaTeX, `smart` means to use the standard TeX ligatures
1808for quotation marks (` `` ` and ` '' ` for double quotes,
1809`` ` `` and `` ' `` for single quotes) and dashes (`--` for
1810en-dash and `---` for em-dash). If `smart` is disabled,
1811then in reading LaTeX pandoc will parse these characters
1812literally. In writing LaTeX, enabling `smart` tells pandoc
1813to use the ligatures when possible; if `smart` is disabled
1814pandoc will use unicode quotation mark and dash characters.
1816Headers and sections
1817--------------------
1819#### Extension: `auto_identifiers` ####
1821A header without an explicitly specified identifier will be
1822automatically assigned a unique identifier based on the header text.
1824This extension can be enabled/disabled for the following formats:
1826input formats
1827: `markdown`, `latex`, `rst`, `mediawiki`, `textile`
1829output formats
1830: `markdown`, `muse`
1832enabled by default in
1833: `markdown`, `muse`
1835The algorithm used to derive the identifier from the header text is:
1837 - Remove all formatting, links, etc.
1838 - Remove all footnotes.
1839 - Remove all punctuation, except underscores, hyphens, and periods.
1840 - Replace all spaces and newlines with hyphens.
1841 - Convert all alphabetic characters to lowercase.
1842 - Remove everything up to the first letter (identifiers may
1843 not begin with a number or punctuation mark).
1844 - If nothing is left after this, use the identifier `section`.
1846Thus, for example,
1848 Header Identifier
1849 ------------------------------- ----------------------------
1850 `Header identifiers in HTML` `header-identifiers-in-html`
1851 `*Dogs*?--in *my* house?` `dogs--in-my-house`
1852 `[HTML], [S5], or [RTF]?` `html-s5-or-rtf`
1853 `3. Applications` `applications`
1854 `33` `section`
1856These rules should, in most cases, allow one to determine the identifier
1857from the header text. The exception is when several headers have the
1858same text; in this case, the first will get an identifier as described
1859above; the second will get the same identifier with `-1` appended; the
1860third with `-2`; and so on.
1862These identifiers are used to provide link targets in the table of
1863contents generated by the `--toc|--table-of-contents` option. They
1864also make it easy to provide links from one section of a document to
1865another. A link to this section, for example, might look like this:
1867 See the section on
1868 [header identifiers](#header-identifiers-in-html-latex-and-context).
1870Note, however, that this method of providing links to sections works
1871only in HTML, LaTeX, and ConTeXt formats.
1873If the `--section-divs` option is specified, then each section will
1874be wrapped in a `section` (or a `div`, if `html4` was specified),
1875and the identifier will be attached to the enclosing `<section>`
1876(or `<div>`) tag rather than the header itself. This allows entire
1877sections to be manipulated using JavaScript or treated differently in
1878CSS.
1880#### Extension: `ascii_identifiers` ####
1882Causes the identifiers produced by `auto_identifiers` to be pure ASCII.
1883Accents are stripped off of accented Latin letters, and non-Latin
1884letters are omitted.
1886Math Input
1887----------
1889The extensions [`tex_math_dollars`](#extension-tex_math_dollars),
1890[`tex_math_single_backslash`](#extension-tex_math_single_backslash), and
1891[`tex_math_double_backslash`](#extension-tex_math_double_backslash)
1892are described in the section about Pandoc's Markdown.
1894However, they can also be used with HTML input. This is handy for
1895reading web pages formatted using MathJax, for example.
1897Raw HTML/TeX
1898------------
1900The following extensions (especially how they affect Markdown
1901input/output) are also described in more detail in their respective
1902sections of [Pandoc's Markdown].
1904#### [Extension: `raw_html`] {#raw_html}
1906When converting from HTML, parse elements to raw HTML which are not
1907representable in pandoc's AST.
1908By default, this is disabled for HTML input.
1910#### [Extension: `raw_tex`] {#raw_tex}
1912Allows raw LaTeX, TeX, and ConTeXt to be included in a document.
1914This extension can be enabled/disabled for the following formats
1915(in addition to `markdown`):
1917input formats
1918: `latex`, `org`, `textile`
1920output formats
1921: `textile`, `commonmark`
1923#### [Extension: `native_divs`] {#native_divs}
1925This extension is enabled by default for HTML input. This means that
1926`div`s are parsed to pandoc native elements. (Alternatively, you
1927can parse them to raw HTML using `-f html-native_divs+raw_html`.)
1929When converting HTML to Markdown, for example, you may want to drop all
1930`div`s and `span`s:
1932 pandoc -f html-native_divs-native_spans -t markdown
1934#### [Extension: `native_spans`] {#native_spans}
1936Analogous to `native_divs` above.
1939Literate Haskell support
1940------------------------
1942#### Extension: `literate_haskell` ####
1944Treat the document as literate Haskell source.
1946This extension can be enabled/disabled for the following formats:
1948input formats
1949: `markdown`, `rst`, `latex`
1951output formats
1952: `markdown`, `rst`, `latex`, `html`
1954If you append `+lhs` (or `+literate_haskell`) to one of the formats
1955above, pandoc will treat the document as literate Haskell source.
1956This means that
1958 - In Markdown input, "bird track" sections will be parsed as Haskell
1959 code rather than block quotations. Text between `\begin{code}`
1960 and `\end{code}` will also be treated as Haskell code. For
1961 ATX-style headers the character '=' will be used instead of '#'.
1963 - In Markdown output, code blocks with classes `haskell` and `literate`
1964 will be rendered using bird tracks, and block quotations will be
1965 indented one space, so they will not be treated as Haskell code.
1966 In addition, headers will be rendered setext-style (with underlines)
1967 rather than ATX-style (with '#' characters). (This is because ghc
1968 treats '#' characters in column 1 as introducing line numbers.)
1970 - In restructured text input, "bird track" sections will be parsed
1971 as Haskell code.
1973 - In restructured text output, code blocks with class `haskell` will
1974 be rendered using bird tracks.
1976 - In LaTeX input, text in `code` environments will be parsed as
1977 Haskell code.
1979 - In LaTeX output, code blocks with class `haskell` will be rendered
1980 inside `code` environments.
1982 - In HTML output, code blocks with class `haskell` will be rendered
1983 with class `literatehaskell` and bird tracks.
1985Examples:
1987 pandoc -f markdown+lhs -t html
1989reads literate Haskell source formatted with Markdown conventions and writes
1990ordinary HTML (without bird tracks).
1992 pandoc -f markdown+lhs -t html+lhs
1994writes HTML with the Haskell code in bird tracks, so it can be copied
1995and pasted as literate Haskell source.
1997Note that GHC expects the bird tracks in the first column, so indented
1998literate code blocks (e.g. inside an itemized environment) will not be
1999picked up by the Haskell compiler.
2001Other extensions
2002----------------
2004#### Extension: `empty_paragraphs` ####
2006Allows empty paragraphs. By default empty paragraphs are
2007omitted.
2009This extension can be enabled/disabled for the following formats:
2011input formats
2012: `docx`, `html`
2014output formats
2015: `docx`, `odt`, `opendocument`, `html`
2017#### Extension: `styles` #### {#ext-styles}
2019Read all docx styles as divs (for paragraph styles) and spans (for
2020character styles) regardless of whether pandoc understands the meaning
2021of these styles. This can be used with [docx custom
2022styles](#custom-styles-in-docx). Disabled by default.
2024input formats
2025: `docx`
2027#### Extension: `amuse` ####
2029In the `muse` input format, this enables Text::Amuse
2030extensions to Emacs Muse markup.
2032#### Extension: `citations` {#org-citations}
2034Some aspects of [Pandoc's Markdown citation syntax](#citations) are also accepted
2035in `org` input.
2037#### Extension: `ntb` ####
2039In the `context` output format this enables the use of [Natural Tables
2040(TABLE)](http://wiki.contextgarden.net/TABLE) instead of the default
2041[Extreme Tables (xtables)](http://wiki.contextgarden.net/xtables).
2042Natural tables allow more fine-grained global customization but come
2043at a performance penalty compared to extreme tables.
2046Pandoc's Markdown
2047=================
2049Pandoc understands an extended and slightly revised version of
2050John Gruber's [Markdown] syntax. This document explains the syntax,
2051noting differences from standard Markdown. Except where noted, these
2052differences can be suppressed by using the `markdown_strict` format instead
2053of `markdown`. Extensions can be enabled or disabled to specify the
2054behavior more granularly. They are described in the following. See also
2055[Extensions] above, for extensions that work also on other formats.
2057Philosophy
2058----------
2060Markdown is designed to be easy to write, and, even more importantly,
2061easy to read:
2063> A Markdown-formatted document should be publishable as-is, as plain
2064> text, without looking like it's been marked up with tags or formatting
2065> instructions.
2066> -- [John Gruber](http://daringfireball.net/projects/markdown/syntax#philosophy)
2068This principle has guided pandoc's decisions in finding syntax for
2069tables, footnotes, and other extensions.
2071There is, however, one respect in which pandoc's aims are different
2072from the original aims of Markdown. Whereas Markdown was originally
2073designed with HTML generation in mind, pandoc is designed for multiple
2074output formats. Thus, while pandoc allows the embedding of raw HTML,
2075it discourages it, and provides other, non-HTMLish ways of representing
2076important document elements like definition lists, tables, mathematics, and
2077footnotes.
2079Paragraphs
2080----------
2082A paragraph is one or more lines of text followed by one or more blank lines.
2083Newlines are treated as spaces, so you can reflow your paragraphs as you like.
2084If you need a hard line break, put two or more spaces at the end of a line.
2086#### Extension: `escaped_line_breaks` ####
2088A backslash followed by a newline is also a hard line break.
2089Note: in multiline and grid table cells, this is the only way
2090to create a hard line break, since trailing spaces in the cells
2091are ignored.
2093Headers
2094-------
2096There are two kinds of headers: Setext and ATX.
2098### Setext-style headers ###
2100A setext-style header is a line of text "underlined" with a row of `=` signs
2101(for a level one header) or `-` signs (for a level two header):
2103 A level-one header
2104 ==================
2106 A level-two header
2107 ------------------
2109The header text can contain inline formatting, such as emphasis (see
2110[Inline formatting], below).
2113### ATX-style headers ###
2115An ATX-style header consists of one to six `#` signs and a line of
2116text, optionally followed by any number of `#` signs. The number of
2117`#` signs at the beginning of the line is the header level:
2119 ## A level-two header
2121 ### A level-three header ###
2123As with setext-style headers, the header text can contain formatting:
2125 # A level-one header with a [link](/url) and *emphasis*
2127#### Extension: `blank_before_header` ####
2129Standard Markdown syntax does not require a blank line before a header.
2130Pandoc does require this (except, of course, at the beginning of the
2131document). The reason for the requirement is that it is all too easy for a
2132`#` to end up at the beginning of a line by accident (perhaps through line
2133wrapping). Consider, for example:
2135 I like several of their flavors of ice cream:
2136 #22, for example, and #5.
2138#### Extension: `space_in_atx_header` ####
2140Many Markdown implementations do not require a space between the
2141opening `#`s of an ATX header and the header text, so that
2142`#5 bolt` and `#hashtag` count as headers. With this extension,
2143pandoc does require the space.
2145### Header identifiers ###
2147See also the [`auto_identifiers` extension](#extension-auto_identifiers) above.
2149#### Extension: `header_attributes` ####
2151Headers can be assigned attributes using this syntax at the end
2152of the line containing the header text:
2154 {#identifier .class .class key=value key=value}
2156Thus, for example, the following headers will all be assigned the identifier
2157`foo`:
2159 # My header {#foo}
2161 ## My header ## {#foo}
2163 My other header {#foo}
2164 ---------------
2166(This syntax is compatible with [PHP Markdown Extra].)
2168Note that although this syntax allows assignment of classes and key/value
2169attributes, writers generally don't use all of this information. Identifiers,
2170classes, and key/value attributes are used in HTML and HTML-based formats such
2171as EPUB and slidy. Identifiers are used for labels and link anchors in the
2172LaTeX, ConTeXt, Textile, and AsciiDoc writers.
2174Headers with the class `unnumbered` will not be numbered, even if
2175`--number-sections` is specified. A single hyphen (`-`) in an attribute
2176context is equivalent to `.unnumbered`, and preferable in non-English
2177documents. So,
2179 # My header {-}
2181is just the same as
2183 # My header {.unnumbered}
2185#### Extension: `implicit_header_references` ####
2187Pandoc behaves as if reference links have been defined for each header.
2188So, to link to a header
2190 # Header identifiers in HTML
2192you can simply write
2194 [Header identifiers in HTML]
2198 [Header identifiers in HTML][]
2202 [the section on header identifiers][header identifiers in
2203 HTML]
2205instead of giving the identifier explicitly:
2207 [Header identifiers in HTML](#header-identifiers-in-html)
2209If there are multiple headers with identical text, the corresponding
2210reference will link to the first one only, and you will need to use explicit
2211links to link to the others, as described above.
2213Like regular reference links, these references are case-insensitive.
2215Explicit link reference definitions always take priority over
2216implicit header references. So, in the following example, the
2217link will point to `bar`, not to `#foo`:
2219 # Foo
2221 [foo]: bar
2223 See [foo]
2225Block quotations
2226----------------
2228Markdown uses email conventions for quoting blocks of text.
2229A block quotation is one or more paragraphs or other block elements
2230(such as lists or headers), with each line preceded by a `>` character
2231and an optional space. (The `>` need not start at the left margin, but
2232it should not be indented more than three spaces.)
2234 > This is a block quote. This
2235 > paragraph has two lines.
2237 > 1. This is a list inside a block quote.
2238 > 2. Second item.
2240A "lazy" form, which requires the `>` character only on the first
2241line of each block, is also allowed:
2243 > This is a block quote. This
2244 paragraph has two lines.
2246 > 1. This is a list inside a block quote.
2247 2. Second item.
2249Among the block elements that can be contained in a block quote are
2250other block quotes. That is, block quotes can be nested:
2252 > This is a block quote.
2254 > > A block quote within a block quote.
2256If the `>` character is followed by an optional space, that space
2257will be considered part of the block quote marker and not part of
2258the indentation of the contents. Thus, to put an indented code
2259block in a block quote, you need five spaces after the `>`:
2261 > code
2263#### Extension: `blank_before_blockquote` ####
2265Standard Markdown syntax does not require a blank line before a block
2266quote. Pandoc does require this (except, of course, at the beginning of the
2267document). The reason for the requirement is that it is all too easy for a
2268`>` to end up at the beginning of a line by accident (perhaps through line
2269wrapping). So, unless the `markdown_strict` format is used, the following does
2270not produce a nested block quote in pandoc:
2272 > This is a block quote.
2273 >> Nested.
2276Verbatim (code) blocks
2277----------------------
2279### Indented code blocks ###
2281A block of text indented four spaces (or one tab) is treated as verbatim
2282text: that is, special characters do not trigger special formatting,
2283and all spaces and line breaks are preserved. For example,
2285 if (a > 3) {
2286 moveShip(5 * gravity, DOWN);
2289The initial (four space or one tab) indentation is not considered part
2290of the verbatim text, and is removed in the output.
2292Note: blank lines in the verbatim text need not begin with four spaces.
2295### Fenced code blocks ###
2297#### Extension: `fenced_code_blocks` ####
2299In addition to standard indented code blocks, pandoc supports
2300*fenced* code blocks. These begin with a row of three or more
2301tildes (`~`) and end with a row of tildes that must be at least as long as
2302the starting row. Everything between these lines is treated as code. No
2303indentation is necessary:
2305 ~~~~~~~
2306 if (a > 3) {
2307 moveShip(5 * gravity, DOWN);
2309 ~~~~~~~
2311Like regular code blocks, fenced code blocks must be separated
2312from surrounding text by blank lines.
2314If the code itself contains a row of tildes or backticks, just use a longer
2315row of tildes or backticks at the start and end:
2317 ~~~~~~~~~~~~~~~~
2318 ~~~~~~~~~~
2319 code including tildes
2320 ~~~~~~~~~~
2321 ~~~~~~~~~~~~~~~~
2323#### Extension: `backtick_code_blocks` ####
2325Same as `fenced_code_blocks`, but uses backticks (`` ` ``) instead of tildes
2326(`~`).
2328#### Extension: `fenced_code_attributes` ####
2330Optionally, you may attach attributes to fenced or backtick code block using
2331this syntax:
2333 ~~~~ {#mycode .haskell .numberLines startFrom="100"}
2334 qsort [] = []
2335 qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
2336 qsort (filter (>= x) xs)
2337 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2339Here `mycode` is an identifier, `haskell` and `numberLines` are classes, and
2340`startFrom` is an attribute with value `100`. Some output formats can use this
2341information to do syntax highlighting. Currently, the only output formats
2342that uses this information are HTML, LaTeX, Docx, Ms, and PowerPoint. If
2343highlighting is supported for your output format and language, then the code
2344block above will appear highlighted, with numbered lines. (To see which
2345languages are supported, type `pandoc --list-highlight-languages`.) Otherwise,
2346the code block above will appear as follows:
2348 <pre id="mycode" class="haskell numberLines" startFrom="100">
2349 <code>
2350 ...
2351 </code>
2352 </pre>
2354The `numberLines` (or `number-lines`) class will cause the lines
2355of the code block to be numbered, starting with `1` or the value
2356of the `startFrom` attribute. The `lineAnchors` (or
2357`line-anchors`) class will cause the lines to be clickable
2358anchors in HTML output.
2360A shortcut form can also be used for specifying the language of
2361the code block:
2363 ```haskell
2364 qsort [] = []
2365 ```
2367This is equivalent to:
2369 ``` {.haskell}
2370 qsort [] = []
2371 ```
2373If the `fenced_code_attributes` extension is disabled, but
2374input contains class attribute(s) for the code block, the first
2375class attribute will be printed after the opening fence as a bare
2376word.
2378To prevent all highlighting, use the `--no-highlight` flag.
2379To set the highlighting style, use `--highlight-style`.
2380For more information on highlighting, see [Syntax highlighting],
2381below.
2383Line blocks
2384-----------
2386#### Extension: `line_blocks` ####
2388A line block is a sequence of lines beginning with a vertical bar (`|`)
2389followed by a space. The division into lines will be preserved in
2390the output, as will any leading spaces; otherwise, the lines will
2391be formatted as Markdown. This is useful for verse and addresses:
2393 | The limerick packs laughs anatomical
2394 | In space that is quite economical.
2395 | But the good ones I've seen
2396 | So seldom are clean
2397 | And the clean ones so seldom are comical
2399 | 200 Main St.
2400 | Berkeley, CA 94718
2402The lines can be hard-wrapped if needed, but the continuation
2403line must begin with a space.
2405 | The Right Honorable Most Venerable and Righteous Samuel L.
2406 Constable, Jr.
2407 | 200 Main St.
2408 | Berkeley, CA 94718
2410This syntax is borrowed from [reStructuredText].
2412Lists
2413-----
2415### Bullet lists ###
2417A bullet list is a list of bulleted list items. A bulleted list
2418item begins with a bullet (`*`, `+`, or `-`). Here is a simple
2419example:
2421 * one
2422 * two
2423 * three
2425This will produce a "compact" list. If you want a "loose" list, in which
2426each item is formatted as a paragraph, put spaces between the items:
2428 * one
2430 * two
2432 * three
2434The bullets need not be flush with the left margin; they may be
2435indented one, two, or three spaces. The bullet must be followed
2436by whitespace.
2438List items look best if subsequent lines are flush with the first
2439line (after the bullet):
2441 * here is my first
2442 list item.
2443 * and my second.
2445But Markdown also allows a "lazy" format:
2447 * here is my first
2448 list item.
2449 * and my second.
2451### Block content in list items ###
2453A list item may contain multiple paragraphs and other block-level
2454content. However, subsequent paragraphs must be preceded by a blank line
2455and indented to line up with the first non-space content after
2456the list marker.
2458 * First paragraph.
2460 Continued.
2462 * Second paragraph. With a code block, which must be indented
2463 eight spaces:
2465 { code }
2467Exception: if the list marker is followed by an indented code
2468block, which must begin 5 spaces after the list marker, then
2469subsequent paragraphs must begin two columns after the last
2470character of the list marker:
2472 * code
2474 continuation paragraph
2476List items may include other lists. In this case the preceding blank
2477line is optional. The nested list must be indented to line up with
2478the first non-space character after the list marker of the
2479containing list item.
2481 * fruits
2482 + apples
2483 - macintosh
2484 - red delicious
2485 + pears
2486 + peaches
2487 * vegetables
2488 + broccoli
2489 + chard
2491As noted above, Markdown allows you to write list items "lazily," instead of
2492indenting continuation lines. However, if there are multiple paragraphs or
2493other blocks in a list item, the first line of each must be indented.
2495 + A lazy, lazy, list
2496 item.
2498 + Another one; this looks
2499 bad but is legal.
2501 Second paragraph of second
2502 list item.
2504### Ordered lists ###
2506Ordered lists work just like bulleted lists, except that the items
2507begin with enumerators rather than bullets.
2509In standard Markdown, enumerators are decimal numbers followed
2510by a period and a space. The numbers themselves are ignored, so
2511there is no difference between this list:
2513 1. one
2514 2. two
2515 3. three
2517and this one:
2519 5. one
2520 7. two
2521 1. three
2523#### Extension: `fancy_lists` ####
2525Unlike standard Markdown, pandoc allows ordered list items to be marked
2526with uppercase and lowercase letters and roman numerals, in addition to
2527Arabic numerals. List markers may be enclosed in parentheses or followed by a
2528single right-parentheses or period. They must be separated from the
2529text that follows by at least one space, and, if the list marker is a
2530capital letter with a period, by at least two spaces.[^2]
2532[^2]: The point of this rule is to ensure that normal paragraphs
2533 starting with people's initials, like
2535 B. Russell was an English philosopher.
2537 do not get treated as list items.
2539 This rule will not prevent
2541 (C) 2007 Joe Smith
2543 from being interpreted as a list item. In this case, a backslash
2544 escape can be used:
2546 (C\) 2007 Joe Smith
2548The `fancy_lists` extension also allows '`#`' to be used as an
2549ordered list marker in place of a numeral:
2551 #. one
2552 #. two
2554#### Extension: `startnum` ####
2556Pandoc also pays attention to the type of list marker used, and to the
2557starting number, and both of these are preserved where possible in the
2558output format. Thus, the following yields a list with numbers followed
2559by a single parenthesis, starting with 9, and a sublist with lowercase
2560roman numerals:
2562 9) Ninth
2563 10) Tenth
2564 11) Eleventh
2565 i. subone
2566 ii. subtwo
2567 iii. subthree
2569Pandoc will start a new list each time a different type of list
2570marker is used. So, the following will create three lists:
2572 (2) Two
2573 (5) Three
2574 1. Four
2575 * Five
2577If default list markers are desired, use `#.`:
2579 #. one
2580 #. two
2581 #. three
2584### Definition lists ###
2586#### Extension: `definition_lists` ####
2588Pandoc supports definition lists, using the syntax of
2589[PHP Markdown Extra] with some extensions.[^3]
2591 Term 1
2593 : Definition 1
2595 Term 2 with *inline markup*
2597 : Definition 2
2599 { some code, part of Definition 2 }
2601 Third paragraph of definition 2.
2603Each term must fit on one line, which may optionally be followed by
2604a blank line, and must be followed by one or more definitions.
2605A definition begins with a colon or tilde, which may be indented one
2606or two spaces.
2608A term may have multiple definitions, and each definition may consist of one or
2609more block elements (paragraph, code block, list, etc.), each indented four
2610spaces or one tab stop. The body of the definition (including the first line,
2611aside from the colon or tilde) should be indented four spaces. However,
2612as with other Markdown lists, you can "lazily" omit indentation except
2613at the beginning of a paragraph or other block element:
2615 Term 1
2617 : Definition
2618 with lazy continuation.
2620 Second paragraph of the definition.
2622If you leave space before the definition (as in the example above),
2623the text of the definition will be treated as a paragraph. In some
2624output formats, this will mean greater spacing between term/definition
2625pairs. For a more compact definition list, omit the space before the
2626definition:
2628 Term 1
2629 ~ Definition 1
2631 Term 2
2632 ~ Definition 2a
2633 ~ Definition 2b
2635Note that space between items in a definition list is required.
2636(A variant that loosens this requirement, but disallows "lazy"
2637hard wrapping, can be activated with `compact_definition_lists`: see
2638[Non-pandoc extensions], below.)
2640[^3]: I have been influenced by the suggestions of [David Wheeler](http://www.justatheory.com/computers/markup/modest-markdown-proposal.html).
2642### Numbered example lists ###
2644#### Extension: `example_lists` ####
2646The special list marker `@` can be used for sequentially numbered
2647examples. The first list item with a `@` marker will be numbered '1',
2648the next '2', and so on, throughout the document. The numbered examples
2649need not occur in a single list; each new list using `@` will take up
2650where the last stopped. So, for example:
2652 (@) My first example will be numbered (1).
2653 (@) My second example will be numbered (2).
2655 Explanation of examples.
2657 (@) My third example will be numbered (3).
2659Numbered examples can be labeled and referred to elsewhere in the
2660document:
2662 (@good) This is a good example.
2664 As (@good) illustrates, ...
2666The label can be any string of alphanumeric characters, underscores,
2667or hyphens.
2669Note: continuation paragraphs in example lists must always
2670be indented four spaces, regardless of the length of the
2671list marker. That is, example lists always behave as if the
2672`four_space_rule` extension is set. This is because example
2673labels tend to be long, and indenting content to the
2674first non-space character after the label would be awkward.
2676### Compact and loose lists ###
2678Pandoc behaves differently from `Markdown.pl` on some "edge
2679cases" involving lists. Consider this source:
2681 + First
2682 + Second:
2683 - Fee
2684 - Fie
2685 - Foe
2687 + Third
2689Pandoc transforms this into a "compact list" (with no `<p>` tags around
2690"First", "Second", or "Third"), while Markdown puts `<p>` tags around
2691"Second" and "Third" (but not "First"), because of the blank space
2692around "Third". Pandoc follows a simple rule: if the text is followed by
2693a blank line, it is treated as a paragraph. Since "Second" is followed
2694by a list, and not a blank line, it isn't treated as a paragraph. The
2695fact that the list is followed by a blank line is irrelevant. (Note:
2696Pandoc works this way even when the `markdown_strict` format is specified. This
2697behavior is consistent with the official Markdown syntax description,
2698even though it is different from that of `Markdown.pl`.)
2701### Ending a list ###
2703What if you want to put an indented code block after a list?
2705 - item one
2706 - item two
2708 { my code block }
2710Trouble! Here pandoc (like other Markdown implementations) will treat
2711`{ my code block }` as the second paragraph of item two, and not as
2712a code block.
2714To "cut off" the list after item two, you can insert some non-indented
2715content, like an HTML comment, which won't produce visible output in
2716any format:
2718 - item one
2719 - item two
2721 <!-- end of list -->
2723 { my code block }
2725You can use the same trick if you want two consecutive lists instead
2726of one big list:
2728 1. one
2729 2. two
2730 3. three
2732 <!-- -->
2734 1. uno
2735 2. dos
2736 3. tres
2738Horizontal rules
2739----------------
2741A line containing a row of three or more `*`, `-`, or `_` characters
2742(optionally separated by spaces) produces a horizontal rule:
2744 * * * *
2746 ---------------
2749Tables
2750------
2752Four kinds of tables may be used. The first three kinds presuppose the use of
2753a fixed-width font, such as Courier. The fourth kind can be used with
2754proportionally spaced fonts, as it does not require lining up columns.
2756#### Extension: `table_captions` ####
2758A caption may optionally be provided with all 4 kinds of tables (as
2759illustrated in the examples below). A caption is a paragraph beginning
2760with the string `Table:` (or just `:`), which will be stripped off.
2761It may appear either before or after the table.
2763#### Extension: `simple_tables` ####
2765Simple tables look like this:
2767 Right Left Center Default
2768 ------- ------ ---------- -------
2769 12 12 12 12
2770 123 123 123 123
2771 1 1 1 1
2773 Table: Demonstration of simple table syntax.
2775The headers and table rows must each fit on one line. Column
2776alignments are determined by the position of the header text relative
2777to the dashed line below it:[^4]
2779 - If the dashed line is flush with the header text on the right side
2780 but extends beyond it on the left, the column is right-aligned.
2781 - If the dashed line is flush with the header text on the left side
2782 but extends beyond it on the right, the column is left-aligned.
2783 - If the dashed line extends beyond the header text on both sides,
2784 the column is centered.
2785 - If the dashed line is flush with the header text on both sides,
2786 the default alignment is used (in most cases, this will be left).
2788[^4]: This scheme is due to Michel Fortin, who proposed it on the
2789 [Markdown discussion list](http://six.pairlist.net/pipermail/markdown-discuss/2005-March/001097.html).
2791The table must end with a blank line, or a line of dashes followed by
2792a blank line.
2794The column headers may be omitted, provided a dashed line is used
2795to end the table. For example:
2797 ------- ------ ---------- -------
2798 12 12 12 12
2799 123 123 123 123
2800 1 1 1 1
2801 ------- ------ ---------- -------
2803When headers are omitted, column alignments are determined on the basis
2804of the first line of the table body. So, in the tables above, the columns
2805would be right, left, center, and right aligned, respectively.
2807#### Extension: `multiline_tables` ####
2809Multiline tables allow headers and table rows to span multiple lines
2810of text (but cells that span multiple columns or rows of the table are
2811not supported). Here is an example:
2813 -------------------------------------------------------------
2814 Centered Default Right Left
2815 Header Aligned Aligned Aligned
2816 ----------- ------- --------------- -------------------------
2817 First row 12.0 Example of a row that
2818 spans multiple lines.
2820 Second row 5.0 Here's another one. Note
2821 the blank line between
2822 rows.
2823 -------------------------------------------------------------
2825 Table: Here's the caption. It, too, may span
2826 multiple lines.
2828These work like simple tables, but with the following differences:
2830 - They must begin with a row of dashes, before the header text
2831 (unless the headers are omitted).
2832 - They must end with a row of dashes, then a blank line.
2833 - The rows must be separated by blank lines.
2835In multiline tables, the table parser pays attention to the widths of
2836the columns, and the writers try to reproduce these relative widths in
2837the output. So, if you find that one of the columns is too narrow in the
2838output, try widening it in the Markdown source.
2840Headers may be omitted in multiline tables as well as simple tables:
2842 ----------- ------- --------------- -------------------------
2843 First row 12.0 Example of a row that
2844 spans multiple lines.
2846 Second row 5.0 Here's another one. Note
2847 the blank line between
2848 rows.
2849 ----------- ------- --------------- -------------------------
2851 : Here's a multiline table without headers.
2853It is possible for a multiline table to have just one row, but the row
2854should be followed by a blank line (and then the row of dashes that ends
2855the table), or the table may be interpreted as a simple table.
2857#### Extension: `grid_tables` ####
2859Grid tables look like this:
2861 : Sample grid table.
2863 +---------------+---------------+--------------------+
2864 | Fruit | Price | Advantages |
2865 +===============+===============+====================+
2866 | Bananas | $1.34 | - built-in wrapper |
2867 | | | - bright color |
2868 +---------------+---------------+--------------------+
2869 | Oranges | $2.10 | - cures scurvy |
2870 | | | - tasty |
2871 +---------------+---------------+--------------------+
2873The row of `=`s separates the header from the table body, and can be
2874omitted for a headerless table. The cells of grid tables may contain
2875arbitrary block elements (multiple paragraphs, code blocks, lists,
2876etc.). Cells that span multiple columns or rows are not
2877supported. Grid tables can be created easily using [Emacs table mode].
2879[Emacs table mode]: http://table.sourceforge.net/
2881Alignments can be specified as with pipe tables, by putting
2882colons at the boundaries of the separator line after the
2883header:
2885 +---------------+---------------+--------------------+
2886 | Right | Left | Centered |
2887 +==============:+:==============+:==================:+
2888 | Bananas | $1.34 | built-in wrapper |
2889 +---------------+---------------+--------------------+
2891For headerless tables, the colons go on the top line instead:
2893 +--------------:+:--------------+:------------------:+
2894 | Right | Left | Centered |
2895 +---------------+---------------+--------------------+
2897##### Grid Table Limitations #####
2899Pandoc does not support grid tables with row spans or column spans.
2900This means that neither variable numbers of columns across rows nor
2901variable numbers of rows across columns are supported by Pandoc.
2902All grid tables must have the same number of columns in each row,
2903and the same number of rows in each column. For example, the
2904Docutils [sample grid tables] will not render as expected with
2905Pandoc.
2907[sample grid tables]: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#grid-tables
2910#### Extension: `pipe_tables` ####
2912Pipe tables look like this:
2914 | Right | Left | Default | Center |
2915 |------:|:-----|---------|:------:|
2916 | 12 | 12 | 12 | 12 |
2917 | 123 | 123 | 123 | 123 |
2918 | 1 | 1 | 1 | 1 |
2920 : Demonstration of pipe table syntax.
2922The syntax is identical to [PHP Markdown Extra tables]. The beginning and
2923ending pipe characters are optional, but pipes are required between all
2924columns. The colons indicate column alignment as shown. The header
2925cannot be omitted. To simulate a headerless table, include a header
2926with blank cells.
2928Since the pipes indicate column boundaries, columns need not be vertically
2929aligned, as they are in the above example. So, this is a perfectly
2930legal (though ugly) pipe table:
2932 fruit| price
2933 -----|-----:
2934 apple|2.05
2935 pear|1.37
2936 orange|3.09
2938The cells of pipe tables cannot contain block elements like paragraphs
2939and lists, and cannot span multiple lines. If a pipe table contains a
2940row whose printable content is wider than the column width (see
2941`--columns`), then the table will take up the full text width and
2942the cell contents will wrap, with the relative cell widths determined
2943by the number of dashes in the line separating the table header from
2944the table body. (For example `---|-` would make the first column 3/4
2945and the second column 1/4 of the full text width.)
2946On the other hand, if no lines are wider than column width, then
2947cell contents will not be wrapped, and the cells will be sized
2948to their contents.
2950Note: pandoc also recognizes pipe tables of the following
2951form, as can be produced by Emacs' orgtbl-mode:
2953 | One | Two |
2954 |-----+-------|
2955 | my | table |
2956 | is | nice |
2958The difference is that `+` is used instead of `|`. Other orgtbl features
2959are not supported. In particular, to get non-default column alignment,
2960you'll need to add colons as above.
2962[PHP Markdown Extra tables]: https://michelf.ca/projects/php-markdown/extra/#table
2964Metadata blocks
2965---------------
2967#### Extension: `pandoc_title_block` ####
2969If the file begins with a title block
2971 % title
2972 % author(s) (separated by semicolons)
2973 % date
2975it will be parsed as bibliographic information, not regular text. (It
2976will be used, for example, in the title of standalone LaTeX or HTML
2977output.) The block may contain just a title, a title and an author,
2978or all three elements. If you want to include an author but no
2979title, or a title and a date but no author, you need a blank line:
2982 % Author
2984 % My title
2986 % June 15, 2006
2988The title may occupy multiple lines, but continuation lines must
2989begin with leading space, thus:
2991 % My title
2992 on multiple lines
2994If a document has multiple authors, the authors may be put on
2995separate lines with leading space, or separated by semicolons, or
2996both. So, all of the following are equivalent:
2998 % Author One
2999 Author Two
3001 % Author One; Author Two
3003 % Author One;
3004 Author Two
3006The date must fit on one line.
3008All three metadata fields may contain standard inline formatting
3009(italics, links, footnotes, etc.).
3011Title blocks will always be parsed, but they will affect the output only
3012when the `--standalone` (`-s`) option is chosen. In HTML output, titles
3013will appear twice: once in the document head -- this is the title that
3014will appear at the top of the window in a browser -- and once at the
3015beginning of the document body. The title in the document head can have
3016an optional prefix attached (`--title-prefix` or `-T` option). The title
3017in the body appears as an H1 element with class "title", so it can be
3018suppressed or reformatted with CSS. If a title prefix is specified with
3019`-T` and no title block appears in the document, the title prefix will
3020be used by itself as the HTML title.
3022The man page writer extracts a title, man page section number, and
3023other header and footer information from the title line. The title
3024is assumed to be the first word on the title line, which may optionally
3025end with a (single-digit) section number in parentheses. (There should
3026be no space between the title and the parentheses.) Anything after
3027this is assumed to be additional footer and header text. A single pipe
3028character (`|`) should be used to separate the footer text from the header
3029text. Thus,
3031 % PANDOC(1)
3033will yield a man page with the title `PANDOC` and section 1.
3035 % PANDOC(1) Pandoc User Manuals
3037will also have "Pandoc User Manuals" in the footer.
3039 % PANDOC(1) Pandoc User Manuals | Version 4.0
3041will also have "Version 4.0" in the header.
3043#### Extension: `yaml_metadata_block` ####
3045A YAML metadata block is a valid YAML object, delimited by a line of three
3046hyphens (`---`) at the top and a line of three hyphens (`---`) or three dots
3047(`...`) at the bottom. A YAML metadata block may occur anywhere in the
3048document, but if it is not at the beginning, it must be preceded by a blank
3049line. (Note that, because of the way pandoc concatenates input files when
3050several are provided, you may also keep the metadata in a separate YAML file
3051and pass it to pandoc as an argument, along with your Markdown files:
3053 pandoc chap1.md chap2.md chap3.md metadata.yaml -s -o book.html
3055Just be sure that the YAML file begins with `---` and ends with `---` or
3056`...`.)
3058Metadata will be taken from the fields of the YAML object and added to any
3059existing document metadata. Metadata can contain lists and objects (nested
3060arbitrarily), but all string scalars will be interpreted as Markdown. Fields
3061with names ending in an underscore will be ignored by pandoc. (They may be
3062given a role by external processors.) Field names must not be
3063interpretable as YAML numbers or boolean values (so, for
3064example, `yes`, `True`, and `15` cannot be used as field names).
3066A document may contain multiple metadata blocks. The metadata fields will
3067be combined through a *left-biased union*: if two metadata blocks attempt
3068to set the same field, the value from the first block will be taken.
3070When pandoc is used with `-t markdown` to create a Markdown document,
3071a YAML metadata block will be produced only if the `-s/--standalone`
3072option is used. All of the metadata will appear in a single block
3073at the beginning of the document.
3075Note that YAML escaping rules must be followed. Thus, for example,
3076if a title contains a colon, it must be quoted. The pipe character
3077(`|`) can be used to begin an indented block that will be interpreted
3078literally, without need for escaping. This form is necessary
3079when the field contains blank lines or block-level formatting:
3081 ---
3082 title: 'This is the title: it contains a colon'
3083 author:
3084 - Author One
3085 - Author Two
3086 keywords: [nothing, nothingness]
3087 abstract: |
3088 This is the abstract.
3090 It consists of two paragraphs.
3091 ...
3093Template variables will be set automatically from the metadata. Thus, for
3094example, in writing HTML, the variable `abstract` will be set to the HTML
3095equivalent of the Markdown in the `abstract` field:
3097 <p>This is the abstract.</p>
3098 <p>It consists of two paragraphs.</p>
3100Variables can contain arbitrary YAML structures, but the template must match
3101this structure. The `author` variable in the default templates expects a
3102simple list or string, but can be changed to support more complicated
3103structures. The following combination, for example, would add an affiliation
3104to the author if one is given:
3106 ---
3107 title: The document title
3108 author:
3109 - name: Author One
3110 affiliation: University of Somewhere
3111 - name: Author Two
3112 affiliation: University of Nowhere
3113 ...
3115To use the structured authors in the example above, you would need a custom
3116template:
3118 $for(author)$
3119 $if(author.name)$
3120 $author.name$$if(author.affiliation)$ ($author.affiliation$)$endif$
3121 $else$
3122 $author$
3123 $endif$
3124 $endfor$
3126Raw content to include in the document's header may be specified
3127using `header-includes`; however, it is important to mark up
3128this content as raw code for a particular output format, using
3129the [`raw_attribute` extension](#extension-raw_attribute)), or it
3130will be interpreted as markdown. For example:
3132 header-includes:
3133 - |
3134 ```{=latex}
3135 \let\oldsection\section
3136 \renewcommand{\section}[1]{\clearpage\oldsection{#1}}
3137 ```
3139Backslash escapes
3140-----------------
3142#### Extension: `all_symbols_escapable` ####
3144Except inside a code block or inline code, any punctuation or space
3145character preceded by a backslash will be treated literally, even if it
3146would normally indicate formatting. Thus, for example, if one writes
3148 *\*hello\**
3150one will get
3152 <em>*hello*</em>
3154instead of
3156 <strong>hello</strong>
3158This rule is easier to remember than standard Markdown's rule,
3159which allows only the following characters to be backslash-escaped:
3161 \`*_{}[]()>#+-.!
3163(However, if the `markdown_strict` format is used, the standard Markdown rule
3164will be used.)
3166A backslash-escaped space is parsed as a nonbreaking space. It will
3167appear in TeX output as `~` and in HTML and XML as `\&#160;` or
3168`\&nbsp;`.
3170A backslash-escaped newline (i.e. a backslash occurring at the end of
3171a line) is parsed as a hard line break. It will appear in TeX output as
3172`\\` and in HTML as `<br />`. This is a nice alternative to
3173Markdown's "invisible" way of indicating hard line breaks using
3174two trailing spaces on a line.
3176Backslash escapes do not work in verbatim contexts.
3178Inline formatting
3179-----------------
3181### Emphasis ###
3183To *emphasize* some text, surround it with `*`s or `_`, like this:
3185 This text is _emphasized with underscores_, and this
3186 is *emphasized with asterisks*.
3188Double `*` or `_` produces **strong emphasis**:
3190 This is **strong emphasis** and __with underscores__.
3192A `*` or `_` character surrounded by spaces, or backslash-escaped,
3193will not trigger emphasis:
3195 This is * not emphasized *, and \*neither is this\*.
3197#### Extension: `intraword_underscores` ####
3199Because `_` is sometimes used inside words and identifiers,
3200pandoc does not interpret a `_` surrounded by alphanumeric
3201characters as an emphasis marker. If you want to emphasize
3202just part of a word, use `*`:
3204 feas*ible*, not feas*able*.
3207### Strikeout ###
3209#### Extension: `strikeout` ####
3211To strikeout a section of text with a horizontal line, begin and end it
3212with `~~`. Thus, for example,
3214 This ~~is deleted text.~~
3217### Superscripts and subscripts ###
3219#### Extension: `superscript`, `subscript` ####
3221Superscripts may be written by surrounding the superscripted text by `^`
3222characters; subscripts may be written by surrounding the subscripted
3223text by `~` characters. Thus, for example,
3225 H~2~O is a liquid. 2^10^ is 1024.
3227If the superscripted or subscripted text contains spaces, these spaces
3228must be escaped with backslashes. (This is to prevent accidental
3229superscripting and subscripting through the ordinary use of `~` and `^`.)
3230Thus, if you want the letter P with 'a cat' in subscripts, use
3231`P~a\ cat~`, not `P~a cat~`.
3234### Verbatim ###
3236To make a short span of text verbatim, put it inside backticks:
3238 What is the difference between `>>=` and `>>`?
3240If the verbatim text includes a backtick, use double backticks:
3242 Here is a literal backtick `` ` ``.
3244(The spaces after the opening backticks and before the closing
3245backticks will be ignored.)
3247The general rule is that a verbatim span starts with a string
3248of consecutive backticks (optionally followed by a space)
3249and ends with a string of the same number of backticks (optionally
3250preceded by a space).
3252Note that backslash-escapes (and other Markdown constructs) do not
3253work in verbatim contexts:
3255 This is a backslash followed by an asterisk: `\*`.
3257#### Extension: `inline_code_attributes` ####
3259Attributes can be attached to verbatim text, just as with
3260[fenced code blocks]:
3262 `<$>`{.haskell}
3264### Small caps ###
3266To write small caps, use the `smallcaps` class:
3268 [Small caps]{.smallcaps}
3270Or, without the `bracketed_spans` extension:
3272 <span class="smallcaps">Small caps</span>
3274For compatibility with other Markdown flavors, CSS is also supported:
3276 <span style="font-variant:small-caps;">Small caps</span>
3278This will work in all output formats that support small caps.
3281Math
3282----
3284#### Extension: `tex_math_dollars` ####
3286Anything between two `$` characters will be treated as TeX math. The
3287opening `$` must have a non-space character immediately to its right,
3288while the closing `$` must have a non-space character immediately to its
3289left, and must not be followed immediately by a digit. Thus,
3290`$20,000 and $30,000` won't parse as math. If for some reason
3291you need to enclose text in literal `$` characters, backslash-escape
3292them and they won't be treated as math delimiters.
3294TeX math will be printed in all output formats. How it is rendered
3295depends on the output format:
3297LaTeX
3298 ~ It will appear verbatim surrounded by `\(...\)` (for inline
3299 math) or `\[...\]` (for display math).
3301Markdown, Emacs Org mode, ConTeXt, ZimWiki
3302 ~ It will appear verbatim surrounded by `$...$` (for inline
3303 math) or `$$...$$` (for display math).
3305reStructuredText
3306 ~ It will be rendered using an [interpreted text role `:math:`].
3308AsciiDoc
3309 ~ It will be rendered as `latexmath:[...]`.
3311Texinfo
3312 ~ It will be rendered inside a `@math` command.
3314groff man
3315 ~ It will be rendered verbatim without `$`'s.
3317MediaWiki, DokuWiki
3318 ~ It will be rendered inside `<math>` tags.
3320Textile
3321 ~ It will be rendered inside `<span class="math">` tags.
3323RTF, OpenDocument
3324 ~ It will be rendered, if possible, using Unicode characters,
3325 and will otherwise appear verbatim.
3327ODT
3328 ~ It will be rendered, if possible, using MathML.
3330DocBook
3331 ~ If the `--mathml` flag is used, it will be rendered using MathML
3332 in an `inlineequation` or `informalequation` tag. Otherwise it
3333 will be rendered, if possible, using Unicode characters.
3335Docx
3336 ~ It will be rendered using OMML math markup.
3338FictionBook2
3339 ~ If the `--webtex` option is used, formulas are rendered as images
3340 using CodeCogs or other compatible web service, downloaded
3341 and embedded in the e-book. Otherwise, they will appear verbatim.
3343HTML, Slidy, DZSlides, S5, EPUB
3344 ~ The way math is rendered in HTML will depend on the
3345 command-line options selected. Therefore see [Math rendering in HTML]
3346 above.
3348[interpreted text role `:math:`]: http://docutils.sourceforge.net/docs/ref/rst/roles.html#math
3350Raw HTML
3351--------
3353#### Extension: `raw_html` ####
3355Markdown allows you to insert raw HTML (or DocBook) anywhere in a document
3356(except verbatim contexts, where `<`, `>`, and `&` are interpreted
3357literally). (Technically this is not an extension, since standard
3358Markdown allows it, but it has been made an extension so that it can
3359be disabled if desired.)
3361The raw HTML is passed through unchanged in HTML, S5, Slidy, Slideous,
3362DZSlides, EPUB, Markdown, Emacs Org mode, and Textile output, and suppressed
3363in other formats.
3365#### Extension: `markdown_in_html_blocks` ####
3367Standard Markdown allows you to include HTML "blocks": blocks
3368of HTML between balanced tags that are separated from the surrounding text
3369with blank lines, and start and end at the left margin. Within
3370these blocks, everything is interpreted as HTML, not Markdown;
3371so (for example), `*` does not signify emphasis.
3373Pandoc behaves this way when the `markdown_strict` format is used; but
3374by default, pandoc interprets material between HTML block tags as Markdown.
3375Thus, for example, pandoc will turn
3377 <table>
3378 <tr>
3379 <td>*one*</td>
3380 <td>[a link](http://google.com)</td>
3381 </tr>
3382 </table>
3384into
3386 <table>
3387 <tr>
3388 <td><em>one</em></td>
3389 <td><a href="http://google.com">a link</a></td>
3390 </tr>
3391 </table>
3393whereas `Markdown.pl` will preserve it as is.
3395There is one exception to this rule: text between `<script>` and
3396`<style>` tags is not interpreted as Markdown.
3398This departure from standard Markdown should make it easier to mix
3399Markdown with HTML block elements. For example, one can surround
3400a block of Markdown text with `<div>` tags without preventing it
3401from being interpreted as Markdown.
3403#### Extension: `native_divs` ####
3405Use native pandoc `Div` blocks for content inside `<div>` tags.
3406For the most part this should give the same output as
3407`markdown_in_html_blocks`, but it makes it easier to write pandoc
3408filters to manipulate groups of blocks.
3410#### Extension: `native_spans` ####
3412Use native pandoc `Span` blocks for content inside `<span>` tags.
3413For the most part this should give the same output as `raw_html`,
3414but it makes it easier to write pandoc filters to manipulate groups
3415of inlines.
3417#### Extension: `raw_tex` ####
3419In addition to raw HTML, pandoc allows raw LaTeX, TeX, and ConTeXt to be
3420included in a document. Inline TeX commands will be preserved and passed
3421unchanged to the LaTeX and ConTeXt writers. Thus, for example, you can use
3422LaTeX to include BibTeX citations:
3424 This result was proved in \cite{jones.1967}.
3426Note that in LaTeX environments, like
3428 \begin{tabular}{|l|l|}\hline
3429 Age & Frequency \\ \hline
3430 18--25 & 15 \\
3431 26--35 & 33 \\
3432 36--45 & 22 \\ \hline
3433 \end{tabular}
3435the material between the begin and end tags will be interpreted as raw
3436LaTeX, not as Markdown.
3438Inline LaTeX is ignored in output formats other than Markdown, LaTeX,
3439Emacs Org mode, and ConTeXt.
3441### Generic raw attribute ###
3443#### Extension: `raw_attribute` ####
3445Inline spans and fenced code blocks with a special
3446kind of attribute will be parsed as raw content with the
3447designated format. For example, the following produces a raw
3448groff `ms` block:
3450 ```{=ms}
3451 .MYMACRO
3452 blah blah
3453 ```
3454And the following produces a raw `html` inline element:
3456 This is `<a>html</a>`{=html}
3458This can be useful to insert raw xml into `docx` documents, e.g.
3459a pagebreak:
3461 ```{=openxml}
3462 <w:p>
3463 <w:r>
3464 <w:br w:type="page"/>
3465 </w:r>
3466 </w:p>
3467 ```
3469The format name should match the target format name (see
3470`-t/--to`, above, for a list, or use `pandoc
3471--list-output-formats`). Use `openxml` for `docx` output,
3472`opendocument` for `odt` output, `html5` for `epub3` output,
3473`html4` for `epub2` output, and `latex`, `beamer`,
3474`ms`, or `html5` for `pdf` output (depending on what you
3475use for `--pdf-engine`).
3477This extension presupposes that the relevant kind of
3478inline code or fenced code block is enabled. Thus, for
3479example, to use a raw attribute with a backtick code block,
3480`backtick_code_blocks` must be enabled.
3482The raw attribute cannot be combined with regular attributes.
3484LaTeX macros
3485------------
3487#### Extension: `latex_macros` ####
3489For output formats other than LaTeX, pandoc will parse LaTeX
3490macro definitions and apply the resulting macros to all LaTeX
3491math and raw LaTeX. So, for example, the following will work in
3492all output formats, not just LaTeX:
3494 \newcommand{\tuple}[1]{\langle #1 \rangle}
3496 $\tuple{a, b, c}$
3498Note that LaTeX macros will not be applied if they occur
3499inside inside a raw span or block marked with the
3500[`raw_attribute` extension](#extension-raw_attribute).
3502When `latex_macros` is disabled, the raw LaTeX and math will
3503not have macros applied. This is usually a better approach when
3504you are targeting LaTeX or PDF.
3506Whether or not `latex_macros` is enabled, the macro definitions
3507will still be passed through as raw LaTeX.
3509Links
3510-----
3512Markdown allows links to be specified in several ways.
3514### Automatic links ###
3516If you enclose a URL or email address in pointy brackets, it
3517will become a link:
3519 <http://google.com>
3520 <sam@green.eggs.ham>
3522### Inline links ###
3524An inline link consists of the link text in square brackets,
3525followed by the URL in parentheses. (Optionally, the URL can
3526be followed by a link title, in quotes.)
3528 This is an [inline link](/url), and here's [one with
3529 a title](http://fsf.org "click here for a good time!").
3531There can be no space between the bracketed part and the parenthesized part.
3532The link text can contain formatting (such as emphasis), but the title cannot.
3534Email addresses in inline links are not autodetected, so they have to be
3535prefixed with `mailto`:
3537 [Write me!](mailto:sam@green.eggs.ham)
3539### Reference links ###
3541An *explicit* reference link has two parts, the link itself and the link
3542definition, which may occur elsewhere in the document (either
3543before or after the link).
3545The link consists of link text in square brackets, followed by a label in
3546square brackets. (There cannot be space between the two unless the
3547`spaced_reference_links` extension is enabled.) The link definition
3548consists of the bracketed label, followed by a colon and a space, followed by
3549the URL, and optionally (after a space) a link title either in quotes or in
3550parentheses. The label must not be parseable as a citation (assuming
3551the `citations` extension is enabled): citations take precedence over
3552link labels.
3554Here are some examples:
3556 [my label 1]: /foo/bar.html "My title, optional"
3557 [my label 2]: /foo
3558 [my label 3]: http://fsf.org (The free software foundation)
3559 [my label 4]: /bar#special 'A title in single quotes'
3561The URL may optionally be surrounded by angle brackets:
3563 [my label 5]: <http://foo.bar.baz>
3565The title may go on the next line:
3567 [my label 3]: http://fsf.org
3568 "The free software foundation"
3570Note that link labels are not case sensitive. So, this will work:
3572 Here is [my link][FOO]
3574 [Foo]: /bar/baz
3576In an *implicit* reference link, the second pair of brackets is
3577empty:
3579 See [my website][].
3581 [my website]: http://foo.bar.baz
3583Note: In `Markdown.pl` and most other Markdown implementations,
3584reference link definitions cannot occur in nested constructions
3585such as list items or block quotes. Pandoc lifts this arbitrary
3586seeming restriction. So the following is fine in pandoc, though
3587not in most other implementations:
3589 > My block [quote].
3591 > [quote]: /foo
3593#### Extension: `shortcut_reference_links` ####
3595In a *shortcut* reference link, the second pair of brackets may
3596be omitted entirely:
3598 See [my website].
3600 [my website]: http://foo.bar.baz
3602### Internal links ###
3604To link to another section of the same document, use the automatically
3605generated identifier (see [Header identifiers]). For example:
3607 See the [Introduction](#introduction).
3611 See the [Introduction].
3613 [Introduction]: #introduction
3615Internal links are currently supported for HTML formats (including
3616HTML slide shows and EPUB), LaTeX, and ConTeXt.
3618Images
3619------
3621A link immediately preceded by a `!` will be treated as an image.
3622The link text will be used as the image's alt text:
3624 ![la lune](lalune.jpg "Voyage to the moon")
3626 ![movie reel]
3628 [movie reel]: movie.gif
3630#### Extension: `implicit_figures` ####
3632An image with nonempty alt text, occurring by itself in a
3633paragraph, will be rendered as a figure with a caption. The
3634image's alt text will be used as the caption.
3636 ![This is the caption](/url/of/image.png)
3638How this is rendered depends on the output format. Some output
3639formats (e.g. RTF) do not yet support figures. In those
3640formats, you'll just get an image in a paragraph by itself, with
3641no caption.
3643If you just want a regular inline image, just make sure it is not
3644the only thing in the paragraph. One way to do this is to insert a
3645nonbreaking space after the image:
3647 ![This image won't be a figure](/url/of/image.png)\
3649Note that in reveal.js slide shows, an image in a paragraph
3650by itself that has the `stretch` class will fill the screen,
3651and the caption and figure tags will be omitted.
3653#### Extension: `link_attributes` ####
3655Attributes can be set on links and images:
3657 An inline ![image](foo.jpg){#id .class width=30 height=20px}
3658 and a reference ![image][ref] with attributes.
3660 [ref]: foo.jpg "optional title" {#id .class key=val key2="val 2"}
3662(This syntax is compatible with [PHP Markdown Extra] when only `#id`
3663and `.class` are used.)
3665For HTML and EPUB, all attributes except `width` and `height` (but
3666including `srcset` and `sizes`) are passed through as is. The other
3667writers ignore attributes that are not supported by their output
3668format.
3670The `width` and `height` attributes on images are treated specially. When
3671used without a unit, the unit is assumed to be pixels. However, any of
3672the following unit identifiers can be used: `px`, `cm`, `mm`, `in`, `inch`
3673and `%`. There must not be any spaces between the number and the unit.
3674For example:
3676```
3677![](file.jpg){ width=50% }
3678```
3680- Dimensions are converted to inches for output in page-based formats like
3681 LaTeX. Dimensions are converted to pixels for output in HTML-like
3682 formats. Use the `--dpi` option to specify the number of pixels per
3683 inch. The default is 96dpi.
3684- The `%` unit is generally relative to some available space.
3685 For example the above example will render to
3686 `<img href="file.jpg" style="width: 50%;" />` (HTML),
3687 `\includegraphics[width=0.5\textwidth]{file.jpg}` (LaTeX), or
3688 `\externalfigure[file.jpg][width=0.5\textwidth]` (ConTeXt).
3689- Some output formats have a notion of a class
3690 ([ConTeXt](http://wiki.contextgarden.net/Using_Graphics#Multiple_Image_Settings))
3691 or a unique identifier (LaTeX `\caption`), or both (HTML).
3692- When no `width` or `height` attributes are specified, the fallback
3693 is to look at the image resolution and the dpi metadata embedded in
3694 the image file.
3696Divs and Spans
3697--------------
3699Using the `native_divs` and `native_spans` extensions
3700(see [above][Extension: `native_divs`]), HTML syntax can
3701be used as part of markdown to create native `Div` and `Span`
3702elements in the pandoc AST (as opposed to raw HTML).
3703However, there is also nicer syntax available:
3705#### Extension: `fenced_divs` ####
3707Allow special fenced syntax for native `Div` blocks. A Div
3708starts with a fence containing at least three consecutive
3709colons plus some attributes. The attributes may optionally
3710be followed by another string of consecutive colons.
3711The attribute syntax is exactly as in fenced code blocks (see
3712[Extension: `fenced_code_attributes`]). As with fenced
3713code blocks, one can use either attributes in curly braces
3714or a single unbraced word, which will be treated as a class
3715name. The Div ends with another line containing a string of at
3716least three consecutive colons. The fenced Div should be
3717separated by blank lines from preceding and following blocks.
3719Example:
3721 ::::: {#special .sidebar}
3722 Here is a paragraph.
3724 And another.
3725 :::::
3727Fenced divs can be nested. Opening fences are distinguished
3728because they *must* have attributes:
3730 ::: Warning ::::::
3731 This is a warning.
3733 ::: Danger
3734 This is a warning within a warning.
3735 :::
3736 ::::::::::::::::::
3738Fences without attributes are always closing fences. Unlike
3739with fenced code blocks, the number of colons in the closing
3740fence need not match the number in the opening fence. However,
3741it can be helpful for visual clarity to use fences of different
3742lengths to distinguish nested divs from their parents.
3745#### Extension: `bracketed_spans` ####
3747A bracketed sequence of inlines, as one would use to begin
3748a link, will be treated as a `Span` with attributes if it is
3749followed immediately by attributes:
3751 [This is *some text*]{.class key="val"}
3753Footnotes
3754---------
3756#### Extension: `footnotes` ####
3758Pandoc's Markdown allows footnotes, using the following syntax:
3760 Here is a footnote reference,[^1] and another.[^longnote]
3762 [^1]: Here is the footnote.
3764 [^longnote]: Here's one with multiple blocks.
3766 Subsequent paragraphs are indented to show that they
3767 belong to the previous footnote.
3769 { some.code }
3771 The whole paragraph can be indented, or just the first
3772 line. In this way, multi-paragraph footnotes work like
3773 multi-paragraph list items.
3775 This paragraph won't be part of the note, because it
3776 isn't indented.
3778The identifiers in footnote references may not contain spaces, tabs,
3779or newlines. These identifiers are used only to correlate the
3780footnote reference with the note itself; in the output, footnotes
3781will be numbered sequentially.
3783The footnotes themselves need not be placed at the end of the
3784document. They may appear anywhere except inside other block elements
3785(lists, block quotes, tables, etc.). Each footnote should be
3786separated from surrounding content (including other footnotes)
3787by blank lines.
3789#### Extension: `inline_notes` ####
3791Inline footnotes are also allowed (though, unlike regular notes,
3792they cannot contain multiple paragraphs). The syntax is as follows:
3794 Here is an inline note.^[Inlines notes are easier to write, since
3795 you don't have to pick an identifier and move down to type the
3796 note.]
3798Inline and regular footnotes may be mixed freely.
3800Citations
3801---------
3803#### Extension: `citations` ####
3805Using an external filter, `pandoc-citeproc`, pandoc can automatically generate
3806citations and a bibliography in a number of styles. Basic usage is
3808 pandoc --filter pandoc-citeproc myinput.txt
3810In order to use this feature, you will need to specify a bibliography file
3811using the `bibliography` metadata field in a YAML metadata section, or
3812`--bibliography` command line argument. You can supply multiple `--bibliography`
3813arguments or set `bibliography` metadata field to YAML array, if you want to
3814use multiple bibliography files. The bibliography may have any of these
3815formats:
3817 Format File extension
3818 ------------ --------------
3819 BibLaTeX .bib
3820 BibTeX .bibtex
3821 Copac .copac
3822 CSL JSON .json
3823 CSL YAML .yaml
3824 EndNote .enl
3825 EndNote XML .xml
3826 ISI .wos
3827 MEDLINE .medline
3828 MODS .mods
3829 RIS .ris
3831Note that `.bib` can be used with both BibTeX and BibLaTeX files;
3832use `.bibtex` to force BibTeX.
3834Note that `pandoc-citeproc --bib2json` and `pandoc-citeproc --bib2yaml`
3835can produce `.json` and `.yaml` files from any of the supported formats.
3837In-field markup: In BibTeX and BibLaTeX databases, pandoc-citeproc parses
3838a subset of LaTeX markup; in CSL YAML databases, pandoc Markdown; and in CSL JSON databases, an [HTML-like markup][CSL markup specs]:
3840`<i>...</i>`
3841: italics
3843`<b>...</b>`
3844: bold
3846`<span style="font-variant:small-caps;">...</span>` or `<sc>...</sc>`
3847: small capitals
3849`<sub>...</sub>`
3850: subscript
3852`<sup>...</sup>`
3853: superscript
3855`<span class="nocase">...</span>`
3856: prevent a phrase from being capitalized as title case
3858`pandoc-citeproc -j` and `-y` interconvert the CSL JSON
3859and CSL YAML formats as far as possible.
3861As an alternative to specifying a bibliography file using `--bibliography`
3862or the YAML metadata field `bibliography`, you can include
3863the citation data directly in the `references` field of the
3864document's YAML metadata. The field should contain an array of
3865YAML-encoded references, for example:
3867 ---
3868 references:
3869 - type: article-journal
3870 id: WatsonCrick1953
3871 author:
3872 - family: Watson
3873 given: J. D.
3874 - family: Crick
3875 given: F. H. C.
3876 issued:
3877 date-parts:
3878 - - 1953
3879 - 4
3880 - 25
3881 title: 'Molecular structure of nucleic acids: a structure for deoxyribose
3882 nucleic acid'
3883 title-short: Molecular structure of nucleic acids
3884 container-title: Nature
3885 volume: 171
3886 issue: 4356
3887 page: 737-738
3888 DOI: 10.1038/171737a0
3889 URL: http://www.nature.com/nature/journal/v171/n4356/abs/171737a0.html
3890 language: en-GB
3891 ...
3893(`pandoc-citeproc --bib2yaml` can produce these from a bibliography file in one
3894of the supported formats.)
3896Citations and references can be formatted using any style supported by the
3897[Citation Style Language], listed in the [Zotero Style Repository].
3898These files are specified using the `--csl` option or the `csl` metadata field.
3899By default, `pandoc-citeproc` will use the [Chicago Manual of Style] author-date
3900format. The CSL project provides further information on [finding and editing styles].
3902To make your citations hyperlinks to the corresponding bibliography
3903entries, add `link-citations: true` to your YAML metadata.
3905Citations go inside square brackets and are separated by semicolons.
3906Each citation must have a key, composed of '@' + the citation
3907identifier from the database, and may optionally have a prefix,
3908a locator, and a suffix. The citation key must begin with a letter, digit,
3909or `_`, and may contain alphanumerics, `_`, and internal punctuation
3910characters (`:.#$%&-+?<>~/`). Here are some examples:
3912 Blah blah [see @doe99, pp. 33-35; also @smith04, chap. 1].
3914 Blah blah [@doe99, pp. 33-35, 38-39 and *passim*].
3916 Blah blah [@smith04; @doe99].
3918`pandoc-citeproc` detects locator terms in the [CSL locale files].
3919Either abbreviated or unabbreviated forms are accepted. In the `en-US`
3920locale, locator terms can be written in either singular or plural forms,
3921as `book`, `bk.`/`bks.`; `chapter`, `chap.`/`chaps.`; `column`,
3922`col.`/`cols.`; `figure`, `fig.`/`figs.`; `folio`, `fol.`/`fols.`;
3923`number`, `no.`/`nos.`; `line`, `l.`/`ll.`; `note`, `n.`/`nn.`; `opus`,
3924`op.`/`opp.`; `page`, `p.`/`pp.`; `paragraph`, `para.`/`paras.`; `part`,
3925`pt.`/`pts.`; `section`, `sec.`/`secs.`; `sub verbo`, `s.v.`/`s.vv.`;
3926`verse`, `v.`/`vv.`; `volume`, `vol.`/`vols.`; `¶`/`¶¶`; `§`/`§§`. If no
3927locator term is used, "page" is assumed.
3929A minus sign (`-`) before the `@` will suppress mention of
3930the author in the citation. This can be useful when the
3931author is already mentioned in the text:
3933 Smith says blah [-@smith04].
3935You can also write an in-text citation, as follows:
3937 @smith04 says blah.
3939 @smith04 [p. 33] says blah.
3941If the style calls for a list of works cited, it will be placed
3942at the end of the document. Normally, you will want to end your
3943document with an appropriate header:
3945 last paragraph...
3947 # References
3949The bibliography will be inserted after this header. Note that
3950the `unnumbered` class will be added to this header, so that the
3951section will not be numbered.
3953If you want to include items in the bibliography without actually
3954citing them in the body text, you can define a dummy `nocite` metadata
3955field and put the citations there:
3957 ---
3958 nocite: |
3959 @item1, @item2
3960 ...
3962 @item3
3964In this example, the document will contain a citation for `item3`
3965only, but the bibliography will contain entries for `item1`, `item2`, and
3966`item3`.
3968It is possible to create a bibliography with all the citations,
3969whether or not they appear in the document, by using a wildcard:
3971 ---
3972 nocite: |
3973 @*
3974 ...
3976For LaTeX or PDF output, you can also use [`natbib`] or [`biblatex`]
3977to render bibliography. In order to do so, specify bibliography files as
3978outlined above, and add `--natbib` or `--biblatex` argument to `pandoc`
3979invocation. Bear in mind that bibliography files have to be in respective
3980format (either BibTeX or BibLaTeX).
3982For more information, see the [pandoc-citeproc man page].
3984[CSL markup specs]: http://docs.citationstyles.org/en/1.0/release-notes.html#rich-text-markup-within-fields
3985[Chicago Manual of Style]: http://chicagomanualofstyle.org
3986[Citation Style Language]: http://citationstyles.org
3987[Zotero Style Repository]: https://www.zotero.org/styles
3988[finding and editing styles]: https://citationstyles.org/authors/
3989[CSL locale files]: https://github.com/citation-style-language/locales
3990[pandoc-citeproc man page]: https://github.com/jgm/pandoc-citeproc/blob/master/man/pandoc-citeproc.1.md
3992Non-pandoc extensions
3993---------------------
3995The following Markdown syntax extensions are not enabled by default
3996in pandoc, but may be enabled by adding `+EXTENSION` to the format
3997name, where `EXTENSION` is the name of the extension. Thus, for
3998example, `markdown+hard_line_breaks` is Markdown with hard line breaks.
4000#### Extension: `old_dashes` ####
4002Selects the pandoc <= 1.8.2.1 behavior for parsing smart dashes:
4003`-` before a numeral is an en-dash, and `--` is an em-dash.
4004This option only has an effect if `smart` is enabled. It is
4005selected automatically for `textile` input.
4007#### Extension: `angle_brackets_escapable` ####
4009Allow `<` and `>` to be backslash-escaped, as they can be in
4010GitHub flavored Markdown but not original Markdown. This is
4011implied by pandoc's default `all_symbols_escapable`.
4013#### Extension: `lists_without_preceding_blankline` ####
4015Allow a list to occur right after a paragraph, with no intervening
4016blank space.
4018#### Extension: `four_space_rule` ####
4020Selects the pandoc <= 2.0 behavior for parsing lists, so that
4021four spaces indent are needed for list item continuation
4022paragraphs.
4024#### Extension: `spaced_reference_links` ####
4026Allow whitespace between the two components of a reference link,
4027for example,
4029 [foo] [bar].
4031#### Extension: `hard_line_breaks` ####
4033Causes all newlines within a paragraph to be interpreted as hard line
4034breaks instead of spaces.
4036#### Extension: `ignore_line_breaks` ####
4038Causes newlines within a paragraph to be ignored, rather than being
4039treated as spaces or as hard line breaks. This option is intended for
4040use with East Asian languages where spaces are not used between words,
4041but text is divided into lines for readability.
4043#### Extension: `east_asian_line_breaks` ####
4045Causes newlines within a paragraph to be ignored, rather than
4046being treated as spaces or as hard line breaks, when they occur
4047between two East Asian wide characters. This is a better choice
4048than `ignore_line_breaks` for texts that include a mix of East
4049Asian wide characters and other characters.
4051#### Extension: `emoji` ####
4053Parses textual emojis like `:smile:` as Unicode emoticons.
4055#### Extension: `tex_math_single_backslash` ####
4057Causes anything between `\(` and `\)` to be interpreted as inline
4058TeX math, and anything between `\[` and `\]` to be interpreted
4059as display TeX math. Note: a drawback of this extension is that
4060it precludes escaping `(` and `[`.
4062#### Extension: `tex_math_double_backslash` ####
4064Causes anything between `\\(` and `\\)` to be interpreted as inline
4065TeX math, and anything between `\\[` and `\\]` to be interpreted
4066as display TeX math.
4068#### Extension: `markdown_attribute` ####
4070By default, pandoc interprets material inside block-level tags as Markdown.
4071This extension changes the behavior so that Markdown is only parsed
4072inside block-level tags if the tags have the attribute `markdown=1`.
4074#### Extension: `mmd_title_block` ####
4076Enables a [MultiMarkdown] style title block at the top of
4077the document, for example:
4079 Title: My title
4080 Author: John Doe
4081 Date: September 1, 2008
4082 Comment: This is a sample mmd title block, with
4083 a field spanning multiple lines.
4085See the MultiMarkdown documentation for details. If `pandoc_title_block` or
4086`yaml_metadata_block` is enabled, it will take precedence over
4087`mmd_title_block`.
4089#### Extension: `abbreviations` ####
4091Parses PHP Markdown Extra abbreviation keys, like
4093 *[HTML]: Hypertext Markup Language
4095Note that the pandoc document model does not support
4096abbreviations, so if this extension is enabled, abbreviation keys are
4097simply skipped (as opposed to being parsed as paragraphs).
4099#### Extension: `autolink_bare_uris` ####
4101Makes all absolute URIs into links, even when not surrounded by
4102pointy braces `<...>`.
4104#### Extension: `mmd_link_attributes` ####
4106Parses multimarkdown style key-value attributes on link
4107and image references. This extension should not be confused with the
4108[`link_attributes`](#extension-link_attributes) extension.
4110 This is a reference ![image][ref] with multimarkdown attributes.
4112 [ref]: http://path.to/image "Image title" width=20px height=30px
4113 id=myId class="myClass1 myClass2"
4115#### Extension: `mmd_header_identifiers` ####
4117Parses multimarkdown style header identifiers (in square brackets,
4118after the header but before any trailing `#`s in an ATX header).
4120#### Extension: `compact_definition_lists` ####
4122Activates the definition list syntax of pandoc 1.12.x and earlier.
4123This syntax differs from the one described above under [Definition lists]
4124in several respects:
4126 - No blank line is required between consecutive items of the
4127 definition list.
4128 - To get a "tight" or "compact" list, omit space between consecutive
4129 items; the space between a term and its definition does not affect
4130 anything.
4131 - Lazy wrapping of paragraphs is not allowed: the entire definition must
4132 be indented four spaces.[^6]
4134[^6]: To see why laziness is incompatible with relaxing the requirement
4135 of a blank line between items, consider the following example:
4137 bar
4138 : definition
4139 foo
4140 : definition
4142 Is this a single list item with two definitions of "bar," the first of
4143 which is lazily wrapped, or two list items? To remove the ambiguity
4144 we must either disallow lazy wrapping or require a blank line between
4145 list items.
4147Markdown variants
4148-----------------
4150In addition to pandoc's extended Markdown, the following Markdown
4151variants are supported:
4153`markdown_phpextra` (PHP Markdown Extra)
4154: `footnotes`, `pipe_tables`, `raw_html`, `markdown_attribute`,
4155 `fenced_code_blocks`, `definition_lists`, `intraword_underscores`,
4156 `header_attributes`, `link_attributes`, `abbreviations`,
4157 `shortcut_reference_links`, `spaced_reference_links`.
4159`markdown_github` (deprecated GitHub-Flavored Markdown)
4160: `pipe_tables`, `raw_html`, `fenced_code_blocks`, `gfm_auto_identifiers`,
4161 `ascii_identifiers`, `backtick_code_blocks`, `autolink_bare_uris`,
4162 `space_in_atx_header`, `intraword_underscores`, `strikeout`,
4163 `emoji`, `shortcut_reference_links`, `angle_brackets_escapable`,
4164 `lists_without_preceding_blankline`.
4166`markdown_mmd` (MultiMarkdown)
4167: `pipe_tables`, `raw_html`, `markdown_attribute`, `mmd_link_attributes`,
4168 `tex_math_double_backslash`, `intraword_underscores`,
4169 `mmd_title_block`, `footnotes`, `definition_lists`,
4170 `all_symbols_escapable`, `implicit_header_references`,
4171 `auto_identifiers`, `mmd_header_identifiers`,
4172 `shortcut_reference_links`, `implicit_figures`,
4173 `superscript`, `subscript`, `backtick_code_blocks`,
4174 `spaced_reference_links`, `raw_attribute`.
4176`markdown_strict` (Markdown.pl)
4177: `raw_html`, `shortcut_reference_links`,
4178 `spaced_reference_links`.
4180We also support `commonmark` and `gfm` (GitHub-Flavored Markdown,
4181which is implemented as a set of extensions on `commonmark`).
4183Note, however, that `commonmark` and `gfm` have limited support
4184for extensions. Only those listed below (and `smart` and
4185`raw_tex`) will work. The extensions can, however, all be
4186individually disabled.
4187Also, `raw_tex` only affects `gfm` output, not input.
4189`gfm` (GitHub-Flavored Markdown)
4190: `pipe_tables`, `raw_html`, `fenced_code_blocks`, `gfm_auto_identifiers`,
4191 `ascii_identifiers`, `backtick_code_blocks`, `autolink_bare_uris`,
4192 `intraword_underscores`, `strikeout`, `hard_line_breaks`, `emoji`,
4193 `shortcut_reference_links`, `angle_brackets_escapable`.
4195Producing slide shows with pandoc
4196=================================
4198You can use pandoc to produce an HTML + JavaScript slide presentation
4199that can be viewed via a web browser. There are five ways to do this,
4200using [S5], [DZSlides], [Slidy], [Slideous], or [reveal.js].
4201You can also produce a PDF slide show using LaTeX [`beamer`], or
4202slides shows in Microsoft [PowerPoint] format.
4204Here's the Markdown source for a simple slide show, `habits.txt`:
4206 % Habits
4207 % John Doe
4208 % March 22, 2005
4210 # In the morning
4212 ## Getting up
4214 - Turn off alarm
4215 - Get out of bed
4217 ## Breakfast
4219 - Eat eggs
4220 - Drink coffee
4222 # In the evening
4224 ## Dinner
4226 - Eat spaghetti
4227 - Drink wine
4229 ------------------
4231 ![picture of spaghetti](images/spaghetti.jpg)
4233 ## Going to sleep
4235 - Get in bed
4236 - Count sheep
4238To produce an HTML/JavaScript slide show, simply type
4240 pandoc -t FORMAT -s habits.txt -o habits.html
4242where `FORMAT` is either `s5`, `slidy`, `slideous`, `dzslides`, or `revealjs`.
4244For Slidy, Slideous, reveal.js, and S5, the file produced by pandoc with the
4245`-s/--standalone` option embeds a link to JavaScript and CSS files, which are
4246assumed to be available at the relative path `s5/default` (for S5), `slideous`
4247(for Slideous), `reveal.js` (for reveal.js), or at the Slidy website at
4248`w3.org` (for Slidy). (These paths can be changed by setting the `slidy-url`,
4249`slideous-url`, `revealjs-url`, or `s5-url` variables; see [Variables for slides],
4250above.) For DZSlides, the (relatively short) JavaScript and CSS are included in
4251the file by default.
4253With all HTML slide formats, the `--self-contained` option can be used to
4254produce a single file that contains all of the data necessary to display the
4255slide show, including linked scripts, stylesheets, images, and videos.
4257To produce a PDF slide show using beamer, type
4259 pandoc -t beamer habits.txt -o habits.pdf
4261Note that a reveal.js slide show can also be converted to a PDF
4262by printing it to a file from the browser.
4264To produce a Powerpoint slide show, type
4266 pandoc habits.txt -o habits.pptx
4268Structuring the slide show
4269--------------------------
4271By default, the *slide level* is the highest header level in
4272the hierarchy that is followed immediately by content, and not another
4273header, somewhere in the document. In the example above, level 1 headers
4274are always followed by level 2 headers, which are followed by content,
4275so 2 is the slide level. This default can be overridden using
4276the `--slide-level` option.
4278The document is carved up into slides according to the following
4279rules:
4281 * A horizontal rule always starts a new slide.
4283 * A header at the slide level always starts a new slide.
4285 * Headers *below* the slide level in the hierarchy create
4286 headers *within* a slide.
4288 * Headers *above* the slide level in the hierarchy create
4289 "title slides," which just contain the section title
4290 and help to break the slide show into sections.
4292 * Content *above* the slide level will not appear in the slide
4293 show.
4295 * A title page is constructed automatically from the document's title
4296 block, if present. (In the case of beamer, this can be disabled
4297 by commenting out some lines in the default template.)
4299These rules are designed to support many different styles of slide show. If
4300you don't care about structuring your slides into sections and subsections,
4301you can just use level 1 headers for all each slide. (In that case, level 1
4302will be the slide level.) But you can also structure the slide show into
4303sections, as in the example above.
4305Note: in reveal.js slide shows, if slide level is 2, a two-dimensional
4306layout will be produced, with level 1 headers building horizontally
4307and level 2 headers building vertically. It is not recommended that
4308you use deeper nesting of section levels with reveal.js.
4310Incremental lists
4311-----------------
4313By default, these writers produce lists that display "all at once."
4314If you want your lists to display incrementally (one item at a time),
4315use the `-i` option. If you want a particular list to depart from the
4316default, put it in a `div` block with class `incremental` or
4317`nonincremental`. So, for example, using the `fenced div` syntax, the
4318following would be incremental regardless of the document default:
4320 ::: incremental
4322 - Eat spaghetti
4323 - Drink wine
4325 :::
4329 ::: nonincremental
4331 - Eat spaghetti
4332 - Drink wine
4334 :::
4336While using `incremental` and `nonincremental` divs are the
4337recommended method of setting incremental lists on a per-case basis,
4338an older method is also supported: putting lists inside a blockquote
4339will depart from the document default (that is, it will display
4340incrementally without the `-i` option and all at once with the `-i`
4341option):
4343 > - Eat spaghetti
4344 > - Drink wine
4346Both methods allow incremental and nonincremental lists to be mixed
4347in a single document.
4349Inserting pauses
4350----------------
4352You can add "pauses" within a slide by including a paragraph containing
4353three dots, separated by spaces:
4355 # Slide with a pause
4357 content before the pause
4359 . . .
4361 content after the pause
4363Styling the slides
4364------------------
4366You can change the style of HTML slides by putting customized CSS files
4367in `$DATADIR/s5/default` (for S5), `$DATADIR/slidy` (for Slidy),
4368or `$DATADIR/slideous` (for Slideous),
4369where `$DATADIR` is the user data directory (see `--data-dir`, above).
4370The originals may be found in pandoc's system data directory (generally
4371`$CABALDIR/pandoc-VERSION/s5/default`). Pandoc will look there for any
4372files it does not find in the user data directory.
4374For dzslides, the CSS is included in the HTML file itself, and may
4375be modified there.
4377All [reveal.js configuration options] can be set through variables.
4378For example, themes can be used by setting the `theme` variable:
4380 -V theme=moon
4382Or you can specify a custom stylesheet using the `--css` option.
4384To style beamer slides, you can specify a `theme`, `colortheme`,
4385`fonttheme`, `innertheme`, and `outertheme`, using the `-V` option:
4387 pandoc -t beamer habits.txt -V theme:Warsaw -o habits.pdf
4389Note that header attributes will turn into slide attributes
4390(on a `<div>` or `<section>`) in HTML slide formats, allowing you
4391to style individual slides. In beamer, the only header attribute
4392that affects slides is the `allowframebreaks` class, which sets the
4393`allowframebreaks` option, causing multiple slides to be created
4394if the content overfills the frame. This is recommended especially for
4395bibliographies:
4397 # References {.allowframebreaks}
4399Speaker notes
4400-------------
4402Speaker notes are supported in reveal.js and PowerPoint (pptx)
4403output. You can add notes to your Markdown document thus:
4405 ::: notes
4407 This is my note.
4409 - It can contain Markdown
4410 - like this list
4412 :::
4414To show the notes window in reveal.js, press `s` while viewing the
4415presentation. Speaker notes in PowerPoint will be available, as usual,
4416in handouts and presenter view.
4418Notes are not yet supported for other slide formats, but the notes
4419will not appear on the slides themselves.
4421Columns
4422-------
4424To put material in side by side columns, you can use a native
4425div container with class `columns`, containing two or more div
4426containers with class `column` and a `width` attribute:
4428 :::::::::::::: {.columns}
4429 ::: {.column width="40%"}
4430 contents...
4431 :::
4432 ::: {.column width="60%"}
4433 contents...
4434 :::
4435 ::::::::::::::
4437Frame attributes in beamer
4438--------------------------
4440Sometimes it is necessary to add the LaTeX `[fragile]` option to
4441a frame in beamer (for example, when using the `minted` environment).
4442This can be forced by adding the `fragile` class to the header
4443introducing the slide:
4445 # Fragile slide {.fragile}
4447All of the other frame attributes described in Section 8.1 of
4448the [Beamer User's Guide] may also be used: `allowdisplaybreaks`,
4449`allowframebreaks`, `b`, `c`, `t`, `environment`, `label`, `plain`,
4450`shrink`, `standout`, `noframenumbering`.
4452Background in reveal.js and beamer
4453----------------------------------
4455Background images can be added to self-contained reveal.js slideshows and
4456to beamer slideshows.
4458For the same image on every slide, use the configuration
4459option `background-image` either in the YAML metadata block
4460or as a command-line variable. (There are no other options in
4461beamer and the rest of this section concerns reveal.js slideshows.)
4463For reveal.js, you can instead use the reveal.js-native option
4464`parallaxBackgroundImage`. You can also set `parallaxBackgroundHorizontal`
4465and `parallaxBackgroundVertical` the same way and must also set
4466`parallaxBackgroundSize` to have your values take effect.
4468To set an image for a particular reveal.js slide, add
4469`{data-background-image="/path/to/image"}`
4470to the first slide-level header on the slide (which may even be empty).
4472In reveal.js's overview mode, the parallaxBackgroundImage will show up
4473only on the first slide.
4475Other reveal.js background settings also work on individual slides, including
4476`data-background-size`, `data-background-repeat`, `data-background-color`,
4477`data-transition`, and `data-transition-speed`.
4479See the [reveal.js
4480documentation](https://github.com/hakimel/reveal.js#slide-backgrounds)
4481for more details.
4483For example in reveal.js:
4485```
4486---
4487title: My Slideshow
4488parallaxBackgroundImage: /path/to/my/background_image.png
4489---
4491## Slide One
4493Slide 1 has background_image.png as its background.
4495## {data-background-image="/path/to/special_image.jpg"}
4497Slide 2 has a special image for its background, even though the header has no content.
4498```
4500Creating EPUBs with pandoc
4501==========================
4503EPUB Metadata
4504-------------
4506EPUB metadata may be specified using the `--epub-metadata` option, but
4507if the source document is Markdown, it is better to use a [YAML metadata
4508block][Extension: `yaml_metadata_block`]. Here is an example:
4510 ---
4511 title:
4512 - type: main
4513 text: My Book
4514 - type: subtitle
4515 text: An investigation of metadata
4516 creator:
4517 - role: author
4518 text: John Smith
4519 - role: editor
4520 text: Sarah Jones
4521 identifier:
4522 - scheme: DOI
4523 text: doi:10.234234.234/33
4524 publisher: My Press
4525 rights: © 2007 John Smith, CC BY-NC
4526 ibooks:
4527 version: 1.3.4
4528 ...
4530The following fields are recognized:
4532`identifier`
4533 ~ Either a string value or an object with fields `text` and
4534 `scheme`. Valid values for `scheme` are `ISBN-10`,
4535 `GTIN-13`, `UPC`, `ISMN-10`, `DOI`, `LCCN`, `GTIN-14`,
4536 `ISBN-13`, `Legal deposit number`, `URN`, `OCLC`,
4537 `ISMN-13`, `ISBN-A`, `JP`, `OLCC`.
4539`title`
4540 ~ Either a string value, or an object with fields `file-as` and
4541 `type`, or a list of such objects. Valid values for `type` are
4542 `main`, `subtitle`, `short`, `collection`, `edition`, `extended`.
4544`creator`
4545 ~ Either a string value, or an object with fields `role`, `file-as`,
4546 and `text`, or a list of such objects. Valid values for `role` are
4547 [MARC relators], but
4548 pandoc will attempt to translate the human-readable versions
4549 (like "author" and "editor") to the appropriate marc relators.
4551`contributor`
4552 ~ Same format as `creator`.
4554`date`
4555 ~ A string value in `YYYY-MM-DD` format. (Only the year is necessary.)
4556 Pandoc will attempt to convert other common date formats.
4558`lang` (or legacy: `language`)
4559 ~ A string value in [BCP 47] format. Pandoc will default to the local
4560 language if nothing is specified.
4562`subject`
4563 ~ A string value or a list of such values.
4565`description`
4566 ~ A string value.
4568`type`
4569 ~ A string value.
4571`format`
4572 ~ A string value.
4574`relation`
4575 ~ A string value.
4577`coverage`
4578 ~ A string value.
4580`rights`
4581 ~ A string value.
4583`cover-image`
4584 ~ A string value (path to cover image).
4586`stylesheet`
4587 ~ A string value (path to CSS stylesheet).
4589`page-progression-direction`
4590 ~ Either `ltr` or `rtl`. Specifies the `page-progression-direction`
4591 attribute for the [`spine` element].
4593`ibooks`
4594 ~ iBooks-specific metadata, with the following fields:
4596 - `version`: (string)
4597 - `specified-fonts`: `true`|`false` (default `false`)
4598 - `ipad-orientation-lock`: `portrait-only`|`landscape-only`
4599 - `iphone-orientation-lock`: `portrait-only`|`landscape-only`
4600 - `binding`: `true`|`false` (default `true`)
4601 - `scroll-axis`: `vertical`|`horizontal`|`default`
4603[MARC relators]: http://loc.gov/marc/relators/relaterm.html
4604[`spine` element]: http://idpf.org/epub/301/spec/epub-publications.html#sec-spine-elem
4606Linked media
4607------------
4609By default, pandoc will download media referenced from any `<img>`, `<audio>`,
4610`<video>` or `<source>` element present in the generated EPUB,
4611and include it in the EPUB container, yielding a completely
4612self-contained EPUB. If you want to link to external media resources
4613instead, use raw HTML in your source and add `data-external="1"` to the tag
4614with the `src` attribute. For example:
4616 <audio controls="1">
4617 <source src="http://example.com/music/toccata.mp3"
4618 data-external="1" type="audio/mpeg">
4619 </source>
4620 </audio>
4622Syntax highlighting
4623===================
4625Pandoc will automatically highlight syntax in [fenced code blocks] that
4626are marked with a language name. The Haskell library [skylighting] is
4627used for highlighting, which works in HTML, Docx, Ms, and LaTeX/PDF output.
4628To see a list of language names that pandoc will recognize, type
4629`pandoc --list-highlight-languages`.
4631The color scheme can be selected using the `--highlight-style` option.
4632The default color scheme is `pygments`, which imitates the default color
4633scheme used by the Python library pygments (though pygments is not actually
4634used to do the highlighting). To see a list of highlight styles,
4635type `pandoc --list-highlight-styles`.
4637To disable highlighting, use the `--no-highlight` option.
4639[skylighting]: https://github.com/jgm/skylighting
4641Custom Styles in Docx
4642=====================
4644Input
4645-----
4647The docx reader, by default, only reads those styles that it can
4648convert into pandoc elements, either by direct conversion or
4649interpreting the derivation of the input document's styles.
4651By enabling the [`styles` extension](#ext-styles) in the docx reader
4652(`-f docx+styles`), you can produce output that maintains the styles
4653of the input document, using the `custom-style` class. Paragraph
4654styles are interpreted as divs, while character styles are interpreted
4655as spans.
4657For example, using the `custom-style-reference.docx` file in the test
4658directory, we have the following different outputs:
4660Without the `+styles` extension:
4662 $ pandoc test/docx/custom-style-reference.docx -f docx -t markdown
4663 This is some text.
4665 This is text with an *emphasized* text style. And this is text with a
4666 **strengthened** text style.
4668 > Here is a styled paragraph that inherits from Block Text.
4670And with the extension:
4672 $ pandoc test/docx/custom-style-reference.docx -f docx+styles -t markdown
4674 ::: {custom-style="FirstParagraph"}
4675 This is some text.
4676 :::
4678 ::: {custom-style="BodyText"}
4679 This is text with an [emphasized]{custom-style="Emphatic"} text style.
4680 And this is text with a [strengthened]{custom-style="Strengthened"}
4681 text style.
4682 :::
4684 ::: {custom-style="MyBlockStyle"}
4685 > Here is a styled paragraph that inherits from Block Text.
4686 :::
4688With these custom styles, you can use your input document as a
4689reference-doc while creating docx output (see below), and maintain the
4690same styles in your input and output files.
4692Output
4693------
4695By default, pandoc's docx output applies a predefined set of styles for
4696blocks such as paragraphs and block quotes, and uses largely default
4697formatting (italics, bold) for inlines. This will work for most
4698purposes, especially alongside a `reference.docx` file. However, if you
4699need to apply your own styles to blocks, or match a preexisting set of
4700styles, pandoc allows you to define custom styles for blocks and text
4701using `div`s and `span`s, respectively.
4703If you define a `div` or `span` with the attribute `custom-style`,
4704pandoc will apply your specified style to the contained elements. So,
4705for example using the `bracketed_spans` syntax,
4707 [Get out]{custom-style="Emphatically"}, he said.
4709would produce a docx file with "Get out" styled with character
4710style `Emphatically`. Similarly, using the `fenced_divs` syntax,
4712 Dickinson starts the poem simply:
4714 ::: {custom-style="Poetry"}
4715 | A Bird came down the Walk---
4716 | He did not know I saw---
4717 :::
4719would style the two contained lines with the `Poetry` paragraph style.
4721If the styles are not yet in your reference.docx, they will be defined
4722in the output file as inheriting from normal text. If they are already
4723defined, pandoc will not alter the definition.
4725This feature allows for greatest customization in conjunction with
4726[pandoc filters]. If you want all paragraphs after block quotes to be
4727indented, you can write a filter to apply the styles necessary. If you
4728want all italics to be transformed to the `Emphasis` character style
4729(perhaps to change their color), you can write a filter which will
4730transform all italicized inlines to inlines within an `Emphasis`
4731custom-style `span`.
4733[pandoc filters]: http://pandoc.org/filters.html
4735Custom writers
4736==============
4738Pandoc can be extended with custom writers written in [lua]. (Pandoc
4739includes a lua interpreter, so lua need not be installed separately.)
4741To use a custom writer, simply specify the path to the lua script
4742in place of the output format. For example:
4744 pandoc -t data/sample.lua
4746Creating a custom writer requires writing a lua function for each
4747possible element in a pandoc document. To get a documented example
4748which you can modify according to your needs, do
4750 pandoc --print-default-data-file sample.lua
4752[lua]: http://www.lua.org
4754Authors
4755=======
4757Copyright 2006-2017 John MacFarlane (jgm@berkeley.edu). Released
4758under the [GPL], version 2 or greater. This software carries no
4759warranty of any kind. (See COPYRIGHT for full copyright and
4760warranty notices.) For a full list of contributors, see the file
4761AUTHORS.md in the pandoc source code.
4763[GPL]: http://www.gnu.org/copyleft/gpl.html "GNU General Public License"