8`pandoc` [*options*] [*input-file*]...
13Pandoc is a [Haskell] library for converting from one markup format to
14another, and a command-line tool that uses this library.
16Pandoc can convert between numerous markup and word processing formats,
17including, but not limited to, various flavors of [Markdown], [HTML],
18[LaTeX] and [Word docx]. For the full lists of input and output formats,
19see the `--from` and `--to` [options below][General options].
20Pandoc can also produce [PDF] output: see [creating a PDF], below.
22Pandoc's enhanced version of Markdown includes syntax for [tables],
23[definition lists], [metadata blocks], [footnotes], [citations], [math],
24and much more. See below under [Pandoc's Markdown].
26Pandoc has a modular design: it consists of a set of readers, which parse
27text in a given format and produce a native representation of the document
28(an _abstract syntax tree_ or AST), and a set of writers, which convert
29this native representation into a target format. Thus, adding an input
30or output format requires only adding a reader or writer. Users can also
31run custom [pandoc filters] to modify the intermediate AST.
33Because pandoc's intermediate representation of a document is less
34expressive than many of the formats it converts between, one should
35not expect perfect conversions between every format and every other.
36Pandoc attempts to preserve the structural elements of a document, but
37not formatting details such as margin size. And some document elements,
38such as complex tables, may not fit into pandoc's simple document
39model. While conversions from pandoc's Markdown to all formats aspire
40to be perfect, conversions from formats more expressive than pandoc's
41Markdown can be expected to be lossy.
46If no *input-files* are specified, input is read from *stdin*.
47Output goes to *stdout* by default. For output to a file,
50 pandoc -o output.html input.txt
52By default, pandoc produces a document fragment. To produce a standalone
53document (e.g. a valid HTML file including `<head>` and `<body>`),
54use the `-s` or `--standalone` flag:
56 pandoc -s -o output.html input.txt
58For more information on how standalone documents are produced, see
61If multiple input files are given, `pandoc` will concatenate them all (with
62blank lines between them) before parsing. (Use `--file-scope` to parse files
68The format of the input and output can be specified explicitly using
69command-line options. The input format can be specified using the
70`-f/--from` option, the output format using the `-t/--to` option.
71Thus, to convert `hello.txt` from Markdown to LaTeX, you could type:
73 pandoc -f markdown -t latex hello.txt
75To convert `hello.html` from HTML to Markdown:
77 pandoc -f html -t markdown hello.html
79Supported input and output formats are listed below under [Options]
80(see `-f` for input formats and `-t` for output formats). You
81can also use `pandoc --list-input-formats` and
82`pandoc --list-output-formats` to print lists of supported
85If the input or output format is not specified explicitly, `pandoc`
86will attempt to guess it from the extensions of the filenames.
89 pandoc -o hello.tex hello.txt
91will convert `hello.txt` from Markdown to LaTeX. If no output file
92is specified (so that output goes to *stdout*), or if the output file's
93extension is unknown, the output format will default to HTML.
94If no input file is specified (so that input comes from *stdin*), or
95if the input files' extensions are unknown, the input format will
96be assumed to be Markdown.
101Pandoc uses the UTF-8 character encoding for both input and output.
102If your local character encoding is not UTF-8, you
103should pipe input and output through [`iconv`]:
105 iconv -t utf-8 input.txt | pandoc | iconv -f utf-8
107Note that in some output formats (such as HTML, LaTeX, ConTeXt,
108RTF, OPML, DocBook, and Texinfo), information about
109the character encoding is included in the document header, which
110will only be included if you use the `-s/--standalone` option.
112[`iconv`]: http://www.gnu.org/software/libiconv/
117To produce a PDF, specify an output file with a `.pdf` extension:
119 pandoc test.txt -o test.pdf
121By default, pandoc will use LaTeX to create the PDF, which requires
122that a LaTeX engine be installed (see `--pdf-engine` below).
124Alternatively, pandoc can use [ConTeXt], `pdfroff`, or any of the
125following HTML/CSS-to-PDF-engines, to create a PDF: [`wkhtmltopdf`],
126[`weasyprint`] or [`prince`].
127To do this, specify an output file with a `.pdf` extension, as before,
128but add the `--pdf-engine` option or `-t context`, `-t html`, or `-t ms`
129to the command line (`-t html` defaults to `--pdf-engine=wkhtmltopdf`).
131PDF output can be controlled using [variables for LaTeX] (if
132LaTeX is used) and [variables for ConTeXt] (if ConTeXt is used).
133When using an HTML/CSS-to-PDF-engine, `--css` affects the output.
134If `wkhtmltopdf` is used, then the variables `margin-left`,
135`margin-right`, `margin-top`, `margin-bottom`, `footer-html`,
136`header-html` and `papersize` will affect the output.
138To debug the PDF creation, it can be useful to look at the intermediate
139representation: instead of `-o test.pdf`, use for example `-s -o test.tex`
140to output the generated LaTeX. You can then test it with `pdflatex test.tex`.
142When using LaTeX, the following packages need to be available
143(they are included with all recent versions of [TeX Live]):
144[`amsfonts`], [`amsmath`], [`lm`], [`unicode-math`],
145[`ifxetex`], [`ifluatex`], [`listings`] (if the
146`--listings` option is used), [`fancyvrb`], [`longtable`],
147[`booktabs`], [`graphicx`] and [`grffile`] (if the document
148contains images), [`hyperref`], [`xcolor`] (with `colorlinks`),
149[`ulem`], [`geometry`] (with the `geometry` variable set),
150[`setspace`] (with `linestretch`), and
151[`babel`] (with `lang`). The use of `xelatex` or `lualatex` as
152the LaTeX engine requires [`fontspec`]. `xelatex` uses
153[`polyglossia`] (with `lang`), [`xecjk`], and [`bidi`] (with the
154`dir` variable set). If the `mathspec` variable is set,
155`xelatex` will use [`mathspec`] instead of [`unicode-math`].
156The [`upquote`] and [`microtype`] packages are used if
157available, and [`csquotes`] will be used for [typography]
158if `\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/
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" \
214General options {.options}
217`-f` *FORMAT*, `-r` *FORMAT*, `--from=`*FORMAT*, `--read=`*FORMAT*
219: Specify input format. *FORMAT* can be:
222 - `commonmark` ([CommonMark] Markdown)
223 - `creole` ([Creole 1.0])
224 - `docbook` ([DocBook])
225 - `docx` ([Word docx])
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])
234 - `jats` ([JATS] XML)
235 - `json` (JSON version of native AST)
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])
244 - `native` (native Haskell)
247 - `org` ([Emacs Org mode])
248 - `rst` ([reStructuredText])
250 - `textile` ([Textile])
251 - `tikiwiki` ([TikiWiki markup])
252 - `twiki` ([TWiki markup])
253 - `vimwiki` ([Vimwiki])
256 Extensions can be individually enabled or disabled by
257 appending `+EXTENSION` or `-EXTENSION` to the format name.
258 See [Extensions] below, for a list of extensions and
259 their names. See `--list-input-formats` and `--list-extensions`,
262`-t` *FORMAT*, `-w` *FORMAT*, `--to=`*FORMAT*, `--write=`*FORMAT*
264: Specify output format. *FORMAT* can be:
266 ::: {#output-formats}
267 - `asciidoc` ([AsciiDoc])
268 - `beamer` ([LaTeX beamer][`beamer`] slide show)
269 - `commonmark` ([CommonMark] Markdown)
270 - `context` ([ConTeXt])
271 - `docbook` or `docbook4` ([DocBook] 4)
272 - `docbook5` (DocBook 5)
273 - `docx` ([Word docx])
274 - `dokuwiki` ([DokuWiki markup])
275 - `epub` or `epub3` ([EPUB] v3 book)
277 - `fb2` ([FictionBook2] e-book)
278 - `gfm` ([GitHub-Flavored Markdown]),
279 or the deprecated and less accurate `markdown_github`;
280 use [`markdown_github`](#markdown-variants) only
281 if you need extensions not supported in [`gfm`](#markdown-variants).
282 - `haddock` ([Haddock markup])
283 - `html` or `html5` ([HTML], i.e. [HTML5]/XHTML [polyglot markup])
284 - `html4` ([XHTML] 1.0 Transitional)
285 - `icml` ([InDesign ICML])
286 - `jats` ([JATS] XML)
287 - `json` (JSON version of native AST)
290 - `markdown` ([Pandoc's Markdown])
291 - `markdown_mmd` ([MultiMarkdown])
292 - `markdown_phpextra` ([PHP Markdown Extra])
293 - `markdown_strict` (original unextended [Markdown])
294 - `mediawiki` ([MediaWiki markup])
297 - `native` (native Haskell),
298 - `odt` ([OpenOffice text document][ODT])
300 - `opendocument` ([OpenDocument])
301 - `org` ([Emacs Org mode])
302 - `plain` (plain text),
303 - `pptx` ([PowerPoint] slide show)
304 - `rst` ([reStructuredText])
305 - `rtf` ([Rich Text Format])
306 - `texinfo` ([GNU Texinfo])
307 - `textile` ([Textile])
308 - `slideous` ([Slideous] HTML and JavaScript slide show)
309 - `slidy` ([Slidy] HTML and JavaScript slide show)
310 - `dzslides` ([DZSlides] HTML5 + JavaScript slide show),
311 - `revealjs` ([reveal.js] HTML5 + JavaScript slide show)
312 - `s5` ([S5] HTML and JavaScript slide show)
313 - `tei` ([TEI Simple])
314 - `zimwiki` ([ZimWiki markup])
315 - the path of a custom lua writer, see [Custom writers] below
318 Note that `odt`, `docx`, and `epub` output will not be directed
319 to *stdout* unless forced with `-o -`.
321 Extensions can be individually enabled or
322 disabled by appending `+EXTENSION` or `-EXTENSION` to the format
323 name. See [Extensions] below, for a list of extensions and their
324 names. See `--list-output-formats` and `--list-extensions`, below.
326`-o` *FILE*, `--output=`*FILE*
328: Write output to *FILE* instead of *stdout*. If *FILE* is
329 `-`, output will go to *stdout*, even if a non-textual format
330 (`docx`, `odt`, `epub2`, `epub3`) is specified.
332`--data-dir=`*DIRECTORY*
334: Specify the user data directory to search for pandoc data files.
335 If this option is not specified, the default user data directory
336 will be used. This is, in UNIX:
342 C:\Documents And Settings\USERNAME\Application Data\pandoc
344 and in Windows Vista or later:
346 C:\Users\USERNAME\AppData\Roaming\pandoc
348 You can find the default user data directory on your system by
349 looking at the output of `pandoc --version`.
350 A `reference.odt`, `reference.docx`, `epub.css`, `templates`,
351 `slidy`, `slideous`, or `s5` directory
352 placed in this directory will override pandoc's normal defaults.
356: Generate a bash completion script. To enable bash completion
357 with pandoc, add this to your `.bashrc`:
359 eval "$(pandoc --bash-completion)"
363: Give verbose debugging output. Currently this only has an effect
368: Suppress warning messages.
372: Exit with error status if there are any warnings.
376: Write log messages in machine-readable JSON format to
377 *FILE*. All messages above DEBUG level will be written,
378 regardless of verbosity settings (`--verbose`, `--quiet`).
380`--list-input-formats`
382: List supported input formats, one per line.
384`--list-output-formats`
386: List supported output formats, one per line.
388`--list-extensions`[`=`*FORMAT*]
390: List supported extensions, one per line, preceded
391 by a `+` or `-` indicating whether it is enabled by default
392 in *FORMAT*. If *FORMAT* is not specified, defaults for
393 pandoc's Markdown are given.
395`--list-highlight-languages`
397: List supported languages for syntax highlighting, one per
400`--list-highlight-styles`
402: List supported styles for syntax highlighting, one per line.
403 See `--highlight-style`.
413[Markdown]: http://daringfireball.net/projects/markdown/
414[CommonMark]: http://commonmark.org
415[PHP Markdown Extra]: https://michelf.ca/projects/php-markdown/extra/
416[GitHub-Flavored Markdown]: https://help.github.com/articles/github-flavored-markdown/
417[MultiMarkdown]: http://fletcherpenney.net/multimarkdown/
418[reStructuredText]: http://docutils.sourceforge.net/docs/ref/rst/introduction.html
419[S5]: http://meyerweb.com/eric/tools/s5/
420[Slidy]: http://www.w3.org/Talks/Tools/Slidy/
421[Slideous]: http://goessner.net/articles/slideous/
422[HTML]: http://www.w3.org/html/
423[HTML5]: http://www.w3.org/TR/html5/
424[polyglot markup]: https://www.w3.org/TR/html-polyglot/
425[XHTML]: http://www.w3.org/TR/xhtml1/
426[LaTeX]: http://latex-project.org
427[`beamer`]: https://ctan.org/pkg/beamer
428[Beamer User's Guide]: http://ctan.math.utah.edu/ctan/tex-archive/macros/latex/contrib/beamer/doc/beameruserguide.pdf
429[ConTeXt]: http://www.contextgarden.net/
430[Rich Text Format]: http://en.wikipedia.org/wiki/Rich_Text_Format
431[DocBook]: http://docbook.org
432[JATS]: https://jats.nlm.nih.gov
433[txt2tags]: http://txt2tags.org
434[EPUB]: http://idpf.org/epub
435[OPML]: http://dev.opml.org/spec2.html
436[OpenDocument]: http://opendocument.xml.org
437[ODT]: http://en.wikipedia.org/wiki/OpenDocument
438[Textile]: http://redcloth.org/textile
439[MediaWiki markup]: https://www.mediawiki.org/wiki/Help:Formatting
440[DokuWiki markup]: https://www.dokuwiki.org/dokuwiki
441[ZimWiki markup]: http://zim-wiki.org/manual/Help/Wiki_Syntax.html
442[TWiki markup]: http://twiki.org/cgi-bin/view/TWiki/TextFormattingRules
443[TikiWiki markup]: https://doc.tiki.org/Wiki-Syntax-Text#The_Markup_Language_Wiki-Syntax
444[Haddock markup]: https://www.haskell.org/haddock/doc/html/ch03s08.html
445[Creole 1.0]: http://www.wikicreole.org/wiki/Creole1.0
446[roff man]: http://man7.org/linux/man-pages/man7/groff_man.7.html
447[roff ms]: http://man7.org/linux/man-pages/man7/groff_ms.7.html
448[Haskell]: https://www.haskell.org
449[GNU Texinfo]: http://www.gnu.org/software/texinfo/
450[Emacs Org mode]: http://orgmode.org
451[AsciiDoc]: http://www.methods.co.nz/asciidoc/
452[DZSlides]: http://paulrouget.com/dzslides/
453[Word docx]: https://en.wikipedia.org/wiki/Office_Open_XML
454[PDF]: https://www.adobe.com/pdf/
455[reveal.js]: http://lab.hakim.se/reveal-js/
456[FictionBook2]: http://www.fictionbook.org/index.php/Eng:XML_Schema_Fictionbook_2.1
457[InDesign ICML]: http://wwwimages.adobe.com/www.adobe.com/content/dam/acom/en/devnet/indesign/sdk/cs6/idml/idml-cookbook.pdf
458[TEI Simple]: https://github.com/TEIC/TEI-Simple
459[Muse]: https://amusewiki.org/library/manual
460[PowerPoint]: https://en.wikipedia.org/wiki/Microsoft_PowerPoint
461[Vimwiki]: https://vimwiki.github.io
463Reader options {.options}
466`--base-header-level=`*NUMBER*
468: Specify the base level for headers (defaults to 1).
470`--strip-empty-paragraphs`
472: *Deprecated. Use the `+empty_paragraphs` extension instead.*
473 Ignore paragraphs with no content. This option is useful
474 for converting word processing documents where users have
475 used empty paragraphs to create inter-paragraph space.
477`--indented-code-classes=`*CLASSES*
479: Specify classes to use for indented code blocks--for example,
480 `perl,numberLines` or `haskell`. Multiple classes may be separated
483`--default-image-extension=`*EXTENSION*
485: Specify a default extension to use when image paths/URLs have no
486 extension. This allows you to use the same source for formats that
487 require different kinds of images. Currently this option only affects
488 the Markdown and LaTeX readers.
492: Parse each file individually before combining for multifile
493 documents. This will allow footnotes in different files with the
494 same identifiers to work as expected. If this option is set,
495 footnotes and links will not work across files. Reading binary
496 files (docx, odt, epub) implies `--file-scope`.
498`-F` *PROGRAM*, `--filter=`*PROGRAM*
500: Specify an executable to be used as a filter transforming the
501 pandoc AST after the input is parsed and before the output is
502 written. The executable should read JSON from stdin and write
503 JSON to stdout. The JSON must be formatted like pandoc's own
504 JSON input and output. The name of the output format will be
505 passed to the filter as the first argument. Hence,
507 pandoc --filter ./caps.py -t latex
511 pandoc -t json | ./caps.py latex | pandoc -f json -t latex
513 The latter form may be useful for debugging filters.
515 Filters may be written in any language. `Text.Pandoc.JSON`
516 exports `toJSONFilter` to facilitate writing filters in Haskell.
517 Those who would prefer to write filters in python can use the
518 module [`pandocfilters`], installable from PyPI. There are also
519 pandoc filter libraries in [PHP], [perl], and
520 [JavaScript/node.js].
522 In order of preference, pandoc will look for filters in
524 1. a specified full or relative path (executable or
527 2. `$DATADIR/filters` (executable or non-executable)
528 where `$DATADIR` is the user data directory (see
529 `--data-dir`, above).
531 3. `$PATH` (executable only)
533 Filters and lua-filters are applied in the order specified
536`--lua-filter=`*SCRIPT*
538: Transform the document in a similar fashion as JSON filters (see
539 `--filter`), but use pandoc's build-in lua filtering system. The given
540 lua script is expected to return a list of lua filters which will be
541 applied in order. Each lua filter must contain element-transforming
542 functions indexed by the name of the AST element on which the filter
543 function should be applied.
545 The `pandoc` lua module provides helper functions for element
546 creation. It is always loaded into the script's lua environment.
548 The following is an example lua script for macro-expansion:
550 function expand_hello_world(inline)
551 if inline.c == '{{helloworld}}' then
552 return pandoc.Emph{ pandoc.Str "Hello, World" }
558 return {{Str = expand_hello_world}}
560 In order of preference, pandoc will look for lua filters in
562 1. a specified full or relative path (executable or
565 2. `$DATADIR/filters` (executable or non-executable)
566 where `$DATADIR` is the user data directory (see
567 `--data-dir`, above).
569`-M` *KEY*[`=`*VAL*], `--metadata=`*KEY*[`:`*VAL*]
571: Set the metadata field *KEY* to the value *VAL*. A value specified
572 on the command line overrides a value specified in the document
573 using [YAML metadata blocks][Extension: `yaml_metadata_block`].
574 Values will be parsed as YAML boolean or string values. If no value is
575 specified, the value will be treated as Boolean true. Like
576 `--variable`, `--metadata` causes template variables to be set.
577 But unlike `--variable`, `--metadata` affects the metadata of the
578 underlying document (which is accessible from filters and may be
579 printed in some output formats) and metadata values will be escaped
580 when inserted into the template.
582`--metadata-file=`*FILE*
584: Read metadata from the supplied YAML (or JSON) file.
585 This option can be used with every input format, but string
586 scalars in the YAML file will always be parsed as Markdown.
587 Generally, the input will be handled the same as in
588 [YAML metadata blocks][Extension: `yaml_metadata_block`].
589 Metadata values specified inside the document, or by using `-M`,
590 overwrite values specified with this option.
592`-p`, `--preserve-tabs`
594: Preserve tabs instead of converting them to spaces (the default).
595 Note that this will only affect tabs in literal code spans and code
596 blocks; tabs in regular text will be treated as spaces.
600: Specify the number of spaces per tab (default is 4).
602`--track-changes=accept`|`reject`|`all`
604: Specifies what to do with insertions, deletions, and comments
605 produced by the MS Word "Track Changes" feature. `accept` (the
606 default), inserts all insertions, and ignores all
607 deletions. `reject` inserts all deletions and ignores
608 insertions. Both `accept` and `reject` ignore comments. `all` puts
609 in insertions, deletions, and comments, wrapped in spans with
610 `insertion`, `deletion`, `comment-start`, and `comment-end`
611 classes, respectively. The author and time of change is
612 included. `all` is useful for scripting: only accepting changes
613 from a certain reviewer, say, or before a certain date. If a
614 paragraph is inserted or deleted, `track-changes=all` produces a
615 span with the class `paragraph-insertion`/`paragraph-deletion`
616 before the affected paragraph break. This option only affects the
619`--extract-media=`*DIR*
621: Extract images and other media contained in or linked from
622 the source document to the path *DIR*, creating it if
623 necessary, and adjust the images references in the document
624 so they point to the extracted files. If the source format is
625 a binary container (docx, epub, or odt), the media is
626 extracted from the container and the original
627 filenames are used. Otherwise the media is read from the
628 file system or downloaded, and new filenames are constructed
629 based on SHA1 hashes of the contents.
631`--abbreviations=`*FILE*
633: Specifies a custom abbreviations file, with abbreviations
634 one to a line. If this option is not specified, pandoc will
635 read the data file `abbreviations` from the user data
636 directory or fall back on a system default. To see the
638 `pandoc --print-default-data-file=abbreviations`. The only
639 use pandoc makes of this list is in the Markdown reader.
640 Strings ending in a period that are found in this list will
641 be followed by a nonbreaking space, so that the period will
642 not produce sentence-ending space in formats like LaTeX.
644[`pandocfilters`]: https://github.com/jgm/pandocfilters
645[PHP]: https://github.com/vinai/pandocfilters-php
646[perl]: https://metacpan.org/pod/Pandoc::Filter
647[JavaScript/node.js]: https://github.com/mvhenderson/pandoc-filter-node
649General writer options {.options}
650----------------------
654: Produce output with an appropriate header and footer (e.g. a
655 standalone HTML, LaTeX, TEI, or RTF file, not a fragment). This option
656 is set automatically for `pdf`, `epub`, `epub3`, `fb2`, `docx`, and `odt`
657 output. For `native` output, this option causes metadata to
658 be included; otherwise, metadata is suppressed.
660`--template=`*FILE*|*URL*
662: Use the specified file as a custom template for the generated document.
663 Implies `--standalone`. See [Templates], below, for a description
664 of template syntax. If no extension is specified, an extension
665 corresponding to the writer will be added, so that `--template=special`
666 looks for `special.html` for HTML output. If the template is not
667 found, pandoc will search for it in the `templates` subdirectory of
668 the user data directory (see `--data-dir`). If this option is not used,
669 a default template appropriate for the output format will be used (see
670 `-D/--print-default-template`).
672`-V` *KEY*[`=`*VAL*], `--variable=`*KEY*[`:`*VAL*]
674: Set the template variable *KEY* to the value *VAL* when rendering the
675 document in standalone mode. This is generally only useful when the
676 `--template` option is used to specify a custom template, since
677 pandoc automatically sets the variables used in the default
678 templates. If no *VAL* is specified, the key will be given the
681`-D` *FORMAT*, `--print-default-template=`*FORMAT*
683: Print the system default template for an output *FORMAT*. (See `-t`
684 for a list of possible *FORMAT*s.) Templates in the user data
685 directory are ignored.
687`--print-default-data-file=`*FILE*
689: Print a system default data file. Files in the user data directory
692`--eol=crlf`|`lf`|`native`
694: Manually specify line endings: `crlf` (Windows), `lf`
695 (macOS/Linux/UNIX), or `native` (line endings appropriate
696 to the OS on which pandoc is being run). The default is
701: Specify the dpi (dots per inch) value for conversion from pixels
702 to inch/centimeters and vice versa. The default is 96dpi.
703 Technically, the correct term would be ppi (pixels per inch).
705`--wrap=auto`|`none`|`preserve`
707: Determine how text is wrapped in the output (the source
708 code, not the rendered version). With `auto` (the default),
709 pandoc will attempt to wrap lines to the column width specified by
710 `--columns` (default 72). With `none`, pandoc will not wrap
711 lines at all. With `preserve`, pandoc will attempt to
712 preserve the wrapping from the source document (that is,
713 where there are nonsemantic newlines in the source, there
714 will be nonsemantic newlines in the output as well).
715 Automatic wrapping does not currently work in HTML output.
719: Specify length of lines in characters. This affects text wrapping
720 in the generated source code (see `--wrap`). It also affects
721 calculation of column widths for plain text tables (see [Tables] below).
723`--toc`, `--table-of-contents`
725: Include an automatically generated table of contents (or, in
726 the case of `latex`, `context`, `docx`, `odt`,
727 `opendocument`, `rst`, or `ms`, an instruction to create
728 one) in the output document. This option has no effect
729 unless `-s/--standalone` is used, and it has no effect
730 on `man`, `docbook4`, `docbook5`, or `jats` output.
732`--toc-depth=`*NUMBER*
734: Specify the number of section levels to include in the table
735 of contents. The default is 3 (which means that level 1, 2, and 3
736 headers will be listed in the contents).
740: Strip out HTML comments in the Markdown or Textile source,
741 rather than passing them on to Markdown, Textile or HTML
742 output as raw HTML. This does not apply to HTML comments
743 inside raw HTML blocks when the `markdown_in_html_blocks`
744 extension is not set.
748: Disables syntax highlighting for code blocks and inlines, even when
749 a language attribute is given.
751`--highlight-style=`*STYLE*|*FILE*
753: Specifies the coloring style to be used in highlighted source code.
754 Options are `pygments` (the default), `kate`, `monochrome`,
755 `breezeDark`, `espresso`, `zenburn`, `haddock`, and `tango`.
756 For more information on syntax highlighting in pandoc, see
757 [Syntax highlighting], below. See also
758 `--list-highlight-styles`.
760 Instead of a *STYLE* name, a JSON file with extension
761 `.theme` may be supplied. This will be parsed as a KDE
762 syntax highlighting theme and (if valid) used as the
765 To generate the JSON version of an existing style,
766 use `--print-highlight-style`.
768`--print-highlight-style=`*STYLE*|*FILE*
770: Prints a JSON version of a highlighting style, which can
771 be modified, saved with a `.theme` extension, and used
772 with `--highlight-style`.
774`--syntax-definition=`*FILE*
776: Instructs pandoc to load a KDE XML syntax definition file,
777 which will be used for syntax highlighting of appropriately
778 marked code blocks. This can be used to add support for
779 new languages or to use altered syntax definitions for
782`-H` *FILE*, `--include-in-header=`*FILE*
784: Include contents of *FILE*, verbatim, at the end of the header.
785 This can be used, for example, to include special
786 CSS or JavaScript in HTML documents. This option can be used
787 repeatedly to include multiple files in the header. They will be
788 included in the order specified. Implies `--standalone`.
790`-B` *FILE*, `--include-before-body=`*FILE*
792: Include contents of *FILE*, verbatim, at the beginning of the
793 document body (e.g. after the `<body>` tag in HTML, or the
794 `\begin{document}` command in LaTeX). This can be used to include
795 navigation bars or banners in HTML documents. This option can be
796 used repeatedly to include multiple files. They will be included in
797 the order specified. Implies `--standalone`.
799`-A` *FILE*, `--include-after-body=`*FILE*
801: Include contents of *FILE*, verbatim, at the end of the document
802 body (before the `</body>` tag in HTML, or the
803 `\end{document}` command in LaTeX). This option can be used
804 repeatedly to include multiple files. They will be included in the
805 order specified. Implies `--standalone`.
807`--resource-path=`*SEARCHPATH*
809: List of paths to search for images and other resources.
810 The paths should be separated by `:` on Linux, UNIX, and
811 macOS systems, and by `;` on Windows. If `--resource-path`
812 is not specified, the default resource path is the working
813 directory. Note that, if `--resource-path` is specified,
814 the working directory must be explicitly listed or it
815 will not be searched. For example:
816 `--resource-path=.:test` will search the working directory
817 and the `test` subdirectory, in that order.
819 `--resource-path` only has an effect if (a) the output
820 format embeds images (for example, `docx`, `pdf`, or `html`
821 with `--self-contained`) or (b) it is used together with
824`--request-header=`*NAME*`:`*VAL*
826: Set the request header *NAME* to the value *VAL* when making
827 HTTP requests (for example, when a URL is given on the
828 command line, or when resources used in a document must be
829 downloaded). If you're behind a proxy, you also need to set
830 the environment variable `http_proxy` to `http://...`.
832Options affecting specific writers {.options}
833----------------------------------
837: Produce a standalone HTML file with no external dependencies, using
838 `data:` URIs to incorporate the contents of linked scripts, stylesheets,
839 images, and videos. Implies `--standalone`. The resulting file should be
840 "self-contained," in the sense that it needs no external files and no net
841 access to be displayed properly by a browser. This option works only with
842 HTML output formats, including `html4`, `html5`, `html+lhs`, `html5+lhs`,
843 `s5`, `slidy`, `slideous`, `dzslides`, and `revealjs`. Scripts, images,
844 and stylesheets at absolute URLs will be downloaded; those at relative
845 URLs will be sought relative to the working directory (if the first source
846 file is local) or relative to the base URL (if the first source
847 file is remote). Elements with the attribute
848 `data-external="1"` will be left alone; the documents they
849 link to will not be incorporated in the document.
850 Limitation: resources that are loaded dynamically through
851 JavaScript cannot be incorporated; as a result,
852 `--self-contained` does not work with `--mathjax`, and some
853 advanced features (e.g. zoom or speaker notes) may not work
854 in an offline "self-contained" `reveal.js` slide show.
858: Use `<q>` tags for quotes in HTML.
862: Use only ASCII characters in output. Currently supported for XML
863 and HTML formats (which use entities instead of UTF-8 when this
864 option is selected), CommonMark, gfm, and Markdown (which use
865 entities), roff ms (which use hexadecimal escapes), and to a
866 limited degree LaTeX (which uses standard commands for accented
867 characters when possible). roff man output uses ASCII by default.
871: Use reference-style links, rather than inline links, in writing Markdown
872 or reStructuredText. By default inline links are used. The
873 placement of link references is affected by the
874 `--reference-location` option.
876`--reference-location = block`|`section`|`document`
878: Specify whether footnotes (and references, if `reference-links` is
879 set) are placed at the end of the current (top-level) block, the
880 current section, or the document. The default is
881 `document`. Currently only affects the markdown writer.
885: Use ATX-style headers in Markdown output. The default is
886 to use setext-style headers for levels 1-2, and then ATX headers.
887 (Note: for `gfm` output, ATX headers are always used.)
889`--top-level-division=[default|section|chapter|part]`
891: Treat top-level headers as the given division type in LaTeX, ConTeXt,
892 DocBook, and TEI output. The hierarchy order is part, chapter, then section;
893 all headers are shifted such that the top-level header becomes the specified
894 type. The default behavior is to determine the best division type via
895 heuristics: unless other conditions apply, `section` is chosen. When the
896 LaTeX document class is set to `report`, `book`, or `memoir` (unless the
897 `article` option is specified), `chapter` is implied as the setting for this
898 option. If `beamer` is the output format, specifying either `chapter` or
899 `part` will cause top-level headers to become `\part{..}`, while
900 second-level headers remain as their default type.
902`-N`, `--number-sections`
904: Number section headings in LaTeX, ConTeXt, HTML, or EPUB output.
905 By default, sections are not numbered. Sections with class
906 `unnumbered` will never be numbered, even if `--number-sections`
909`--number-offset=`*NUMBER*[`,`*NUMBER*`,`*...*]
911: Offset for section headings in HTML output (ignored in other
912 output formats). The first number is added to the section number for
913 top-level headers, the second for second-level headers, and so on.
914 So, for example, if you want the first top-level header in your
915 document to be numbered "6", specify `--number-offset=5`.
916 If your document starts with a level-2 header which you want to
917 be numbered "1.5", specify `--number-offset=1,4`.
918 Offsets are 0 by default. Implies `--number-sections`.
922: Use the [`listings`] package for LaTeX code blocks. The package
923 does not support multi-byte encoding for source code. To handle UTF-8
924 you would need to use a custom template. This issue is fully
925 documented here: [Encoding issue with the listings package].
929: Make list items in slide shows display incrementally (one by one).
930 The default is for lists to be displayed all at once.
932`--slide-level=`*NUMBER*
934: Specifies that headers with the specified level create
935 slides (for `beamer`, `s5`, `slidy`, `slideous`, `dzslides`). Headers
936 above this level in the hierarchy are used to divide the
937 slide show into sections; headers below this level create
938 subheads within a slide. Note that content that is
939 not contained under slide-level headers will not appear in
940 the slide show. The default is to set the slide level based
941 on the contents of the document; see [Structuring the slide
946: Wrap sections in `<section>` tags (or `<div>` tags for `html4`),
947 and attach identifiers to the enclosing `<section>` (or `<div>`)
948 rather than the header itself. See
949 [Header identifiers], below.
951`--email-obfuscation=none`|`javascript`|`references`
953: Specify a method for obfuscating `mailto:` links in HTML documents.
954 `none` leaves `mailto:` links as they are. `javascript` obfuscates
955 them using JavaScript. `references` obfuscates them by printing their
956 letters as decimal or hexadecimal character references. The default
959`--id-prefix=`*STRING*
961: Specify a prefix to be added to all identifiers and internal links
962 in HTML and DocBook output, and to footnote numbers in Markdown
963 and Haddock output. This is useful for preventing duplicate
964 identifiers when generating fragments to be included in other pages.
966`-T` *STRING*, `--title-prefix=`*STRING*
968: Specify *STRING* as a prefix at the beginning of the title
969 that appears in the HTML header (but not in the title as it
970 appears at the beginning of the HTML body). Implies
973`-c` *URL*, `--css=`*URL*
975: Link to a CSS style sheet. This option can be used repeatedly to
976 include multiple files. They will be included in the order specified.
978 A stylesheet is required for generating EPUB. If none is
979 provided using this option (or the `css` or `stylesheet`
980 metadata fields), pandoc will look for a file `epub.css` in the
981 user data directory (see `--data-dir`). If it is not
982 found there, sensible defaults will be used.
984`--reference-doc=`*FILE*
986: Use the specified file as a style reference in producing a
991 : For best results, the reference docx should be a modified
992 version of a docx file produced using pandoc. The contents
993 of the reference docx are ignored, but its stylesheets and
994 document properties (including margins, page size, header,
995 and footer) are used in the new docx. If no reference docx
996 is specified on the command line, pandoc will look for a
997 file `reference.docx` in the user data directory (see
998 `--data-dir`). If this is not found either, sensible
999 defaults will be used.
1001 To produce a custom `reference.docx`, first get a copy of
1002 the default `reference.docx`: `pandoc
1003 --print-default-data-file reference.docx >
1004 custom-reference.docx`. Then open `custom-reference.docx`
1005 in Word, modify the styles as you wish, and save the file.
1006 For best results, do not make changes to this file other
1007 than modifying the styles used by pandoc: [paragraph]
1008 Normal, Body Text, First Paragraph, Compact, Title,
1009 Subtitle, Author, Date, Abstract, Bibliography, Heading 1,
1010 Heading 2, Heading 3, Heading 4, Heading 5, Heading 6,
1011 Heading 7, Heading 8, Heading 9, Block Text, Footnote Text,
1012 Definition Term, Definition, Caption, Table Caption,
1013 Image Caption, Figure, Captioned Figure, TOC Heading;
1014 [character] Default Paragraph Font, Body Text Char,
1015 Verbatim Char, Footnote Reference, Hyperlink; [table]
1020 : For best results, the reference ODT should be a modified
1021 version of an ODT produced using pandoc. The contents of
1022 the reference ODT are ignored, but its stylesheets are used
1023 in the new ODT. If no reference ODT is specified on the
1024 command line, pandoc will look for a file `reference.odt` in
1025 the user data directory (see `--data-dir`). If this is not
1026 found either, sensible defaults will be used.
1028 To produce a custom `reference.odt`, first get a copy of
1029 the default `reference.odt`: `pandoc
1030 --print-default-data-file reference.odt >
1031 custom-reference.odt`. Then open `custom-reference.odt` in
1032 LibreOffice, modify the styles as you wish, and save the
1037 : Any template included with a recent install of Microsoft
1038 PowerPoint (either with `.pptx` or `.potx` extension) should
1039 work, as will most templates derived from these.
1041 The specific requirement is that the template should contain
1042 the following four layouts as its first four layouts:
1045 2. Title and Content
1049 All templates included with a recent version of MS PowerPoint
1050 will fit these criteria. (You can click on `Layout` under the
1051 `Home` menu to check.)
1053 You can also modify the default `reference.pptx`: first run
1054 `pandoc --print-default-data-file reference.pptx >
1055 custom-reference.pptx`, and then modify
1056 `custom-reference.pptx` in MS PowerPoint (pandoc will use the
1057 first four layout slides, as mentioned above).
1059`--epub-cover-image=`*FILE*
1061: Use the specified image as the EPUB cover. It is recommended
1062 that the image be less than 1000px in width and height. Note that
1063 in a Markdown source document you can also specify `cover-image`
1064 in a YAML metadata block (see [EPUB Metadata], below).
1066`--epub-metadata=`*FILE*
1068: Look in the specified XML file for metadata for the EPUB.
1069 The file should contain a series of [Dublin Core elements].
1072 <dc:rights>Creative Commons</dc:rights>
1073 <dc:language>es-AR</dc:language>
1075 By default, pandoc will include the following metadata elements:
1076 `<dc:title>` (from the document title), `<dc:creator>` (from the
1077 document authors), `<dc:date>` (from the document date, which should
1078 be in [ISO 8601 format]), `<dc:language>` (from the `lang`
1079 variable, or, if is not set, the locale), and `<dc:identifier
1080 id="BookId">` (a randomly generated UUID). Any of these may be
1081 overridden by elements in the metadata file.
1083 Note: if the source document is Markdown, a YAML metadata block
1084 in the document can be used instead. See below under
1087`--epub-embed-font=`*FILE*
1089: Embed the specified font in the EPUB. This option can be repeated
1090 to embed multiple fonts. Wildcards can also be used: for example,
1091 `DejaVuSans-*.ttf`. However, if you use wildcards on the command
1092 line, be sure to escape them or put the whole filename in single quotes,
1093 to prevent them from being interpreted by the shell. To use the
1094 embedded fonts, you will need to add declarations like the following
1095 to your CSS (see `--css`):
1098 font-family: DejaVuSans;
1100 font-weight: normal;
1101 src:url("DejaVuSans-Regular.ttf");
1104 font-family: DejaVuSans;
1107 src:url("DejaVuSans-Bold.ttf");
1110 font-family: DejaVuSans;
1112 font-weight: normal;
1113 src:url("DejaVuSans-Oblique.ttf");
1116 font-family: DejaVuSans;
1119 src:url("DejaVuSans-BoldOblique.ttf");
1121 body { font-family: "DejaVuSans"; }
1123`--epub-chapter-level=`*NUMBER*
1125: Specify the header level at which to split the EPUB into separate
1126 "chapter" files. The default is to split into chapters at level 1
1127 headers. This option only affects the internal composition of the
1128 EPUB, not the way chapters and sections are displayed to users. Some
1129 readers may be slow if the chapter files are too large, so for large
1130 documents with few level 1 headers, one might want to use a chapter
1133`--epub-subdirectory=`*DIRNAME*
1135: Specify the subdirectory in the OCF container that is to hold
1136 the EPUB-specific contents. The default is `EPUB`. To put
1137 the EPUB contents in the top level, use an empty string.
1139`--pdf-engine=pdflatex`|`lualatex`|`xelatex`|`wkhtmltopdf`|`weasyprint`|`prince`|`context`|`pdfroff`
1141: Use the specified engine when producing PDF output.
1142 The default is `pdflatex`. If the engine is not in your PATH,
1143 the full path of the engine may be specified here.
1145`--pdf-engine-opt=`*STRING*
1147: Use the given string as a command-line argument to the `pdf-engine`.
1148 If used multiple times, the arguments are provided with spaces between
1149 them. Note that no check for duplicate options is done.
1151[Dublin Core elements]: http://dublincore.org/documents/dces/
1152[ISO 8601 format]: http://www.w3.org/TR/NOTE-datetime
1153[Encoding issue with the listings package]:
1154 https://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings#Encoding_issue
1156Citation rendering {.options}
1159`--bibliography=`*FILE*
1161: Set the `bibliography` field in the document's metadata to *FILE*,
1162 overriding any value set in the metadata, and process citations
1163 using `pandoc-citeproc`. (This is equivalent to
1164 `--metadata bibliography=FILE --filter pandoc-citeproc`.)
1165 If `--natbib` or `--biblatex` is also supplied, `pandoc-citeproc` is not
1166 used, making this equivalent to `--metadata bibliography=FILE`.
1167 If you supply this argument multiple times, each *FILE* will be added
1172: Set the `csl` field in the document's metadata to *FILE*,
1173 overriding any value set in the metadata. (This is equivalent to
1174 `--metadata csl=FILE`.)
1175 This option is only relevant with `pandoc-citeproc`.
1177`--citation-abbreviations=`*FILE*
1179: Set the `citation-abbreviations` field in the document's metadata to
1180 *FILE*, overriding any value set in the metadata. (This is equivalent to
1181 `--metadata citation-abbreviations=FILE`.)
1182 This option is only relevant with `pandoc-citeproc`.
1186: Use [`natbib`] for citations in LaTeX output. This option is not for use
1187 with the `pandoc-citeproc` filter or with PDF output. It is intended for
1188 use in producing a LaTeX file that can be processed with [`bibtex`].
1192: Use [`biblatex`] for citations in LaTeX output. This option is not for use
1193 with the `pandoc-citeproc` filter or with PDF output. It is intended for
1194 use in producing a LaTeX file that can be processed with [`bibtex`] or [`biber`].
1196Math rendering in HTML {.options}
1197----------------------
1199The default is to render TeX math as far as possible using Unicode characters.
1200Formulas are put inside a `span` with `class="math"`, so that they may be styled
1201differently from the surrounding text if needed. However, this gives acceptable
1202results only for basic math, usually you will want to use `--mathjax` or another
1203of the following options.
1205`--mathjax`[`=`*URL*]
1207: Use [MathJax] to display embedded TeX math in HTML output.
1208 TeX math will be put between `\(...\)` (for inline math)
1209 or `\[...\]` (for display math) and wrapped in `<span>` tags
1210 with class `math`. Then the MathJax JavaScript will render it.
1211 The *URL* should point to the `MathJax.js` load script.
1212 If a *URL* is not provided, a link to the Cloudflare CDN will
1217: Convert TeX math to [MathML] (in `epub3`, `docbook4`, `docbook5`, `jats`,
1218 `html4` and `html5`). This is the default in `odt` output. Note that
1219 currently only Firefox and Safari (and select e-book readers) natively
1224: Convert TeX formulas to `<img>` tags that link to an external script
1225 that converts formulas to images. The formula will be URL-encoded
1226 and concatenated with the URL provided. For SVG images you can for
1227 example use `--webtex https://latex.codecogs.com/svg.latex?`.
1228 If no URL is specified, the CodeCogs URL generating PNGs
1229 will be used (`https://latex.codecogs.com/png.latex?`).
1230 Note: the `--webtex` option will affect Markdown output
1231 as well as HTML, which is useful if you're targeting a
1232 version of Markdown without native math support.
1236: Use [KaTeX] to display embedded TeX math in HTML output.
1237 The *URL* is the base URL for the KaTeX library. That directory
1238 should contain a `katex.min.js` and a `katex.min.css` file.
1239 If a *URL* is not provided, a link to the KaTeX CDN will be inserted.
1243: Enclose TeX math in `<eq>` tags in HTML output. The resulting HTML
1244 can then be processed by [GladTeX] to produce images of the typeset
1245 formulas and an HTML file with links to these images.
1246 So, the procedure is:
1248 pandoc -s --gladtex input.md -o myfile.htex
1249 gladtex -d myfile-images myfile.htex
1250 # produces myfile.html and images in myfile-images
1252[MathML]: http://www.w3.org/Math/
1253[MathJax]: https://www.mathjax.org
1254[KaTeX]: https://github.com/Khan/KaTeX
1255[GladTeX]: http://humenda.github.io/GladTeX/
1257Options for wrapper scripts {.options}
1258---------------------------
1262: Print information about command-line arguments to *stdout*, then exit.
1263 This option is intended primarily for use in wrapper scripts.
1264 The first line of output contains the name of the output file specified
1265 with the `-o` option, or `-` (for *stdout*) if no output file was
1266 specified. The remaining lines contain the command-line arguments,
1267 one per line, in the order they appear. These do not include regular
1268 pandoc options and their arguments, but do include any options appearing
1269 after a `--` separator at the end of the line.
1273: Ignore command-line arguments (for use in wrapper scripts).
1274 Regular pandoc options are not ignored. Thus, for example,
1276 pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1
1280 pandoc -o foo.html -s
1285When the `-s/--standalone` option is used, pandoc uses a template to
1286add header and footer material that is needed for a self-standing
1287document. To see the default template that is used, just type
1291where *FORMAT* is the name of the output format. A custom template
1292can be specified using the `--template` option. You can also override
1293the system default templates for a given output format *FORMAT*
1294by putting a file `templates/default.*FORMAT*` in the user data
1295directory (see `--data-dir`, above). *Exceptions:*
1297- For `odt` output, customize the `default.opendocument`
1299- For `pdf` output, customize the `default.latex` template
1300 (or the `default.context` template, if you use `-t context`,
1301 or the `default.ms` template, if you use `-t ms`, or the
1302 `default.html` template, if you use `-t html`).
1303- `docx` has no template (however, you can use
1304 `--reference-doc` to customize the output).
1306Templates contain *variables*, which allow for the inclusion of
1307arbitrary information at any point in the file. They may be set at the
1308command line using the `-V/--variable` option. If a variable is not set,
1309pandoc will look for the key in the document's metadata – which can be set
1310using either [YAML metadata blocks][Extension: `yaml_metadata_block`]
1311or with the `--metadata` option.
1313Variables set by pandoc
1314-----------------------
1316Some variables are set automatically by pandoc. These vary somewhat
1317depending on the output format, but include the following:
1319`sourcefile`, `outputfile`
1320: source and destination filenames, as given on the command line.
1321 `sourcefile` can also be a list if input comes from multiple files, or empty
1322 if input is from stdin. You can use the following snippet in your template
1323 to distinguish them:
1333 Similarly, `outputfile` can be `-` if output goes to the terminal.
1335`title`, `author`, `date`
1336: allow identification of basic aspects of the document. Included
1337 in PDF metadata through LaTeX and ConTeXt. These can be set
1338 through a [pandoc title block][Extension: `pandoc_title_block`],
1339 which allows for multiple authors, or through a YAML metadata block:
1348: document subtitle, included in HTML, EPUB, LaTeX, ConTeXt, and Word docx;
1349 renders in LaTeX only when using a document class that supports
1350 `\subtitle`, such as `beamer` or the [KOMA-Script] series (`scrartcl`,
1351 `scrreprt`, `scrbook`).[^subtitle]
1354: author affiliations (in LaTeX and Beamer only). Can be a
1355 list, when there are multiple authors.
1358: document summary, included in LaTeX, ConTeXt, AsciiDoc, and Word docx
1361: list of keywords to be included in HTML, PDF, and AsciiDoc metadata;
1362 may be repeated as for `author`, above
1365: contents specified by `-H/--include-in-header` (may have multiple
1369: non-null value if `--toc/--table-of-contents` was specified
1372: title of table of contents (works only with EPUB,
1373 opendocument, odt, docx, pptx, beamer, LaTeX)
1376: contents specified by `-B/--include-before-body` (may have
1380: contents specified by `-A/--include-after-body` (may have
1387: JSON representation of all of the document's metadata. Field
1388 values are transformed to the selected output format.
1390[^subtitle]: To make `subtitle` work with other LaTeX
1391 document classes, you can add the following to `header-includes`:
1393 \providecommand{\subtitle}[1]{%
1394 \usepackage{titling}
1396 \par\large#1\end{center}}
1403: identifies the main language of the document,
1404 using a code according to [BCP 47] (e.g. `en` or `en-GB`).
1405 For some output formats, pandoc will convert it to an appropriate
1406 format stored in the additional variables `babel-lang`,
1407 `polyglossia-lang` (LaTeX) and `context-lang` (ConTeXt).
1409 Native pandoc Spans and Divs with the lang attribute
1410 (value in BCP 47) can be used to switch the language in
1411 that range. In LaTeX output, `babel-otherlangs` and
1412 `polyglossia-otherlangs` variables will be generated
1413 automatically based on the `lang` attributes of Spans
1414 and Divs in the document.
1417: the base direction of the document, either `rtl` (right-to-left)
1418 or `ltr` (left-to-right).
1420 For bidirectional documents, native pandoc `span`s and `div`s
1421 with the `dir` attribute (value `rtl` or `ltr`) can be used to
1422 override the base direction in some output formats.
1423 This may not always be necessary if the final renderer
1424 (e.g. the browser, when generating HTML) supports the
1425 [Unicode Bidirectional Algorithm].
1427 When using LaTeX for bidirectional documents, only the `xelatex` engine
1428 is fully supported (use `--pdf-engine=xelatex`).
1430[BCP 47]: https://tools.ietf.org/html/bcp47
1431[Unicode Bidirectional Algorithm]: http://www.w3.org/International/articles/inline-bidi-markup/uba-basics
1436Variables are available for [producing slide shows with pandoc],
1437including all [reveal.js configuration options].
1440: title graphic for Beamer documents
1443: logo for Beamer documents
1446: base URL for Slidy documents (defaults to
1447 `https://www.w3.org/Talks/Tools/Slidy2`)
1450: base URL for Slideous documents (defaults to `slideous`)
1453: base URL for S5 documents (defaults to `s5/default`)
1456: base URL for reveal.js documents (defaults to `reveal.js`)
1458`theme`, `colortheme`, `fonttheme`, `innertheme`, `outertheme`
1459: themes for LaTeX [`beamer`] documents
1462: options for LaTeX beamer themes (a list).
1465: controls navigation symbols in `beamer` documents
1466 (default is `empty` for no navigation symbols; other valid values
1467 are `frame`, `vertical`, and `horizontal`).
1470: enables on "title pages" for new sections in `beamer`
1471 documents (default = true).
1474: when true, the `beamerarticle` package is loaded (for
1475 producing an article from beamer slides).
1478: aspect ratio of slides (for beamer only, `1610` for 16:10, `169` for 16:9,
1479 `149` for 14:9, `141` for 1.41:1, `54` for 5:4, `43` for 4:3 which is the
1480 default, and `32` for 3:2).
1482[reveal.js configuration options]: https://github.com/hakimel/reveal.js#configuration
1487LaTeX variables are used when [creating a PDF].
1490: paper size, e.g. `letter`, `a4`
1493: font size for body text (e.g. `10pt`, `12pt`)
1496: document class, e.g. [`article`], [`report`], [`book`], [`memoir`]
1499: option for document class, e.g. `oneside`; may be repeated
1500 for multiple options
1503: In beamer, add extra beamer option with `\setbeameroption{}`
1506: option for [`geometry`] package, e.g. `margin=1in`;
1507 may be repeated for multiple options
1509`margin-left`, `margin-right`, `margin-top`, `margin-bottom`
1510: sets margins, if `geometry` is not used (otherwise `geometry`
1514: adjusts line spacing using the [`setspace`]
1515 package, e.g. `1.25`, `1.5`
1518: font package for use with `pdflatex`:
1519 [TeX Live] includes many options, documented in the [LaTeX Font Catalogue].
1520 The default is [Latin Modern][`lm`].
1523: options for package used as `fontfamily`: e.g. `osf,sc` with
1524 `fontfamily` set to [`mathpazo`] provides Palatino with old-style
1525 figures and true small caps; may be repeated for multiple options
1527`mainfont`, `romanfont`, `sansfont`, `monofont`, `mathfont`, `CJKmainfont`
1528: font families for use with `xelatex` or
1529 `lualatex`: take the name of any system font, using the
1530 [`fontspec`] package. Note that if `CJKmainfont` is used,
1531 the [`xecjk`] package must be available.
1533`mainfontoptions`, `romanfontoptions`, `sansfontoptions`, `monofontoptions`, `mathfontoptions`, `CJKoptions`
1534: options to use with `mainfont`, `sansfont`, `monofont`, `mathfont`,
1535 `CJKmainfont` in `xelatex` and `lualatex`. Allow for any choices
1536 available through [`fontspec`], such as the OpenType features
1537 `Numbers=OldStyle,Numbers=Proportional`. May be repeated for multiple options.
1540: allows font encoding to be specified through `fontenc` package (with `pdflatex`);
1541 default is `T1` (see guide to [LaTeX font encodings])
1544: options to pass to the microtype package
1547: add color to link text; automatically enabled if any of
1548 `linkcolor`, `filecolor`, `citecolor`, `urlcolor`, or `toccolor` are set
1550`linkcolor`, `filecolor`, `citecolor`, `urlcolor`, `toccolor`
1551: color for internal links, external links, citation links, linked
1552 URLs, and links in table of contents, respectively: uses options
1553 allowed by [`xcolor`], including the `dvipsnames`, `svgnames`, and
1557: causes links to be printed as footnotes
1560: uses document class settings for indentation (the default LaTeX template
1561 otherwise removes indentation and adds space between paragraphs)
1564: disables default behavior of LaTeX template that redefines (sub)paragraphs
1565 as sections, changing the appearance of nested headings in some classes
1568: specifies contents of acknowledgments footnote after document title.
1571: include table of contents (can also be set using `--toc/--table-of-contents`)
1574: level of section to include in table of contents
1577: numbering depth for sections, if sections are numbered
1580: include list of figures, list of tables
1583: bibliography to use for resolving references
1586: bibliography style, when used with `--natbib` and `--biblatex`.
1589: bibliography title, when used with `--natbib` and `--biblatex`.
1592: list of options for biblatex.
1595: list of options for natbib.
1598: An option for LaTeX's `\pagestyle{}`. The default article class
1599 supports 'plain' (default), 'empty', and 'headings'; headings puts
1600 section titles in the header.
1602[`article`]: https://ctan.org/pkg/article
1603[`report`]: https://ctan.org/pkg/report
1604[`book`]: https://ctan.org/pkg/book
1605[KOMA-Script]: https://ctan.org/pkg/koma-script
1606[`memoir`]: https://ctan.org/pkg/memoir
1607[`xcolor`]: https://ctan.org/pkg/xcolor
1608[LaTeX Font Catalogue]: http://www.tug.dk/FontCatalogue/
1609[`mathpazo`]: https://ctan.org/pkg/mathpazo
1610[LaTeX font encodings]: https://ctan.org/pkg/encguide
1612Variables for ConTeXt
1613---------------------
1616: paper size, e.g. `letter`, `A4`, `landscape` (see [ConTeXt Paper Setup]);
1617 may be repeated for multiple options
1620: options for page margins and text arrangement (see [ConTeXt Layout]);
1621 may be repeated for multiple options
1623`margin-left`, `margin-right`, `margin-top`, `margin-bottom`
1624: sets margins, if `layout` is not used (otherwise `layout`
1628: font size for body text (e.g. `10pt`, `12pt`)
1630`mainfont`, `sansfont`, `monofont`, `mathfont`
1631: font families: take the name of any system font (see [ConTeXt Font Switching])
1633`linkcolor`, `contrastcolor`
1634: color for links outside and inside a page, e.g. `red`, `blue` (see [ConTeXt Color])
1637: typeface style for links, e.g. `normal`, `bold`, `slanted`, `boldslanted`, `type`, `cap`, `small`
1640: controls indentation of paragraphs, e.g. `yes,small,next` (see [ConTeXt Indentation]);
1641 may be repeated for multiple options
1644: spacing between paragraphs, e.g. `none`, `small` (using [`setupwhitespace`])
1647: adjusts line spacing, e.g. `4ex` (using [`setupinterlinespace`]);
1648 may be repeated for multiple options
1650`headertext`, `footertext`
1651: text to be placed in running header or footer (see [ConTeXt Headers and Footers]);
1652 may be repeated up to four times for different placement
1655: page number style and location (using [`setuppagenumbering`]);
1656 may be repeated for multiple options
1659: include table of contents (can also be set using `--toc/--table-of-contents`)
1662: include list of figures, list of tables
1665: adds to the preamble the setup necessary to generate PDF/A-1b:2005.
1666 To successfully generate PDF/A the required ICC color profiles have to
1667 be available and the content and all included files (such as images)
1668 have to be standard conforming. The ICC profiles can be obtained
1669 from [ConTeXt ICC Profiles]. See also [ConTeXt PDFA] for more
1672[ConTeXt Paper Setup]: https://wiki.contextgarden.net/PaperSetup
1673[ConTeXt Layout]: https://wiki.contextgarden.net/Layout
1674[ConTeXt Font Switching]: https://wiki.contextgarden.net/Font_Switching
1675[ConTeXt Color]: https://wiki.contextgarden.net/Color
1676[ConTeXt Headers and Footers]: https://wiki.contextgarden.net/Headers_and_Footers
1677[ConTeXt Indentation]: https://wiki.contextgarden.net/Indentation
1678[ConTeXt ICC Profiles]: https://wiki.contextgarden.net/PDFX#ICC_profiles
1679[ConTeXt PDFA]: https://wiki.contextgarden.net/PDF/A
1680[`setupwhitespace`]: https://wiki.contextgarden.net/Command/setupwhitespace
1681[`setupinterlinespace`]: https://wiki.contextgarden.net/Command/setupinterlinespace
1682[`setuppagenumbering`]: https://wiki.contextgarden.net/Command/setuppagenumbering
1684Variables for man pages
1685-----------------------
1688: section number in man pages
1691: header in man pages
1694: footer in man pages
1697: adjusts text to left (`l`), right (`r`), center (`c`),
1698 or both (`b`) margins
1701: if `true` (the default), hyphenation will be used
1707: point size (e.g. `10p`)
1710: line height (e.g. `12p`)
1713: font family (e.g. `T` or `P`)
1716: paragraph indent (e.g. `2m`)
1718Using variables in templates
1719----------------------------
1721Variable names are sequences of alphanumerics, `-`, and `_`,
1722starting with a letter. A variable name surrounded by `$` signs
1723will be replaced by its value. For example, the string `$title$` in
1725 <title>$title$</title>
1727will be replaced by the document title.
1729To write a literal `$` in a template, use `$$`.
1731Templates may contain conditionals. The syntax is as follows:
1739This will include `X` in the template if `variable` has a truthy
1740value; otherwise it will include `Y`. Here a truthy value is any
1743- a string that is not entirely white space,
1744- a non-empty array where the first value is truthy,
1745- any number (including zero),
1747- the boolean `true` (to specify the boolean `true`
1748 value using YAML metadata or the `--metadata` flag,
1749 use `true`, `True`, or `TRUE`; with the `--variable`
1750 flag, simply omit a value for the variable, e.g.
1751 `--variable draft`).
1753`X` and `Y` are placeholders for any valid template text,
1754and may include interpolated variables or other conditionals.
1755The `$else$` section may be omitted.
1757When variables can have multiple values (for example, `author` in
1758a multi-author document), you can use the `$for$` keyword:
1761 <meta name="author" content="$author$" />
1764You can optionally specify a separator to be used between
1767 $for(author)$$author$$sep$, $endfor$
1769A dot can be used to select a field of a variable that takes
1770an object as its value. So, for example:
1772 $author.name$ ($author.affiliation$)
1774If you use custom templates, you may need to revise them as pandoc
1775changes. We recommend tracking the changes in the default templates,
1776and modifying your custom templates accordingly. An easy way to do this
1777is to fork the [pandoc-templates] repository and merge in changes after each
1780Templates may contain comments: anything on a line after `$--`
1781will be treated as a comment and ignored.
1783[pandoc-templates]: https://github.com/jgm/pandoc-templates
1788The behavior of some of the readers and writers can be adjusted by
1789enabling or disabling various extensions.
1791An extension can be enabled by adding `+EXTENSION`
1792to the format name and disabled by adding `-EXTENSION`. For example,
1793`--from markdown_strict+footnotes` is strict Markdown with footnotes
1794enabled, while `--from markdown-footnotes-pipe_tables` is pandoc's
1795Markdown without footnotes or pipe tables.
1797The markdown reader and writer make by far the most use of extensions.
1798Extensions only used by them are therefore covered in the
1799section [Pandoc's Markdown] below (See [Markdown variants] for
1800`commonmark` and `gfm`.) In the following, extensions that also work
1801for other formats are covered.
1806#### Extension: `smart` ####
1808Interpret straight quotes as curly quotes, `---` as em-dashes,
1809`--` as en-dashes, and `...` as ellipses. Nonbreaking spaces are
1810inserted after certain abbreviations, such as "Mr."
1812This extension can be enabled/disabled for the following formats:
1815: `markdown`, `commonmark`, `latex`, `mediawiki`, `org`, `rst`, `twiki`
1818: `markdown`, `latex`, `context`, `rst`
1820enabled by default in
1821: `markdown`, `latex`, `context` (both input and output)
1823Note: If you are *writing* Markdown, then the `smart` extension
1824has the reverse effect: what would have been curly quotes comes
1827In LaTeX, `smart` means to use the standard TeX ligatures
1828for quotation marks (` `` ` and ` '' ` for double quotes,
1829`` ` `` and `` ' `` for single quotes) and dashes (`--` for
1830en-dash and `---` for em-dash). If `smart` is disabled,
1831then in reading LaTeX pandoc will parse these characters
1832literally. In writing LaTeX, enabling `smart` tells pandoc
1833to use the ligatures when possible; if `smart` is disabled
1834pandoc will use unicode quotation mark and dash characters.
1839#### Extension: `auto_identifiers` ####
1841A header without an explicitly specified identifier will be
1842automatically assigned a unique identifier based on the header text.
1844This extension can be enabled/disabled for the following formats:
1847: `markdown`, `latex`, `rst`, `mediawiki`, `textile`
1852enabled by default in
1855The default algorithm used to derive the identifier from the
1858 - Remove all formatting, links, etc.
1859 - Remove all footnotes.
1860 - Remove all punctuation, except underscores, hyphens, and periods.
1861 - Replace all spaces and newlines with hyphens.
1862 - Convert all alphabetic characters to lowercase.
1863 - Remove everything up to the first letter (identifiers may
1864 not begin with a number or punctuation mark).
1865 - If nothing is left after this, use the identifier `section`.
1870 ------------------------------- ----------------------------
1871 `Header identifiers in HTML` `header-identifiers-in-html`
1872 `*Dogs*?--in *my* house?` `dogs--in-my-house`
1873 `[HTML], [S5], or [RTF]?` `html-s5-or-rtf`
1874 `3. Applications` `applications`
1877These rules should, in most cases, allow one to determine the identifier
1878from the header text. The exception is when several headers have the
1879same text; in this case, the first will get an identifier as described
1880above; the second will get the same identifier with `-1` appended; the
1881third with `-2`; and so on.
1883(However, a different algorithm is used if
1884`gfm_auto_identifiers` is enabled; see below.)
1886These identifiers are used to provide link targets in the table of
1887contents generated by the `--toc|--table-of-contents` option. They
1888also make it easy to provide links from one section of a document to
1889another. A link to this section, for example, might look like this:
1892 [header identifiers](#header-identifiers-in-html-latex-and-context).
1894Note, however, that this method of providing links to sections works
1895only in HTML, LaTeX, and ConTeXt formats.
1897If the `--section-divs` option is specified, then each section will
1898be wrapped in a `section` (or a `div`, if `html4` was specified),
1899and the identifier will be attached to the enclosing `<section>`
1900(or `<div>`) tag rather than the header itself. This allows entire
1901sections to be manipulated using JavaScript or treated differently in
1904#### Extension: `ascii_identifiers` ####
1906Causes the identifiers produced by `auto_identifiers` to be pure ASCII.
1907Accents are stripped off of accented Latin letters, and non-Latin
1910#### Extension: `gfm_auto_identifiers` ####
1912Changes the algorithm used by `auto_identifiers` to conform to
1913GitHub's method. Spaces are converted to dashes (`-`),
1914uppercase characters to lowercase characters, and punctuation
1915characters other than `-` and `_` are removed.
1920The extensions [`tex_math_dollars`](#extension-tex_math_dollars),
1921[`tex_math_single_backslash`](#extension-tex_math_single_backslash), and
1922[`tex_math_double_backslash`](#extension-tex_math_double_backslash)
1923are described in the section about Pandoc's Markdown.
1925However, they can also be used with HTML input. This is handy for
1926reading web pages formatted using MathJax, for example.
1931The following extensions (especially how they affect Markdown
1932input/output) are also described in more detail in their respective
1933sections of [Pandoc's Markdown].
1935#### Extension: `raw_html` {#raw_html}
1937When converting from HTML, parse elements to raw HTML which are not
1938representable in pandoc's AST.
1939By default, this is disabled for HTML input.
1941#### Extension: `raw_tex` {#raw_tex}
1943Allows raw LaTeX, TeX, and ConTeXt to be included in a document.
1945This extension can be enabled/disabled for the following formats
1946(in addition to `markdown`):
1949: `latex`, `org`, `textile`, `html` (environments, `\ref`, and
1953: `textile`, `commonmark`
1955#### Extension: `native_divs` {#native_divs}
1957This extension is enabled by default for HTML input. This means that
1958`div`s are parsed to pandoc native elements. (Alternatively, you
1959can parse them to raw HTML using `-f html-native_divs+raw_html`.)
1961When converting HTML to Markdown, for example, you may want to drop all
1964 pandoc -f html-native_divs-native_spans -t markdown
1966#### Extension: `native_spans` {#native_spans}
1968Analogous to `native_divs` above.
1971Literate Haskell support
1972------------------------
1974#### Extension: `literate_haskell` ####
1976Treat the document as literate Haskell source.
1978This extension can be enabled/disabled for the following formats:
1981: `markdown`, `rst`, `latex`
1984: `markdown`, `rst`, `latex`, `html`
1986If you append `+lhs` (or `+literate_haskell`) to one of the formats
1987above, pandoc will treat the document as literate Haskell source.
1990 - In Markdown input, "bird track" sections will be parsed as Haskell
1991 code rather than block quotations. Text between `\begin{code}`
1992 and `\end{code}` will also be treated as Haskell code. For
1993 ATX-style headers the character '=' will be used instead of '#'.
1995 - In Markdown output, code blocks with classes `haskell` and `literate`
1996 will be rendered using bird tracks, and block quotations will be
1997 indented one space, so they will not be treated as Haskell code.
1998 In addition, headers will be rendered setext-style (with underlines)
1999 rather than ATX-style (with '#' characters). (This is because ghc
2000 treats '#' characters in column 1 as introducing line numbers.)
2002 - In restructured text input, "bird track" sections will be parsed
2005 - In restructured text output, code blocks with class `haskell` will
2006 be rendered using bird tracks.
2008 - In LaTeX input, text in `code` environments will be parsed as
2011 - In LaTeX output, code blocks with class `haskell` will be rendered
2012 inside `code` environments.
2014 - In HTML output, code blocks with class `haskell` will be rendered
2015 with class `literatehaskell` and bird tracks.
2019 pandoc -f markdown+lhs -t html
2021reads literate Haskell source formatted with Markdown conventions and writes
2022ordinary HTML (without bird tracks).
2024 pandoc -f markdown+lhs -t html+lhs
2026writes HTML with the Haskell code in bird tracks, so it can be copied
2027and pasted as literate Haskell source.
2029Note that GHC expects the bird tracks in the first column, so indented
2030literate code blocks (e.g. inside an itemized environment) will not be
2031picked up by the Haskell compiler.
2036#### Extension: `empty_paragraphs` ####
2038Allows empty paragraphs. By default empty paragraphs are
2041This extension can be enabled/disabled for the following formats:
2047: `docx`, `odt`, `opendocument`, `html`
2049#### Extension: `styles` #### {#ext-styles}
2051Read all docx styles as divs (for paragraph styles) and spans (for
2052character styles) regardless of whether pandoc understands the meaning
2053of these styles. This can be used with [docx custom
2054styles](#custom-styles-in-docx). Disabled by default.
2059#### Extension: `amuse` ####
2061In the `muse` input format, this enables Text::Amuse
2062extensions to Emacs Muse markup.
2064#### Extension: `citations` {#org-citations}
2066Some aspects of [Pandoc's Markdown citation syntax](#citations) are also accepted
2069#### Extension: `ntb` ####
2071In the `context` output format this enables the use of [Natural Tables
2072(TABLE)](http://wiki.contextgarden.net/TABLE) instead of the default
2073[Extreme Tables (xtables)](http://wiki.contextgarden.net/xtables).
2074Natural tables allow more fine-grained global customization but come
2075at a performance penalty compared to extreme tables.
2081Pandoc understands an extended and slightly revised version of
2082John Gruber's [Markdown] syntax. This document explains the syntax,
2083noting differences from standard Markdown. Except where noted, these
2084differences can be suppressed by using the `markdown_strict` format instead
2085of `markdown`. Extensions can be enabled or disabled to specify the
2086behavior more granularly. They are described in the following. See also
2087[Extensions] above, for extensions that work also on other formats.
2092Markdown is designed to be easy to write, and, even more importantly,
2095> A Markdown-formatted document should be publishable as-is, as plain
2096> text, without looking like it's been marked up with tags or formatting
2098> -- [John Gruber](http://daringfireball.net/projects/markdown/syntax#philosophy)
2100This principle has guided pandoc's decisions in finding syntax for
2101tables, footnotes, and other extensions.
2103There is, however, one respect in which pandoc's aims are different
2104from the original aims of Markdown. Whereas Markdown was originally
2105designed with HTML generation in mind, pandoc is designed for multiple
2106output formats. Thus, while pandoc allows the embedding of raw HTML,
2107it discourages it, and provides other, non-HTMLish ways of representing
2108important document elements like definition lists, tables, mathematics, and
2114A paragraph is one or more lines of text followed by one or more blank lines.
2115Newlines are treated as spaces, so you can reflow your paragraphs as you like.
2116If you need a hard line break, put two or more spaces at the end of a line.
2118#### Extension: `escaped_line_breaks` ####
2120A backslash followed by a newline is also a hard line break.
2121Note: in multiline and grid table cells, this is the only way
2122to create a hard line break, since trailing spaces in the cells
2128There are two kinds of headers: Setext and ATX.
2130### Setext-style headers ###
2132A setext-style header is a line of text "underlined" with a row of `=` signs
2133(for a level one header) or `-` signs (for a level two header):
2141The header text can contain inline formatting, such as emphasis (see
2142[Inline formatting], below).
2145### ATX-style headers ###
2147An ATX-style header consists of one to six `#` signs and a line of
2148text, optionally followed by any number of `#` signs. The number of
2149`#` signs at the beginning of the line is the header level:
2151 ## A level-two header
2153 ### A level-three header ###
2155As with setext-style headers, the header text can contain formatting:
2157 # A level-one header with a [link](/url) and *emphasis*
2159#### Extension: `blank_before_header` ####
2161Standard Markdown syntax does not require a blank line before a header.
2162Pandoc does require this (except, of course, at the beginning of the
2163document). The reason for the requirement is that it is all too easy for a
2164`#` to end up at the beginning of a line by accident (perhaps through line
2165wrapping). Consider, for example:
2167 I like several of their flavors of ice cream:
2168 #22, for example, and #5.
2170#### Extension: `space_in_atx_header` ####
2172Many Markdown implementations do not require a space between the
2173opening `#`s of an ATX header and the header text, so that
2174`#5 bolt` and `#hashtag` count as headers. With this extension,
2175pandoc does require the space.
2177### Header identifiers ###
2179See also the [`auto_identifiers` extension](#extension-auto_identifiers) above.
2181#### Extension: `header_attributes` ####
2183Headers can be assigned attributes using this syntax at the end
2184of the line containing the header text:
2186 {#identifier .class .class key=value key=value}
2188Thus, for example, the following headers will all be assigned the identifier
2193 ## My header ## {#foo}
2195 My other header {#foo}
2198(This syntax is compatible with [PHP Markdown Extra].)
2200Note that although this syntax allows assignment of classes and key/value
2201attributes, writers generally don't use all of this information. Identifiers,
2202classes, and key/value attributes are used in HTML and HTML-based formats such
2203as EPUB and slidy. Identifiers are used for labels and link anchors in the
2204LaTeX, ConTeXt, Textile, and AsciiDoc writers.
2206Headers with the class `unnumbered` will not be numbered, even if
2207`--number-sections` is specified. A single hyphen (`-`) in an attribute
2208context is equivalent to `.unnumbered`, and preferable in non-English
2215 # My header {.unnumbered}
2217#### Extension: `implicit_header_references` ####
2219Pandoc behaves as if reference links have been defined for each header.
2220So, to link to a header
2222 # Header identifiers in HTML
2226 [Header identifiers in HTML]
2230 [Header identifiers in HTML][]
2234 [the section on header identifiers][header identifiers in
2237instead of giving the identifier explicitly:
2239 [Header identifiers in HTML](#header-identifiers-in-html)
2241If there are multiple headers with identical text, the corresponding
2242reference will link to the first one only, and you will need to use explicit
2243links to link to the others, as described above.
2245Like regular reference links, these references are case-insensitive.
2247Explicit link reference definitions always take priority over
2248implicit header references. So, in the following example, the
2249link will point to `bar`, not to `#foo`:
2260Markdown uses email conventions for quoting blocks of text.
2261A block quotation is one or more paragraphs or other block elements
2262(such as lists or headers), with each line preceded by a `>` character
2263and an optional space. (The `>` need not start at the left margin, but
2264it should not be indented more than three spaces.)
2266 > This is a block quote. This
2267 > paragraph has two lines.
2269 > 1. This is a list inside a block quote.
2272A "lazy" form, which requires the `>` character only on the first
2273line of each block, is also allowed:
2275 > This is a block quote. This
2276 paragraph has two lines.
2278 > 1. This is a list inside a block quote.
2281Among the block elements that can be contained in a block quote are
2282other block quotes. That is, block quotes can be nested:
2284 > This is a block quote.
2286 > > A block quote within a block quote.
2288If the `>` character is followed by an optional space, that space
2289will be considered part of the block quote marker and not part of
2290the indentation of the contents. Thus, to put an indented code
2291block in a block quote, you need five spaces after the `>`:
2295#### Extension: `blank_before_blockquote` ####
2297Standard Markdown syntax does not require a blank line before a block
2298quote. Pandoc does require this (except, of course, at the beginning of the
2299document). The reason for the requirement is that it is all too easy for a
2300`>` to end up at the beginning of a line by accident (perhaps through line
2301wrapping). So, unless the `markdown_strict` format is used, the following does
2302not produce a nested block quote in pandoc:
2304 > This is a block quote.
2308Verbatim (code) blocks
2309----------------------
2311### Indented code blocks ###
2313A block of text indented four spaces (or one tab) is treated as verbatim
2314text: that is, special characters do not trigger special formatting,
2315and all spaces and line breaks are preserved. For example,
2318 moveShip(5 * gravity, DOWN);
2321The initial (four space or one tab) indentation is not considered part
2322of the verbatim text, and is removed in the output.
2324Note: blank lines in the verbatim text need not begin with four spaces.
2327### Fenced code blocks ###
2329#### Extension: `fenced_code_blocks` ####
2331In addition to standard indented code blocks, pandoc supports
2332*fenced* code blocks. These begin with a row of three or more
2333tildes (`~`) and end with a row of tildes that must be at least as long as
2334the starting row. Everything between these lines is treated as code. No
2335indentation is necessary:
2339 moveShip(5 * gravity, DOWN);
2343Like regular code blocks, fenced code blocks must be separated
2344from surrounding text by blank lines.
2346If the code itself contains a row of tildes or backticks, just use a longer
2347row of tildes or backticks at the start and end:
2351 code including tildes
2355#### Extension: `backtick_code_blocks` ####
2357Same as `fenced_code_blocks`, but uses backticks (`` ` ``) instead of tildes
2360#### Extension: `fenced_code_attributes` ####
2362Optionally, you may attach attributes to fenced or backtick code block using
2365 ~~~~ {#mycode .haskell .numberLines startFrom="100"}
2367 qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
2368 qsort (filter (>= x) xs)
2369 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2371Here `mycode` is an identifier, `haskell` and `numberLines` are classes, and
2372`startFrom` is an attribute with value `100`. Some output formats can use this
2373information to do syntax highlighting. Currently, the only output formats
2374that uses this information are HTML, LaTeX, Docx, Ms, and PowerPoint. If
2375highlighting is supported for your output format and language, then the code
2376block above will appear highlighted, with numbered lines. (To see which
2377languages are supported, type `pandoc --list-highlight-languages`.) Otherwise,
2378the code block above will appear as follows:
2380 <pre id="mycode" class="haskell numberLines" startFrom="100">
2386The `numberLines` (or `number-lines`) class will cause the lines
2387of the code block to be numbered, starting with `1` or the value
2388of the `startFrom` attribute. The `lineAnchors` (or
2389`line-anchors`) class will cause the lines to be clickable
2390anchors in HTML output.
2392A shortcut form can also be used for specifying the language of
2399This is equivalent to:
2405If the `fenced_code_attributes` extension is disabled, but
2406input contains class attribute(s) for the code block, the first
2407class attribute will be printed after the opening fence as a bare
2410To prevent all highlighting, use the `--no-highlight` flag.
2411To set the highlighting style, use `--highlight-style`.
2412For more information on highlighting, see [Syntax highlighting],
2418#### Extension: `line_blocks` ####
2420A line block is a sequence of lines beginning with a vertical bar (`|`)
2421followed by a space. The division into lines will be preserved in
2422the output, as will any leading spaces; otherwise, the lines will
2423be formatted as Markdown. This is useful for verse and addresses:
2425 | The limerick packs laughs anatomical
2426 | In space that is quite economical.
2427 | But the good ones I've seen
2428 | So seldom are clean
2429 | And the clean ones so seldom are comical
2432 | Berkeley, CA 94718
2434The lines can be hard-wrapped if needed, but the continuation
2435line must begin with a space.
2437 | The Right Honorable Most Venerable and Righteous Samuel L.
2440 | Berkeley, CA 94718
2442This syntax is borrowed from [reStructuredText].
2449A bullet list is a list of bulleted list items. A bulleted list
2450item begins with a bullet (`*`, `+`, or `-`). Here is a simple
2457This will produce a "compact" list. If you want a "loose" list, in which
2458each item is formatted as a paragraph, put spaces between the items:
2466The bullets need not be flush with the left margin; they may be
2467indented one, two, or three spaces. The bullet must be followed
2470List items look best if subsequent lines are flush with the first
2471line (after the bullet):
2477But Markdown also allows a "lazy" format:
2483### Block content in list items ###
2485A list item may contain multiple paragraphs and other block-level
2486content. However, subsequent paragraphs must be preceded by a blank line
2487and indented to line up with the first non-space content after
2494 * Second paragraph. With a code block, which must be indented
2499Exception: if the list marker is followed by an indented code
2500block, which must begin 5 spaces after the list marker, then
2501subsequent paragraphs must begin two columns after the last
2502character of the list marker:
2506 continuation paragraph
2508List items may include other lists. In this case the preceding blank
2509line is optional. The nested list must be indented to line up with
2510the first non-space character after the list marker of the
2511containing list item.
2523As noted above, Markdown allows you to write list items "lazily," instead of
2524indenting continuation lines. However, if there are multiple paragraphs or
2525other blocks in a list item, the first line of each must be indented.
2527 + A lazy, lazy, list
2530 + Another one; this looks
2533 Second paragraph of second
2536### Ordered lists ###
2538Ordered lists work just like bulleted lists, except that the items
2539begin with enumerators rather than bullets.
2541In standard Markdown, enumerators are decimal numbers followed
2542by a period and a space. The numbers themselves are ignored, so
2543there is no difference between this list:
2555#### Extension: `fancy_lists` ####
2557Unlike standard Markdown, pandoc allows ordered list items to be marked
2558with uppercase and lowercase letters and roman numerals, in addition to
2559Arabic numerals. List markers may be enclosed in parentheses or followed by a
2560single right-parentheses or period. They must be separated from the
2561text that follows by at least one space, and, if the list marker is a
2562capital letter with a period, by at least two spaces.[^2]
2564[^2]: The point of this rule is to ensure that normal paragraphs
2565 starting with people's initials, like
2567 B. Russell was an English philosopher.
2569 do not get treated as list items.
2571 This rule will not prevent
2575 from being interpreted as a list item. In this case, a backslash
2580The `fancy_lists` extension also allows '`#`' to be used as an
2581ordered list marker in place of a numeral:
2586#### Extension: `startnum` ####
2588Pandoc also pays attention to the type of list marker used, and to the
2589starting number, and both of these are preserved where possible in the
2590output format. Thus, the following yields a list with numbers followed
2591by a single parenthesis, starting with 9, and a sublist with lowercase
2601Pandoc will start a new list each time a different type of list
2602marker is used. So, the following will create three lists:
2609If default list markers are desired, use `#.`:
2616### Definition lists ###
2618#### Extension: `definition_lists` ####
2620Pandoc supports definition lists, using the syntax of
2621[PHP Markdown Extra] with some extensions.[^3]
2627 Term 2 with *inline markup*
2631 { some code, part of Definition 2 }
2633 Third paragraph of definition 2.
2635Each term must fit on one line, which may optionally be followed by
2636a blank line, and must be followed by one or more definitions.
2637A definition begins with a colon or tilde, which may be indented one
2640A term may have multiple definitions, and each definition may consist of one or
2641more block elements (paragraph, code block, list, etc.), each indented four
2642spaces or one tab stop. The body of the definition (including the first line,
2643aside from the colon or tilde) should be indented four spaces. However,
2644as with other Markdown lists, you can "lazily" omit indentation except
2645at the beginning of a paragraph or other block element:
2650 with lazy continuation.
2652 Second paragraph of the definition.
2654If you leave space before the definition (as in the example above),
2655the text of the definition will be treated as a paragraph. In some
2656output formats, this will mean greater spacing between term/definition
2657pairs. For a more compact definition list, omit the space before the
2667Note that space between items in a definition list is required.
2668(A variant that loosens this requirement, but disallows "lazy"
2669hard wrapping, can be activated with `compact_definition_lists`: see
2670[Non-pandoc extensions], below.)
2672[^3]: I have been influenced by the suggestions of [David Wheeler](http://www.justatheory.com/computers/markup/modest-markdown-proposal.html).
2674### Numbered example lists ###
2676#### Extension: `example_lists` ####
2678The special list marker `@` can be used for sequentially numbered
2679examples. The first list item with a `@` marker will be numbered '1',
2680the next '2', and so on, throughout the document. The numbered examples
2681need not occur in a single list; each new list using `@` will take up
2682where the last stopped. So, for example:
2684 (@) My first example will be numbered (1).
2685 (@) My second example will be numbered (2).
2687 Explanation of examples.
2689 (@) My third example will be numbered (3).
2691Numbered examples can be labeled and referred to elsewhere in the
2694 (@good) This is a good example.
2696 As (@good) illustrates, ...
2698The label can be any string of alphanumeric characters, underscores,
2701Note: continuation paragraphs in example lists must always
2702be indented four spaces, regardless of the length of the
2703list marker. That is, example lists always behave as if the
2704`four_space_rule` extension is set. This is because example
2705labels tend to be long, and indenting content to the
2706first non-space character after the label would be awkward.
2708### Compact and loose lists ###
2710Pandoc behaves differently from `Markdown.pl` on some "edge
2711cases" involving lists. Consider this source:
2721Pandoc transforms this into a "compact list" (with no `<p>` tags around
2722"First", "Second", or "Third"), while Markdown puts `<p>` tags around
2723"Second" and "Third" (but not "First"), because of the blank space
2724around "Third". Pandoc follows a simple rule: if the text is followed by
2725a blank line, it is treated as a paragraph. Since "Second" is followed
2726by a list, and not a blank line, it isn't treated as a paragraph. The
2727fact that the list is followed by a blank line is irrelevant. (Note:
2728Pandoc works this way even when the `markdown_strict` format is specified. This
2729behavior is consistent with the official Markdown syntax description,
2730even though it is different from that of `Markdown.pl`.)
2733### Ending a list ###
2735What if you want to put an indented code block after a list?
2742Trouble! Here pandoc (like other Markdown implementations) will treat
2743`{ my code block }` as the second paragraph of item two, and not as
2746To "cut off" the list after item two, you can insert some non-indented
2747content, like an HTML comment, which won't produce visible output in
2753 <!-- end of list -->
2757You can use the same trick if you want two consecutive lists instead
2773A line containing a row of three or more `*`, `-`, or `_` characters
2774(optionally separated by spaces) produces a horizontal rule:
2784Four kinds of tables may be used. The first three kinds presuppose the use of
2785a fixed-width font, such as Courier. The fourth kind can be used with
2786proportionally spaced fonts, as it does not require lining up columns.
2788#### Extension: `table_captions` ####
2790A caption may optionally be provided with all 4 kinds of tables (as
2791illustrated in the examples below). A caption is a paragraph beginning
2792with the string `Table:` (or just `:`), which will be stripped off.
2793It may appear either before or after the table.
2795#### Extension: `simple_tables` ####
2797Simple tables look like this:
2799 Right Left Center Default
2800 ------- ------ ---------- -------
2805 Table: Demonstration of simple table syntax.
2807The headers and table rows must each fit on one line. Column
2808alignments are determined by the position of the header text relative
2809to the dashed line below it:[^4]
2811 - If the dashed line is flush with the header text on the right side
2812 but extends beyond it on the left, the column is right-aligned.
2813 - If the dashed line is flush with the header text on the left side
2814 but extends beyond it on the right, the column is left-aligned.
2815 - If the dashed line extends beyond the header text on both sides,
2816 the column is centered.
2817 - If the dashed line is flush with the header text on both sides,
2818 the default alignment is used (in most cases, this will be left).
2820[^4]: This scheme is due to Michel Fortin, who proposed it on the
2821 [Markdown discussion list](http://six.pairlist.net/pipermail/markdown-discuss/2005-March/001097.html).
2823The table must end with a blank line, or a line of dashes followed by
2826The column headers may be omitted, provided a dashed line is used
2827to end the table. For example:
2829 ------- ------ ---------- -------
2833 ------- ------ ---------- -------
2835When headers are omitted, column alignments are determined on the basis
2836of the first line of the table body. So, in the tables above, the columns
2837would be right, left, center, and right aligned, respectively.
2839#### Extension: `multiline_tables` ####
2841Multiline tables allow headers and table rows to span multiple lines
2842of text (but cells that span multiple columns or rows of the table are
2843not supported). Here is an example:
2845 -------------------------------------------------------------
2846 Centered Default Right Left
2847 Header Aligned Aligned Aligned
2848 ----------- ------- --------------- -------------------------
2849 First row 12.0 Example of a row that
2850 spans multiple lines.
2852 Second row 5.0 Here's another one. Note
2853 the blank line between
2855 -------------------------------------------------------------
2857 Table: Here's the caption. It, too, may span
2860These work like simple tables, but with the following differences:
2862 - They must begin with a row of dashes, before the header text
2863 (unless the headers are omitted).
2864 - They must end with a row of dashes, then a blank line.
2865 - The rows must be separated by blank lines.
2867In multiline tables, the table parser pays attention to the widths of
2868the columns, and the writers try to reproduce these relative widths in
2869the output. So, if you find that one of the columns is too narrow in the
2870output, try widening it in the Markdown source.
2872Headers may be omitted in multiline tables as well as simple tables:
2874 ----------- ------- --------------- -------------------------
2875 First row 12.0 Example of a row that
2876 spans multiple lines.
2878 Second row 5.0 Here's another one. Note
2879 the blank line between
2881 ----------- ------- --------------- -------------------------
2883 : Here's a multiline table without headers.
2885It is possible for a multiline table to have just one row, but the row
2886should be followed by a blank line (and then the row of dashes that ends
2887the table), or the table may be interpreted as a simple table.
2889#### Extension: `grid_tables` ####
2891Grid tables look like this:
2893 : Sample grid table.
2895 +---------------+---------------+--------------------+
2896 | Fruit | Price | Advantages |
2897 +===============+===============+====================+
2898 | Bananas | $1.34 | - built-in wrapper |
2899 | | | - bright color |
2900 +---------------+---------------+--------------------+
2901 | Oranges | $2.10 | - cures scurvy |
2903 +---------------+---------------+--------------------+
2905The row of `=`s separates the header from the table body, and can be
2906omitted for a headerless table. The cells of grid tables may contain
2907arbitrary block elements (multiple paragraphs, code blocks, lists,
2908etc.). Cells that span multiple columns or rows are not
2909supported. Grid tables can be created easily using [Emacs table mode].
2911[Emacs table mode]: http://table.sourceforge.net/
2913Alignments can be specified as with pipe tables, by putting
2914colons at the boundaries of the separator line after the
2917 +---------------+---------------+--------------------+
2918 | Right | Left | Centered |
2919 +==============:+:==============+:==================:+
2920 | Bananas | $1.34 | built-in wrapper |
2921 +---------------+---------------+--------------------+
2923For headerless tables, the colons go on the top line instead:
2925 +--------------:+:--------------+:------------------:+
2926 | Right | Left | Centered |
2927 +---------------+---------------+--------------------+
2929##### Grid Table Limitations #####
2931Pandoc does not support grid tables with row spans or column spans.
2932This means that neither variable numbers of columns across rows nor
2933variable numbers of rows across columns are supported by Pandoc.
2934All grid tables must have the same number of columns in each row,
2935and the same number of rows in each column. For example, the
2936Docutils [sample grid tables] will not render as expected with
2939[sample grid tables]: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#grid-tables
2942#### Extension: `pipe_tables` ####
2944Pipe tables look like this:
2946 | Right | Left | Default | Center |
2947 |------:|:-----|---------|:------:|
2948 | 12 | 12 | 12 | 12 |
2949 | 123 | 123 | 123 | 123 |
2952 : Demonstration of pipe table syntax.
2954The syntax is identical to [PHP Markdown Extra tables]. The beginning and
2955ending pipe characters are optional, but pipes are required between all
2956columns. The colons indicate column alignment as shown. The header
2957cannot be omitted. To simulate a headerless table, include a header
2960Since the pipes indicate column boundaries, columns need not be vertically
2961aligned, as they are in the above example. So, this is a perfectly
2962legal (though ugly) pipe table:
2970The cells of pipe tables cannot contain block elements like paragraphs
2971and lists, and cannot span multiple lines. If a pipe table contains a
2972row whose printable content is wider than the column width (see
2973`--columns`), then the table will take up the full text width and
2974the cell contents will wrap, with the relative cell widths determined
2975by the number of dashes in the line separating the table header from
2976the table body. (For example `---|-` would make the first column 3/4
2977and the second column 1/4 of the full text width.)
2978On the other hand, if no lines are wider than column width, then
2979cell contents will not be wrapped, and the cells will be sized
2982Note: pandoc also recognizes pipe tables of the following
2983form, as can be produced by Emacs' orgtbl-mode:
2990The difference is that `+` is used instead of `|`. Other orgtbl features
2991are not supported. In particular, to get non-default column alignment,
2992you'll need to add colons as above.
2994[PHP Markdown Extra tables]: https://michelf.ca/projects/php-markdown/extra/#table
2999#### Extension: `pandoc_title_block` ####
3001If the file begins with a title block
3004 % author(s) (separated by semicolons)
3007it will be parsed as bibliographic information, not regular text. (It
3008will be used, for example, in the title of standalone LaTeX or HTML
3009output.) The block may contain just a title, a title and an author,
3010or all three elements. If you want to include an author but no
3011title, or a title and a date but no author, you need a blank line:
3020The title may occupy multiple lines, but continuation lines must
3021begin with leading space, thus:
3026If a document has multiple authors, the authors may be put on
3027separate lines with leading space, or separated by semicolons, or
3028both. So, all of the following are equivalent:
3033 % Author One; Author Two
3038The date must fit on one line.
3040All three metadata fields may contain standard inline formatting
3041(italics, links, footnotes, etc.).
3043Title blocks will always be parsed, but they will affect the output only
3044when the `--standalone` (`-s`) option is chosen. In HTML output, titles
3045will appear twice: once in the document head -- this is the title that
3046will appear at the top of the window in a browser -- and once at the
3047beginning of the document body. The title in the document head can have
3048an optional prefix attached (`--title-prefix` or `-T` option). The title
3049in the body appears as an H1 element with class "title", so it can be
3050suppressed or reformatted with CSS. If a title prefix is specified with
3051`-T` and no title block appears in the document, the title prefix will
3052be used by itself as the HTML title.
3054The man page writer extracts a title, man page section number, and
3055other header and footer information from the title line. The title
3056is assumed to be the first word on the title line, which may optionally
3057end with a (single-digit) section number in parentheses. (There should
3058be no space between the title and the parentheses.) Anything after
3059this is assumed to be additional footer and header text. A single pipe
3060character (`|`) should be used to separate the footer text from the header
3065will yield a man page with the title `PANDOC` and section 1.
3067 % PANDOC(1) Pandoc User Manuals
3069will also have "Pandoc User Manuals" in the footer.
3071 % PANDOC(1) Pandoc User Manuals | Version 4.0
3073will also have "Version 4.0" in the header.
3075#### Extension: `yaml_metadata_block` ####
3077A YAML metadata block is a valid YAML object, delimited by a line of three
3078hyphens (`---`) at the top and a line of three hyphens (`---`) or three dots
3079(`...`) at the bottom. A YAML metadata block may occur anywhere in the
3080document, but if it is not at the beginning, it must be preceded by a blank
3081line. (Note that, because of the way pandoc concatenates input files when
3082several are provided, you may also keep the metadata in a separate YAML file
3083and pass it to pandoc as an argument, along with your Markdown files:
3085 pandoc chap1.md chap2.md chap3.md metadata.yaml -s -o book.html
3087Just be sure that the YAML file begins with `---` and ends with `---` or
3088`...`.) Alternatively, you can use the `--metadata-file` option. Using
3089that approach however, you cannot reference content (like footnotes)
3090from the main markdown input document.
3092Metadata will be taken from the fields of the YAML object and added to any
3093existing document metadata. Metadata can contain lists and objects (nested
3094arbitrarily), but all string scalars will be interpreted as Markdown. Fields
3095with names ending in an underscore will be ignored by pandoc. (They may be
3096given a role by external processors.) Field names must not be
3097interpretable as YAML numbers or boolean values (so, for
3098example, `yes`, `True`, and `15` cannot be used as field names).
3100A document may contain multiple metadata blocks. The metadata fields will
3101be combined through a *left-biased union*: if two metadata blocks attempt
3102to set the same field, the value from the first block will be taken.
3104When pandoc is used with `-t markdown` to create a Markdown document,
3105a YAML metadata block will be produced only if the `-s/--standalone`
3106option is used. All of the metadata will appear in a single block
3107at the beginning of the document.
3109Note that YAML escaping rules must be followed. Thus, for example,
3110if a title contains a colon, it must be quoted. The pipe character
3111(`|`) can be used to begin an indented block that will be interpreted
3112literally, without need for escaping. This form is necessary
3113when the field contains blank lines or block-level formatting:
3116 title: 'This is the title: it contains a colon'
3120 keywords: [nothing, nothingness]
3122 This is the abstract.
3124 It consists of two paragraphs.
3127Template variables will be set automatically from the metadata. Thus, for
3128example, in writing HTML, the variable `abstract` will be set to the HTML
3129equivalent of the Markdown in the `abstract` field:
3131 <p>This is the abstract.</p>
3132 <p>It consists of two paragraphs.</p>
3134Variables can contain arbitrary YAML structures, but the template must match
3135this structure. The `author` variable in the default templates expects a
3136simple list or string, but can be changed to support more complicated
3137structures. The following combination, for example, would add an affiliation
3138to the author if one is given:
3141 title: The document title
3144 affiliation: University of Somewhere
3146 affiliation: University of Nowhere
3149To use the structured authors in the example above, you would need a custom
3154 $author.name$$if(author.affiliation)$ ($author.affiliation$)$endif$
3160Raw content to include in the document's header may be specified
3161using `header-includes`; however, it is important to mark up
3162this content as raw code for a particular output format, using
3163the [`raw_attribute` extension](#extension-raw_attribute)), or it
3164will be interpreted as markdown. For example:
3169 \let\oldsection\section
3170 \renewcommand{\section}[1]{\clearpage\oldsection{#1}}
3176#### Extension: `all_symbols_escapable` ####
3178Except inside a code block or inline code, any punctuation or space
3179character preceded by a backslash will be treated literally, even if it
3180would normally indicate formatting. Thus, for example, if one writes
3190 <strong>hello</strong>
3192This rule is easier to remember than standard Markdown's rule,
3193which allows only the following characters to be backslash-escaped:
3197(However, if the `markdown_strict` format is used, the standard Markdown rule
3200A backslash-escaped space is parsed as a nonbreaking space. It will
3201appear in TeX output as `~` and in HTML and XML as `\ ` or
3204A backslash-escaped newline (i.e. a backslash occurring at the end of
3205a line) is parsed as a hard line break. It will appear in TeX output as
3206`\\` and in HTML as `<br />`. This is a nice alternative to
3207Markdown's "invisible" way of indicating hard line breaks using
3208two trailing spaces on a line.
3210Backslash escapes do not work in verbatim contexts.
3217To *emphasize* some text, surround it with `*`s or `_`, like this:
3219 This text is _emphasized with underscores_, and this
3220 is *emphasized with asterisks*.
3222Double `*` or `_` produces **strong emphasis**:
3224 This is **strong emphasis** and __with underscores__.
3226A `*` or `_` character surrounded by spaces, or backslash-escaped,
3227will not trigger emphasis:
3229 This is * not emphasized *, and \*neither is this\*.
3231#### Extension: `intraword_underscores` ####
3233Because `_` is sometimes used inside words and identifiers,
3234pandoc does not interpret a `_` surrounded by alphanumeric
3235characters as an emphasis marker. If you want to emphasize
3236just part of a word, use `*`:
3238 feas*ible*, not feas*able*.
3243#### Extension: `strikeout` ####
3245To strikeout a section of text with a horizontal line, begin and end it
3246with `~~`. Thus, for example,
3248 This ~~is deleted text.~~
3251### Superscripts and subscripts ###
3253#### Extension: `superscript`, `subscript` ####
3255Superscripts may be written by surrounding the superscripted text by `^`
3256characters; subscripts may be written by surrounding the subscripted
3257text by `~` characters. Thus, for example,
3259 H~2~O is a liquid. 2^10^ is 1024.
3261If the superscripted or subscripted text contains spaces, these spaces
3262must be escaped with backslashes. (This is to prevent accidental
3263superscripting and subscripting through the ordinary use of `~` and `^`.)
3264Thus, if you want the letter P with 'a cat' in subscripts, use
3265`P~a\ cat~`, not `P~a cat~`.
3270To make a short span of text verbatim, put it inside backticks:
3272 What is the difference between `>>=` and `>>`?
3274If the verbatim text includes a backtick, use double backticks:
3276 Here is a literal backtick `` ` ``.
3278(The spaces after the opening backticks and before the closing
3279backticks will be ignored.)
3281The general rule is that a verbatim span starts with a string
3282of consecutive backticks (optionally followed by a space)
3283and ends with a string of the same number of backticks (optionally
3284preceded by a space).
3286Note that backslash-escapes (and other Markdown constructs) do not
3287work in verbatim contexts:
3289 This is a backslash followed by an asterisk: `\*`.
3291#### Extension: `inline_code_attributes` ####
3293Attributes can be attached to verbatim text, just as with
3294[fenced code blocks]:
3300To write small caps, use the `smallcaps` class:
3302 [Small caps]{.smallcaps}
3304Or, without the `bracketed_spans` extension:
3306 <span class="smallcaps">Small caps</span>
3308For compatibility with other Markdown flavors, CSS is also supported:
3310 <span style="font-variant:small-caps;">Small caps</span>
3312This will work in all output formats that support small caps.
3318#### Extension: `tex_math_dollars` ####
3320Anything between two `$` characters will be treated as TeX math. The
3321opening `$` must have a non-space character immediately to its right,
3322while the closing `$` must have a non-space character immediately to its
3323left, and must not be followed immediately by a digit. Thus,
3324`$20,000 and $30,000` won't parse as math. If for some reason
3325you need to enclose text in literal `$` characters, backslash-escape
3326them and they won't be treated as math delimiters.
3328TeX math will be printed in all output formats. How it is rendered
3329depends on the output format:
3332 ~ It will appear verbatim surrounded by `\(...\)` (for inline
3333 math) or `\[...\]` (for display math).
3335Markdown, Emacs Org mode, ConTeXt, ZimWiki
3336 ~ It will appear verbatim surrounded by `$...$` (for inline
3337 math) or `$$...$$` (for display math).
3340 ~ It will be rendered using an [interpreted text role `:math:`].
3343 ~ It will be rendered as `latexmath:[...]`.
3346 ~ It will be rendered inside a `@math` command.
3349 ~ It will be rendered verbatim without `$`'s.
3352 ~ It will be rendered inside `<math>` tags.
3355 ~ It will be rendered inside `<span class="math">` tags.
3358 ~ It will be rendered, if possible, using Unicode characters,
3359 and will otherwise appear verbatim.
3362 ~ It will be rendered, if possible, using MathML.
3365 ~ If the `--mathml` flag is used, it will be rendered using MathML
3366 in an `inlineequation` or `informalequation` tag. Otherwise it
3367 will be rendered, if possible, using Unicode characters.
3370 ~ It will be rendered using OMML math markup.
3373 ~ If the `--webtex` option is used, formulas are rendered as images
3374 using CodeCogs or other compatible web service, downloaded
3375 and embedded in the e-book. Otherwise, they will appear verbatim.
3377HTML, Slidy, DZSlides, S5, EPUB
3378 ~ The way math is rendered in HTML will depend on the
3379 command-line options selected. Therefore see [Math rendering in HTML]
3382[interpreted text role `:math:`]: http://docutils.sourceforge.net/docs/ref/rst/roles.html#math
3387#### Extension: `raw_html` ####
3389Markdown allows you to insert raw HTML (or DocBook) anywhere in a document
3390(except verbatim contexts, where `<`, `>`, and `&` are interpreted
3391literally). (Technically this is not an extension, since standard
3392Markdown allows it, but it has been made an extension so that it can
3393be disabled if desired.)
3395The raw HTML is passed through unchanged in HTML, S5, Slidy, Slideous,
3396DZSlides, EPUB, Markdown, CommonMark, Emacs Org mode, and Textile
3397output, and suppressed in other formats.
3399In the CommonMark format, if `raw_html` is enabled, superscripts,
3400subscripts, strikeouts and small capitals will be represented as HTML.
3401Otherwise, plain-text fallbacks will be used. Note that even if
3402`raw_html` is disabled, tables will be rendered with HTML syntax if
3403they cannot use pipe syntax.
3405#### Extension: `markdown_in_html_blocks` ####
3407Standard Markdown allows you to include HTML "blocks": blocks
3408of HTML between balanced tags that are separated from the surrounding text
3409with blank lines, and start and end at the left margin. Within
3410these blocks, everything is interpreted as HTML, not Markdown;
3411so (for example), `*` does not signify emphasis.
3413Pandoc behaves this way when the `markdown_strict` format is used; but
3414by default, pandoc interprets material between HTML block tags as Markdown.
3415Thus, for example, pandoc will turn
3420 <td>[a link](http://google.com)</td>
3428 <td><em>one</em></td>
3429 <td><a href="http://google.com">a link</a></td>
3433whereas `Markdown.pl` will preserve it as is.
3435There is one exception to this rule: text between `<script>` and
3436`<style>` tags is not interpreted as Markdown.
3438This departure from standard Markdown should make it easier to mix
3439Markdown with HTML block elements. For example, one can surround
3440a block of Markdown text with `<div>` tags without preventing it
3441from being interpreted as Markdown.
3443#### Extension: `native_divs` ####
3445Use native pandoc `Div` blocks for content inside `<div>` tags.
3446For the most part this should give the same output as
3447`markdown_in_html_blocks`, but it makes it easier to write pandoc
3448filters to manipulate groups of blocks.
3450#### Extension: `native_spans` ####
3452Use native pandoc `Span` blocks for content inside `<span>` tags.
3453For the most part this should give the same output as `raw_html`,
3454but it makes it easier to write pandoc filters to manipulate groups
3457#### Extension: `raw_tex` ####
3459In addition to raw HTML, pandoc allows raw LaTeX, TeX, and ConTeXt to be
3460included in a document. Inline TeX commands will be preserved and passed
3461unchanged to the LaTeX and ConTeXt writers. Thus, for example, you can use
3462LaTeX to include BibTeX citations:
3464 This result was proved in \cite{jones.1967}.
3466Note that in LaTeX environments, like
3468 \begin{tabular}{|l|l|}\hline
3469 Age & Frequency \\ \hline
3472 36--45 & 22 \\ \hline
3475the material between the begin and end tags will be interpreted as raw
3476LaTeX, not as Markdown.
3478Inline LaTeX is ignored in output formats other than Markdown, LaTeX,
3479Emacs Org mode, and ConTeXt.
3481### Generic raw attribute ###
3483#### Extension: `raw_attribute` ####
3485Inline spans and fenced code blocks with a special
3486kind of attribute will be parsed as raw content with the
3487designated format. For example, the following produces a raw
3494And the following produces a raw `html` inline element:
3496 This is `<a>html</a>`{=html}
3498This can be useful to insert raw xml into `docx` documents, e.g.
3504 <w:br w:type="page"/>
3509The format name should match the target format name (see
3510`-t/--to`, above, for a list, or use `pandoc
3511--list-output-formats`). Use `openxml` for `docx` output,
3512`opendocument` for `odt` output, `html5` for `epub3` output,
3513`html4` for `epub2` output, and `latex`, `beamer`,
3514`ms`, or `html5` for `pdf` output (depending on what you
3515use for `--pdf-engine`).
3517This extension presupposes that the relevant kind of
3518inline code or fenced code block is enabled. Thus, for
3519example, to use a raw attribute with a backtick code block,
3520`backtick_code_blocks` must be enabled.
3522The raw attribute cannot be combined with regular attributes.
3527#### Extension: `latex_macros` ####
3529When this extension is enabled, pandoc will parse LaTeX
3530macro definitions and apply the resulting macros to all LaTeX
3531math and raw LaTeX. So, for example, the following will work in
3532all output formats, not just LaTeX:
3534 \newcommand{\tuple}[1]{\langle #1 \rangle}
3538Note that LaTeX macros will not be applied if they occur
3539inside inside a raw span or block marked with the
3540[`raw_attribute` extension](#extension-raw_attribute).
3542When `latex_macros` is disabled, the raw LaTeX and math will
3543not have macros applied. This is usually a better approach when
3544you are targeting LaTeX or PDF.
3546Whether or not `latex_macros` is enabled, the macro definitions
3547will still be passed through as raw LaTeX.
3552Markdown allows links to be specified in several ways.
3554### Automatic links ###
3556If you enclose a URL or email address in pointy brackets, it
3560 <sam@green.eggs.ham>
3564An inline link consists of the link text in square brackets,
3565followed by the URL in parentheses. (Optionally, the URL can
3566be followed by a link title, in quotes.)
3568 This is an [inline link](/url), and here's [one with
3569 a title](http://fsf.org "click here for a good time!").
3571There can be no space between the bracketed part and the parenthesized part.
3572The link text can contain formatting (such as emphasis), but the title cannot.
3574Email addresses in inline links are not autodetected, so they have to be
3575prefixed with `mailto`:
3577 [Write me!](mailto:sam@green.eggs.ham)
3579### Reference links ###
3581An *explicit* reference link has two parts, the link itself and the link
3582definition, which may occur elsewhere in the document (either
3583before or after the link).
3585The link consists of link text in square brackets, followed by a label in
3586square brackets. (There cannot be space between the two unless the
3587`spaced_reference_links` extension is enabled.) The link definition
3588consists of the bracketed label, followed by a colon and a space, followed by
3589the URL, and optionally (after a space) a link title either in quotes or in
3590parentheses. The label must not be parseable as a citation (assuming
3591the `citations` extension is enabled): citations take precedence over
3594Here are some examples:
3596 [my label 1]: /foo/bar.html "My title, optional"
3598 [my label 3]: http://fsf.org (The free software foundation)
3599 [my label 4]: /bar#special 'A title in single quotes'
3601The URL may optionally be surrounded by angle brackets:
3603 [my label 5]: <http://foo.bar.baz>
3605The title may go on the next line:
3607 [my label 3]: http://fsf.org
3608 "The free software foundation"
3610Note that link labels are not case sensitive. So, this will work:
3612 Here is [my link][FOO]
3616In an *implicit* reference link, the second pair of brackets is
3621 [my website]: http://foo.bar.baz
3623Note: In `Markdown.pl` and most other Markdown implementations,
3624reference link definitions cannot occur in nested constructions
3625such as list items or block quotes. Pandoc lifts this arbitrary
3626seeming restriction. So the following is fine in pandoc, though
3627not in most other implementations:
3633#### Extension: `shortcut_reference_links` ####
3635In a *shortcut* reference link, the second pair of brackets may
3640 [my website]: http://foo.bar.baz
3642### Internal links ###
3644To link to another section of the same document, use the automatically
3645generated identifier (see [Header identifiers]). For example:
3647 See the [Introduction](#introduction).
3651 See the [Introduction].
3653 [Introduction]: #introduction
3655Internal links are currently supported for HTML formats (including
3656HTML slide shows and EPUB), LaTeX, and ConTeXt.
3661A link immediately preceded by a `!` will be treated as an image.
3662The link text will be used as the image's alt text:
3664 
3668 [movie reel]: movie.gif
3670#### Extension: `implicit_figures` ####
3672An image with nonempty alt text, occurring by itself in a
3673paragraph, will be rendered as a figure with a caption. The
3674image's alt text will be used as the caption.
3676 
3678How this is rendered depends on the output format. Some output
3679formats (e.g. RTF) do not yet support figures. In those
3680formats, you'll just get an image in a paragraph by itself, with
3683If you just want a regular inline image, just make sure it is not
3684the only thing in the paragraph. One way to do this is to insert a
3685nonbreaking space after the image:
3687 \
3689Note that in reveal.js slide shows, an image in a paragraph
3690by itself that has the `stretch` class will fill the screen,
3691and the caption and figure tags will be omitted.
3693#### Extension: `link_attributes` ####
3695Attributes can be set on links and images:
3697 An inline {#id .class width=30 height=20px}
3698 and a reference ![image][ref] with attributes.
3700 [ref]: foo.jpg "optional title" {#id .class key=val key2="val 2"}
3702(This syntax is compatible with [PHP Markdown Extra] when only `#id`
3703and `.class` are used.)
3705For HTML and EPUB, all attributes except `width` and `height` (but
3706including `srcset` and `sizes`) are passed through as is. The other
3707writers ignore attributes that are not supported by their output
3710The `width` and `height` attributes on images are treated specially. When
3711used without a unit, the unit is assumed to be pixels. However, any of
3712the following unit identifiers can be used: `px`, `cm`, `mm`, `in`, `inch`
3713and `%`. There must not be any spaces between the number and the unit.
3717{ width=50% }
3720- Dimensions are converted to inches for output in page-based formats like
3721 LaTeX. Dimensions are converted to pixels for output in HTML-like
3722 formats. Use the `--dpi` option to specify the number of pixels per
3723 inch. The default is 96dpi.
3724- The `%` unit is generally relative to some available space.
3725 For example the above example will render to the following.
3726 - HTML: `<img href="file.jpg" style="width: 50%;" />`
3727 - LaTeX: `\includegraphics[width=0.5\textwidth,height=\textheight]{file.jpg}`
3728 (If you're using a custom template, you need to configure `graphicx`
3729 as in the default template.)
3730 - ConTeXt: `\externalfigure[file.jpg][width=0.5\textwidth]`
3731- Some output formats have a notion of a class
3732 ([ConTeXt](http://wiki.contextgarden.net/Using_Graphics#Multiple_Image_Settings))
3733 or a unique identifier (LaTeX `\caption`), or both (HTML).
3734- When no `width` or `height` attributes are specified, the fallback
3735 is to look at the image resolution and the dpi metadata embedded in
3741Using the `native_divs` and `native_spans` extensions
3742(see [above][Extension: `native_divs`]), HTML syntax can
3743be used as part of markdown to create native `Div` and `Span`
3744elements in the pandoc AST (as opposed to raw HTML).
3745However, there is also nicer syntax available:
3747#### Extension: `fenced_divs` ####
3749Allow special fenced syntax for native `Div` blocks. A Div
3750starts with a fence containing at least three consecutive
3751colons plus some attributes. The attributes may optionally
3752be followed by another string of consecutive colons.
3753The attribute syntax is exactly as in fenced code blocks (see
3754[Extension: `fenced_code_attributes`]). As with fenced
3755code blocks, one can use either attributes in curly braces
3756or a single unbraced word, which will be treated as a class
3757name. The Div ends with another line containing a string of at
3758least three consecutive colons. The fenced Div should be
3759separated by blank lines from preceding and following blocks.
3763 ::::: {#special .sidebar}
3764 Here is a paragraph.
3769Fenced divs can be nested. Opening fences are distinguished
3770because they *must* have attributes:
3776 This is a warning within a warning.
3780Fences without attributes are always closing fences. Unlike
3781with fenced code blocks, the number of colons in the closing
3782fence need not match the number in the opening fence. However,
3783it can be helpful for visual clarity to use fences of different
3784lengths to distinguish nested divs from their parents.
3787#### Extension: `bracketed_spans` ####
3789A bracketed sequence of inlines, as one would use to begin
3790a link, will be treated as a `Span` with attributes if it is
3791followed immediately by attributes:
3793 [This is *some text*]{.class key="val"}
3798#### Extension: `footnotes` ####
3800Pandoc's Markdown allows footnotes, using the following syntax:
3802 Here is a footnote reference,[^1] and another.[^longnote]
3804 [^1]: Here is the footnote.
3806 [^longnote]: Here's one with multiple blocks.
3808 Subsequent paragraphs are indented to show that they
3809 belong to the previous footnote.
3813 The whole paragraph can be indented, or just the first
3814 line. In this way, multi-paragraph footnotes work like
3815 multi-paragraph list items.
3817 This paragraph won't be part of the note, because it
3820The identifiers in footnote references may not contain spaces, tabs,
3821or newlines. These identifiers are used only to correlate the
3822footnote reference with the note itself; in the output, footnotes
3823will be numbered sequentially.
3825The footnotes themselves need not be placed at the end of the
3826document. They may appear anywhere except inside other block elements
3827(lists, block quotes, tables, etc.). Each footnote should be
3828separated from surrounding content (including other footnotes)
3831#### Extension: `inline_notes` ####
3833Inline footnotes are also allowed (though, unlike regular notes,
3834they cannot contain multiple paragraphs). The syntax is as follows:
3836 Here is an inline note.^[Inlines notes are easier to write, since
3837 you don't have to pick an identifier and move down to type the
3840Inline and regular footnotes may be mixed freely.
3845#### Extension: `citations` ####
3847Using an external filter, `pandoc-citeproc`, pandoc can automatically generate
3848citations and a bibliography in a number of styles. Basic usage is
3850 pandoc --filter pandoc-citeproc myinput.txt
3852In order to use this feature, you will need to specify a bibliography file
3853using the `bibliography` metadata field in a YAML metadata section, or
3854`--bibliography` command line argument. You can supply multiple `--bibliography`
3855arguments or set `bibliography` metadata field to YAML array, if you want to
3856use multiple bibliography files. The bibliography may have any of these
3859 Format File extension
3860 ------------ --------------
3873Note that `.bib` can be used with both BibTeX and BibLaTeX files;
3874use `.bibtex` to force BibTeX.
3876Note that `pandoc-citeproc --bib2json` and `pandoc-citeproc --bib2yaml`
3877can produce `.json` and `.yaml` files from any of the supported formats.
3879In-field markup: In BibTeX and BibLaTeX databases,
3880pandoc-citeproc parses a subset of LaTeX markup; in CSL YAML
3881databases, pandoc Markdown; and in CSL JSON databases, an
3882[HTML-like markup][CSL markup specs]:
3890`<span style="font-variant:small-caps;">...</span>` or `<sc>...</sc>`
3899`<span class="nocase">...</span>`
3900: prevent a phrase from being capitalized as title case
3902`pandoc-citeproc -j` and `-y` interconvert the CSL JSON
3903and CSL YAML formats as far as possible.
3905As an alternative to specifying a bibliography file using `--bibliography`
3906or the YAML metadata field `bibliography`, you can include
3907the citation data directly in the `references` field of the
3908document's YAML metadata. The field should contain an array of
3909YAML-encoded references, for example:
3913 - type: article-journal
3925 title: 'Molecular structure of nucleic acids: a structure for deoxyribose
3927 title-short: Molecular structure of nucleic acids
3928 container-title: Nature
3932 DOI: 10.1038/171737a0
3933 URL: http://www.nature.com/nature/journal/v171/n4356/abs/171737a0.html
3937(`pandoc-citeproc --bib2yaml` can produce these from a bibliography file in one
3938of the supported formats.)
3940Citations and references can be formatted using any style supported by the
3941[Citation Style Language], listed in the [Zotero Style Repository].
3942These files are specified using the `--csl` option or the `csl` metadata field.
3943By default, `pandoc-citeproc` will use the [Chicago Manual of Style] author-date
3944format. The CSL project provides further information on [finding and editing styles].
3946To make your citations hyperlinks to the corresponding bibliography
3947entries, add `link-citations: true` to your YAML metadata.
3949Citations go inside square brackets and are separated by semicolons.
3950Each citation must have a key, composed of '@' + the citation
3951identifier from the database, and may optionally have a prefix,
3952a locator, and a suffix. The citation key must begin with a letter, digit,
3953or `_`, and may contain alphanumerics, `_`, and internal punctuation
3954characters (`:.#$%&-+?<>~/`). Here are some examples:
3956 Blah blah [see @doe99, pp. 33-35; also @smith04, chap. 1].
3958 Blah blah [@doe99, pp. 33-35, 38-39 and *passim*].
3960 Blah blah [@smith04; @doe99].
3962`pandoc-citeproc` detects locator terms in the [CSL locale files].
3963Either abbreviated or unabbreviated forms are accepted. In the `en-US`
3964locale, locator terms can be written in either singular or plural forms,
3965as `book`, `bk.`/`bks.`; `chapter`, `chap.`/`chaps.`; `column`,
3966`col.`/`cols.`; `figure`, `fig.`/`figs.`; `folio`, `fol.`/`fols.`;
3967`number`, `no.`/`nos.`; `line`, `l.`/`ll.`; `note`, `n.`/`nn.`; `opus`,
3968`op.`/`opp.`; `page`, `p.`/`pp.`; `paragraph`, `para.`/`paras.`; `part`,
3969`pt.`/`pts.`; `section`, `sec.`/`secs.`; `sub verbo`, `s.v.`/`s.vv.`;
3970`verse`, `v.`/`vv.`; `volume`, `vol.`/`vols.`; `¶`/`¶¶`; `§`/`§§`. If no
3971locator term is used, "page" is assumed.
3973`pandoc-citeproc` will use heuristics to distinguish the locator
3974from the suffix. In complex cases, the locator can be enclosed
3975in curly braces (using `pandoc-citeproc` 0.15 and higher only):
3977 [@smith{ii, A, D-Z}, with a suffix]
3978 [@smith, {pp. iv, vi-xi, (xv)-(xvii)} with suffix here]
3980A minus sign (`-`) before the `@` will suppress mention of
3981the author in the citation. This can be useful when the
3982author is already mentioned in the text:
3984 Smith says blah [-@smith04].
3986You can also write an in-text citation, as follows:
3990 @smith04 [p. 33] says blah.
3992If the style calls for a list of works cited, it will be placed
3993in a div with id `refs`, if one exists:
3998Otherwise, it will be placed at the end of the document.
3999Generation of the bibliography can be suppressed by setting
4000`suppress-bibliography: true` in the YAML metadata.
4002If you wish the bibliography to have a section header, you can
4003set `reference-section-title` in the metadata, or put the header
4004at the beginning of the div with id `refs` (if you are using it)
4005or at the end of your document:
4011The bibliography will be inserted after this header. Note that
4012the `unnumbered` class will be added to this header, so that the
4013section will not be numbered.
4015If you want to include items in the bibliography without actually
4016citing them in the body text, you can define a dummy `nocite` metadata
4017field and put the citations there:
4026In this example, the document will contain a citation for `item3`
4027only, but the bibliography will contain entries for `item1`, `item2`, and
4030It is possible to create a bibliography with all the citations,
4031whether or not they appear in the document, by using a wildcard:
4038For LaTeX output, you can also use [`natbib`] or [`biblatex`] to
4039render the bibliography. In order to do so, specify bibliography
4040files as outlined above, and add `--natbib` or `--biblatex`
4041argument to `pandoc` invocation. Bear in mind that bibliography
4042files have to be in respective format (either BibTeX or
4045For more information, see the [pandoc-citeproc man page].
4047[CSL markup specs]: http://docs.citationstyles.org/en/1.0/release-notes.html#rich-text-markup-within-fields
4048[Chicago Manual of Style]: http://chicagomanualofstyle.org
4049[Citation Style Language]: http://citationstyles.org
4050[Zotero Style Repository]: https://www.zotero.org/styles
4051[finding and editing styles]: https://citationstyles.org/authors/
4052[CSL locale files]: https://github.com/citation-style-language/locales
4053[pandoc-citeproc man page]: https://github.com/jgm/pandoc-citeproc/blob/master/man/pandoc-citeproc.1.md
4055Non-pandoc extensions
4056---------------------
4058The following Markdown syntax extensions are not enabled by default
4059in pandoc, but may be enabled by adding `+EXTENSION` to the format
4060name, where `EXTENSION` is the name of the extension. Thus, for
4061example, `markdown+hard_line_breaks` is Markdown with hard line breaks.
4063#### Extension: `old_dashes` ####
4065Selects the pandoc <= 1.8.2.1 behavior for parsing smart dashes:
4066`-` before a numeral is an en-dash, and `--` is an em-dash.
4067This option only has an effect if `smart` is enabled. It is
4068selected automatically for `textile` input.
4070#### Extension: `angle_brackets_escapable` ####
4072Allow `<` and `>` to be backslash-escaped, as they can be in
4073GitHub flavored Markdown but not original Markdown. This is
4074implied by pandoc's default `all_symbols_escapable`.
4076#### Extension: `lists_without_preceding_blankline` ####
4078Allow a list to occur right after a paragraph, with no intervening
4081#### Extension: `four_space_rule` ####
4083Selects the pandoc <= 2.0 behavior for parsing lists, so that
4084four spaces indent are needed for list item continuation
4087#### Extension: `spaced_reference_links` ####
4089Allow whitespace between the two components of a reference link,
4094#### Extension: `hard_line_breaks` ####
4096Causes all newlines within a paragraph to be interpreted as hard line
4097breaks instead of spaces.
4099#### Extension: `ignore_line_breaks` ####
4101Causes newlines within a paragraph to be ignored, rather than being
4102treated as spaces or as hard line breaks. This option is intended for
4103use with East Asian languages where spaces are not used between words,
4104but text is divided into lines for readability.
4106#### Extension: `east_asian_line_breaks` ####
4108Causes newlines within a paragraph to be ignored, rather than
4109being treated as spaces or as hard line breaks, when they occur
4110between two East Asian wide characters. This is a better choice
4111than `ignore_line_breaks` for texts that include a mix of East
4112Asian wide characters and other characters.
4114#### Extension: `emoji` ####
4116Parses textual emojis like `:smile:` as Unicode emoticons.
4118#### Extension: `tex_math_single_backslash` ####
4120Causes anything between `\(` and `\)` to be interpreted as inline
4121TeX math, and anything between `\[` and `\]` to be interpreted
4122as display TeX math. Note: a drawback of this extension is that
4123it precludes escaping `(` and `[`.
4125#### Extension: `tex_math_double_backslash` ####
4127Causes anything between `\\(` and `\\)` to be interpreted as inline
4128TeX math, and anything between `\\[` and `\\]` to be interpreted
4131#### Extension: `markdown_attribute` ####
4133By default, pandoc interprets material inside block-level tags as Markdown.
4134This extension changes the behavior so that Markdown is only parsed
4135inside block-level tags if the tags have the attribute `markdown=1`.
4137#### Extension: `mmd_title_block` ####
4139Enables a [MultiMarkdown] style title block at the top of
4140the document, for example:
4144 Date: September 1, 2008
4145 Comment: This is a sample mmd title block, with
4146 a field spanning multiple lines.
4148See the MultiMarkdown documentation for details. If `pandoc_title_block` or
4149`yaml_metadata_block` is enabled, it will take precedence over
4152#### Extension: `abbreviations` ####
4154Parses PHP Markdown Extra abbreviation keys, like
4156 *[HTML]: Hypertext Markup Language
4158Note that the pandoc document model does not support
4159abbreviations, so if this extension is enabled, abbreviation keys are
4160simply skipped (as opposed to being parsed as paragraphs).
4162#### Extension: `autolink_bare_uris` ####
4164Makes all absolute URIs into links, even when not surrounded by
4165pointy braces `<...>`.
4167#### Extension: `mmd_link_attributes` ####
4169Parses multimarkdown style key-value attributes on link
4170and image references. This extension should not be confused with the
4171[`link_attributes`](#extension-link_attributes) extension.
4173 This is a reference ![image][ref] with multimarkdown attributes.
4175 [ref]: http://path.to/image "Image title" width=20px height=30px
4176 id=myId class="myClass1 myClass2"
4178#### Extension: `mmd_header_identifiers` ####
4180Parses multimarkdown style header identifiers (in square brackets,
4181after the header but before any trailing `#`s in an ATX header).
4183#### Extension: `compact_definition_lists` ####
4185Activates the definition list syntax of pandoc 1.12.x and earlier.
4186This syntax differs from the one described above under [Definition lists]
4189 - No blank line is required between consecutive items of the
4191 - To get a "tight" or "compact" list, omit space between consecutive
4192 items; the space between a term and its definition does not affect
4194 - Lazy wrapping of paragraphs is not allowed: the entire definition must
4195 be indented four spaces.[^6]
4197[^6]: To see why laziness is incompatible with relaxing the requirement
4198 of a blank line between items, consider the following example:
4205 Is this a single list item with two definitions of "bar," the first of
4206 which is lazily wrapped, or two list items? To remove the ambiguity
4207 we must either disallow lazy wrapping or require a blank line between
4213In addition to pandoc's extended Markdown, the following Markdown
4214variants are supported:
4216`markdown_phpextra` (PHP Markdown Extra)
4217: `footnotes`, `pipe_tables`, `raw_html`, `markdown_attribute`,
4218 `fenced_code_blocks`, `definition_lists`, `intraword_underscores`,
4219 `header_attributes`, `link_attributes`, `abbreviations`,
4220 `shortcut_reference_links`, `spaced_reference_links`.
4222`markdown_github` (deprecated GitHub-Flavored Markdown)
4223: `pipe_tables`, `raw_html`, `fenced_code_blocks`, `auto_identifiers`,
4224 `gfm_auto_identifiers`, `backtick_code_blocks`,
4225 `autolink_bare_uris`, `space_in_atx_header`,
4226 `intraword_underscores`, `strikeout`, `emoji`,
4227 `shortcut_reference_links`, `angle_brackets_escapable`,
4228 `lists_without_preceding_blankline`.
4230`markdown_mmd` (MultiMarkdown)
4231: `pipe_tables`, `raw_html`, `markdown_attribute`, `mmd_link_attributes`,
4232 `tex_math_double_backslash`, `intraword_underscores`,
4233 `mmd_title_block`, `footnotes`, `definition_lists`,
4234 `all_symbols_escapable`, `implicit_header_references`,
4235 `auto_identifiers`, `mmd_header_identifiers`,
4236 `shortcut_reference_links`, `implicit_figures`,
4237 `superscript`, `subscript`, `backtick_code_blocks`,
4238 `spaced_reference_links`, `raw_attribute`.
4240`markdown_strict` (Markdown.pl)
4241: `raw_html`, `shortcut_reference_links`,
4242 `spaced_reference_links`.
4244We also support `commonmark` and `gfm` (GitHub-Flavored Markdown,
4245which is implemented as a set of extensions on `commonmark`).
4247Note, however, that `commonmark` and `gfm` have limited support
4248for extensions. Only those listed below (and `smart` and
4249`raw_tex`) will work. The extensions can, however, all be
4250individually disabled.
4251Also, `raw_tex` only affects `gfm` output, not input.
4253`gfm` (GitHub-Flavored Markdown)
4254: `pipe_tables`, `raw_html`, `fenced_code_blocks`, `auto_identifiers`,
4255 `gfm_auto_identifiers`, `backtick_code_blocks`,
4256 `autolink_bare_uris`, `space_in_atx_header`,
4257 `intraword_underscores`, `strikeout`, `emoji`,
4258 `shortcut_reference_links`, `angle_brackets_escapable`,
4259 `lists_without_preceding_blankline`.
4262Producing slide shows with pandoc
4263=================================
4265You can use pandoc to produce an HTML + JavaScript slide presentation
4266that can be viewed via a web browser. There are five ways to do this,
4267using [S5], [DZSlides], [Slidy], [Slideous], or [reveal.js].
4268You can also produce a PDF slide show using LaTeX [`beamer`], or
4269slides shows in Microsoft [PowerPoint] format.
4271Here's the Markdown source for a simple slide show, `habits.txt`:
4298 
4305To produce an HTML/JavaScript slide show, simply type
4307 pandoc -t FORMAT -s habits.txt -o habits.html
4309where `FORMAT` is either `s5`, `slidy`, `slideous`, `dzslides`, or `revealjs`.
4311For Slidy, Slideous, reveal.js, and S5, the file produced by pandoc with the
4312`-s/--standalone` option embeds a link to JavaScript and CSS files, which are
4313assumed to be available at the relative path `s5/default` (for S5), `slideous`
4314(for Slideous), `reveal.js` (for reveal.js), or at the Slidy website at
4315`w3.org` (for Slidy). (These paths can be changed by setting the `slidy-url`,
4316`slideous-url`, `revealjs-url`, or `s5-url` variables; see [Variables for slides],
4317above.) For DZSlides, the (relatively short) JavaScript and CSS are included in
4320With all HTML slide formats, the `--self-contained` option can be used to
4321produce a single file that contains all of the data necessary to display the
4322slide show, including linked scripts, stylesheets, images, and videos.
4324To produce a PDF slide show using beamer, type
4326 pandoc -t beamer habits.txt -o habits.pdf
4328Note that a reveal.js slide show can also be converted to a PDF
4329by printing it to a file from the browser.
4331To produce a Powerpoint slide show, type
4333 pandoc habits.txt -o habits.pptx
4335Structuring the slide show
4336--------------------------
4338By default, the *slide level* is the highest header level in
4339the hierarchy that is followed immediately by content, and not another
4340header, somewhere in the document. In the example above, level 1 headers
4341are always followed by level 2 headers, which are followed by content,
4342so 2 is the slide level. This default can be overridden using
4343the `--slide-level` option.
4345The document is carved up into slides according to the following
4348 * A horizontal rule always starts a new slide.
4350 * A header at the slide level always starts a new slide.
4352 * Headers *below* the slide level in the hierarchy create
4353 headers *within* a slide.
4355 * Headers *above* the slide level in the hierarchy create
4356 "title slides," which just contain the section title
4357 and help to break the slide show into sections.
4359 * Content *above* the slide level will not appear in the slide
4362 * A title page is constructed automatically from the document's title
4363 block, if present. (In the case of beamer, this can be disabled
4364 by commenting out some lines in the default template.)
4366These rules are designed to support many different styles of slide show. If
4367you don't care about structuring your slides into sections and subsections,
4368you can just use level 1 headers for all each slide. (In that case, level 1
4369will be the slide level.) But you can also structure the slide show into
4370sections, as in the example above.
4372Note: in reveal.js slide shows, if slide level is 2, a two-dimensional
4373layout will be produced, with level 1 headers building horizontally
4374and level 2 headers building vertically. It is not recommended that
4375you use deeper nesting of section levels with reveal.js.
4380By default, these writers produce lists that display "all at once."
4381If you want your lists to display incrementally (one item at a time),
4382use the `-i` option. If you want a particular list to depart from the
4383default, put it in a `div` block with class `incremental` or
4384`nonincremental`. So, for example, using the `fenced div` syntax, the
4385following would be incremental regardless of the document default:
4403While using `incremental` and `nonincremental` divs are the
4404recommended method of setting incremental lists on a per-case basis,
4405an older method is also supported: putting lists inside a blockquote
4406will depart from the document default (that is, it will display
4407incrementally without the `-i` option and all at once with the `-i`
4413Both methods allow incremental and nonincremental lists to be mixed
4414in a single document.
4419You can add "pauses" within a slide by including a paragraph containing
4420three dots, separated by spaces:
4422 # Slide with a pause
4424 content before the pause
4428 content after the pause
4433You can change the style of HTML slides by putting customized CSS files
4434in `$DATADIR/s5/default` (for S5), `$DATADIR/slidy` (for Slidy),
4435or `$DATADIR/slideous` (for Slideous),
4436where `$DATADIR` is the user data directory (see `--data-dir`, above).
4437The originals may be found in pandoc's system data directory (generally
4438`$CABALDIR/pandoc-VERSION/s5/default`). Pandoc will look there for any
4439files it does not find in the user data directory.
4441For dzslides, the CSS is included in the HTML file itself, and may
4444All [reveal.js configuration options] can be set through variables.
4445For example, themes can be used by setting the `theme` variable:
4449Or you can specify a custom stylesheet using the `--css` option.
4451To style beamer slides, you can specify a `theme`, `colortheme`,
4452`fonttheme`, `innertheme`, and `outertheme`, using the `-V` option:
4454 pandoc -t beamer habits.txt -V theme:Warsaw -o habits.pdf
4456Note that header attributes will turn into slide attributes
4457(on a `<div>` or `<section>`) in HTML slide formats, allowing you
4458to style individual slides. In beamer, the only header attribute
4459that affects slides is the `allowframebreaks` class, which sets the
4460`allowframebreaks` option, causing multiple slides to be created
4461if the content overfills the frame. This is recommended especially for
4464 # References {.allowframebreaks}
4469Speaker notes are supported in reveal.js and PowerPoint (pptx)
4470output. You can add notes to your Markdown document thus:
4476 - It can contain Markdown
4481To show the notes window in reveal.js, press `s` while viewing the
4482presentation. Speaker notes in PowerPoint will be available, as usual,
4483in handouts and presenter view.
4485Notes are not yet supported for other slide formats, but the notes
4486will not appear on the slides themselves.
4491To put material in side by side columns, you can use a native
4492div container with class `columns`, containing two or more div
4493containers with class `column` and a `width` attribute:
4495 :::::::::::::: {.columns}
4496 ::: {.column width="40%"}
4499 ::: {.column width="60%"}
4504Frame attributes in beamer
4505--------------------------
4507Sometimes it is necessary to add the LaTeX `[fragile]` option to
4508a frame in beamer (for example, when using the `minted` environment).
4509This can be forced by adding the `fragile` class to the header
4510introducing the slide:
4512 # Fragile slide {.fragile}
4514All of the other frame attributes described in Section 8.1 of
4515the [Beamer User's Guide] may also be used: `allowdisplaybreaks`,
4516`allowframebreaks`, `b`, `c`, `t`, `environment`, `label`, `plain`,
4517`shrink`, `standout`, `noframenumbering`.
4519Background in reveal.js and beamer
4520----------------------------------
4522Background images can be added to self-contained reveal.js slideshows and
4523to beamer slideshows.
4525For the same image on every slide, use the configuration
4526option `background-image` either in the YAML metadata block
4527or as a command-line variable. (There are no other options in
4528beamer and the rest of this section concerns reveal.js slideshows.)
4530For reveal.js, you can instead use the reveal.js-native option
4531`parallaxBackgroundImage`. You can also set `parallaxBackgroundHorizontal`
4532and `parallaxBackgroundVertical` the same way and must also set
4533`parallaxBackgroundSize` to have your values take effect.
4535To set an image for a particular reveal.js slide, add
4536`{data-background-image="/path/to/image"}`
4537to the first slide-level header on the slide (which may even be empty).
4539In reveal.js's overview mode, the parallaxBackgroundImage will show up
4540only on the first slide.
4542Other reveal.js background settings also work on individual slides, including
4543`data-background-size`, `data-background-repeat`, `data-background-color`,
4544`data-transition`, and `data-transition-speed`.
4547documentation](https://github.com/hakimel/reveal.js#slide-backgrounds)
4550For example in reveal.js:
4555parallaxBackgroundImage: /path/to/my/background_image.png
4560Slide 1 has background_image.png as its background.
4562## {data-background-image="/path/to/special_image.jpg"}
4564Slide 2 has a special image for its background, even though the header has no content.
4567Creating EPUBs with pandoc
4568==========================
4573EPUB metadata may be specified using the `--epub-metadata` option, but
4574if the source document is Markdown, it is better to use a [YAML metadata
4575block][Extension: `yaml_metadata_block`]. Here is an example:
4582 text: An investigation of metadata
4590 text: doi:10.234234.234/33
4592 rights: © 2007 John Smith, CC BY-NC
4597The following fields are recognized:
4600 ~ Either a string value or an object with fields `text` and
4601 `scheme`. Valid values for `scheme` are `ISBN-10`,
4602 `GTIN-13`, `UPC`, `ISMN-10`, `DOI`, `LCCN`, `GTIN-14`,
4603 `ISBN-13`, `Legal deposit number`, `URN`, `OCLC`,
4604 `ISMN-13`, `ISBN-A`, `JP`, `OLCC`.
4607 ~ Either a string value, or an object with fields `file-as` and
4608 `type`, or a list of such objects. Valid values for `type` are
4609 `main`, `subtitle`, `short`, `collection`, `edition`, `extended`.
4612 ~ Either a string value, or an object with fields `role`, `file-as`,
4613 and `text`, or a list of such objects. Valid values for `role` are
4614 [MARC relators], but
4615 pandoc will attempt to translate the human-readable versions
4616 (like "author" and "editor") to the appropriate marc relators.
4619 ~ Same format as `creator`.
4622 ~ A string value in `YYYY-MM-DD` format. (Only the year is necessary.)
4623 Pandoc will attempt to convert other common date formats.
4625`lang` (or legacy: `language`)
4626 ~ A string value in [BCP 47] format. Pandoc will default to the local
4627 language if nothing is specified.
4630 ~ A string value or a list of such values.
4651 ~ A string value (path to cover image).
4653`css` (or legacy: `stylesheet`)
4654 ~ A string value (path to CSS stylesheet).
4656`page-progression-direction`
4657 ~ Either `ltr` or `rtl`. Specifies the `page-progression-direction`
4658 attribute for the [`spine` element].
4661 ~ iBooks-specific metadata, with the following fields:
4663 - `version`: (string)
4664 - `specified-fonts`: `true`|`false` (default `false`)
4665 - `ipad-orientation-lock`: `portrait-only`|`landscape-only`
4666 - `iphone-orientation-lock`: `portrait-only`|`landscape-only`
4667 - `binding`: `true`|`false` (default `true`)
4668 - `scroll-axis`: `vertical`|`horizontal`|`default`
4670[MARC relators]: http://loc.gov/marc/relators/relaterm.html
4671[`spine` element]: http://idpf.org/epub/301/spec/epub-publications.html#sec-spine-elem
4673The `epub:type` attribute
4674-------------------------
4676For `epub3` output, you can mark up the header that corresponds to an EPUB
4677chapter using the [`epub:type` attribute][epub-type]. For example, to set
4678the attribute to the value `prologue`, use this markdown:
4680 # My chapter {epub:type=prologue}
4682Which will result in:
4684 <body epub:type="frontmatter">
4685 <section epub:type="prologue">
4688Pandoc will output `<body epub:type="bodymatter">`, unless
4689you use one of the following values, in which case either
4690`frontmatter` or `backmatter` will be output.
4692`epub:type` of first section `epub:type` of body
4693---------------------------- ------------------
4696acknowledgments frontmatter
4697copyright-page frontmatter
4698dedication frontmatter
4700halftitle, frontmatter
4701introduction frontmatter
4703seriespage frontmatter
4704titlepage frontmatter
4708conclusion backmatter
4711[epub-type]: http://www.idpf.org/epub/31/spec/epub-contentdocs.html#sec-epub-type-attribute
4716By default, pandoc will download media referenced from any `<img>`, `<audio>`,
4717`<video>` or `<source>` element present in the generated EPUB,
4718and include it in the EPUB container, yielding a completely
4719self-contained EPUB. If you want to link to external media resources
4720instead, use raw HTML in your source and add `data-external="1"` to the tag
4721with the `src` attribute. For example:
4723 <audio controls="1">
4724 <source src="http://example.com/music/toccata.mp3"
4725 data-external="1" type="audio/mpeg">
4732Pandoc will automatically highlight syntax in [fenced code blocks] that
4733are marked with a language name. The Haskell library [skylighting] is
4734used for highlighting. Currently highlighting is supported only for
4735HTML, EPUB, Docx, Ms, and LaTeX/PDF output. To see a list of language names
4736that pandoc will recognize, type `pandoc --list-highlight-languages`.
4738The color scheme can be selected using the `--highlight-style` option.
4739The default color scheme is `pygments`, which imitates the default color
4740scheme used by the Python library pygments (though pygments is not actually
4741used to do the highlighting). To see a list of highlight styles,
4742type `pandoc --list-highlight-styles`.
4744If you are not satisfied with the predefined styles, you can
4745use `--print-highlight-style` to generate a JSON `.theme` file which
4746can be modified and used as the argument to `--highlight-style`. To
4747get a JSON version of the `pygments` style, for example:
4749 pandoc --print-highlight-style pygments > my.theme
4751Then edit `my.theme` and use it like this:
4753 pandoc --highlight-style my.theme
4755If you are not satisfied with the built-in highlighting, or you
4756want highlight a language that isn't supported, you can use the
4757`--syntax-definition` option to load a [KDE-style XML syntax definition
4758file](https://docs.kde.org/stable5/en/applications/katepart/highlight.html).
4759Before writing your own, have a look at KDE's [repository of syntax
4760definitions](https://github.com/KDE/syntax-highlighting/tree/master/data/syntax).
4762To disable highlighting, use the `--no-highlight` option.
4764[skylighting]: https://github.com/jgm/skylighting
4766Custom Styles in Docx
4767=====================
4772The docx reader, by default, only reads those styles that it can
4773convert into pandoc elements, either by direct conversion or
4774interpreting the derivation of the input document's styles.
4776By enabling the [`styles` extension](#ext-styles) in the docx reader
4777(`-f docx+styles`), you can produce output that maintains the styles
4778of the input document, using the `custom-style` class. Paragraph
4779styles are interpreted as divs, while character styles are interpreted
4782For example, using the `custom-style-reference.docx` file in the test
4783directory, we have the following different outputs:
4785Without the `+styles` extension:
4787 $ pandoc test/docx/custom-style-reference.docx -f docx -t markdown
4790 This is text with an *emphasized* text style. And this is text with a
4791 **strengthened** text style.
4793 > Here is a styled paragraph that inherits from Block Text.
4795And with the extension:
4797 $ pandoc test/docx/custom-style-reference.docx -f docx+styles -t markdown
4799 ::: {custom-style="FirstParagraph"}
4803 ::: {custom-style="BodyText"}
4804 This is text with an [emphasized]{custom-style="Emphatic"} text style.
4805 And this is text with a [strengthened]{custom-style="Strengthened"}
4809 ::: {custom-style="MyBlockStyle"}
4810 > Here is a styled paragraph that inherits from Block Text.
4813With these custom styles, you can use your input document as a
4814reference-doc while creating docx output (see below), and maintain the
4815same styles in your input and output files.
4820By default, pandoc's docx output applies a predefined set of styles for
4821blocks such as paragraphs and block quotes, and uses largely default
4822formatting (italics, bold) for inlines. This will work for most
4823purposes, especially alongside a `reference.docx` file. However, if you
4824need to apply your own styles to blocks, or match a preexisting set of
4825styles, pandoc allows you to define custom styles for blocks and text
4826using `div`s and `span`s, respectively.
4828If you define a `div` or `span` with the attribute `custom-style`,
4829pandoc will apply your specified style to the contained elements. So,
4830for example using the `bracketed_spans` syntax,
4832 [Get out]{custom-style="Emphatically"}, he said.
4834would produce a docx file with "Get out" styled with character
4835style `Emphatically`. Similarly, using the `fenced_divs` syntax,
4837 Dickinson starts the poem simply:
4839 ::: {custom-style="Poetry"}
4840 | A Bird came down the Walk---
4841 | He did not know I saw---
4844would style the two contained lines with the `Poetry` paragraph style.
4846If the styles are not yet in your reference.docx, they will be defined
4847in the output file as inheriting from normal text. If they are already
4848defined, pandoc will not alter the definition.
4850This feature allows for greatest customization in conjunction with
4851[pandoc filters]. If you want all paragraphs after block quotes to be
4852indented, you can write a filter to apply the styles necessary. If you
4853want all italics to be transformed to the `Emphasis` character style
4854(perhaps to change their color), you can write a filter which will
4855transform all italicized inlines to inlines within an `Emphasis`
4858[pandoc filters]: http://pandoc.org/filters.html
4863Pandoc can be extended with custom writers written in [lua]. (Pandoc
4864includes a lua interpreter, so lua need not be installed separately.)
4866To use a custom writer, simply specify the path to the lua script
4867in place of the output format. For example:
4869 pandoc -t data/sample.lua
4871Creating a custom writer requires writing a lua function for each
4872possible element in a pandoc document. To get a documented example
4873which you can modify according to your needs, do
4875 pandoc --print-default-data-file sample.lua
4877[lua]: http://www.lua.org
4882If you use pandoc to convert user-contributed content in a web
4883application, here are some things to keep in mind:
48851. Although pandoc itself will not create or modify any files other
4886 than those you explicitly ask it create (with the exception
4887 of temporary files used in producing PDFs), a filter or custom
4888 writer could in principle do anything on your file system. Please
4889 audit filters and custom writers very carefully before using them.
48912. If your application uses pandoc as a Haskell library (rather than
4892 shelling out to the executable), it is possible to use it in a mode
4893 that fully isolates pandoc from your file system, by running the
4894 pandoc operations in the `PandocPure` monad. See the document
4895 [Using the pandoc API](http://pandoc.org/using-the-pandoc-api.html)
48983. Pandoc's parsers can exhibit pathological performance on some
4899 corner cases. It is wise to put any pandoc operations under
4900 a timeout, to avoid DOS attacks that exploit these issues.
4901 If you are using the pandoc executable, you can add the
4902 command line options `+RTS -M512M -RTS` (for example) to limit
4903 the heap size to 512MB.
49054. The HTML generated by pandoc is not guaranteed to be safe.
4906 If `raw_html` is enabled for the Markdown input, users can
4907 inject arbitrary HTML. Even if `raw_html` is disabled,
4908 users can include dangerous content in attributes for
4909 headers, spans, and code blocks. To be safe, you should
4910 run all the generated HTML through an HTML sanitizer.
4915Copyright 2006-2017 John MacFarlane (jgm@berkeley.edu). Released
4916under the [GPL], version 2 or greater. This software carries no
4917warranty of any kind. (See COPYRIGHT for full copyright and
4918warranty notices.) For a full list of contributors, see the file
4919AUTHORS.md in the pandoc source code.
4921[GPL]: http://www.gnu.org/copyleft/gpl.html "GNU General Public License"
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list