2title: Pandoc User's Guide
9`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.
45If no *input-files* are specified, input is read from *stdin*.
46Output goes to *stdout* by default. For output to a file,
49 pandoc -o output.html input.txt
51By default, pandoc produces a document fragment. To produce a standalone
52document (e.g. a valid HTML file including `<head>` and `<body>`),
53use the `-s` or `--standalone` flag:
55 pandoc -s -o output.html input.txt
57For more information on how standalone documents are produced, see
60If multiple input files are given, `pandoc` will concatenate them all (with
61blank lines between them) before parsing. (Use `--file-scope` to parse files
66The format of the input and output can be specified explicitly using
67command-line options. The input format can be specified using the
68`-f/--from` option, the output format using the `-t/--to` option.
69Thus, to convert `hello.txt` from Markdown to LaTeX, you could type:
71 pandoc -f markdown -t latex hello.txt
73To convert `hello.html` from HTML to Markdown:
75 pandoc -f html -t markdown hello.html
77Supported input and output formats are listed below under [Options]
78(see `-f` for input formats and `-t` for output formats). You
79can also use `pandoc --list-input-formats` and
80`pandoc --list-output-formats` to print lists of supported
83If the input or output format is not specified explicitly, `pandoc`
84will attempt to guess it from the extensions of the filenames.
87 pandoc -o hello.tex hello.txt
89will convert `hello.txt` from Markdown to LaTeX. If no output file
90is specified (so that output goes to *stdout*), or if the output file's
91extension is unknown, the output format will default to HTML.
92If no input file is specified (so that input comes from *stdin*), or
93if the input files' extensions are unknown, the input format will
94be assumed to be Markdown.
98Pandoc uses the UTF-8 character encoding for both input and output.
99If your local character encoding is not UTF-8, you
100should pipe input and output through [`iconv`]:
102 iconv -t utf-8 input.txt | pandoc | iconv -f utf-8
104Note that in some output formats (such as HTML, LaTeX, ConTeXt,
105RTF, OPML, DocBook, and Texinfo), information about
106the character encoding is included in the document header, which
107will only be included if you use the `-s/--standalone` option.
109[`iconv`]: https://www.gnu.org/software/libiconv/
113To produce a PDF, specify an output file with a `.pdf` extension:
115 pandoc test.txt -o test.pdf
117By default, pandoc will use LaTeX to create the PDF, which requires
118that a LaTeX engine be installed (see `--pdf-engine` below).
119Alternatively, pandoc can use ConTeXt, roff ms, or HTML as an
120intermediate format. To do this, specify an output file with a
121`.pdf` extension, as before, but add the `--pdf-engine` option
122or `-t context`, `-t html`, or `-t ms` to the command line.
123The tool used to generate the PDF from the intermediate format
124may be specified using `--pdf-engine`.
126You can control the PDF style using variables, depending on
127the intermediate format used: see [variables for LaTeX],
128[variables for ConTeXt], [variables for `wkhtmltopdf`],
129[variables for ms]. When HTML is used as an intermediate
130format, the output can be styled using `--css`.
132To debug the PDF creation, it can be useful to look at the intermediate
133representation: instead of `-o test.pdf`, use for example `-s -o test.tex`
134to output the generated LaTeX. You can then test it with `pdflatex test.tex`.
136When using LaTeX, the following packages need to be available
137(they are included with all recent versions of [TeX Live]):
138[`amsfonts`], [`amsmath`], [`lm`], [`unicode-math`],
139[`ifxetex`], [`ifluatex`], [`listings`] (if the
140`--listings` option is used), [`fancyvrb`], [`longtable`],
141[`booktabs`], [`graphicx`] (if the document
142contains images), [`hyperref`], [`xcolor`],
143[`ulem`], [`geometry`] (with the `geometry` variable set),
144[`setspace`] (with `linestretch`), and
145[`babel`] (with `lang`). The use of `xelatex` or `lualatex` as
146the PDF engine requires [`fontspec`]. `xelatex` uses
147[`polyglossia`] (with `lang`), [`xecjk`], and [`bidi`] (with the
148`dir` variable set). If the `mathspec` variable is set,
149`xelatex` will use [`mathspec`] instead of [`unicode-math`].
150The [`upquote`] and [`microtype`] packages are used if
151available, and [`csquotes`] will be used for [typography]
152if the `csquotes` variable or metadata field is set to a
153true value. The [`natbib`], [`biblatex`], [`bibtex`], and
154[`biber`] packages can optionally be used for [citation
155rendering]. The following packages will be used to improve
156output quality if present, but pandoc does not require them to
157be present: [`upquote`] (for straight quotes in verbatim
158environments), [`microtype`] (for better spacing adjustments),
159[`parskip`] (for better inter-paragraph spaces), [`xurl`] (for
160better line breaks in URLs), [`bookmark`] (for better PDF
161bookmarks), and [`footnotehyper`] or [`footnote`] (to allow
164[TeX Live]: https://www.tug.org/texlive/
165[`amsfonts`]: https://ctan.org/pkg/amsfonts
166[`amsmath`]: https://ctan.org/pkg/amsmath
167[`babel`]: https://ctan.org/pkg/babel
168[`biber`]: https://ctan.org/pkg/biber
169[`biblatex`]: https://ctan.org/pkg/biblatex
170[`bibtex`]: https://ctan.org/pkg/bibtex
171[`bidi`]: https://ctan.org/pkg/bidi
172[`bookmark`]: https://ctan.org/pkg/bookmark
173[`booktabs`]: https://ctan.org/pkg/booktabs
174[`csquotes`]: https://ctan.org/pkg/csquotes
175[`fancyvrb`]: https://ctan.org/pkg/fancyvrb
176[`fontspec`]: https://ctan.org/pkg/fontspec
177[`footnote`]: https://ctan.org/pkg/footnote
178[`footnotehyper`]: https://ctan.org/pkg/footnotehyper
179[`geometry`]: https://ctan.org/pkg/geometry
180[`graphicx`]: https://ctan.org/pkg/graphicx
181[`grffile`]: https://ctan.org/pkg/grffile
182[`hyperref`]: https://ctan.org/pkg/hyperref
183[`ifluatex`]: https://ctan.org/pkg/ifluatex
184[`ifxetex`]: https://ctan.org/pkg/ifxetex
185[`listings`]: https://ctan.org/pkg/listings
186[`lm`]: https://ctan.org/pkg/lm
187[`longtable`]: https://ctan.org/pkg/longtable
188[`mathspec`]: https://ctan.org/pkg/mathspec
189[`microtype`]: https://ctan.org/pkg/microtype
190[`natbib`]: https://ctan.org/pkg/natbib
191[`parskip`]: https://ctan.org/pkg/parskip
192[`polyglossia`]: https://ctan.org/pkg/polyglossia
193[`prince`]: https://www.princexml.com/
194[`setspace`]: https://ctan.org/pkg/setspace
195[`ulem`]: https://ctan.org/pkg/ulem
196[`unicode-math`]: https://ctan.org/pkg/unicode-math
197[`upquote`]: https://ctan.org/pkg/upquote
198[`weasyprint`]: https://weasyprint.org
199[`wkhtmltopdf`]: https://wkhtmltopdf.org
200[`xcolor`]: https://ctan.org/pkg/xcolor
201[`xecjk`]: https://ctan.org/pkg/xecjk
202[`xurl`]: https://ctan.org/pkg/xurl
206## Reading from the Web
208Instead of an input file, an absolute URI may be given. In this case
209pandoc will fetch the content using HTTP:
211 pandoc -f html -t markdown https://www.fsf.org
213It is possible to supply a custom User-Agent string or other
214header when requesting a document from a URL:
216 pandoc -f html -t markdown --request-header User-Agent:"Mozilla/5.0" \
221## General options {.options}
223`-f` *FORMAT*, `-r` *FORMAT*, `--from=`*FORMAT*, `--read=`*FORMAT*
225: Specify input format. *FORMAT* can be:
228 - `commonmark` ([CommonMark] Markdown)
229 - `commonmark_x` ([CommonMark] Markdown with extensions)
230 - `creole` ([Creole 1.0])
231 - `csv` ([CSV] table)
232 - `docbook` ([DocBook])
233 - `docx` ([Word docx])
234 - `dokuwiki` ([DokuWiki markup])
236 - `fb2` ([FictionBook2] e-book)
237 - `gfm` ([GitHub-Flavored Markdown]),
238 or the deprecated and less accurate `markdown_github`;
239 use [`markdown_github`](#markdown-variants) only
240 if you need extensions not supported in [`gfm`](#markdown-variants).
241 - `haddock` ([Haddock markup])
243 - `ipynb` ([Jupyter notebook])
244 - `jats` ([JATS] XML)
245 - `jira` ([Jira]/Confluence wiki markup)
246 - `json` (JSON version of native AST)
248 - `markdown` ([Pandoc's Markdown])
249 - `markdown_mmd` ([MultiMarkdown])
250 - `markdown_phpextra` ([PHP Markdown Extra])
251 - `markdown_strict` (original unextended [Markdown])
252 - `mediawiki` ([MediaWiki markup])
255 - `native` (native Haskell)
258 - `org` ([Emacs Org mode])
259 - `rst` ([reStructuredText])
261 - `textile` ([Textile])
262 - `tikiwiki` ([TikiWiki markup])
263 - `twiki` ([TWiki markup])
264 - `vimwiki` ([Vimwiki])
267 Extensions can be individually enabled or disabled by
268 appending `+EXTENSION` or `-EXTENSION` to the format name.
269 See [Extensions] below, for a list of extensions and
270 their names. See `--list-input-formats` and `--list-extensions`,
273`-t` *FORMAT*, `-w` *FORMAT*, `--to=`*FORMAT*, `--write=`*FORMAT*
275: Specify output format. *FORMAT* can be:
277 ::: {#output-formats}
278 - `asciidoc` ([AsciiDoc]) or `asciidoctor` ([AsciiDoctor])
279 - `beamer` ([LaTeX beamer][`beamer`] slide show)
280 - `commonmark` ([CommonMark] Markdown)
281 - `commonmark_x` ([CommonMark] Markdown with extensions)
282 - `context` ([ConTeXt])
283 - `docbook` or `docbook4` ([DocBook] 4)
284 - `docbook5` (DocBook 5)
285 - `docx` ([Word docx])
286 - `dokuwiki` ([DokuWiki markup])
287 - `epub` or `epub3` ([EPUB] v3 book)
289 - `fb2` ([FictionBook2] e-book)
290 - `gfm` ([GitHub-Flavored Markdown]),
291 or the deprecated and less accurate `markdown_github`;
292 use [`markdown_github`](#markdown-variants) only
293 if you need extensions not supported in [`gfm`](#markdown-variants).
294 - `haddock` ([Haddock markup])
295 - `html` or `html5` ([HTML], i.e. [HTML5]/XHTML [polyglot markup])
296 - `html4` ([XHTML] 1.0 Transitional)
297 - `icml` ([InDesign ICML])
298 - `ipynb` ([Jupyter notebook])
299 - `jats_archiving` ([JATS] XML, Archiving and Interchange Tag Set)
300 - `jats_articleauthoring` ([JATS] XML, Article Authoring Tag Set)
301 - `jats_publishing` ([JATS] XML, Journal Publishing Tag Set)
302 - `jats` (alias for `jats_archiving`)
303 - `jira` ([Jira]/Confluence wiki markup)
304 - `json` (JSON version of native AST)
307 - `markdown` ([Pandoc's Markdown])
308 - `markdown_mmd` ([MultiMarkdown])
309 - `markdown_phpextra` ([PHP Markdown Extra])
310 - `markdown_strict` (original unextended [Markdown])
311 - `mediawiki` ([MediaWiki markup])
314 - `native` (native Haskell),
315 - `odt` ([OpenOffice text document][ODT])
317 - `opendocument` ([OpenDocument])
318 - `org` ([Emacs Org mode])
320 - `plain` (plain text),
321 - `pptx` ([PowerPoint] slide show)
322 - `rst` ([reStructuredText])
323 - `rtf` ([Rich Text Format])
324 - `texinfo` ([GNU Texinfo])
325 - `textile` ([Textile])
326 - `slideous` ([Slideous] HTML and JavaScript slide show)
327 - `slidy` ([Slidy] HTML and JavaScript slide show)
328 - `dzslides` ([DZSlides] HTML5 + JavaScript slide show),
329 - `revealjs` ([reveal.js] HTML5 + JavaScript slide show)
330 - `s5` ([S5] HTML and JavaScript slide show)
331 - `tei` ([TEI Simple])
332 - `xwiki` ([XWiki markup])
333 - `zimwiki` ([ZimWiki markup])
334 - the path of a custom Lua writer, see [Custom writers] below
337 Note that `odt`, `docx`, `epub`, and `pdf` output will not be directed
338 to *stdout* unless forced with `-o -`.
340 Extensions can be individually enabled or
341 disabled by appending `+EXTENSION` or `-EXTENSION` to the format
342 name. See [Extensions] below, for a list of extensions and their
343 names. See `--list-output-formats` and `--list-extensions`, below.
345`-o` *FILE*, `--output=`*FILE*
347: Write output to *FILE* instead of *stdout*. If *FILE* is
348 `-`, output will go to *stdout*, even if a non-textual format
349 (`docx`, `odt`, `epub2`, `epub3`) is specified.
351`--data-dir=`*DIRECTORY*
353: Specify the user data directory to search for pandoc data files.
354 If this option is not specified, the default user data directory
355 will be used. On \*nix and macOS systems this will be the `pandoc`
356 subdirectory of the XDG data directory (by default,
357 `$HOME/.local/share`, overridable by setting the `XDG_DATA_HOME`
358 environment variable). If that directory does not exist,
359 `$HOME/.pandoc` will be used (for backwards compatibility).
360 In Windows the default user data directory is
361 `C:\Users\USERNAME\AppData\Roaming\pandoc`.
362 You can find the default user data directory on your system by
363 looking at the output of `pandoc --version`.
364 A `reference.odt`, `reference.docx`, `epub.css`, `templates`,
365 `slidy`, `slideous`, or `s5` directory
366 placed in this directory will override pandoc's normal defaults.
368`-d` *FILE*, `--defaults=`*FILE*
370: Specify a set of default option settings. *FILE* is a YAML
371 file whose fields correspond to command-line option
372 settings. All options for document conversion, including input
373 and output files, can be set using a defaults file. The file will
374 be searched for first in the working directory, and then in
375 the `defaults` subdirectory of the user data directory
376 (see `--data-dir`). The `.yaml` extension may be omitted.
377 See the section [Default files] for more information on the
378 file format. Settings from the defaults file may be
379 overridden or extended by subsequent options on the command
384: Generate a bash completion script. To enable bash completion
385 with pandoc, add this to your `.bashrc`:
387 eval "$(pandoc --bash-completion)"
391: Give verbose debugging output.
395: Suppress warning messages.
399: Exit with error status if there are any warnings.
403: Write log messages in machine-readable JSON format to
404 *FILE*. All messages above DEBUG level will be written,
405 regardless of verbosity settings (`--verbose`, `--quiet`).
407`--list-input-formats`
409: List supported input formats, one per line.
411`--list-output-formats`
413: List supported output formats, one per line.
415`--list-extensions`[`=`*FORMAT*]
417: List supported extensions for *FORMAT*, one per line, preceded
418 by a `+` or `-` indicating whether it is enabled by default
419 in *FORMAT*. If *FORMAT* is not specified, defaults for
420 pandoc's Markdown are given.
422`--list-highlight-languages`
424: List supported languages for syntax highlighting, one per
427`--list-highlight-styles`
429: List supported styles for syntax highlighting, one per line.
430 See `--highlight-style`.
440[Markdown]: https://daringfireball.net/projects/markdown/
441[CommonMark]: https://commonmark.org
442[PHP Markdown Extra]: https://michelf.ca/projects/php-markdown/extra/
443[GitHub-Flavored Markdown]: https://help.github.com/articles/github-flavored-markdown/
444[MultiMarkdown]: https://fletcherpenney.net/multimarkdown/
445[reStructuredText]: https://docutils.sourceforge.io/docs/ref/rst/introduction.html
446[S5]: https://meyerweb.com/eric/tools/s5/
447[Slidy]: https://www.w3.org/Talks/Tools/Slidy2/
448[Slideous]: https://goessner.net/articles/slideous/
449[HTML]: https://www.w3.org/html/
450[HTML5]: https://html.spec.whatwg.org/
451[polyglot markup]: https://www.w3.org/TR/html-polyglot/
452[XHTML]: https://www.w3.org/TR/xhtml1/
453[LaTeX]: https://www.latex-project.org/
454[`beamer`]: https://ctan.org/pkg/beamer
455[Beamer User's Guide]: http://mirrors.ctan.org/macros/latex/contrib/beamer/doc/beameruserguide.pdf
456[ConTeXt]: https://www.contextgarden.net/
457[Rich Text Format]: https://en.wikipedia.org/wiki/Rich_Text_Format
458[DocBook]: https://docbook.org
459[JATS]: https://jats.nlm.nih.gov
460[Jira]: https://jira.atlassian.com/secure/WikiRendererHelpAction.jspa?section=all
461[txt2tags]: https://txt2tags.org
462[EPUB]: http://idpf.org/epub
463[OPML]: http://dev.opml.org/spec2.html
464[OpenDocument]: http://opendocument.xml.org
465[ODT]: https://en.wikipedia.org/wiki/OpenDocument
466[Textile]: https://www.promptworks.com/textile
467[MediaWiki markup]: https://www.mediawiki.org/wiki/Help:Formatting
468[DokuWiki markup]: https://www.dokuwiki.org/dokuwiki
469[ZimWiki markup]: https://zim-wiki.org/manual/Help/Wiki_Syntax.html
470[XWiki markup]: https://www.xwiki.org/xwiki/bin/view/Documentation/UserGuide/Features/XWikiSyntax/
471[TWiki markup]: https://twiki.org/cgi-bin/view/TWiki/TextFormattingRules
472[TikiWiki markup]: https://doc.tiki.org/Wiki-Syntax-Text#The_Markup_Language_Wiki-Syntax
473[Haddock markup]: https://www.haskell.org/haddock/doc/html/ch03s08.html
474[Creole 1.0]: http://www.wikicreole.org/wiki/Creole1.0
475[CSV]: https://tools.ietf.org/html/rfc4180
476[roff man]: https://man.cx/groff_man(7)
477[roff ms]: https://man.cx/groff_ms(7)
478[Haskell]: https://www.haskell.org
479[GNU Texinfo]: https://www.gnu.org/software/texinfo/
480[Emacs Org mode]: https://orgmode.org
481[AsciiDoc]: https://www.methods.co.nz/asciidoc/
482[AsciiDoctor]: https://asciidoctor.org/
483[DZSlides]: http://paulrouget.com/dzslides/
484[Word docx]: https://en.wikipedia.org/wiki/Office_Open_XML
485[PDF]: https://www.adobe.com/pdf/
486[reveal.js]: https://revealjs.com/
487[FictionBook2]: http://www.fictionbook.org/index.php/Eng:XML_Schema_Fictionbook_2.1
488[Jupyter notebook]: https://nbformat.readthedocs.io/en/latest/
489[InDesign ICML]: https://wwwimages.adobe.com/www.adobe.com/content/dam/acom/en/devnet/indesign/sdk/cs6/idml/idml-cookbook.pdf
490[TEI Simple]: https://github.com/TEIC/TEI-Simple
491[Muse]: https://amusewiki.org/library/manual
492[PowerPoint]: https://en.wikipedia.org/wiki/Microsoft_PowerPoint
493[Vimwiki]: https://vimwiki.github.io
495## Reader options {.options}
497`--shift-heading-level-by=`*NUMBER*
499: Shift heading levels by a positive or negative integer.
500 For example, with `--shift-heading-level-by=-1`, level 2
501 headings become level 1 headings, and level 3 headings
502 become level 2 headings. Headings cannot have a level
503 less than 1, so a heading that would be shifted below level 1
504 becomes a regular paragraph. Exception: with a shift of -N,
505 a level-N heading at the beginning of the document
506 replaces the metadata title. `--shift-heading-level-by=-1`
507 is a good choice when converting HTML or Markdown documents that
508 use an initial level-1 heading for the document title and
509 level-2+ headings for sections. `--shift-heading-level-by=1`
510 may be a good choice for converting Markdown documents that
511 use level-1 headings for sections to HTML, since pandoc uses
512 a level-1 heading to render the document title.
514`--base-header-level=`*NUMBER*
516: *Deprecated. Use `--shift-heading-level-by`=X instead,
517 where X = NUMBER - 1.* Specify the base level for headings
520`--strip-empty-paragraphs`
522: *Deprecated. Use the `+empty_paragraphs` extension instead.*
523 Ignore paragraphs with no content. This option is useful
524 for converting word processing documents where users have
525 used empty paragraphs to create inter-paragraph space.
527`--indented-code-classes=`*CLASSES*
529: Specify classes to use for indented code blocks--for example,
530 `perl,numberLines` or `haskell`. Multiple classes may be separated
533`--default-image-extension=`*EXTENSION*
535: Specify a default extension to use when image paths/URLs have no
536 extension. This allows you to use the same source for formats that
537 require different kinds of images. Currently this option only affects
538 the Markdown and LaTeX readers.
542: Parse each file individually before combining for multifile
543 documents. This will allow footnotes in different files with the
544 same identifiers to work as expected. If this option is set,
545 footnotes and links will not work across files. Reading binary
546 files (docx, odt, epub) implies `--file-scope`.
548`-F` *PROGRAM*, `--filter=`*PROGRAM*
550: Specify an executable to be used as a filter transforming the
551 pandoc AST after the input is parsed and before the output is
552 written. The executable should read JSON from stdin and write
553 JSON to stdout. The JSON must be formatted like pandoc's own
554 JSON input and output. The name of the output format will be
555 passed to the filter as the first argument. Hence,
557 pandoc --filter ./caps.py -t latex
561 pandoc -t json | ./caps.py latex | pandoc -f json -t latex
563 The latter form may be useful for debugging filters.
565 Filters may be written in any language. `Text.Pandoc.JSON`
566 exports `toJSONFilter` to facilitate writing filters in Haskell.
567 Those who would prefer to write filters in python can use the
568 module [`pandocfilters`], installable from PyPI. There are also
569 pandoc filter libraries in [PHP], [perl], and
570 [JavaScript/node.js].
572 In order of preference, pandoc will look for filters in
574 1. a specified full or relative path (executable or
577 2. `$DATADIR/filters` (executable or non-executable)
578 where `$DATADIR` is the user data directory (see
579 `--data-dir`, above).
581 3. `$PATH` (executable only)
583 Filters and Lua-filters are applied in the order specified
586`-L` *SCRIPT*, `--lua-filter=`*SCRIPT*
588: Transform the document in a similar fashion as JSON filters (see
589 `--filter`), but use pandoc's build-in Lua filtering system. The given
590 Lua script is expected to return a list of Lua filters which will be
591 applied in order. Each Lua filter must contain element-transforming
592 functions indexed by the name of the AST element on which the filter
593 function should be applied.
595 The `pandoc` Lua module provides helper functions for element
596 creation. It is always loaded into the script's Lua environment.
598 The following is an example Lua script for macro-expansion:
600 function expand_hello_world(inline)
601 if inline.c == '{{helloworld}}' then
602 return pandoc.Emph{ pandoc.Str "Hello, World" }
608 return {{Str = expand_hello_world}}
610 In order of preference, pandoc will look for Lua filters in
612 1. a specified full or relative path (executable or
615 2. `$DATADIR/filters` (executable or non-executable)
616 where `$DATADIR` is the user data directory (see
617 `--data-dir`, above).
619`-M` *KEY*[`=`*VAL*], `--metadata=`*KEY*[`:`*VAL*]
621: Set the metadata field *KEY* to the value *VAL*. A value specified
622 on the command line overrides a value specified in the document
623 using [YAML metadata blocks][Extension: `yaml_metadata_block`].
624 Values will be parsed as YAML boolean or string values. If no value is
625 specified, the value will be treated as Boolean true. Like
626 `--variable`, `--metadata` causes template variables to be set.
627 But unlike `--variable`, `--metadata` affects the metadata of the
628 underlying document (which is accessible from filters and may be
629 printed in some output formats) and metadata values will be escaped
630 when inserted into the template.
632`--metadata-file=`*FILE*
634: Read metadata from the supplied YAML (or JSON) file. This
635 option can be used with every input format, but string scalars
636 in the YAML file will always be parsed as Markdown. Generally,
637 the input will be handled the same as in [YAML metadata
638 blocks][Extension: `yaml_metadata_block`]. This option can be
639 used repeatedly to include multiple metadata files; values in
640 files specified later on the command line will be preferred
641 over those specified in earlier files. Metadata values
642 specified inside the document, or by using `-M`, overwrite
643 values specified with this option.
645`-p`, `--preserve-tabs`
647: Preserve tabs instead of converting them to spaces. (By default, pandoc
648 converts tabs to spaces before parsing its input.) Note that this will
649 only affect tabs in literal code spans and code blocks. Tabs in regular
650 text are always treated as spaces.
654: Specify the number of spaces per tab (default is 4).
656`--track-changes=accept`|`reject`|`all`
658: Specifies what to do with insertions, deletions, and comments
659 produced by the MS Word "Track Changes" feature. `accept` (the
660 default), inserts all insertions, and ignores all
661 deletions. `reject` inserts all deletions and ignores
662 insertions. Both `accept` and `reject` ignore comments. `all` puts
663 in insertions, deletions, and comments, wrapped in spans with
664 `insertion`, `deletion`, `comment-start`, and `comment-end`
665 classes, respectively. The author and time of change is
666 included. `all` is useful for scripting: only accepting changes
667 from a certain reviewer, say, or before a certain date. If a
668 paragraph is inserted or deleted, `track-changes=all` produces a
669 span with the class `paragraph-insertion`/`paragraph-deletion`
670 before the affected paragraph break. This option only affects the
673`--extract-media=`*DIR*
675: Extract images and other media contained in or linked from
676 the source document to the path *DIR*, creating it if
677 necessary, and adjust the images references in the document
678 so they point to the extracted files. If the source format is
679 a binary container (docx, epub, or odt), the media is
680 extracted from the container and the original
681 filenames are used. Otherwise the media is read from the
682 file system or downloaded, and new filenames are constructed
683 based on SHA1 hashes of the contents.
685`--abbreviations=`*FILE*
687: Specifies a custom abbreviations file, with abbreviations
688 one to a line. If this option is not specified, pandoc will
689 read the data file `abbreviations` from the user data
690 directory or fall back on a system default. To see the
692 `pandoc --print-default-data-file=abbreviations`. The only
693 use pandoc makes of this list is in the Markdown reader.
694 Strings ending in a period that are found in this list will
695 be followed by a nonbreaking space, so that the period will
696 not produce sentence-ending space in formats like LaTeX.
698[`pandocfilters`]: https://github.com/jgm/pandocfilters
699[PHP]: https://github.com/vinai/pandocfilters-php
700[perl]: https://metacpan.org/pod/Pandoc::Filter
701[JavaScript/node.js]: https://github.com/mvhenderson/pandoc-filter-node
703## General writer options {.options}
707: Produce output with an appropriate header and footer (e.g. a
708 standalone HTML, LaTeX, TEI, or RTF file, not a fragment). This option
709 is set automatically for `pdf`, `epub`, `epub3`, `fb2`, `docx`, and `odt`
710 output. For `native` output, this option causes metadata to
711 be included; otherwise, metadata is suppressed.
713`--template=`*FILE*|*URL*
715: Use the specified file as a custom template for the generated document.
716 Implies `--standalone`. See [Templates], below, for a description
717 of template syntax. If no extension is specified, an extension
718 corresponding to the writer will be added, so that `--template=special`
719 looks for `special.html` for HTML output. If the template is not
720 found, pandoc will search for it in the `templates` subdirectory of
721 the user data directory (see `--data-dir`). If this option is not used,
722 a default template appropriate for the output format will be used (see
723 `-D/--print-default-template`).
725`-V` *KEY*[`=`*VAL*], `--variable=`*KEY*[`:`*VAL*]
727: Set the template variable *KEY* to the value *VAL* when rendering the
728 document in standalone mode. If no *VAL* is specified, the
729 key will be given the value `true`.
731`-D` *FORMAT*, `--print-default-template=`*FORMAT*
733: Print the system default template for an output *FORMAT*. (See `-t`
734 for a list of possible *FORMAT*s.) Templates in the user data
735 directory are ignored. This option may be used with
736 `-o`/`--output` to redirect output to a file, but
737 `-o`/`--output` must come before `--print-default-template`
740 Note that some of the default templates use partials, for
741 example `styles.html`. To print the partials, use
742 `--print-default-data-file`: for example,
743 `--print-default-data-file=templates/styles.html`.
745`--print-default-data-file=`*FILE*
747: Print a system default data file. Files in the user data directory
748 are ignored. This option may be used with `-o`/`--output` to
749 redirect output to a file, but `-o`/`--output` must come before
750 `--print-default-data-file` on the command line.
752`--eol=crlf`|`lf`|`native`
754: Manually specify line endings: `crlf` (Windows), `lf`
755 (macOS/Linux/UNIX), or `native` (line endings appropriate
756 to the OS on which pandoc is being run). The default is
761: Specify the default dpi (dots per inch) value for conversion
762 from pixels to inch/centimeters and vice versa. (Technically,
763 the correct term would be ppi: pixels per inch.) The default
764 is 96dpi. When images contain information about dpi
765 internally, the encoded value is used instead of the default
766 specified by this option.
768`--wrap=auto`|`none`|`preserve`
770: Determine how text is wrapped in the output (the source
771 code, not the rendered version). With `auto` (the default),
772 pandoc will attempt to wrap lines to the column width specified by
773 `--columns` (default 72). With `none`, pandoc will not wrap
774 lines at all. With `preserve`, pandoc will attempt to
775 preserve the wrapping from the source document (that is,
776 where there are nonsemantic newlines in the source, there
777 will be nonsemantic newlines in the output as well).
778 Automatic wrapping does not currently work in HTML output.
779 In `ipynb` output, this option affects wrapping of the
780 contents of markdown cells.
784: Specify length of lines in characters. This affects text wrapping
785 in the generated source code (see `--wrap`). It also affects
786 calculation of column widths for plain text tables (see [Tables] below).
788`--toc`, `--table-of-contents`
790: Include an automatically generated table of contents (or, in
791 the case of `latex`, `context`, `docx`, `odt`,
792 `opendocument`, `rst`, or `ms`, an instruction to create
793 one) in the output document. This option has no effect
794 unless `-s/--standalone` is used, and it has no effect
795 on `man`, `docbook4`, `docbook5`, or `jats` output.
797 Note that if you are producing a PDF via `ms`, the table
798 of contents will appear at the beginning of the
799 document, before the title. If you would prefer it to
800 be at the end of the document, use the option
801 `--pdf-engine-opt=--no-toc-relocation`.
803`--toc-depth=`*NUMBER*
805: Specify the number of section levels to include in the table
806 of contents. The default is 3 (which means that level-1, 2, and 3
807 headings will be listed in the contents).
811: Strip out HTML comments in the Markdown or Textile source,
812 rather than passing them on to Markdown, Textile or HTML
813 output as raw HTML. This does not apply to HTML comments
814 inside raw HTML blocks when the `markdown_in_html_blocks`
815 extension is not set.
819: Disables syntax highlighting for code blocks and inlines, even when
820 a language attribute is given.
822`--highlight-style=`*STYLE*|*FILE*
824: Specifies the coloring style to be used in highlighted source code.
825 Options are `pygments` (the default), `kate`, `monochrome`,
826 `breezeDark`, `espresso`, `zenburn`, `haddock`, and `tango`.
827 For more information on syntax highlighting in pandoc, see
828 [Syntax highlighting], below. See also
829 `--list-highlight-styles`.
831 Instead of a *STYLE* name, a JSON file with extension
832 `.theme` may be supplied. This will be parsed as a KDE
833 syntax highlighting theme and (if valid) used as the
836 To generate the JSON version of an existing style,
837 use `--print-highlight-style`.
839`--print-highlight-style=`*STYLE*|*FILE*
841: Prints a JSON version of a highlighting style, which can
842 be modified, saved with a `.theme` extension, and used
843 with `--highlight-style`. This option may be used with
844 `-o`/`--output` to redirect output to a file, but
845 `-o`/`--output` must come before `--print-highlight-style`
848`--syntax-definition=`*FILE*
850: Instructs pandoc to load a KDE XML syntax definition file,
851 which will be used for syntax highlighting of appropriately
852 marked code blocks. This can be used to add support for
853 new languages or to use altered syntax definitions for
854 existing languages. This option may be repeated to add
855 multiple syntax definitions.
857`-H` *FILE*, `--include-in-header=`*FILE*|*URL*
859: Include contents of *FILE*, verbatim, at the end of the header.
860 This can be used, for example, to include special
861 CSS or JavaScript in HTML documents. This option can be used
862 repeatedly to include multiple files in the header. They will be
863 included in the order specified. Implies `--standalone`.
865`-B` *FILE*, `--include-before-body=`*FILE*|*URL*
867: Include contents of *FILE*, verbatim, at the beginning of the
868 document body (e.g. after the `<body>` tag in HTML, or the
869 `\begin{document}` command in LaTeX). This can be used to include
870 navigation bars or banners in HTML documents. This option can be
871 used repeatedly to include multiple files. They will be included in
872 the order specified. Implies `--standalone`.
874`-A` *FILE*, `--include-after-body=`*FILE*|*URL*
876: Include contents of *FILE*, verbatim, at the end of the document
877 body (before the `</body>` tag in HTML, or the
878 `\end{document}` command in LaTeX). This option can be used
879 repeatedly to include multiple files. They will be included in the
880 order specified. Implies `--standalone`.
882`--resource-path=`*SEARCHPATH*
884: List of paths to search for images and other resources.
885 The paths should be separated by `:` on Linux, UNIX, and
886 macOS systems, and by `;` on Windows. If `--resource-path`
887 is not specified, the default resource path is the working
888 directory. Note that, if `--resource-path` is specified,
889 the working directory must be explicitly listed or it
890 will not be searched. For example:
891 `--resource-path=.:test` will search the working directory
892 and the `test` subdirectory, in that order.
894 `--resource-path` only has an effect if (a) the output
895 format embeds images (for example, `docx`, `pdf`, or `html`
896 with `--self-contained`) or (b) it is used together with
899`--request-header=`*NAME*`:`*VAL*
901: Set the request header *NAME* to the value *VAL* when making
902 HTTP requests (for example, when a URL is given on the
903 command line, or when resources used in a document must be
904 downloaded). If you're behind a proxy, you also need to set
905 the environment variable `http_proxy` to `http://...`.
907`--no-check-certificate`
909: Disable the certificate verification to allow access to
910 unsecure HTTP resources (for example when the certificate
911 is no longer valid or self signed).
913## Options affecting specific writers {.options}
917: Produce a standalone HTML file with no external dependencies, using
918 `data:` URIs to incorporate the contents of linked scripts, stylesheets,
919 images, and videos. Implies `--standalone`. The resulting file should be
920 "self-contained," in the sense that it needs no external files and no net
921 access to be displayed properly by a browser. This option works only with
922 HTML output formats, including `html4`, `html5`, `html+lhs`, `html5+lhs`,
923 `s5`, `slidy`, `slideous`, `dzslides`, and `revealjs`. Scripts, images,
924 and stylesheets at absolute URLs will be downloaded; those at relative
925 URLs will be sought relative to the working directory (if the first source
926 file is local) or relative to the base URL (if the first source
927 file is remote). Elements with the attribute
928 `data-external="1"` will be left alone; the documents they
929 link to will not be incorporated in the document.
930 Limitation: resources that are loaded dynamically through
931 JavaScript cannot be incorporated; as a result,
932 `--self-contained` does not work with `--mathjax`, and some
933 advanced features (e.g. zoom or speaker notes) may not work
934 in an offline "self-contained" `reveal.js` slide show.
938: Use `<q>` tags for quotes in HTML.
942: Use only ASCII characters in output. Currently supported for XML
943 and HTML formats (which use entities instead of UTF-8 when this
944 option is selected), CommonMark, gfm, and Markdown (which use
945 entities), roff ms (which use hexadecimal escapes), and to a
946 limited degree LaTeX (which uses standard commands for accented
947 characters when possible). roff man output uses ASCII by default.
951: Use reference-style links, rather than inline links, in writing Markdown
952 or reStructuredText. By default inline links are used. The
953 placement of link references is affected by the
954 `--reference-location` option.
956`--reference-location = block`|`section`|`document`
958: Specify whether footnotes (and references, if `reference-links` is
959 set) are placed at the end of the current (top-level) block, the
960 current section, or the document. The default is
961 `document`. Currently only affects the markdown writer.
965: Use ATX-style headings in Markdown output. The default is
966 to use setext-style headings for levels 1 to 2, and then ATX headings.
967 (Note: for `gfm` output, ATX headings are always used.)
968 This option also affects markdown cells in `ipynb` output.
970`--top-level-division=[default|section|chapter|part]`
972: Treat top-level headings as the given division type in LaTeX, ConTeXt,
973 DocBook, and TEI output. The hierarchy order is part, chapter, then section;
974 all headings are shifted such that the top-level heading becomes the specified
975 type. The default behavior is to determine the best division type via
976 heuristics: unless other conditions apply, `section` is chosen. When the
977 `documentclass` variable is set to `report`, `book`, or `memoir` (unless the
978 `article` option is specified), `chapter` is implied as the setting for this
979 option. If `beamer` is the output format, specifying either `chapter` or
980 `part` will cause top-level headings to become `\part{..}`, while
981 second-level headings remain as their default type.
983`-N`, `--number-sections`
985: Number section headings in LaTeX, ConTeXt, HTML, or EPUB output.
986 By default, sections are not numbered. Sections with class
987 `unnumbered` will never be numbered, even if `--number-sections`
990`--number-offset=`*NUMBER*[`,`*NUMBER*`,`*...*]
992: Offset for section headings in HTML output (ignored in other
993 output formats). The first number is added to the section number for
994 top-level headings, the second for second-level headings, and so on.
995 So, for example, if you want the first top-level heading in your
996 document to be numbered "6", specify `--number-offset=5`.
997 If your document starts with a level-2 heading which you want to
998 be numbered "1.5", specify `--number-offset=1,4`.
999 Offsets are 0 by default. Implies `--number-sections`.
1003: Use the [`listings`] package for LaTeX code blocks. The package
1004 does not support multi-byte encoding for source code. To handle UTF-8
1005 you would need to use a custom template. This issue is fully
1006 documented here: [Encoding issue with the listings package].
1008`-i`, `--incremental`
1010: Make list items in slide shows display incrementally (one by one).
1011 The default is for lists to be displayed all at once.
1013`--slide-level=`*NUMBER*
1015: Specifies that headings with the specified level create
1016 slides (for `beamer`, `s5`, `slidy`, `slideous`, `dzslides`). Headings
1017 above this level in the hierarchy are used to divide the
1018 slide show into sections; headings below this level create
1019 subheads within a slide. Note that content that is
1020 not contained under slide-level headings will not appear in
1021 the slide show. The default is to set the slide level based
1022 on the contents of the document; see [Structuring the slide
1027: Wrap sections in `<section>` tags (or `<div>` tags for `html4`),
1028 and attach identifiers to the enclosing `<section>` (or `<div>`)
1029 rather than the heading itself. See
1030 [Heading identifiers], below.
1032`--email-obfuscation=none`|`javascript`|`references`
1034: Specify a method for obfuscating `mailto:` links in HTML documents.
1035 `none` leaves `mailto:` links as they are. `javascript` obfuscates
1036 them using JavaScript. `references` obfuscates them by printing their
1037 letters as decimal or hexadecimal character references. The default
1040`--id-prefix=`*STRING*
1042: Specify a prefix to be added to all identifiers and internal links
1043 in HTML and DocBook output, and to footnote numbers in Markdown
1044 and Haddock output. This is useful for preventing duplicate
1045 identifiers when generating fragments to be included in other pages.
1047`-T` *STRING*, `--title-prefix=`*STRING*
1049: Specify *STRING* as a prefix at the beginning of the title
1050 that appears in the HTML header (but not in the title as it
1051 appears at the beginning of the HTML body). Implies `--standalone`.
1053`-c` *URL*, `--css=`*URL*
1055: Link to a CSS style sheet. This option can be used repeatedly to
1056 include multiple files. They will be included in the order specified.
1058 A stylesheet is required for generating EPUB. If none is
1059 provided using this option (or the `css` or `stylesheet`
1060 metadata fields), pandoc will look for a file `epub.css` in the
1061 user data directory (see `--data-dir`). If it is not
1062 found there, sensible defaults will be used.
1064`--reference-doc=`*FILE*
1066: Use the specified file as a style reference in producing a
1071 : For best results, the reference docx should be a modified
1072 version of a docx file produced using pandoc. The contents
1073 of the reference docx are ignored, but its stylesheets and
1074 document properties (including margins, page size, header,
1075 and footer) are used in the new docx. If no reference docx
1076 is specified on the command line, pandoc will look for a
1077 file `reference.docx` in the user data directory (see
1078 `--data-dir`). If this is not found either, sensible
1079 defaults will be used.
1081 To produce a custom `reference.docx`, first get a copy of
1082 the default `reference.docx`: `pandoc
1083 -o custom-reference.docx --print-default-data-file reference.docx`.
1084 Then open `custom-reference.docx` in Word, modify the
1085 styles as you wish, and save the file. For best
1086 results, do not make changes to this file other than
1087 modifying the styles used by pandoc:
1123 - Default Paragraph Font
1126 - Footnote Reference
1135 : For best results, the reference ODT should be a modified
1136 version of an ODT produced using pandoc. The contents of
1137 the reference ODT are ignored, but its stylesheets are used
1138 in the new ODT. If no reference ODT is specified on the
1139 command line, pandoc will look for a file `reference.odt` in
1140 the user data directory (see `--data-dir`). If this is not
1141 found either, sensible defaults will be used.
1143 To produce a custom `reference.odt`, first get a copy of
1144 the default `reference.odt`: `pandoc
1145 -o custom-reference.odt --print-default-data-file reference.odt`.
1146 Then open `custom-reference.odt` in LibreOffice, modify
1147 the styles as you wish, and save the file.
1151 : Templates included with Microsoft PowerPoint 2013 (either with
1152 `.pptx` or `.potx` extension) are known to work, as are most
1153 templates derived from these.
1155 The specific requirement is that the template should begin with
1156 the following first four layouts:
1159 2. Title and Content
1163 All templates included with a recent version of MS PowerPoint
1164 will fit these criteria. (You can click on `Layout` under the
1165 `Home` menu to check.)
1167 You can also modify the default `reference.pptx`: first run
1168 `pandoc -o custom-reference.pptx --print-default-data-file
1169 reference.pptx`, and then modify `custom-reference.pptx`
1170 in MS PowerPoint (pandoc will use the first four layout
1171 slides, as mentioned above).
1173`--epub-cover-image=`*FILE*
1175: Use the specified image as the EPUB cover. It is recommended
1176 that the image be less than 1000px in width and height. Note that
1177 in a Markdown source document you can also specify `cover-image`
1178 in a YAML metadata block (see [EPUB Metadata], below).
1180`--epub-metadata=`*FILE*
1182: Look in the specified XML file for metadata for the EPUB.
1183 The file should contain a series of [Dublin Core elements].
1186 <dc:rights>Creative Commons</dc:rights>
1187 <dc:language>es-AR</dc:language>
1189 By default, pandoc will include the following metadata elements:
1190 `<dc:title>` (from the document title), `<dc:creator>` (from the
1191 document authors), `<dc:date>` (from the document date, which should
1192 be in [ISO 8601 format]), `<dc:language>` (from the `lang`
1193 variable, or, if is not set, the locale), and `<dc:identifier
1194 id="BookId">` (a randomly generated UUID). Any of these may be
1195 overridden by elements in the metadata file.
1197 Note: if the source document is Markdown, a YAML metadata block
1198 in the document can be used instead. See below under
1201`--epub-embed-font=`*FILE*
1203: Embed the specified font in the EPUB. This option can be repeated
1204 to embed multiple fonts. Wildcards can also be used: for example,
1205 `DejaVuSans-*.ttf`. However, if you use wildcards on the command
1206 line, be sure to escape them or put the whole filename in single quotes,
1207 to prevent them from being interpreted by the shell. To use the
1208 embedded fonts, you will need to add declarations like the following
1209 to your CSS (see `--css`):
1212 font-family: DejaVuSans;
1214 font-weight: normal;
1215 src:url("DejaVuSans-Regular.ttf");
1218 font-family: DejaVuSans;
1221 src:url("DejaVuSans-Bold.ttf");
1224 font-family: DejaVuSans;
1226 font-weight: normal;
1227 src:url("DejaVuSans-Oblique.ttf");
1230 font-family: DejaVuSans;
1233 src:url("DejaVuSans-BoldOblique.ttf");
1235 body { font-family: "DejaVuSans"; }
1237`--epub-chapter-level=`*NUMBER*
1239: Specify the heading level at which to split the EPUB into separate
1240 "chapter" files. The default is to split into chapters at level-1
1241 headings. This option only affects the internal composition of the
1242 EPUB, not the way chapters and sections are displayed to users. Some
1243 readers may be slow if the chapter files are too large, so for large
1244 documents with few level-1 headings, one might want to use a chapter
1247`--epub-subdirectory=`*DIRNAME*
1249: Specify the subdirectory in the OCF container that is to hold
1250 the EPUB-specific contents. The default is `EPUB`. To put
1251 the EPUB contents in the top level, use an empty string.
1253`--ipynb-output=all|none|best`
1255: Determines how ipynb output cells are treated. `all` means
1256 that all of the data formats included in the original are
1257 preserved. `none` means that the contents of data cells
1258 are omitted. `best` causes pandoc to try to pick the
1259 richest data block in each output cell that is compatible
1260 with the output format. The default is `best`.
1262`--pdf-engine=`*PROGRAM*
1264: Use the specified engine when producing PDF output.
1265 Valid values are `pdflatex`, `lualatex`, `xelatex`, `latexmk`,
1266 `tectonic`, `wkhtmltopdf`, `weasyprint`, `prince`, `context`,
1267 and `pdfroff`. If the engine is not in your PATH, the full
1268 path of the engine may be specified here. If this option
1269 is not specified, pandoc uses the following defaults
1270 depending on the output format specified using `-t/--to`:
1272 - `-t latex` or none: `pdflatex` (other options: `xelatex`, `lualatex`,
1273 `tectonic`, `latexmk`)
1274 - `-t context`: `context`
1275 - `-t html`: `wkhtmltopdf` (other options: `prince`, `weasyprint`;
1276 see [print-css.rocks](https://print-css.rocks) for a good
1277 introduction to PDF generation from HTML/CSS.)
1278 - `-t ms`: `pdfroff`
1280`--pdf-engine-opt=`*STRING*
1282: Use the given string as a command-line argument to the `pdf-engine`.
1283 For example, to use a persistent directory `foo` for `latexmk`'s
1284 auxiliary files, use `--pdf-engine-opt=-outdir=foo`.
1285 Note that no check for duplicate options is done.
1287[Dublin Core elements]: https://www.dublincore.org/specifications/dublin-core/dces/
1288[ISO 8601 format]: https://www.w3.org/TR/NOTE-datetime
1289[Encoding issue with the listings package]:
1290 https://en.wikibooks.org/wiki/LaTeX/Source_Code_Listings#Encoding_issue
1292## Citation rendering {.options}
1294`--bibliography=`*FILE*
1296: Set the `bibliography` field in the document's metadata to *FILE*,
1297 overriding any value set in the metadata, and process citations
1298 using `pandoc-citeproc`. (This is equivalent to
1299 `--metadata bibliography=FILE --filter pandoc-citeproc`.)
1300 If `--natbib` or `--biblatex` is also supplied, `pandoc-citeproc` is not
1301 used, making this equivalent to `--metadata bibliography=FILE`.
1302 If you supply this argument multiple times, each *FILE* will be added
1307: Set the `csl` field in the document's metadata to *FILE*,
1308 overriding any value set in the metadata. (This is equivalent to
1309 `--metadata csl=FILE`.)
1310 This option is only relevant with `pandoc-citeproc`.
1312`--citation-abbreviations=`*FILE*
1314: Set the `citation-abbreviations` field in the document's metadata to
1315 *FILE*, overriding any value set in the metadata. (This is equivalent to
1316 `--metadata citation-abbreviations=FILE`.)
1317 This option is only relevant with `pandoc-citeproc`.
1321: Use [`natbib`] for citations in LaTeX output. This option is not for use
1322 with the `pandoc-citeproc` filter or with PDF output. It is intended for
1323 use in producing a LaTeX file that can be processed with [`bibtex`].
1327: Use [`biblatex`] for citations in LaTeX output. This option is not for use
1328 with the `pandoc-citeproc` filter or with PDF output. It is intended for
1329 use in producing a LaTeX file that can be processed with [`bibtex`] or [`biber`].
1331## Math rendering in HTML {.options}
1333The default is to render TeX math as far as possible using Unicode characters.
1334Formulas are put inside a `span` with `class="math"`, so that they may be styled
1335differently from the surrounding text if needed. However, this gives acceptable
1336results only for basic math, usually you will want to use `--mathjax` or another
1337of the following options.
1339`--mathjax`[`=`*URL*]
1341: Use [MathJax] to display embedded TeX math in HTML output.
1342 TeX math will be put between `\(...\)` (for inline math)
1343 or `\[...\]` (for display math) and wrapped in `<span>` tags
1344 with class `math`. Then the MathJax JavaScript will render it.
1345 The *URL* should point to the `MathJax.js` load script.
1346 If a *URL* is not provided, a link to the Cloudflare CDN will
1351: Convert TeX math to [MathML] (in `epub3`, `docbook4`, `docbook5`, `jats`,
1352 `html4` and `html5`). This is the default in `odt` output. Note that
1353 currently only Firefox and Safari (and select e-book readers) natively
1358: Convert TeX formulas to `<img>` tags that link to an external script
1359 that converts formulas to images. The formula will be URL-encoded
1360 and concatenated with the URL provided. For SVG images you can for
1361 example use `--webtex https://latex.codecogs.com/svg.latex?`.
1362 If no URL is specified, the CodeCogs URL generating PNGs
1363 will be used (`https://latex.codecogs.com/png.latex?`).
1364 Note: the `--webtex` option will affect Markdown output
1365 as well as HTML, which is useful if you're targeting a
1366 version of Markdown without native math support.
1370: Use [KaTeX] to display embedded TeX math in HTML output.
1371 The *URL* is the base URL for the KaTeX library. That directory
1372 should contain a `katex.min.js` and a `katex.min.css` file.
1373 If a *URL* is not provided, a link to the KaTeX CDN will be inserted.
1377: Enclose TeX math in `<eq>` tags in HTML output. The resulting HTML
1378 can then be processed by [GladTeX] to produce images of the typeset
1379 formulas and an HTML file with links to these images.
1380 So, the procedure is:
1382 pandoc -s --gladtex input.md -o myfile.htex
1383 gladtex -d myfile-images myfile.htex
1384 # produces myfile.html and images in myfile-images
1386[MathML]: https://www.w3.org/Math/
1387[MathJax]: https://www.mathjax.org
1388[KaTeX]: https://github.com/Khan/KaTeX
1389[GladTeX]: https://humenda.github.io/GladTeX/
1391## Options for wrapper scripts {.options}
1395: Print information about command-line arguments to *stdout*, then exit.
1396 This option is intended primarily for use in wrapper scripts.
1397 The first line of output contains the name of the output file specified
1398 with the `-o` option, or `-` (for *stdout*) if no output file was
1399 specified. The remaining lines contain the command-line arguments,
1400 one per line, in the order they appear. These do not include regular
1401 pandoc options and their arguments, but do include any options appearing
1402 after a `--` separator at the end of the line.
1406: Ignore command-line arguments (for use in wrapper scripts).
1407 Regular pandoc options are not ignored. Thus, for example,
1409 pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1
1413 pandoc -o foo.html -s
1417If pandoc completes successfully, it will return exit code 0.
1418Nonzero exit codes have the following meanings:
1421----- ------------------------------------
1422 3 PandocFailOnWarningError
1424 5 PandocTemplateError
1426 21 PandocUnknownReaderError
1427 22 PandocUnknownWriterError
1428 23 PandocUnsupportedExtensionError
1429 31 PandocEpubSubdirectoryError
1431 47 PandocPDFProgramNotFoundError
1433 62 PandocShouldNeverHappenError
1436 65 PandocParsecError
1437 66 PandocMakePDFError
1438 67 PandocSyntaxMapError
1439 83 PandocFilterError
1441 92 PandocUTF8DecodingError
1442 93 PandocIpynbDecodingError
1443 97 PandocCouldNotFindDataFileError
1444 99 PandocResourceNotFound
1445----- ------------------------------------
1449The `--defaults` option may be used to specify a package
1450of options. Here is a sample defaults file demonstrating all of
1451the fields that may be used:
1455# reader: may be used instead of from:
1457# writer: may be used instead of to:
1459# leave blank for output to stdout:
1461# leave blank for input from stdin, use [] for no input:
1465# or you may use input-file: with a single value
1469self-contained: false
1471# note that structured variables may be specified:
1478# metadata values specified here are parsed as literal
1479# string text, not markdown:
1486# or you may use metadata-file: with a single value
1488# Note that these take files, not their contents:
1489include-before-body: []
1490include-after-body: []
1491include-in-header: []
1494# filters will be assumed to be Lua filters if they have
1495# the .lua extension, and json filters otherwise. But
1496# the filter type can also be specified explicitly, as shown:
1507# ERROR, WARNING, or INFO
1511# citeproc, natbib, or biblatex
1512cite-method: citeproc
1513# part, chapter, section, or default:
1514top-level-division: chapter
1520# you may also use pdf-engine-opt: with a single option
1521# pdf-engine-opt: "-shell-escape"
1523# auto, preserve, or none
1528extract-media: mediadir
1530table-of-contents: true
1532number-sections: false
1533# a list of offsets at each heading level
1534number-offset: [0,0,0,0,0,0]
1535# toc: may also be used instead of table-of-contents:
1536shift-heading-level-by: 1
1538identifier-prefix: foo
1540strip-empty-paragraphs: true
1541# lf, crlf, or native
1543strip-comments: false
1544indented-code-classes: []
1546default-image-extension: ".jpg"
1548# either a style name of a style definition file:
1549highlight-style: pygments
1552# or you may use syntax-definition: with a single value
1555reference-doc: myref.docx
1557# method is plain, webtex, gladtex, mathml, mathjax, katex
1558# you may specify a url with webtex, mathjax, katex
1561 url: "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"
1562# none, references, or javascript
1563email-obfuscation: javascript
1571epub-subdirectory: EPUB
1572epub-metadata: meta.xml
1575epub-chapter-level: 1
1576epub-cover-image: cover.jpg
1578reference-links: true
1579# block, section, or document
1580reference-location: block
1583# accept, reject, or all
1584track-changes: accept
1593# A list of two-element lists
1595- ["User-Agent", "Mozilla/5.0"]
1597fail-if-warnings: false
1603Fields that are omitted will just have their regular
1604default values. So a defaults file can be as simple as
1611Default files can be placed in the `defaults` subdirectory of
1612the user data directory and used from any directory. For
1613example, one could create a file specifying defaults for writing
1614letters, save it as `letter.yaml` in the `defaults` subdirectory
1615of the user data directory, and then invoke these defaults
1616from any directory using `pandoc --defaults letter`
1617or `pandoc -dletter`.
1619When multiple defaults are used, their contents will be combined.
1621Note that, where command-line arguments may be repeated
1622(`--metadata-file`, `--css`, `--include-in-header`,
1623`--include-before-body`, `--include-after-body`, `--variable`,
1624`--metadata`, `--syntax-definition`), the values specified on
1625the command line will combine with values specified in the
1626defaults file, rather than replacing them.
1630When the `-s/--standalone` option is used, pandoc uses a template to
1631add header and footer material that is needed for a self-standing
1632document. To see the default template that is used, just type
1636where *FORMAT* is the name of the output format. A custom template
1637can be specified using the `--template` option. You can also override
1638the system default templates for a given output format *FORMAT*
1639by putting a file `templates/default.*FORMAT*` in the user data
1640directory (see `--data-dir`, above). *Exceptions:*
1642- For `odt` output, customize the `default.opendocument`
1644- For `pdf` output, customize the `default.latex` template
1645 (or the `default.context` template, if you use `-t context`,
1646 or the `default.ms` template, if you use `-t ms`, or the
1647 `default.html` template, if you use `-t html`).
1648- `docx` and `pptx` have no template (however, you can use
1649 `--reference-doc` to customize the output).
1651Templates contain *variables*, which allow for the inclusion of
1652arbitrary information at any point in the file. They may be set at the
1653command line using the `-V/--variable` option. If a variable is not set,
1654pandoc will look for the key in the document's metadata, which can be set
1655using either [YAML metadata blocks][Extension: `yaml_metadata_block`]
1656or with the `-M/--metadata` option. In addition, some variables
1657are given default values by pandoc. See [Variables] below for
1658a list of variables used in pandoc's default templates.
1660If you use custom templates, you may need to revise them as pandoc
1661changes. We recommend tracking the changes in the default templates,
1662and modifying your custom templates accordingly. An easy way to do this
1663is to fork the [pandoc-templates] repository and merge in
1664changes after each pandoc release.
1666 [pandoc-templates]: https://github.com/jgm/pandoc-templates
1672Anything between the sequence `$--` and the end of the
1673line will be treated as a comment and omitted from the output.
1677To mark variables and control structures in the template,
1678either `$`...`$` or `${`...`}` may be used as delimiters.
1679The styles may also be mixed in the same template, but the
1680opening and closing delimiter must match in each case. The
1681opening delimiter may be followed by one or more spaces
1682or tabs, which will be ignored. The closing delimiter may
1683be followed by one or more spaces or tabs, which will be
1686To include a literal `$` in the document, use `$$`.
1688### Interpolated variables
1690A slot for an interpolated variable is a variable name surrounded
1691by matched delimiters. Variable names must begin with a letter
1692and can contain letters, numbers, `_`, `-`, and `.`. The
1693keywords `it`, `if`, `else`, `endif`, `for`, `sep`, and `endfor` may
1694not be used as variable names. Examples:
1707Variable names with periods are used to get at structured
1708variable values. So, for example, `employee.salary` will return the
1709value of the `salary` field of the object that is the value of
1710the `employee` field.
1712- If the value of the variable is simple value, it will be
1713 rendered verbatim. (Note that no escaping is done;
1714 the assumption is that the calling program will escape
1715 the strings appropriately for the output format.)
1716- If the value is a list, the values will be concatenated.
1717- If the value is a map, the string `true` will be rendered.
1718- Every other value will be rendered as the empty string.
1722A conditional begins with `if(variable)` (enclosed in
1723matched delimiters) and ends with `endif` (enclosed in matched
1724delimiters). It may optionally contain an `else` (enclosed in
1725matched delimiters). The `if` section is used if
1726`variable` has a non-empty value, otherwise the `else`
1727section is used (if present). Examples:
1742${if(foo)}bar${endif}
1755The keyword `elseif` may be used to simplify complex nested
1770A for loop begins with `for(variable)` (enclosed in
1771matched delimiters) and ends with `endfor` (enclosed in matched
1774- If `variable` is an array, the material inside the loop will
1775 be evaluated repeatedly, with `variable` being set to each
1776 value of the array in turn, and concatenated.
1777- If `variable` is a map, the material inside will be set to
1779- If the value of the associated variable is not an array or
1780 a map, a single iteration will be performed on its value.
1785$for(foo)$$foo$$sep$, $endfor$
1788 - $foo.last$, $foo.first$
1792 - ${ foo.bar.last }, ${ foo.bar.first }
1796$it.name$: $it.office$
1800You may optionally specify a separator between consecutive
1801values using `sep` (enclosed in matched delimiters). The
1802material between `sep` and the `endfor` is the separator.
1805${ for(foo) }${ foo }${ sep }, ${ endfor }
1808Instead of using `variable` inside the loop, the special
1809anaphoric keyword `it` may be used.
1813 - ${ it.last }, ${ it.first }
1819Partials (subtemplates stored in different files) may be
1820included by using the name of the partial, followed
1821by `()`, for example:
1827Partials will be sought in the directory containing
1828the main template. The file name will be assumed to
1829have the same extension as the main template if it
1830lacks an extension. When calling the partial, the
1831full name including file extension can also be used:
1837(If a partial is not found in the directory of the
1838template, it will also be sought in the `templates`
1839subdirectory of the user data directory.)
1841Partials may optionally be applied to variables using
1847${ articles:bibentry() }
1850If `articles` is an array, this will iterate over its
1851values, applying the partial `bibentry()` to each one. So the
1852second example above is equivalent to
1860Note that the anaphoric keyword `it` must be used when
1861iterating over partials. In the above examples,
1862the `bibentry` partial should contain `it.title`
1863(and so on) instead of `articles.title`.
1865Final newlines are omitted from included partials.
1867Partials may include other partials.
1869A separator between values of an array may be specified
1870in square brackets, immediately after the variable name
1876${articles:bibentry()[; ]$
1879The separator in this case is literal and (unlike with `sep`
1880in an explicit `for` loop) cannot contain interpolated
1881variables or other template directives.
1885To ensure that content is "nested," that is, subsequent lines
1886indented, use the `^` directive:
1889$item.number$ $^$$item.description$ ($item.price$)
1892In this example, if `item.description` has multiple lines,
1893they will all be indented to line up with the first line:
189600123 A fine bottle of 18-year old
1897 Oban whiskey. ($148)
1900To nest multiple lines to the same level, align them
1901with the `^` directive in the template. For example:
1904$item.number$ $^$$item.description$ ($item.price$)
1905 (Available til $item.sellby$.)
191100123 A fine bottle of 18-year old
1912 Oban whiskey. ($148)
1913 (Available til March 30, 2020.)
1916If a variable occurs by itself on a line, preceded by whitespace
1917and not followed by further text or directives on the same line,
1918and the variable's value contains multiple lines, it will be
1919nested automatically.
1923Normally, spaces in the template itself (as opposed to values of
1924the interpolated variables) are not breakable, but they can be
1925made breakable in part of the template by using the `~` keyword
1926(ended with another `~`).
1929$~$This long line may break if the document is rendered
1930with a short line length.$~$
1935A pipe transforms the value of a variable or partial. Pipes are
1936specified using a slash (`/`) between the variable name (or partial)
1937and the pipe name. Example:
1944$for(metadata/pairs)$
1945- $it.key$: $it.value$
1948$employee:name()/uppercase$
1951Pipes may be chained:
1954$for(employees/pairs)$
1955$it.key/alpha/uppercase$. $it.name$
1959Some pipes take parameters:
1962|----------------------|------------|
1964$it.name.first/uppercase/left 20 "| "$$it.name.salary/right 10 " | " " |"$
1966|----------------------|------------|
1969Currently the following pipes are predefined:
1971- `pairs`: Converts a map or array to an array of maps,
1972 each with `key` and `value` fields. If the original
1973 value was an array, the `key` will be the array index,
1976- `uppercase`: Converts text to uppercase.
1978- `lowercase`: Converts text to lowercase.
1980- `length`: Returns the length of the value: number
1981 of characters for a textual value, number of elements
1984- `reverse`: Reverses a textual value or array,
1985 and has no effect on other values.
1987- `first`: Returns the first value of an array, if
1988 applied to a non-empty array; otherwise returns
1991- `last`: Returns the last value of an array, if
1992 applied to a non-empty array; otherwise returns
1995- `rest`: Returns all but the first value of an array, if
1996 applied to a non-empty array; otherwise returns
1999- `allbutlast`: Returns all but the last value of an array, if
2000 applied to a non-empty array; otherwise returns
2003- `chomp`: Removes trailing newlines (and breakable space).
2005- `nowrap`: Disables line wrapping on breakable spaces.
2007- `alpha`: Converts textual values that can be
2008 read as an integer into lowercase alphabetic
2009 characters `a..z` (mod 26). This can be used to get lettered
2010 enumeration from array indices. To get uppercase
2011 letters, chain with `uppercase`.
2013- `roman`: Converts textual values that can be
2014 read as an integer into lowercase roman numerials.
2015 This can be used to get lettered enumeration from array indices.
2016 To get uppercase roman, chain with `uppercase`.
2018- `left n "leftborder" "rightborder"`: Renders a textual value
2019 in a block of width `n`, aligned to the left, with an optional
2020 left and right border. Has no effect on other values. This
2021 can be used to align material in tables. Widths are positive
2022 integers indicating the number of characters. Borders
2023 are strings inside double quotes; literal `"` and `\` characters
2024 must be backslash-escaped.
2026- `right n "leftborder" "rightborder"`: Renders a textual value
2027 in a block of width `n`, aligned to the right, and has no
2028 effect on other values.
2030- `center n "leftborder" "rightborder"`: Renders a textual
2031 value in a block of width `n`, aligned to the center, and has
2032 no effect on other values.
2037### Metadata variables
2039`title`, `author`, `date`
2040: allow identification of basic aspects of the document. Included
2041 in PDF metadata through LaTeX and ConTeXt. These can be set
2042 through a [pandoc title block][Extension: `pandoc_title_block`],
2043 which allows for multiple authors, or through a
2044 [YAML metadata block][Extension: `yaml_metadata_block`]:
2052 Note that if you just want to set PDF or HTML metadata, without
2053 including a title block in the document itself, you can
2054 set the `title-meta`, `author-meta`, and `date-meta`
2055 variables. (By default these are set automatically, based
2056 on `title`, `author`, and `date`.)
2059: document subtitle, included in HTML, EPUB, LaTeX, ConTeXt, and docx
2063: document summary, included in LaTeX, ConTeXt, AsciiDoc, and docx
2067: list of keywords to be included in HTML, PDF, ODT, pptx, docx
2068 and AsciiDoc metadata; repeat as for `author`, above
2071: document subject, included in ODT, PDF, docx and pptx metadata
2074: document description, included in ODT, docx and pptx metadata. Some
2075 applications show this as `Comments` metadata.
2078: document category, included in docx and pptx metadata
2081any root-level string metadata, not included in ODT, docx
2082or pptx metadata is added as a *custom property*.
2083The following [YAML] metadata block for instance:
2086 title: 'This is the title'
2087 subtitle: "This is the subtitle"
2095 It consists of two paragraphs
2098will include `title`, `author` and `description` as standard document
2099properties and `subtitle` as a custom property when converting to docx,
2102### Language variables
2105: identifies the main language of the document using IETF language
2106 tags (following the [BCP 47] standard), such as `en` or `en-GB`.
2107 The [Language subtag lookup] tool can look up or verify these tags.
2108 This affects most formats, and controls hyphenation in PDF output
2109 when using LaTeX (through [`babel`] and [`polyglossia`]) or ConTeXt.
2111 Use native pandoc [Divs and Spans] with the `lang` attribute to
2112 switch the language:
2118 Text in the main document language (British English).
2121 > Cette citation est écrite en français canadien.
2124 More text in English. ['Zitat auf Deutsch.']{lang=de}
2127: the base script direction, either `rtl` (right-to-left)
2128 or `ltr` (left-to-right).
2130 For bidirectional documents, native pandoc `span`s and `div`s
2131 with the `dir` attribute (value `rtl` or `ltr`) can be used to
2132 override the base direction in some output formats.
2133 This may not always be necessary if the final renderer
2134 (e.g. the browser, when generating HTML) supports the
2135 [Unicode Bidirectional Algorithm].
2137 When using LaTeX for bidirectional documents, only the `xelatex` engine
2138 is fully supported (use `--pdf-engine=xelatex`).
2140[BCP 47]: https://tools.ietf.org/html/bcp47
2141[Unicode Bidirectional Algorithm]: https://www.w3.org/International/articles/inline-bidi-markup/uba-basics
2142[Language subtag lookup]: https://r12a.github.io/app-subtags/
2144### Variables for HTML math
2147: when using [KaTeX](#option--katex), you can render display math equations
2148 flush left using [YAML metadata](#layout) or with `-M classoption=fleqn`.
2150### Variables for HTML slides
2152These affect HTML output when [producing slide shows with pandoc].
2154All [reveal.js configuration options] are available as variables.
2155To turn off boolean flags that default to true in reveal.js, use `0`.
2158: base URL for reveal.js documents (defaults to
2159 `https://unpkg.com/reveal.js@^4/`)
2162: base URL for S5 documents (defaults to `s5/default`)
2165: base URL for Slidy documents (defaults to
2166 `https://www.w3.org/Talks/Tools/Slidy2`)
2169: base URL for Slideous documents (defaults to `slideous`)
2171`title-slide-attributes`
2172: additional attributes for the title slide of reveal.js slide shows.
2173 See [background in reveal.js and beamer] for an example.
2175[reveal.js configuration options]: https://revealjs.com/config/
2177### Variables for Beamer slides
2179These variables change the appearance of PDF slides using [`beamer`].
2182: slide aspect ratio (`43` for 4:3 [default], `169` for 16:9,
2183 `1610` for 16:10, `149` for 14:9, `141` for 1.41:1, `54` for 5:4,
2187: produce an article from Beamer slides
2190: add extra beamer option with `\setbeameroption{}`
2193: author affiliations: can be a list when there are multiple authors
2196: logo image for slides
2199: controls navigation symbols (default is `empty` for no navigation
2200 symbols; other valid values are `frame`, `vertical`, and `horizontal`)
2203: enables "title pages" for new sections (default is true)
2205`theme`, `colortheme`, `fonttheme`, `innertheme`, `outertheme`
2209: options for LaTeX beamer themes (a list).
2212: image for title slide
2214### Variables for PowerPoint
2216These variables control the visual aspects of a slide show that
2217are not easily controlled via templates.
2220: font to use for code.
2222### Variables for LaTeX
2224Pandoc uses these variables when [creating a PDF] with a LaTeX engine.
2229: make `\paragraph` and `\subparagraph` (fourth- and
2230 fifth-level headings, or fifth- and sixth-level with book
2231 classes) free-standing rather than run-in; requires further
2232 formatting to distinguish from `\subsubsection` (third- or
2233 fourth-level headings). Instead of using this option,
2234 [KOMA-Script] can adjust headings more extensively:
2237 documentclass: scrartcl
2239 \RedeclareSectionCommand[
2240 beforeskip=-10pt plus -2pt minus -1pt,
2241 afterskip=1sp plus -1sp minus 1sp,
2242 font=\normalfont\itshape]{paragraph}
2243 \RedeclareSectionCommand[
2244 beforeskip=-10pt plus -2pt minus -1pt,
2245 afterskip=1sp plus -1sp minus 1sp,
2246 font=\normalfont\scshape,
2247 indent=0pt]{subparagraph}
2251: option for document class, e.g. `oneside`; repeat for multiple options:
2260: document class: usually one of the standard classes, [`article`], [`book`],
2261 and [`report`]; the [KOMA-Script] equivalents, `scrartcl`, `scrbook`,
2262 and `scrreprt`, which default to smaller margins; or [`memoir`]
2265: option for [`geometry`] package, e.g. `margin=1in`;
2266 repeat for multiple options:
2276: option for [`hyperref`] package, e.g. `linktoc=all`;
2277 repeat for multiple options:
2283 - pdfpagemode=FullScreen
2287: uses document class settings for indentation (the default LaTeX template
2288 otherwise removes indentation and adds space between paragraphs)
2291: adjusts line spacing using the [`setspace`]
2292 package, e.g. `1.25`, `1.5`
2294`margin-left`, `margin-right`, `margin-top`, `margin-bottom`
2295: sets margins if `geometry` is not used (otherwise `geometry`
2299: control `\pagestyle{}`: the default article class
2300 supports `plain` (default), `empty` (no running heads or page numbers),
2301 and `headings` (section titles in running heads)
2304: paper size, e.g. `letter`, `a4`
2307: numbering depth for sections (with `--number-sections` option
2308 or `numbersections` variable)
2313: allows font encoding to be specified through `fontenc` package (with `pdflatex`);
2314 default is `T1` (see [LaTeX font encodings guide])
2317: font package for use with `pdflatex`:
2318 [TeX Live] includes many options, documented in the [LaTeX Font Catalogue].
2319 The default is [Latin Modern][`lm`].
2322: options for package used as `fontfamily`; repeat for multiple options.
2323 For example, to use the Libertine font with proportional lowercase
2324 (old-style) figures through the [`libertinus`] package:
2327 fontfamily: libertinus
2334: font size for body text. The standard classes allow 10pt, 11pt, and
2335 12pt. To use another size, set `documentclass` to one of
2336 the [KOMA-Script] classes, such as `scrartcl` or `scrbook`.
2338`mainfont`, `sansfont`, `monofont`, `mathfont`, `CJKmainfont`
2339: font families for use with `xelatex` or
2340 `lualatex`: take the name of any system font, using the
2341 [`fontspec`] package. `CJKmainfont` uses the [`xecjk`] package.
2343`mainfontoptions`, `sansfontoptions`, `monofontoptions`, `mathfontoptions`, `CJKoptions`
2344: options to use with `mainfont`, `sansfont`, `monofont`, `mathfont`,
2345 `CJKmainfont` in `xelatex` and `lualatex`. Allow for any
2346 choices available through [`fontspec`]; repeat for multiple
2347 options. For example, to use the [TeX Gyre] version of
2348 Palatino with lowercase figures:
2351 mainfont: TeX Gyre Pagella
2354 - Numbers=Proportional
2358: options to pass to the microtype package
2363: add color to link text; automatically enabled if any of
2364 `linkcolor`, `filecolor`, `citecolor`, `urlcolor`, or `toccolor` are set
2366`linkcolor`, `filecolor`, `citecolor`, `urlcolor`, `toccolor`
2367: color for internal links, external links, citation links, linked
2368 URLs, and links in table of contents, respectively: uses options
2369 allowed by [`xcolor`], including the `dvipsnames`, `svgnames`, and
2373: causes links to be printed as footnotes
2378: include list of figures, list of tables
2381: contents of acknowledgments footnote after document title
2384: include table of contents (can also be set using `--toc/--table-of-contents`)
2387: level of section to include in table of contents
2389#### BibLaTeX Bibliographies
2391These variables function when using BibLaTeX for [citation rendering].
2394: list of options for biblatex
2397: bibliography style, when used with `--natbib` and `--biblatex`.
2400: bibliography title, when used with `--natbib` and `--biblatex`.
2403: bibliography to use for resolving references
2406: list of options for natbib
2408[KOMA-Script]: https://ctan.org/pkg/koma-script
2409[LaTeX Font Catalogue]: https://tug.org/FontCatalogue/
2410[LaTeX font encodings guide]: https://ctan.org/pkg/encguide
2411[TeX Gyre]: http://www.gust.org.pl/projects/e-foundry/tex-gyre
2412[`article`]: https://ctan.org/pkg/article
2413[`book`]: https://ctan.org/pkg/book
2414[`libertinus`]: https://ctan.org/pkg/libertinus
2415[`memoir`]: https://ctan.org/pkg/memoir
2416[`report`]: https://ctan.org/pkg/report
2418### Variables for ConTeXt
2420Pandoc uses these variables when [creating a PDF] with ConTeXt.
2423: font size for body text (e.g. `10pt`, `12pt`)
2425`headertext`, `footertext`
2426: text to be placed in running header or footer (see [ConTeXt Headers and Footers]);
2427 repeat up to four times for different placement
2430: controls indentation of paragraphs, e.g. `yes,small,next` (see [ConTeXt Indentation]);
2431 repeat for multiple options
2434: adjusts line spacing, e.g. `4ex` (using [`setupinterlinespace`]);
2435 repeat for multiple options
2438: options for page margins and text arrangement (see [ConTeXt Layout]);
2439 repeat for multiple options
2441`linkcolor`, `contrastcolor`
2442: color for links outside and inside a page, e.g. `red`, `blue` (see [ConTeXt Color])
2445: typeface style for links, e.g. `normal`, `bold`, `slanted`, `boldslanted`, `type`, `cap`, `small`
2448: include list of figures, list of tables
2450`mainfont`, `sansfont`, `monofont`, `mathfont`
2451: font families: take the name of any system font (see [ConTeXt Font Switching])
2453`margin-left`, `margin-right`, `margin-top`, `margin-bottom`
2454: sets margins, if `layout` is not used (otherwise `layout`
2458: page number style and location (using [`setuppagenumbering`]);
2459 repeat for multiple options
2462: paper size, e.g. `letter`, `A4`, `landscape` (see [ConTeXt Paper Setup]);
2463 repeat for multiple options
2466: adds to the preamble the setup necessary to generate PDF/A of the type
2467 specified, e.g. `1a:2005`, `2a`. If no type is specified (i.e. the value
2468 is set to True, by e.g. `--metadata=pdfa` or `pdfa: true` in a YAML metadata
2469 block), `1b:2005` will be used as default, for reasons of backwards
2470 compatibility. Using `--variable=pdfa` without specified value is not supported.
2471 To successfully generate PDF/A the required ICC color profiles have to
2472 be available and the content and all included files (such as images)
2473 have to be standard conforming. The ICC profiles and output intent
2474 may be specified using the variables `pdfaiccprofile` and `pdfaintent`.
2475 See also [ConTeXt PDFA] for more details.
2478: when used in conjunction with `pdfa`, specifies the ICC profile to use
2479 in the PDF, e.g. `default.cmyk`. If left unspecified, `sRGB.icc` is
2480 used as default. May be repeated to include multiple profiles. Note that
2481 the profiles have to be available on the system. They can be obtained
2482 from [ConTeXt ICC Profiles].
2485: when used in conjunction with `pdfa`, specifies the output intent for
2486 the colors, e.g. `ISO coated v2 300\letterpercent\space (ECI)`
2487 If left unspecified, `sRGB IEC61966-2.1` is used as default.
2490: include table of contents (can also be set using `--toc/--table-of-contents`)
2493: spacing between paragraphs, e.g. `none`, `small` (using [`setupwhitespace`])
2496: include all source documents as file attachments in the PDF file
2498[ConTeXt Paper Setup]: https://wiki.contextgarden.net/PaperSetup
2499[ConTeXt Layout]: https://wiki.contextgarden.net/Layout
2500[ConTeXt Font Switching]: https://wiki.contextgarden.net/Font_Switching
2501[ConTeXt Color]: https://wiki.contextgarden.net/Color
2502[ConTeXt Headers and Footers]: https://wiki.contextgarden.net/Headers_and_Footers
2503[ConTeXt Indentation]: https://wiki.contextgarden.net/Indentation
2504[ConTeXt ICC Profiles]: https://wiki.contextgarden.net/PDFX#ICC_profiles
2505[ConTeXt PDFA]: https://wiki.contextgarden.net/PDF/A
2506[`setupwhitespace`]: https://wiki.contextgarden.net/Command/setupwhitespace
2507[`setupinterlinespace`]: https://wiki.contextgarden.net/Command/setupinterlinespace
2508[`setuppagenumbering`]: https://wiki.contextgarden.net/Command/setuppagenumbering
2510### Variables for `wkhtmltopdf`
2512Pandoc uses these variables when [creating a PDF] with [`wkhtmltopdf`].
2513The `--css` option also affects the output.
2515`footer-html`, `header-html`
2516: add information to the header and footer
2518`margin-left`, `margin-right`, `margin-top`, `margin-bottom`
2519: set the page margins
2522: sets the PDF paper size
2524### Variables for man pages
2527: adjusts text to left (`l`), right (`r`), center (`c`),
2528 or both (`b`) margins
2531: footer in man pages
2534: header in man pages
2537: if `true` (the default), hyphenation will be used
2540: section number in man pages
2545: font family (e.g. `T` or `P`)
2548: paragraph indent (e.g. `2m`)
2551: line height (e.g. `12p`)
2554: point size (e.g. `10p`)
2556### Variables set automatically
2558Pandoc sets these variables automatically in response to [options] or
2559document contents; users can also modify them. These vary depending
2560on the output format, and include the following:
2566: the `date` variable converted to ISO 8601 YYYY-MM-DD,
2567 included in all HTML based formats (dzslides, epub,
2568 html, html4, html5, revealjs, s5, slideous, slidy).
2569 The recognized formats for `date` are: `mm/dd/yyyy`,
2570 `mm/dd/yy`, `yyyy-mm-dd` (ISO 8601), `dd MM yyyy`
2571 (e.g. either `02 Apr 2018` or `02 April 2018`),
2572 `MM dd, yyyy` (e.g. `Apr. 02, 2018` or `April 02, 2018),
2573 `yyyy[mm[dd]]]` (e.g. `20180402, `201804` or `2018`).
2576: contents specified by `-H/--include-in-header` (may have multiple
2580: contents specified by `-B/--include-before-body` (may have
2584: contents specified by `-A/--include-after-body` (may have
2588: JSON representation of all of the document's metadata. Field
2589 values are transformed to the selected output format.
2592: non-null value if `-N/--number-sections` was specified
2594`sourcefile`, `outputfile`
2595: source and destination filenames, as given on the command line.
2596 `sourcefile` can also be a list if input comes from multiple files,
2597 or empty if input is from stdin. You can use the following snippet in
2598 your template to distinguish them:
2608 Similarly, `outputfile` can be `-` if output goes to the terminal.
2610 If you need absolute paths, use e.g. `$curdir$/$sourcefile$`.
2613: working directory from which pandoc is run.
2616: non-null value if `--toc/--table-of-contents` was specified
2619: title of table of contents (works only with EPUB,
2620 HTML, opendocument, odt, docx, pptx, beamer, LaTeX)
2622[pandoc-templates]: https://github.com/jgm/pandoc-templates
2626The behavior of some of the readers and writers can be adjusted by
2627enabling or disabling various extensions.
2629An extension can be enabled by adding `+EXTENSION`
2630to the format name and disabled by adding `-EXTENSION`. For example,
2631`--from markdown_strict+footnotes` is strict Markdown with footnotes
2632enabled, while `--from markdown-footnotes-pipe_tables` is pandoc's
2633Markdown without footnotes or pipe tables.
2635The markdown reader and writer make by far the most use of extensions.
2636Extensions only used by them are therefore covered in the
2637section [Pandoc's Markdown] below (See [Markdown variants] for
2638`commonmark` and `gfm`.) In the following, extensions that also work
2639for other formats are covered.
2641Note that markdown extensions added to the `ipynb` format
2642affect Markdown cells in Jupyter notebooks (as do command-line
2643options like `--atx-headers`).
2647#### Extension: `smart` ####
2649Interpret straight quotes as curly quotes, `---` as em-dashes,
2650`--` as en-dashes, and `...` as ellipses. Nonbreaking spaces are
2651inserted after certain abbreviations, such as "Mr."
2653This extension can be enabled/disabled for the following formats:
2656: `markdown`, `commonmark`, `latex`, `mediawiki`, `org`, `rst`, `twiki`
2659: `markdown`, `latex`, `context`, `rst`
2661enabled by default in
2662: `markdown`, `latex`, `context` (both input and output)
2664Note: If you are *writing* Markdown, then the `smart` extension
2665has the reverse effect: what would have been curly quotes comes
2668In LaTeX, `smart` means to use the standard TeX ligatures
2669for quotation marks (` `` ` and ` '' ` for double quotes,
2670`` ` `` and `` ' `` for single quotes) and dashes (`--` for
2671en-dash and `---` for em-dash). If `smart` is disabled,
2672then in reading LaTeX pandoc will parse these characters
2673literally. In writing LaTeX, enabling `smart` tells pandoc
2674to use the ligatures when possible; if `smart` is disabled
2675pandoc will use unicode quotation mark and dash characters.
2677## Headings and sections
2679#### Extension: `auto_identifiers` ####
2681A heading without an explicitly specified identifier will be
2682automatically assigned a unique identifier based on the heading text.
2684This extension can be enabled/disabled for the following formats:
2687: `markdown`, `latex`, `rst`, `mediawiki`, `textile`
2692enabled by default in
2695The default algorithm used to derive the identifier from the
2698 - Remove all formatting, links, etc.
2699 - Remove all footnotes.
2700 - Remove all non-alphanumeric characters,
2701 except underscores, hyphens, and periods.
2702 - Replace all spaces and newlines with hyphens.
2703 - Convert all alphabetic characters to lowercase.
2704 - Remove everything up to the first letter (identifiers may
2705 not begin with a number or punctuation mark).
2706 - If nothing is left after this, use the identifier `section`.
2711 ------------------------------- ----------------------------
2712 `Heading identifiers in HTML` `heading-identifiers-in-html`
2713 `Maître d'hôtel` `maître-dhôtel`
2714 `*Dogs*?--in *my* house?` `dogs--in-my-house`
2715 `[HTML], [S5], or [RTF]?` `html-s5-or-rtf`
2716 `3. Applications` `applications`
2719These rules should, in most cases, allow one to determine the identifier
2720from the heading text. The exception is when several headings have the
2721same text; in this case, the first will get an identifier as described
2722above; the second will get the same identifier with `-1` appended; the
2723third with `-2`; and so on.
2725(However, a different algorithm is used if
2726`gfm_auto_identifiers` is enabled; see below.)
2728These identifiers are used to provide link targets in the table of
2729contents generated by the `--toc|--table-of-contents` option. They
2730also make it easy to provide links from one section of a document to
2731another. A link to this section, for example, might look like this:
2734 [heading identifiers](#heading-identifiers-in-html-latex-and-context).
2736Note, however, that this method of providing links to sections works
2737only in HTML, LaTeX, and ConTeXt formats.
2739If the `--section-divs` option is specified, then each section will
2740be wrapped in a `section` (or a `div`, if `html4` was specified),
2741and the identifier will be attached to the enclosing `<section>`
2742(or `<div>`) tag rather than the heading itself. This allows entire
2743sections to be manipulated using JavaScript or treated differently in
2746#### Extension: `ascii_identifiers` ####
2748Causes the identifiers produced by `auto_identifiers` to be pure ASCII.
2749Accents are stripped off of accented Latin letters, and non-Latin
2752#### Extension: `gfm_auto_identifiers` ####
2754Changes the algorithm used by `auto_identifiers` to conform to
2755GitHub's method. Spaces are converted to dashes (`-`),
2756uppercase characters to lowercase characters, and punctuation
2757characters other than `-` and `_` are removed.
2758Emojis are replaced by their names.
2762The extensions [`tex_math_dollars`](#extension-tex_math_dollars),
2763[`tex_math_single_backslash`](#extension-tex_math_single_backslash), and
2764[`tex_math_double_backslash`](#extension-tex_math_double_backslash)
2765are described in the section about Pandoc's Markdown.
2767However, they can also be used with HTML input. This is handy for
2768reading web pages formatted using MathJax, for example.
2772The following extensions are described in more detail in
2773their respective sections of [Pandoc's Markdown]:
2775- [`raw_html`](#extension-raw_html) allows HTML elements which
2776 are not representable in pandoc's AST to be parsed as raw HTML.
2777 By default, this is disabled for HTML input.
2779- [`raw_tex`](#extension-raw_tex) allows raw LaTeX, TeX, and ConTeXt
2780 to be included in a document. This extension can be enabled/disabled
2781 for the following formats (in addition to `markdown`):
2784 : `latex`, `org`, `textile`, `html` (environments, `\ref`, and
2785 `\eqref` only), `ipynb`
2788 : `textile`, `commonmark`
2790 Note: as applied to `ipynb`, `raw_html` and `raw_tex` affect not
2791 only raw TeX in markdown cells, but data with mime type
2792 `text/html` in output cells. Since the `ipynb` reader attempts
2793 to preserve the richest possible outputs when several options
2794 are given, you will get best results if you disable `raw_html`
2795 and `raw_tex` when converting to formats like `docx` which don't
2796 allow raw `html` or `tex`.
2798- [`native_divs`](#extension-native_divs) causes HTML `div`
2799 elements to be parsed as native pandoc Div blocks.
2800 If you want them to be parsed as raw HTML, use
2801 `-f html-native_divs+raw_html`.
2803- [`native_spans`](#extension-native_spans) causes HTML `span`
2804 elements to be parsed as native pandoc Span inlines.
2805 If you want them to be parsed as raw HTML, use
2806 `-f html-native_spans+raw_html`. If you want to drop all
2807 `div`s and `span`s when converting HTML to Markdown, you
2808 can use `pandoc -f html-native_divs-native_spans -t markdown`.
2810## Literate Haskell support
2812#### Extension: `literate_haskell` ####
2814Treat the document as literate Haskell source.
2816This extension can be enabled/disabled for the following formats:
2819: `markdown`, `rst`, `latex`
2822: `markdown`, `rst`, `latex`, `html`
2824If you append `+lhs` (or `+literate_haskell`) to one of the formats
2825above, pandoc will treat the document as literate Haskell source.
2828 - In Markdown input, "bird track" sections will be parsed as Haskell
2829 code rather than block quotations. Text between `\begin{code}`
2830 and `\end{code}` will also be treated as Haskell code. For
2831 ATX-style headings the character '=' will be used instead of '#'.
2833 - In Markdown output, code blocks with classes `haskell` and `literate`
2834 will be rendered using bird tracks, and block quotations will be
2835 indented one space, so they will not be treated as Haskell code.
2836 In addition, headings will be rendered setext-style (with underlines)
2837 rather than ATX-style (with '#' characters). (This is because ghc
2838 treats '#' characters in column 1 as introducing line numbers.)
2840 - In restructured text input, "bird track" sections will be parsed
2843 - In restructured text output, code blocks with class `haskell` will
2844 be rendered using bird tracks.
2846 - In LaTeX input, text in `code` environments will be parsed as
2849 - In LaTeX output, code blocks with class `haskell` will be rendered
2850 inside `code` environments.
2852 - In HTML output, code blocks with class `haskell` will be rendered
2853 with class `literatehaskell` and bird tracks.
2857 pandoc -f markdown+lhs -t html
2859reads literate Haskell source formatted with Markdown conventions and writes
2860ordinary HTML (without bird tracks).
2862 pandoc -f markdown+lhs -t html+lhs
2864writes HTML with the Haskell code in bird tracks, so it can be copied
2865and pasted as literate Haskell source.
2867Note that GHC expects the bird tracks in the first column, so indented
2868literate code blocks (e.g. inside an itemized environment) will not be
2869picked up by the Haskell compiler.
2873#### Extension: `empty_paragraphs` ####
2875Allows empty paragraphs. By default empty paragraphs are
2878This extension can be enabled/disabled for the following formats:
2884: `docx`, `odt`, `opendocument`, `html`
2886#### Extension: `native_numbering` ####
2888Enables native numbering of figures and tables. Enumeration
2891This extension can be enabled/disabled for the following formats:
2894: `odt`, `opendocument`
2896#### Extension: `styles` {#ext-styles} ####
2898When converting from docx, read all docx styles as divs (for
2899paragraph styles) and spans (for character styles) regardless
2900of whether pandoc understands the meaning of these styles.
2901This can be used with [docx custom styles](#custom-styles).
2907#### Extension: `amuse` ####
2909In the `muse` input format, this enables Text::Amuse
2910extensions to Emacs Muse markup.
2912#### Extension: `citations` {#org-citations}
2914Some aspects of [Pandoc's Markdown citation syntax](#citations) are also accepted
2917#### Extension: `ntb` ####
2919In the `context` output format this enables the use of [Natural Tables
2920(TABLE)](https://wiki.contextgarden.net/TABLE) instead of the default
2921[Extreme Tables (xtables)](https://wiki.contextgarden.net/xtables).
2922Natural tables allow more fine-grained global customization but come
2923at a performance penalty compared to extreme tables.
2928Pandoc understands an extended and slightly revised version of
2929John Gruber's [Markdown] syntax. This document explains the syntax,
2930noting differences from standard Markdown. Except where noted, these
2931differences can be suppressed by using the `markdown_strict` format instead
2932of `markdown`. Extensions can be enabled or disabled to specify the
2933behavior more granularly. They are described in the following. See also
2934[Extensions] above, for extensions that work also on other formats.
2938Markdown is designed to be easy to write, and, even more importantly,
2941> A Markdown-formatted document should be publishable as-is, as plain
2942> text, without looking like it's been marked up with tags or formatting
2944> -- [John Gruber](https://daringfireball.net/projects/markdown/syntax#philosophy)
2946This principle has guided pandoc's decisions in finding syntax for
2947tables, footnotes, and other extensions.
2949There is, however, one respect in which pandoc's aims are different
2950from the original aims of Markdown. Whereas Markdown was originally
2951designed with HTML generation in mind, pandoc is designed for multiple
2952output formats. Thus, while pandoc allows the embedding of raw HTML,
2953it discourages it, and provides other, non-HTMLish ways of representing
2954important document elements like definition lists, tables, mathematics, and
2959A paragraph is one or more lines of text followed by one or more blank lines.
2960Newlines are treated as spaces, so you can reflow your paragraphs as you like.
2961If you need a hard line break, put two or more spaces at the end of a line.
2963#### Extension: `escaped_line_breaks` ####
2965A backslash followed by a newline is also a hard line break.
2966Note: in multiline and grid table cells, this is the only way
2967to create a hard line break, since trailing spaces in the cells
2972There are two kinds of headings: Setext and ATX.
2974### Setext-style headings ###
2976A setext-style heading is a line of text "underlined" with a row of `=` signs
2977(for a level-one heading) or `-` signs (for a level-two heading):
2985The heading text can contain inline formatting, such as emphasis (see
2986[Inline formatting], below).
2989### ATX-style headings ###
2991An ATX-style heading consists of one to six `#` signs and a line of
2992text, optionally followed by any number of `#` signs. The number of
2993`#` signs at the beginning of the line is the heading level:
2995 ## A level-two heading
2997 ### A level-three heading ###
2999As with setext-style headings, the heading text can contain formatting:
3001 # A level-one heading with a [link](/url) and *emphasis*
3003#### Extension: `blank_before_header` ####
3005Standard Markdown syntax does not require a blank line before a heading.
3006Pandoc does require this (except, of course, at the beginning of the
3007document). The reason for the requirement is that it is all too easy for a
3008`#` to end up at the beginning of a line by accident (perhaps through line
3009wrapping). Consider, for example:
3011 I like several of their flavors of ice cream:
3012 #22, for example, and #5.
3014#### Extension: `space_in_atx_header` ####
3016Many Markdown implementations do not require a space between the
3017opening `#`s of an ATX heading and the heading text, so that
3018`#5 bolt` and `#hashtag` count as headings. With this extension,
3019pandoc does require the space.
3021### Heading identifiers ###
3023See also the [`auto_identifiers` extension](#extension-auto_identifiers) above.
3025#### Extension: `header_attributes` ####
3027Headings can be assigned attributes using this syntax at the end
3028of the line containing the heading text:
3030 {#identifier .class .class key=value key=value}
3032Thus, for example, the following headings will all be assigned the identifier
3037 ## My heading ## {#foo}
3039 My other heading {#foo}
3042(This syntax is compatible with [PHP Markdown Extra].)
3044Note that although this syntax allows assignment of classes and key/value
3045attributes, writers generally don't use all of this information. Identifiers,
3046classes, and key/value attributes are used in HTML and HTML-based formats such
3047as EPUB and slidy. Identifiers are used for labels and link anchors in the
3048LaTeX, ConTeXt, Textile, Jira markup, and AsciiDoc writers.
3050Headings with the class `unnumbered` will not be numbered, even if
3051`--number-sections` is specified. A single hyphen (`-`) in an attribute
3052context is equivalent to `.unnumbered`, and preferable in non-English
3059 # My heading {.unnumbered}
3061If the `unlisted` class is present in addition to `unnumbered`,
3062the heading will not be included in a table of contents.
3063(Currently this feature is only implemented for certain
3064formats: those based on LaTeX and HTML, PowerPoint, and RTF.)
3066#### Extension: `implicit_header_references` ####
3068Pandoc behaves as if reference links have been defined for each heading.
3069So, to link to a heading
3071 # Heading identifiers in HTML
3075 [Heading identifiers in HTML]
3079 [Heading identifiers in HTML][]
3083 [the section on heading identifiers][heading identifiers in
3086instead of giving the identifier explicitly:
3088 [Heading identifiers in HTML](#heading-identifiers-in-html)
3090If there are multiple headings with identical text, the corresponding
3091reference will link to the first one only, and you will need to use explicit
3092links to link to the others, as described above.
3094Like regular reference links, these references are case-insensitive.
3096Explicit link reference definitions always take priority over
3097implicit heading references. So, in the following example, the
3098link will point to `bar`, not to `#foo`:
3108Markdown uses email conventions for quoting blocks of text.
3109A block quotation is one or more paragraphs or other block elements
3110(such as lists or headings), with each line preceded by a `>` character
3111and an optional space. (The `>` need not start at the left margin, but
3112it should not be indented more than three spaces.)
3114 > This is a block quote. This
3115 > paragraph has two lines.
3117 > 1. This is a list inside a block quote.
3120A "lazy" form, which requires the `>` character only on the first
3121line of each block, is also allowed:
3123 > This is a block quote. This
3124 paragraph has two lines.
3126 > 1. This is a list inside a block quote.
3129Among the block elements that can be contained in a block quote are
3130other block quotes. That is, block quotes can be nested:
3132 > This is a block quote.
3134 > > A block quote within a block quote.
3136If the `>` character is followed by an optional space, that space
3137will be considered part of the block quote marker and not part of
3138the indentation of the contents. Thus, to put an indented code
3139block in a block quote, you need five spaces after the `>`:
3143#### Extension: `blank_before_blockquote` ####
3145Standard Markdown syntax does not require a blank line before a block
3146quote. Pandoc does require this (except, of course, at the beginning of the
3147document). The reason for the requirement is that it is all too easy for a
3148`>` to end up at the beginning of a line by accident (perhaps through line
3149wrapping). So, unless the `markdown_strict` format is used, the following does
3150not produce a nested block quote in pandoc:
3152 > This is a block quote.
3156## Verbatim (code) blocks
3158### Indented code blocks ###
3160A block of text indented four spaces (or one tab) is treated as verbatim
3161text: that is, special characters do not trigger special formatting,
3162and all spaces and line breaks are preserved. For example,
3165 moveShip(5 * gravity, DOWN);
3168The initial (four space or one tab) indentation is not considered part
3169of the verbatim text, and is removed in the output.
3171Note: blank lines in the verbatim text need not begin with four spaces.
3174### Fenced code blocks ###
3176#### Extension: `fenced_code_blocks` ####
3178In addition to standard indented code blocks, pandoc supports
3179*fenced* code blocks. These begin with a row of three or more
3180tildes (`~`) and end with a row of tildes that must be at least as long as
3181the starting row. Everything between these lines is treated as code. No
3182indentation is necessary:
3186 moveShip(5 * gravity, DOWN);
3190Like regular code blocks, fenced code blocks must be separated
3191from surrounding text by blank lines.
3193If the code itself contains a row of tildes or backticks, just use a longer
3194row of tildes or backticks at the start and end:
3198 code including tildes
3202#### Extension: `backtick_code_blocks` ####
3204Same as `fenced_code_blocks`, but uses backticks (`` ` ``) instead of tildes
3207#### Extension: `fenced_code_attributes` ####
3209Optionally, you may attach attributes to fenced or backtick code block using
3212 ~~~~ {#mycode .haskell .numberLines startFrom="100"}
3214 qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
3215 qsort (filter (>= x) xs)
3216 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3218Here `mycode` is an identifier, `haskell` and `numberLines` are classes, and
3219`startFrom` is an attribute with value `100`. Some output formats can use this
3220information to do syntax highlighting. Currently, the only output formats
3221that uses this information are HTML, LaTeX, Docx, Ms, and PowerPoint. If
3222highlighting is supported for your output format and language, then the code
3223block above will appear highlighted, with numbered lines. (To see which
3224languages are supported, type `pandoc --list-highlight-languages`.) Otherwise,
3225the code block above will appear as follows:
3227 <pre id="mycode" class="haskell numberLines" startFrom="100">
3233The `numberLines` (or `number-lines`) class will cause the lines
3234of the code block to be numbered, starting with `1` or the value
3235of the `startFrom` attribute. The `lineAnchors` (or
3236`line-anchors`) class will cause the lines to be clickable
3237anchors in HTML output.
3239A shortcut form can also be used for specifying the language of
3246This is equivalent to:
3252If the `fenced_code_attributes` extension is disabled, but
3253input contains class attribute(s) for the code block, the first
3254class attribute will be printed after the opening fence as a bare
3257To prevent all highlighting, use the `--no-highlight` flag.
3258To set the highlighting style, use `--highlight-style`.
3259For more information on highlighting, see [Syntax highlighting],
3264#### Extension: `line_blocks` ####
3266A line block is a sequence of lines beginning with a vertical bar (`|`)
3267followed by a space. The division into lines will be preserved in
3268the output, as will any leading spaces; otherwise, the lines will
3269be formatted as Markdown. This is useful for verse and addresses:
3271 | The limerick packs laughs anatomical
3272 | In space that is quite economical.
3273 | But the good ones I've seen
3274 | So seldom are clean
3275 | And the clean ones so seldom are comical
3278 | Berkeley, CA 94718
3280The lines can be hard-wrapped if needed, but the continuation
3281line must begin with a space.
3283 | The Right Honorable Most Venerable and Righteous Samuel L.
3286 | Berkeley, CA 94718
3288This syntax is borrowed from [reStructuredText].
3294A bullet list is a list of bulleted list items. A bulleted list
3295item begins with a bullet (`*`, `+`, or `-`). Here is a simple
3302This will produce a "compact" list. If you want a "loose" list, in which
3303each item is formatted as a paragraph, put spaces between the items:
3311The bullets need not be flush with the left margin; they may be
3312indented one, two, or three spaces. The bullet must be followed
3315List items look best if subsequent lines are flush with the first
3316line (after the bullet):
3322But Markdown also allows a "lazy" format:
3328### Block content in list items ###
3330A list item may contain multiple paragraphs and other block-level
3331content. However, subsequent paragraphs must be preceded by a blank line
3332and indented to line up with the first non-space content after
3339 * Second paragraph. With a code block, which must be indented
3344Exception: if the list marker is followed by an indented code
3345block, which must begin 5 spaces after the list marker, then
3346subsequent paragraphs must begin two columns after the last
3347character of the list marker:
3351 continuation paragraph
3353List items may include other lists. In this case the preceding blank
3354line is optional. The nested list must be indented to line up with
3355the first non-space character after the list marker of the
3356containing list item.
3368As noted above, Markdown allows you to write list items "lazily," instead of
3369indenting continuation lines. However, if there are multiple paragraphs or
3370other blocks in a list item, the first line of each must be indented.
3372 + A lazy, lazy, list
3375 + Another one; this looks
3378 Second paragraph of second
3381### Ordered lists ###
3383Ordered lists work just like bulleted lists, except that the items
3384begin with enumerators rather than bullets.
3386In standard Markdown, enumerators are decimal numbers followed
3387by a period and a space. The numbers themselves are ignored, so
3388there is no difference between this list:
3400#### Extension: `fancy_lists` ####
3402Unlike standard Markdown, pandoc allows ordered list items to be marked
3403with uppercase and lowercase letters and roman numerals, in addition to
3404Arabic numerals. List markers may be enclosed in parentheses or followed by a
3405single right-parentheses or period. They must be separated from the
3406text that follows by at least one space, and, if the list marker is a
3407capital letter with a period, by at least two spaces.[^2]
3409[^2]: The point of this rule is to ensure that normal paragraphs
3410 starting with people's initials, like
3412 B. Russell was an English philosopher.
3414 do not get treated as list items.
3416 This rule will not prevent
3420 from being interpreted as a list item. In this case, a backslash
3425The `fancy_lists` extension also allows '`#`' to be used as an
3426ordered list marker in place of a numeral:
3431#### Extension: `startnum` ####
3433Pandoc also pays attention to the type of list marker used, and to the
3434starting number, and both of these are preserved where possible in the
3435output format. Thus, the following yields a list with numbers followed
3436by a single parenthesis, starting with 9, and a sublist with lowercase
3446Pandoc will start a new list each time a different type of list
3447marker is used. So, the following will create three lists:
3454If default list markers are desired, use `#.`:
3460#### Extension: `task_lists` ####
3462Pandoc supports task lists, using the syntax of GitHub-Flavored Markdown.
3464 - [ ] an unchecked task list item
3467### Definition lists ###
3469#### Extension: `definition_lists` ####
3471Pandoc supports definition lists, using the syntax of
3472[PHP Markdown Extra] with some extensions.[^3]
3478 Term 2 with *inline markup*
3482 { some code, part of Definition 2 }
3484 Third paragraph of definition 2.
3486Each term must fit on one line, which may optionally be followed by
3487a blank line, and must be followed by one or more definitions.
3488A definition begins with a colon or tilde, which may be indented one
3491A term may have multiple definitions, and each definition may consist of one or
3492more block elements (paragraph, code block, list, etc.), each indented four
3493spaces or one tab stop. The body of the definition (including the first line,
3494aside from the colon or tilde) should be indented four spaces. However,
3495as with other Markdown lists, you can "lazily" omit indentation except
3496at the beginning of a paragraph or other block element:
3501 with lazy continuation.
3503 Second paragraph of the definition.
3505If you leave space before the definition (as in the example above),
3506the text of the definition will be treated as a paragraph. In some
3507output formats, this will mean greater spacing between term/definition
3508pairs. For a more compact definition list, omit the space before the
3518Note that space between items in a definition list is required.
3519(A variant that loosens this requirement, but disallows "lazy"
3520hard wrapping, can be activated with `compact_definition_lists`: see
3521[Non-pandoc extensions], below.)
3523[^3]: I have been influenced by the suggestions of [David Wheeler](https://justatheory.com/2009/02/modest-markdown-proposal/).
3525### Numbered example lists ###
3527#### Extension: `example_lists` ####
3529The special list marker `@` can be used for sequentially numbered
3530examples. The first list item with a `@` marker will be numbered '1',
3531the next '2', and so on, throughout the document. The numbered examples
3532need not occur in a single list; each new list using `@` will take up
3533where the last stopped. So, for example:
3535 (@) My first example will be numbered (1).
3536 (@) My second example will be numbered (2).
3538 Explanation of examples.
3540 (@) My third example will be numbered (3).
3542Numbered examples can be labeled and referred to elsewhere in the
3545 (@good) This is a good example.
3547 As (@good) illustrates, ...
3549The label can be any string of alphanumeric characters, underscores,
3552Note: continuation paragraphs in example lists must always
3553be indented four spaces, regardless of the length of the
3554list marker. That is, example lists always behave as if the
3555`four_space_rule` extension is set. This is because example
3556labels tend to be long, and indenting content to the
3557first non-space character after the label would be awkward.
3559### Compact and loose lists ###
3561Pandoc behaves differently from `Markdown.pl` on some "edge
3562cases" involving lists. Consider this source:
3572Pandoc transforms this into a "compact list" (with no `<p>` tags around
3573"First", "Second", or "Third"), while Markdown puts `<p>` tags around
3574"Second" and "Third" (but not "First"), because of the blank space
3575around "Third". Pandoc follows a simple rule: if the text is followed by
3576a blank line, it is treated as a paragraph. Since "Second" is followed
3577by a list, and not a blank line, it isn't treated as a paragraph. The
3578fact that the list is followed by a blank line is irrelevant. (Note:
3579Pandoc works this way even when the `markdown_strict` format is specified. This
3580behavior is consistent with the official Markdown syntax description,
3581even though it is different from that of `Markdown.pl`.)
3584### Ending a list ###
3586What if you want to put an indented code block after a list?
3593Trouble! Here pandoc (like other Markdown implementations) will treat
3594`{ my code block }` as the second paragraph of item two, and not as
3597To "cut off" the list after item two, you can insert some non-indented
3598content, like an HTML comment, which won't produce visible output in
3604 <!-- end of list -->
3608You can use the same trick if you want two consecutive lists instead
3623A line containing a row of three or more `*`, `-`, or `_` characters
3624(optionally separated by spaces) produces a horizontal rule:
3633Four kinds of tables may be used. The first three kinds presuppose the use of
3634a fixed-width font, such as Courier. The fourth kind can be used with
3635proportionally spaced fonts, as it does not require lining up columns.
3637#### Extension: `table_captions` ####
3639A caption may optionally be provided with all 4 kinds of tables (as
3640illustrated in the examples below). A caption is a paragraph beginning
3641with the string `Table:` (or just `:`), which will be stripped off.
3642It may appear either before or after the table.
3644#### Extension: `simple_tables` ####
3646Simple tables look like this:
3648 Right Left Center Default
3649 ------- ------ ---------- -------
3654 Table: Demonstration of simple table syntax.
3656The header and table rows must each fit on one line. Column
3657alignments are determined by the position of the header text relative
3658to the dashed line below it:[^4]
3660 - If the dashed line is flush with the header text on the right side
3661 but extends beyond it on the left, the column is right-aligned.
3662 - If the dashed line is flush with the header text on the left side
3663 but extends beyond it on the right, the column is left-aligned.
3664 - If the dashed line extends beyond the header text on both sides,
3665 the column is centered.
3666 - If the dashed line is flush with the header text on both sides,
3667 the default alignment is used (in most cases, this will be left).
3669[^4]: This scheme is due to Michel Fortin, who proposed it on the
3670 [Markdown discussion list](http://six.pairlist.net/pipermail/markdown-discuss/2005-March/001097.html).
3672The table must end with a blank line, or a line of dashes followed by
3675The column header row may be omitted, provided a dashed line is used
3676to end the table. For example:
3678 ------- ------ ---------- -------
3682 ------- ------ ---------- -------
3684When the header row is omitted, column alignments are determined on the basis
3685of the first line of the table body. So, in the tables above, the columns
3686would be right, left, center, and right aligned, respectively.
3688#### Extension: `multiline_tables` ####
3690Multiline tables allow header and table rows to span multiple lines
3691of text (but cells that span multiple columns or rows of the table are
3692not supported). Here is an example:
3694 -------------------------------------------------------------
3695 Centered Default Right Left
3696 Header Aligned Aligned Aligned
3697 ----------- ------- --------------- -------------------------
3698 First row 12.0 Example of a row that
3699 spans multiple lines.
3701 Second row 5.0 Here's another one. Note
3702 the blank line between
3704 -------------------------------------------------------------
3706 Table: Here's the caption. It, too, may span
3709These work like simple tables, but with the following differences:
3711 - They must begin with a row of dashes, before the header text
3712 (unless the header row is omitted).
3713 - They must end with a row of dashes, then a blank line.
3714 - The rows must be separated by blank lines.
3716In multiline tables, the table parser pays attention to the widths of
3717the columns, and the writers try to reproduce these relative widths in
3718the output. So, if you find that one of the columns is too narrow in the
3719output, try widening it in the Markdown source.
3721The header may be omitted in multiline tables as well as simple tables:
3723 ----------- ------- --------------- -------------------------
3724 First row 12.0 Example of a row that
3725 spans multiple lines.
3727 Second row 5.0 Here's another one. Note
3728 the blank line between
3730 ----------- ------- --------------- -------------------------
3732 : Here's a multiline table without a header.
3734It is possible for a multiline table to have just one row, but the row
3735should be followed by a blank line (and then the row of dashes that ends
3736the table), or the table may be interpreted as a simple table.
3738#### Extension: `grid_tables` ####
3740Grid tables look like this:
3742 : Sample grid table.
3744 +---------------+---------------+--------------------+
3745 | Fruit | Price | Advantages |
3746 +===============+===============+====================+
3747 | Bananas | $1.34 | - built-in wrapper |
3748 | | | - bright color |
3749 +---------------+---------------+--------------------+
3750 | Oranges | $2.10 | - cures scurvy |
3752 +---------------+---------------+--------------------+
3754The row of `=`s separates the header from the table body, and can be
3755omitted for a headerless table. The cells of grid tables may contain
3756arbitrary block elements (multiple paragraphs, code blocks, lists,
3757etc.). Cells that span multiple columns or rows are not
3758supported. Grid tables can be created easily using Emacs' table-mode
3759(`M-x table-insert`).
3761Alignments can be specified as with pipe tables, by putting
3762colons at the boundaries of the separator line after the
3765 +---------------+---------------+--------------------+
3766 | Right | Left | Centered |
3767 +==============:+:==============+:==================:+
3768 | Bananas | $1.34 | built-in wrapper |
3769 +---------------+---------------+--------------------+
3771For headerless tables, the colons go on the top line instead:
3773 +--------------:+:--------------+:------------------:+
3774 | Right | Left | Centered |
3775 +---------------+---------------+--------------------+
3777##### Grid Table Limitations #####
3779Pandoc does not support grid tables with row spans or column spans.
3780This means that neither variable numbers of columns across rows nor
3781variable numbers of rows across columns are supported by Pandoc.
3782All grid tables must have the same number of columns in each row,
3783and the same number of rows in each column. For example, the
3784Docutils [sample grid tables] will not render as expected with
3787[sample grid tables]: https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#grid-tables
3790#### Extension: `pipe_tables` ####
3792Pipe tables look like this:
3794 | Right | Left | Default | Center |
3795 |------:|:-----|---------|:------:|
3796 | 12 | 12 | 12 | 12 |
3797 | 123 | 123 | 123 | 123 |
3800 : Demonstration of pipe table syntax.
3802The syntax is identical to [PHP Markdown Extra tables]. The beginning and
3803ending pipe characters are optional, but pipes are required between all
3804columns. The colons indicate column alignment as shown. The header
3805cannot be omitted. To simulate a headerless table, include a header
3808Since the pipes indicate column boundaries, columns need not be vertically
3809aligned, as they are in the above example. So, this is a perfectly
3810legal (though ugly) pipe table:
3818The cells of pipe tables cannot contain block elements like paragraphs
3819and lists, and cannot span multiple lines. If a pipe table contains a
3820row whose Markdown content is wider than the column width (see
3821`--columns`), then the table will take up the full text width and
3822the cell contents will wrap, with the relative cell widths determined
3823by the number of dashes in the line separating the table header from
3824the table body. (For example `---|-` would make the first column 3/4
3825and the second column 1/4 of the full text width.)
3826On the other hand, if no lines are wider than column width, then
3827cell contents will not be wrapped, and the cells will be sized
3830Note: pandoc also recognizes pipe tables of the following
3831form, as can be produced by Emacs' orgtbl-mode:
3838The difference is that `+` is used instead of `|`. Other orgtbl features
3839are not supported. In particular, to get non-default column alignment,
3840you'll need to add colons as above.
3842[PHP Markdown Extra tables]: https://michelf.ca/projects/php-markdown/extra/#table
3846#### Extension: `pandoc_title_block` ####
3848If the file begins with a title block
3851 % author(s) (separated by semicolons)
3854it will be parsed as bibliographic information, not regular text. (It
3855will be used, for example, in the title of standalone LaTeX or HTML
3856output.) The block may contain just a title, a title and an author,
3857or all three elements. If you want to include an author but no
3858title, or a title and a date but no author, you need a blank line:
3871The title may occupy multiple lines, but continuation lines must
3872begin with leading space, thus:
3879If a document has multiple authors, the authors may be put on
3880separate lines with leading space, or separated by semicolons, or
3881both. So, all of the following are equivalent:
3889% Author One; Author Two
3897The date must fit on one line.
3899All three metadata fields may contain standard inline formatting
3900(italics, links, footnotes, etc.).
3902Title blocks will always be parsed, but they will affect the output only
3903when the `--standalone` (`-s`) option is chosen. In HTML output, titles
3904will appear twice: once in the document head -- this is the title that
3905will appear at the top of the window in a browser -- and once at the
3906beginning of the document body. The title in the document head can have
3907an optional prefix attached (`--title-prefix` or `-T` option). The title
3908in the body appears as an H1 element with class "title", so it can be
3909suppressed or reformatted with CSS. If a title prefix is specified with
3910`-T` and no title block appears in the document, the title prefix will
3911be used by itself as the HTML title.
3913The man page writer extracts a title, man page section number, and
3914other header and footer information from the title line. The title
3915is assumed to be the first word on the title line, which may optionally
3916end with a (single-digit) section number in parentheses. (There should
3917be no space between the title and the parentheses.) Anything after
3918this is assumed to be additional footer and header text. A single pipe
3919character (`|`) should be used to separate the footer text from the header
3924will yield a man page with the title `PANDOC` and section 1.
3926 % PANDOC(1) Pandoc User Manuals
3928will also have "Pandoc User Manuals" in the footer.
3930 % PANDOC(1) Pandoc User Manuals | Version 4.0
3932will also have "Version 4.0" in the header.
3934#### Extension: `yaml_metadata_block` ####
3936A [YAML] metadata block is a valid YAML object, delimited by a line of three
3937hyphens (`---`) at the top and a line of three hyphens (`---`) or three dots
3938(`...`) at the bottom. A YAML metadata block may occur anywhere in the
3939document, but if it is not at the beginning, it must be preceded by a blank
3940line. (Note that, because of the way pandoc concatenates input files when
3941several are provided, you may also keep the metadata in a separate YAML file
3942and pass it to pandoc as an argument, along with your Markdown files:
3944 pandoc chap1.md chap2.md chap3.md metadata.yaml -s -o book.html
3946Just be sure that the YAML file begins with `---` and ends with `---` or
3947`...`.) Alternatively, you can use the `--metadata-file` option. Using
3948that approach however, you cannot reference content (like footnotes)
3949from the main markdown input document.
3951Metadata will be taken from the fields of the YAML object and added to any
3952existing document metadata. Metadata can contain lists and objects (nested
3953arbitrarily), but all string scalars will be interpreted as Markdown. Fields
3954with names ending in an underscore will be ignored by pandoc. (They may be
3955given a role by external processors.) Field names must not be
3956interpretable as YAML numbers or boolean values (so, for
3957example, `yes`, `True`, and `15` cannot be used as field names).
3959A document may contain multiple metadata blocks. If two
3960metadata blocks attempt to set the same field, the value from
3961the second block will be taken.
3963When pandoc is used with `-t markdown` to create a Markdown document,
3964a YAML metadata block will be produced only if the `-s/--standalone`
3965option is used. All of the metadata will appear in a single block
3966at the beginning of the document.
3968Note that [YAML] escaping rules must be followed. Thus, for example,
3969if a title contains a colon, it must be quoted. The pipe character
3970(`|`) can be used to begin an indented block that will be interpreted
3971literally, without need for escaping. This form is necessary
3972when the field contains blank lines or block-level formatting:
3975 title: 'This is the title: it contains a colon'
3979 keywords: [nothing, nothingness]
3981 This is the abstract.
3983 It consists of two paragraphs.
3986Template variables will be set automatically from the metadata. Thus, for
3987example, in writing HTML, the variable `abstract` will be set to the HTML
3988equivalent of the Markdown in the `abstract` field:
3990 <p>This is the abstract.</p>
3991 <p>It consists of two paragraphs.</p>
3993Variables can contain arbitrary YAML structures, but the template must match
3994this structure. The `author` variable in the default templates expects a
3995simple list or string, but can be changed to support more complicated
3996structures. The following combination, for example, would add an affiliation
3997to the author if one is given:
4000 title: The document title
4003 affiliation: University of Somewhere
4005 affiliation: University of Nowhere
4008To use the structured authors in the example above, you would need a custom
4013 $author.name$$if(author.affiliation)$ ($author.affiliation$)$endif$
4019Raw content to include in the document's header may be specified
4020using `header-includes`; however, it is important to mark up
4021this content as raw code for a particular output format, using
4022the [`raw_attribute` extension](#extension-raw_attribute)), or it
4023will be interpreted as markdown. For example:
4028 \let\oldsection\section
4029 \renewcommand{\section}[1]{\clearpage\oldsection{#1}}
4034#### Extension: `all_symbols_escapable` ####
4036Except inside a code block or inline code, any punctuation or space
4037character preceded by a backslash will be treated literally, even if it
4038would normally indicate formatting. Thus, for example, if one writes
4048 <strong>hello</strong>
4050This rule is easier to remember than standard Markdown's rule,
4051which allows only the following characters to be backslash-escaped:
4055(However, if the `markdown_strict` format is used, the standard Markdown rule
4058A backslash-escaped space is parsed as a nonbreaking space. In TeX output,
4059it will appear as `~`. In HTML and XML output, it will appear as a
4060literal unicode nonbreaking space character (note that it will thus
4061actually look "invisible" in the generated HTML source; you can still
4062use the `--ascii` command-line option to make it appear as an explicit
4065A backslash-escaped newline (i.e. a backslash occurring at the end of
4066a line) is parsed as a hard line break. It will appear in TeX output as
4067`\\` and in HTML as `<br />`. This is a nice alternative to
4068Markdown's "invisible" way of indicating hard line breaks using
4069two trailing spaces on a line.
4071Backslash escapes do not work in verbatim contexts.
4077To *emphasize* some text, surround it with `*`s or `_`, like this:
4079 This text is _emphasized with underscores_, and this
4080 is *emphasized with asterisks*.
4082Double `*` or `_` produces **strong emphasis**:
4084 This is **strong emphasis** and __with underscores__.
4086A `*` or `_` character surrounded by spaces, or backslash-escaped,
4087will not trigger emphasis:
4089 This is * not emphasized *, and \*neither is this\*.
4091#### Extension: `intraword_underscores` ####
4093Because `_` is sometimes used inside words and identifiers,
4094pandoc does not interpret a `_` surrounded by alphanumeric
4095characters as an emphasis marker. If you want to emphasize
4096just part of a word, use `*`:
4098 feas*ible*, not feas*able*.
4103#### Extension: `strikeout` ####
4105To strikeout a section of text with a horizontal line, begin and end it
4106with `~~`. Thus, for example,
4108 This ~~is deleted text.~~
4111### Superscripts and subscripts ###
4113#### Extension: `superscript`, `subscript` ####
4115Superscripts may be written by surrounding the superscripted text by `^`
4116characters; subscripts may be written by surrounding the subscripted
4117text by `~` characters. Thus, for example,
4119 H~2~O is a liquid. 2^10^ is 1024.
4121The text between `^...^` or `~...~` may not contain spaces or
4122newlines. If the superscripted or subscripted text contains
4123spaces, these spaces must be escaped with backslashes. (This is
4124to prevent accidental superscripting and subscripting through
4125the ordinary use of `~` and `^`, and also bad interactions with
4126footnotes.) Thus, if you want the letter P with 'a cat' in
4127subscripts, use `P~a\ cat~`, not `P~a cat~`.
4131To make a short span of text verbatim, put it inside backticks:
4133 What is the difference between `>>=` and `>>`?
4135If the verbatim text includes a backtick, use double backticks:
4137 Here is a literal backtick `` ` ``.
4139(The spaces after the opening backticks and before the closing
4140backticks will be ignored.)
4142The general rule is that a verbatim span starts with a string
4143of consecutive backticks (optionally followed by a space)
4144and ends with a string of the same number of backticks (optionally
4145preceded by a space).
4147Note that backslash-escapes (and other Markdown constructs) do not
4148work in verbatim contexts:
4150 This is a backslash followed by an asterisk: `\*`.
4152#### Extension: `inline_code_attributes` ####
4154Attributes can be attached to verbatim text, just as with
4155[fenced code blocks]:
4161To write small caps, use the `smallcaps` class:
4163 [Small caps]{.smallcaps}
4165Or, without the `bracketed_spans` extension:
4167 <span class="smallcaps">Small caps</span>
4169For compatibility with other Markdown flavors, CSS is also supported:
4171 <span style="font-variant:small-caps;">Small caps</span>
4173This will work in all output formats that support small caps.
4178#### Extension: `tex_math_dollars` ####
4180Anything between two `$` characters will be treated as TeX math. The
4181opening `$` must have a non-space character immediately to its right,
4182while the closing `$` must have a non-space character immediately to its
4183left, and must not be followed immediately by a digit. Thus,
4184`$20,000 and $30,000` won't parse as math. If for some reason
4185you need to enclose text in literal `$` characters, backslash-escape
4186them and they won't be treated as math delimiters.
4188For display math, use `$$` delimiters. (In this case, the delimiters
4189may be separated from the formula by whitespace.)
4191TeX math will be printed in all output formats. How it is rendered
4192depends on the output format:
4195 ~ It will appear verbatim surrounded by `\(...\)` (for inline
4196 math) or `\[...\]` (for display math).
4198Markdown, Emacs Org mode, ConTeXt, ZimWiki
4199 ~ It will appear verbatim surrounded by `$...$` (for inline
4200 math) or `$$...$$` (for display math).
4203 ~ It will appear verbatim surrounded by `{{formula}}..{{/formula}}`.
4206 ~ It will be rendered using an [interpreted text role `:math:`].
4209 ~ For AsciiDoc output format (`-t asciidoc`) it will appear verbatim
4210 surrounded by `latexmath:[$...$]` (for inline math) or
4211 `[latexmath]++++\[...\]+++` (for display math).
4212 For AsciiDoctor output format (`-t asciidoctor`) the LaTex delimiters
4213 (`$..$` and `\[..\]`) are omitted.
4216 ~ It will be rendered inside a `@math` command.
4218roff man, Jira markup
4219 ~ It will be rendered verbatim without `$`'s.
4222 ~ It will be rendered inside `<math>` tags.
4225 ~ It will be rendered inside `<span class="math">` tags.
4228 ~ It will be rendered, if possible, using Unicode characters,
4229 and will otherwise appear verbatim.
4232 ~ It will be rendered, if possible, using MathML.
4235 ~ If the `--mathml` flag is used, it will be rendered using MathML
4236 in an `inlineequation` or `informalequation` tag. Otherwise it
4237 will be rendered, if possible, using Unicode characters.
4240 ~ It will be rendered using OMML math markup.
4243 ~ If the `--webtex` option is used, formulas are rendered as images
4244 using CodeCogs or other compatible web service, downloaded
4245 and embedded in the e-book. Otherwise, they will appear verbatim.
4247HTML, Slidy, DZSlides, S5, EPUB
4248 ~ The way math is rendered in HTML will depend on the
4249 command-line options selected. Therefore see [Math rendering in HTML]
4252[interpreted text role `:math:`]: https://docutils.sourceforge.io/docs/ref/rst/roles.html#math
4256#### Extension: `raw_html` ####
4258Markdown allows you to insert raw HTML (or DocBook) anywhere in a document
4259(except verbatim contexts, where `<`, `>`, and `&` are interpreted
4260literally). (Technically this is not an extension, since standard
4261Markdown allows it, but it has been made an extension so that it can
4262be disabled if desired.)
4264The raw HTML is passed through unchanged in HTML, S5, Slidy, Slideous,
4265DZSlides, EPUB, Markdown, CommonMark, Emacs Org mode, and Textile
4266output, and suppressed in other formats.
4268For a more explicit way of including raw HTML in a Markdown
4269document, see the [`raw_attribute` extension][Extension: `raw_attribute`].
4271In the CommonMark format, if `raw_html` is enabled, superscripts,
4272subscripts, strikeouts and small capitals will be represented as HTML.
4273Otherwise, plain-text fallbacks will be used. Note that even if
4274`raw_html` is disabled, tables will be rendered with HTML syntax if
4275they cannot use pipe syntax.
4277#### Extension: `markdown_in_html_blocks` ####
4279Standard Markdown allows you to include HTML "blocks": blocks
4280of HTML between balanced tags that are separated from the surrounding text
4281with blank lines, and start and end at the left margin. Within
4282these blocks, everything is interpreted as HTML, not Markdown;
4283so (for example), `*` does not signify emphasis.
4285Pandoc behaves this way when the `markdown_strict` format is used; but
4286by default, pandoc interprets material between HTML block tags as Markdown.
4287Thus, for example, pandoc will turn
4292 <td>[a link](https://google.com)</td>
4300 <td><em>one</em></td>
4301 <td><a href="https://google.com">a link</a></td>
4305whereas `Markdown.pl` will preserve it as is.
4307There is one exception to this rule: text between `<script>` and
4308`<style>` tags is not interpreted as Markdown.
4310This departure from standard Markdown should make it easier to mix
4311Markdown with HTML block elements. For example, one can surround
4312a block of Markdown text with `<div>` tags without preventing it
4313from being interpreted as Markdown.
4315#### Extension: `native_divs` ####
4317Use native pandoc `Div` blocks for content inside `<div>` tags.
4318For the most part this should give the same output as
4319`markdown_in_html_blocks`, but it makes it easier to write pandoc
4320filters to manipulate groups of blocks.
4322#### Extension: `native_spans` ####
4324Use native pandoc `Span` blocks for content inside `<span>` tags.
4325For the most part this should give the same output as `raw_html`,
4326but it makes it easier to write pandoc filters to manipulate groups
4329#### Extension: `raw_tex` ####
4331In addition to raw HTML, pandoc allows raw LaTeX, TeX, and ConTeXt to be
4332included in a document. Inline TeX commands will be preserved and passed
4333unchanged to the LaTeX and ConTeXt writers. Thus, for example, you can use
4334LaTeX to include BibTeX citations:
4336 This result was proved in \cite{jones.1967}.
4338Note that in LaTeX environments, like
4340 \begin{tabular}{|l|l|}\hline
4341 Age & Frequency \\ \hline
4344 36--45 & 22 \\ \hline
4347the material between the begin and end tags will be interpreted as raw
4348LaTeX, not as Markdown.
4350For a more explicit and flexible way of including raw TeX in a
4351Markdown document, see the [`raw_attribute`
4352extension][Extension: `raw_attribute`].
4354Inline LaTeX is ignored in output formats other than Markdown, LaTeX,
4355Emacs Org mode, and ConTeXt.
4357### Generic raw attribute ###
4359#### Extension: `raw_attribute` ####
4361Inline spans and fenced code blocks with a special
4362kind of attribute will be parsed as raw content with the
4363designated format. For example, the following produces a raw
4370And the following produces a raw `html` inline element:
4372 This is `<a>html</a>`{=html}
4374This can be useful to insert raw xml into `docx` documents, e.g.
4380 <w:br w:type="page"/>
4385The format name should match the target format name (see
4386`-t/--to`, above, for a list, or use `pandoc
4387--list-output-formats`). Use `openxml` for `docx` output,
4388`opendocument` for `odt` output, `html5` for `epub3` output,
4389`html4` for `epub2` output, and `latex`, `beamer`,
4390`ms`, or `html5` for `pdf` output (depending on what you
4391use for `--pdf-engine`).
4393This extension presupposes that the relevant kind of
4394inline code or fenced code block is enabled. Thus, for
4395example, to use a raw attribute with a backtick code block,
4396`backtick_code_blocks` must be enabled.
4398The raw attribute cannot be combined with regular attributes.
4402#### Extension: `latex_macros` ####
4404When this extension is enabled, pandoc will parse LaTeX
4405macro definitions and apply the resulting macros to all LaTeX
4406math and raw LaTeX. So, for example, the following will work in
4407all output formats, not just LaTeX:
4409 \newcommand{\tuple}[1]{\langle #1 \rangle}
4413Note that LaTeX macros will not be applied if they occur
4414inside a raw span or block marked with the
4415[`raw_attribute` extension](#extension-raw_attribute).
4417When `latex_macros` is disabled, the raw LaTeX and math will
4418not have macros applied. This is usually a better approach when
4419you are targeting LaTeX or PDF.
4421Macro definitions in LaTeX will be passed through as raw LaTeX
4422only if `latex_macros` is not enabled. Macro definitions in
4423Markdown source (or other formats allowing `raw_tex`) will
4424be passed through regardless of whether `latex_macros` is
4429Markdown allows links to be specified in several ways.
4431### Automatic links ###
4433If you enclose a URL or email address in pointy brackets, it
4436 <https://google.com>
4437 <sam@green.eggs.ham>
4441An inline link consists of the link text in square brackets,
4442followed by the URL in parentheses. (Optionally, the URL can
4443be followed by a link title, in quotes.)
4445 This is an [inline link](/url), and here's [one with
4446 a title](https://fsf.org "click here for a good time!").
4448There can be no space between the bracketed part and the parenthesized part.
4449The link text can contain formatting (such as emphasis), but the title cannot.
4451Email addresses in inline links are not autodetected, so they have to be
4452prefixed with `mailto`:
4454 [Write me!](mailto:sam@green.eggs.ham)
4456### Reference links ###
4458An *explicit* reference link has two parts, the link itself and the link
4459definition, which may occur elsewhere in the document (either
4460before or after the link).
4462The link consists of link text in square brackets, followed by a label in
4463square brackets. (There cannot be space between the two unless the
4464`spaced_reference_links` extension is enabled.) The link definition
4465consists of the bracketed label, followed by a colon and a space, followed by
4466the URL, and optionally (after a space) a link title either in quotes or in
4467parentheses. The label must not be parseable as a citation (assuming
4468the `citations` extension is enabled): citations take precedence over
4471Here are some examples:
4473 [my label 1]: /foo/bar.html "My title, optional"
4475 [my label 3]: https://fsf.org (The free software foundation)
4476 [my label 4]: /bar#special 'A title in single quotes'
4478The URL may optionally be surrounded by angle brackets:
4480 [my label 5]: <http://foo.bar.baz>
4482The title may go on the next line:
4484 [my label 3]: https://fsf.org
4485 "The free software foundation"
4487Note that link labels are not case sensitive. So, this will work:
4489 Here is [my link][FOO]
4493In an *implicit* reference link, the second pair of brackets is
4498 [my website]: http://foo.bar.baz
4500Note: In `Markdown.pl` and most other Markdown implementations,
4501reference link definitions cannot occur in nested constructions
4502such as list items or block quotes. Pandoc lifts this arbitrary
4503seeming restriction. So the following is fine in pandoc, though
4504not in most other implementations:
4510#### Extension: `shortcut_reference_links` ####
4512In a *shortcut* reference link, the second pair of brackets may
4517 [my website]: http://foo.bar.baz
4519### Internal links ###
4521To link to another section of the same document, use the automatically
4522generated identifier (see [Heading identifiers]). For example:
4524 See the [Introduction](#introduction).
4528 See the [Introduction].
4530 [Introduction]: #introduction
4532Internal links are currently supported for HTML formats (including
4533HTML slide shows and EPUB), LaTeX, and ConTeXt.
4537A link immediately preceded by a `!` will be treated as an image.
4538The link text will be used as the image's alt text:
4540 
4544 [movie reel]: movie.gif
4546#### Extension: `implicit_figures` ####
4548An image with nonempty alt text, occurring by itself in a
4549paragraph, will be rendered as a figure with a caption. The
4550image's alt text will be used as the caption.
4552 
4554How this is rendered depends on the output format. Some output
4555formats (e.g. RTF) do not yet support figures. In those
4556formats, you'll just get an image in a paragraph by itself, with
4559If you just want a regular inline image, just make sure it is not
4560the only thing in the paragraph. One way to do this is to insert a
4561nonbreaking space after the image:
4563 \
4565Note that in reveal.js slide shows, an image in a paragraph
4566by itself that has the `stretch` class will fill the screen,
4567and the caption and figure tags will be omitted.
4569#### Extension: `link_attributes` ####
4571Attributes can be set on links and images:
4573 An inline {#id .class width=30 height=20px}
4574 and a reference ![image][ref] with attributes.
4576 [ref]: foo.jpg "optional title" {#id .class key=val key2="val 2"}
4578(This syntax is compatible with [PHP Markdown Extra] when only `#id`
4579and `.class` are used.)
4581For HTML and EPUB, all known HTML5 attributes except `width` and
4582`height` (but including `srcset` and `sizes`) are passed through
4583as is. Unknown attributes are passed through as custom
4584attributes, with `data-` prepended. The other writers ignore
4585attributes that are not specifically supported by their output format.
4587The `width` and `height` attributes on images are treated specially. When
4588used without a unit, the unit is assumed to be pixels. However, any of
4589the following unit identifiers can be used: `px`, `cm`, `mm`, `in`, `inch`
4590and `%`. There must not be any spaces between the number and the unit.
4594{ width=50% }
4597- Dimensions may be converted to a form that is compatible with
4598 the output format (for example, dimensions given in pixels will
4599 be converted to inches when converting HTML to LaTeX). Conversion
4600 between pixels and physical measurements is affected by the
4601 `--dpi` option (by default, 96 dpi is assumed, unless the image
4602 itself contains dpi information).
4603- The `%` unit is generally relative to some available space.
4604 For example the above example will render to the following.
4605 - HTML: `<img href="file.jpg" style="width: 50%;" />`
4606 - LaTeX: `\includegraphics[width=0.5\textwidth,height=\textheight]{file.jpg}`
4607 (If you're using a custom template, you need to configure `graphicx`
4608 as in the default template.)
4609 - ConTeXt: `\externalfigure[file.jpg][width=0.5\textwidth]`
4610- Some output formats have a notion of a class
4611 ([ConTeXt](https://wiki.contextgarden.net/Using_Graphics#Multiple_Image_Settings))
4612 or a unique identifier (LaTeX `\caption`), or both (HTML).
4613- When no `width` or `height` attributes are specified, the fallback
4614 is to look at the image resolution and the dpi metadata embedded in
4619Using the `native_divs` and `native_spans` extensions
4620(see [above][Extension: `native_divs`]), HTML syntax can
4621be used as part of markdown to create native `Div` and `Span`
4622elements in the pandoc AST (as opposed to raw HTML).
4623However, there is also nicer syntax available:
4625#### Extension: `fenced_divs` ####
4627Allow special fenced syntax for native `Div` blocks. A Div
4628starts with a fence containing at least three consecutive
4629colons plus some attributes. The attributes may optionally
4630be followed by another string of consecutive colons.
4631The attribute syntax is exactly as in fenced code blocks (see
4632[Extension: `fenced_code_attributes`]). As with fenced
4633code blocks, one can use either attributes in curly braces
4634or a single unbraced word, which will be treated as a class
4635name. The Div ends with another line containing a string of at
4636least three consecutive colons. The fenced Div should be
4637separated by blank lines from preceding and following blocks.
4641 ::::: {#special .sidebar}
4642 Here is a paragraph.
4647Fenced divs can be nested. Opening fences are distinguished
4648because they *must* have attributes:
4654 This is a warning within a warning.
4658Fences without attributes are always closing fences. Unlike
4659with fenced code blocks, the number of colons in the closing
4660fence need not match the number in the opening fence. However,
4661it can be helpful for visual clarity to use fences of different
4662lengths to distinguish nested divs from their parents.
4665#### Extension: `bracketed_spans` ####
4667A bracketed sequence of inlines, as one would use to begin
4668a link, will be treated as a `Span` with attributes if it is
4669followed immediately by attributes:
4671 [This is *some text*]{.class key="val"}
4675#### Extension: `footnotes` ####
4677Pandoc's Markdown allows footnotes, using the following syntax:
4679 Here is a footnote reference,[^1] and another.[^longnote]
4681 [^1]: Here is the footnote.
4683 [^longnote]: Here's one with multiple blocks.
4685 Subsequent paragraphs are indented to show that they
4686 belong to the previous footnote.
4690 The whole paragraph can be indented, or just the first
4691 line. In this way, multi-paragraph footnotes work like
4692 multi-paragraph list items.
4694 This paragraph won't be part of the note, because it
4697The identifiers in footnote references may not contain spaces, tabs,
4698or newlines. These identifiers are used only to correlate the
4699footnote reference with the note itself; in the output, footnotes
4700will be numbered sequentially.
4702The footnotes themselves need not be placed at the end of the
4703document. They may appear anywhere except inside other block elements
4704(lists, block quotes, tables, etc.). Each footnote should be
4705separated from surrounding content (including other footnotes)
4708#### Extension: `inline_notes` ####
4710Inline footnotes are also allowed (though, unlike regular notes,
4711they cannot contain multiple paragraphs). The syntax is as follows:
4713 Here is an inline note.^[Inlines notes are easier to write, since
4714 you don't have to pick an identifier and move down to type the
4717Inline and regular footnotes may be mixed freely.
4721#### Extension: `citations` ####
4723Using an external filter, `pandoc-citeproc`, pandoc can automatically generate
4724citations and a bibliography in a number of styles. Basic usage is
4726 pandoc --filter pandoc-citeproc myinput.txt
4728In order to use this feature, you will need to specify a bibliography file
4729using the `bibliography` metadata field in a YAML metadata section, or
4730`--bibliography` command line argument. You can supply multiple `--bibliography`
4731arguments or set `bibliography` metadata field to YAML array, if you want to
4732use multiple bibliography files. The bibliography may have any of these
4735 Format File extension
4736 ------------ --------------
4749Note that `.bib` can be used with both BibTeX and BibLaTeX files;
4750use `.bibtex` to force BibTeX.
4752Note that `pandoc-citeproc --bib2json` and `pandoc-citeproc --bib2yaml`
4753can produce `.json` and `.yaml` files from any of the supported formats.
4755In-field markup: In BibTeX and BibLaTeX databases,
4756pandoc-citeproc parses a subset of LaTeX markup; in CSL YAML
4757databases, pandoc Markdown; and in CSL JSON databases, an
4758[HTML-like markup][CSL markup specs]:
4766`<span style="font-variant:small-caps;">...</span>` or `<sc>...</sc>`
4775`<span class="nocase">...</span>`
4776: prevent a phrase from being capitalized as title case
4778`pandoc-citeproc -j` and `-y` interconvert the CSL JSON
4779and CSL YAML formats as far as possible.
4781As an alternative to specifying a bibliography file using `--bibliography`
4782or the YAML metadata field `bibliography`, you can include
4783the citation data directly in the `references` field of the
4784document's YAML metadata. The field should contain an array of
4785YAML-encoded references, for example:
4789 - type: article-journal
4801 title: 'Molecular structure of nucleic acids: a structure for deoxyribose
4803 title-short: Molecular structure of nucleic acids
4804 container-title: Nature
4808 DOI: 10.1038/171737a0
4809 URL: https://www.nature.com/articles/171737a0
4813(`pandoc-citeproc --bib2yaml` can produce these from a bibliography file in one
4814of the supported formats.)
4816Citations and references can be formatted using any style supported by the
4817[Citation Style Language], listed in the [Zotero Style Repository].
4818These files are specified using the `--csl` option or the `csl` metadata field.
4819By default, `pandoc-citeproc` will use the [Chicago Manual of Style] author-date
4820format. The CSL project provides further information on [finding and editing styles].
4822To make your citations hyperlinks to the corresponding bibliography
4823entries, add `link-citations: true` to your YAML metadata.
4825Citations go inside square brackets and are separated by semicolons.
4826Each citation must have a key, composed of '@' + the citation
4827identifier from the database, and may optionally have a prefix,
4828a locator, and a suffix. The citation key must begin with a letter, digit,
4829or `_`, and may contain alphanumerics, `_`, and internal punctuation
4830characters (`:.#$%&-+?<>~/`). Here are some examples:
4832 Blah blah [see @doe99, pp. 33-35; also @smith04, chap. 1].
4834 Blah blah [@doe99, pp. 33-35, 38-39 and *passim*].
4836 Blah blah [@smith04; @doe99].
4838`pandoc-citeproc` detects locator terms in the [CSL locale files].
4839Either abbreviated or unabbreviated forms are accepted. In the `en-US`
4840locale, locator terms can be written in either singular or plural forms,
4841as `book`, `bk.`/`bks.`; `chapter`, `chap.`/`chaps.`; `column`,
4842`col.`/`cols.`; `figure`, `fig.`/`figs.`; `folio`, `fol.`/`fols.`;
4843`number`, `no.`/`nos.`; `line`, `l.`/`ll.`; `note`, `n.`/`nn.`; `opus`,
4844`op.`/`opp.`; `page`, `p.`/`pp.`; `paragraph`, `para.`/`paras.`; `part`,
4845`pt.`/`pts.`; `section`, `sec.`/`secs.`; `sub verbo`, `s.v.`/`s.vv.`;
4846`verse`, `v.`/`vv.`; `volume`, `vol.`/`vols.`; `¶`/`¶¶`; `§`/`§§`. If no
4847locator term is used, "page" is assumed.
4849`pandoc-citeproc` will use heuristics to distinguish the locator
4850from the suffix. In complex cases, the locator can be enclosed
4851in curly braces (using `pandoc-citeproc` 0.15 and higher only):
4853 [@smith{ii, A, D-Z}, with a suffix]
4854 [@smith, {pp. iv, vi-xi, (xv)-(xvii)} with suffix here]
4856A minus sign (`-`) before the `@` will suppress mention of
4857the author in the citation. This can be useful when the
4858author is already mentioned in the text:
4860 Smith says blah [-@smith04].
4862You can also write an in-text citation, as follows:
4866 @smith04 [p. 33] says blah.
4868If the style calls for a list of works cited, it will be placed
4869in a div with id `refs`, if one exists:
4874Otherwise, it will be placed at the end of the document.
4875Generation of the bibliography can be suppressed by setting
4876`suppress-bibliography: true` in the YAML metadata.
4878If you wish the bibliography to have a section heading, you can
4879set `reference-section-title` in the metadata, or put the heading
4880at the beginning of the div with id `refs` (if you are using it)
4881or at the end of your document:
4887The bibliography will be inserted after this heading. Note that
4888the `unnumbered` class will be added to this heading, so that the
4889section will not be numbered.
4891If you want to include items in the bibliography without actually
4892citing them in the body text, you can define a dummy `nocite` metadata
4893field and put the citations there:
4902In this example, the document will contain a citation for `item3`
4903only, but the bibliography will contain entries for `item1`, `item2`, and
4906It is possible to create a bibliography with all the citations,
4907whether or not they appear in the document, by using a wildcard:
4914For LaTeX output, you can also use [`natbib`] or [`biblatex`] to
4915render the bibliography. In order to do so, specify bibliography
4916files as outlined above, and add `--natbib` or `--biblatex`
4917argument to `pandoc` invocation. Bear in mind that bibliography
4918files have to be in respective format (either BibTeX or
4921For more information, see the [pandoc-citeproc man page].
4923[CSL markup specs]: https://docs.citationstyles.org/en/1.0/release-notes.html#rich-text-markup-within-fields
4924[Chicago Manual of Style]: https://chicagomanualofstyle.org
4925[Citation Style Language]: https://citationstyles.org
4926[Zotero Style Repository]: https://www.zotero.org/styles
4927[finding and editing styles]: https://citationstyles.org/authors/
4928[CSL locale files]: https://github.com/citation-style-language/locales
4929[pandoc-citeproc man page]: https://github.com/jgm/pandoc-citeproc/blob/master/man/pandoc-citeproc.1.md
4931## Non-pandoc extensions
4933The following Markdown syntax extensions are not enabled by default
4934in pandoc, but may be enabled by adding `+EXTENSION` to the format
4935name, where `EXTENSION` is the name of the extension. Thus, for
4936example, `markdown+hard_line_breaks` is Markdown with hard line breaks.
4938#### Extension: `attributes` ####
4940Allows attributes to be attached to any inline or block-level
4941element. The syntax for the attributes is the same as that
4942used in [`header_attributes`][Extension: `header_attributes`].
4944- Attributes that occur immediately after an inline
4945 element affect that element. If they follow a space, then they
4946 belong to the space. (Hence, this option subsumes
4947 `inline_code_attributes` and `link_attributes`.)
4948- Attributes that occur immediately before a block
4949 element, on a line by themselves, affect that
4951- Consecutive attribute specifiers may be used,
4952 either for blocks or for inlines. Their attributes
4954- Attributes that occur at the end of the text of
4955 a Setext or ATX heading (separated by whitespace
4956 from the text) affect the heading element. (Hence, this
4957 option subsumes `header_attributes`.)
4958- Attributes that occur after the opening fence
4959 in a fenced code block affect the code block element. (Hence,
4960 this option subsumes `fenced_code_attributes`.)
4961- Attributes that occur at the end of a reference
4962 link definition affect links that refer to that
4965Note that pandoc's AST does not currently allow attributes
4966to be attached to arbitrary elements. Hence a Span or Div
4967container will be added if needed.
4969#### Extension: `old_dashes` ####
4971Selects the pandoc <= 1.8.2.1 behavior for parsing smart dashes:
4972`-` before a numeral is an en-dash, and `--` is an em-dash.
4973This option only has an effect if `smart` is enabled. It is
4974selected automatically for `textile` input.
4976#### Extension: `angle_brackets_escapable` ####
4978Allow `<` and `>` to be backslash-escaped, as they can be in
4979GitHub flavored Markdown but not original Markdown. This is
4980implied by pandoc's default `all_symbols_escapable`.
4982#### Extension: `lists_without_preceding_blankline` ####
4984Allow a list to occur right after a paragraph, with no intervening
4987#### Extension: `four_space_rule` ####
4989Selects the pandoc <= 2.0 behavior for parsing lists, so that
4990four spaces indent are needed for list item continuation
4993#### Extension: `spaced_reference_links` ####
4995Allow whitespace between the two components of a reference link,
5000#### Extension: `hard_line_breaks` ####
5002Causes all newlines within a paragraph to be interpreted as hard line
5003breaks instead of spaces.
5005#### Extension: `ignore_line_breaks` ####
5007Causes newlines within a paragraph to be ignored, rather than being
5008treated as spaces or as hard line breaks. This option is intended for
5009use with East Asian languages where spaces are not used between words,
5010but text is divided into lines for readability.
5012#### Extension: `east_asian_line_breaks` ####
5014Causes newlines within a paragraph to be ignored, rather than
5015being treated as spaces or as hard line breaks, when they occur
5016between two East Asian wide characters. This is a better choice
5017than `ignore_line_breaks` for texts that include a mix of East
5018Asian wide characters and other characters.
5020#### Extension: `emoji` ####
5022Parses textual emojis like `:smile:` as Unicode emoticons.
5024#### Extension: `tex_math_single_backslash` ####
5026Causes anything between `\(` and `\)` to be interpreted as inline
5027TeX math, and anything between `\[` and `\]` to be interpreted
5028as display TeX math. Note: a drawback of this extension is that
5029it precludes escaping `(` and `[`.
5031#### Extension: `tex_math_double_backslash` ####
5033Causes anything between `\\(` and `\\)` to be interpreted as inline
5034TeX math, and anything between `\\[` and `\\]` to be interpreted
5037#### Extension: `markdown_attribute` ####
5039By default, pandoc interprets material inside block-level tags as Markdown.
5040This extension changes the behavior so that Markdown is only parsed
5041inside block-level tags if the tags have the attribute `markdown=1`.
5043#### Extension: `mmd_title_block` ####
5045Enables a [MultiMarkdown] style title block at the top of
5046the document, for example:
5050 Date: September 1, 2008
5051 Comment: This is a sample mmd title block, with
5052 a field spanning multiple lines.
5054See the MultiMarkdown documentation for details. If `pandoc_title_block` or
5055`yaml_metadata_block` is enabled, it will take precedence over
5058#### Extension: `abbreviations` ####
5060Parses PHP Markdown Extra abbreviation keys, like
5062 *[HTML]: Hypertext Markup Language
5064Note that the pandoc document model does not support
5065abbreviations, so if this extension is enabled, abbreviation keys are
5066simply skipped (as opposed to being parsed as paragraphs).
5068#### Extension: `autolink_bare_uris` ####
5070Makes all absolute URIs into links, even when not surrounded by
5071pointy braces `<...>`.
5073#### Extension: `mmd_link_attributes` ####
5075Parses multimarkdown style key-value attributes on link
5076and image references. This extension should not be confused with the
5077[`link_attributes`](#extension-link_attributes) extension.
5079 This is a reference ![image][ref] with multimarkdown attributes.
5081 [ref]: https://path.to/image "Image title" width=20px height=30px
5082 id=myId class="myClass1 myClass2"
5084#### Extension: `mmd_header_identifiers` ####
5086Parses multimarkdown style heading identifiers (in square brackets,
5087after the heading but before any trailing `#`s in an ATX heading).
5089#### Extension: `compact_definition_lists` ####
5091Activates the definition list syntax of pandoc 1.12.x and earlier.
5092This syntax differs from the one described above under [Definition lists]
5095 - No blank line is required between consecutive items of the
5097 - To get a "tight" or "compact" list, omit space between consecutive
5098 items; the space between a term and its definition does not affect
5100 - Lazy wrapping of paragraphs is not allowed: the entire definition must
5101 be indented four spaces.[^6]
5103[^6]: To see why laziness is incompatible with relaxing the requirement
5104 of a blank line between items, consider the following example:
5111 Is this a single list item with two definitions of "bar," the first of
5112 which is lazily wrapped, or two list items? To remove the ambiguity
5113 we must either disallow lazy wrapping or require a blank line between
5116#### Extension: `gutenberg` ####
5118Use [Project Gutenberg] conventions for `plain` output:
5119all-caps for strong emphasis, surround by underscores
5120for regular emphasis, add extra blank space around headings.
5122 [Project Gutenberg]: https://www.gutenberg.org
5126In addition to pandoc's extended Markdown, the following Markdown
5127variants are supported:
5129`markdown_phpextra` (PHP Markdown Extra)
5130: `footnotes`, `pipe_tables`, `raw_html`, `markdown_attribute`,
5131 `fenced_code_blocks`, `definition_lists`, `intraword_underscores`,
5132 `header_attributes`, `link_attributes`, `abbreviations`,
5133 `shortcut_reference_links`, `spaced_reference_links`.
5135`markdown_github` (deprecated GitHub-Flavored Markdown)
5136: `pipe_tables`, `raw_html`, `fenced_code_blocks`, `auto_identifiers`,
5137 `gfm_auto_identifiers`, `backtick_code_blocks`,
5138 `autolink_bare_uris`, `space_in_atx_header`,
5139 `intraword_underscores`, `strikeout`, `task_lists`, `emoji`,
5140 `shortcut_reference_links`, `angle_brackets_escapable`,
5141 `lists_without_preceding_blankline`.
5143`markdown_mmd` (MultiMarkdown)
5144: `pipe_tables`, `raw_html`, `markdown_attribute`, `mmd_link_attributes`,
5145 `tex_math_double_backslash`, `intraword_underscores`,
5146 `mmd_title_block`, `footnotes`, `definition_lists`,
5147 `all_symbols_escapable`, `implicit_header_references`,
5148 `auto_identifiers`, `mmd_header_identifiers`,
5149 `shortcut_reference_links`, `implicit_figures`,
5150 `superscript`, `subscript`, `backtick_code_blocks`,
5151 `spaced_reference_links`, `raw_attribute`.
5153`markdown_strict` (Markdown.pl)
5154: `raw_html`, `shortcut_reference_links`,
5155 `spaced_reference_links`.
5157We also support `commonmark` and `gfm` (GitHub-Flavored Markdown,
5158which is implemented as a set of extensions on `commonmark`).
5160Note, however, that `commonmark` and `gfm` have limited support
5161for extensions. Only those listed below (and `smart`,
5162`raw_tex`, and `hard_line_breaks`) will work. The extensions
5163can, however, all be individually disabled. Also, `raw_tex`
5164only affects `gfm` output, not input.
5166`gfm` (GitHub-Flavored Markdown)
5167: `pipe_tables`, `raw_html`, `native_divs`,
5168 `fenced_code_blocks`, `auto_identifiers`,
5169 `gfm_auto_identifiers`, `backtick_code_blocks`,
5170 `autolink_bare_uris`, `space_in_atx_header`,
5171 `intraword_underscores`, `strikeout`, `task_lists`, `emoji`,
5172 `shortcut_reference_links`, `angle_brackets_escapable`,
5173 `lists_without_preceding_blankline`.
5176# Producing slide shows with pandoc
5178You can use pandoc to produce an HTML + JavaScript slide presentation
5179that can be viewed via a web browser. There are five ways to do this,
5180using [S5], [DZSlides], [Slidy], [Slideous], or [reveal.js].
5181You can also produce a PDF slide show using LaTeX [`beamer`], or
5182slides shows in Microsoft [PowerPoint] format.
5184Here's the Markdown source for a simple slide show, `habits.txt`:
5211 
5218To produce an HTML/JavaScript slide show, simply type
5220 pandoc -t FORMAT -s habits.txt -o habits.html
5222where `FORMAT` is either `s5`, `slidy`, `slideous`, `dzslides`, or `revealjs`.
5224For Slidy, Slideous, reveal.js, and S5, the file produced by pandoc with the
5225`-s/--standalone` option embeds a link to JavaScript and CSS files, which are
5226assumed to be available at the relative path `s5/default` (for S5), `slideous`
5227(for Slideous), `reveal.js` (for reveal.js), or at the Slidy website at
5228`w3.org` (for Slidy). (These paths can be changed by setting the `slidy-url`,
5229`slideous-url`, `revealjs-url`, or `s5-url` variables; see [Variables for HTML slides],
5230above.) For DZSlides, the (relatively short) JavaScript and CSS are included in
5233With all HTML slide formats, the `--self-contained` option can be used to
5234produce a single file that contains all of the data necessary to display the
5235slide show, including linked scripts, stylesheets, images, and videos.
5237To produce a PDF slide show using beamer, type
5239 pandoc -t beamer habits.txt -o habits.pdf
5241Note that a reveal.js slide show can also be converted to a PDF
5242by printing it to a file from the browser.
5244To produce a Powerpoint slide show, type
5246 pandoc habits.txt -o habits.pptx
5248## Structuring the slide show
5250By default, the *slide level* is the highest heading level in
5251the hierarchy that is followed immediately by content, and not another
5252heading, somewhere in the document. In the example above, level-1 headings
5253are always followed by level-2 headings, which are followed by content,
5254so the slide level is 2. This default can be overridden using
5255the `--slide-level` option.
5257The document is carved up into slides according to the following
5260 * A horizontal rule always starts a new slide.
5262 * A heading at the slide level always starts a new slide.
5264 * Headings *below* the slide level in the hierarchy create
5265 headings *within* a slide.
5267 * Headings *above* the slide level in the hierarchy create
5268 "title slides," which just contain the section title
5269 and help to break the slide show into sections.
5270 Non-slide content under these headings will be included
5271 on the title slide (for HTML slide shows) or in a
5272 subsequent slide with the same title (for beamer).
5274 * A title page is constructed automatically from the document's title
5275 block, if present. (In the case of beamer, this can be disabled
5276 by commenting out some lines in the default template.)
5278These rules are designed to support many different styles of slide show. If
5279you don't care about structuring your slides into sections and subsections,
5280you can just use level-1 headings for all each slide. (In that case, level-1
5281will be the slide level.) But you can also structure the slide show into
5282sections, as in the example above.
5284Note: in reveal.js slide shows, if slide level is 2, a two-dimensional
5285layout will be produced, with level-1 headings building horizontally
5286and level-2 headings building vertically. It is not recommended that
5287you use deeper nesting of section levels with reveal.js.
5291By default, these writers produce lists that display "all at once."
5292If you want your lists to display incrementally (one item at a time),
5293use the `-i` option. If you want a particular list to depart from the
5294default, put it in a `div` block with class `incremental` or
5295`nonincremental`. So, for example, using the `fenced div` syntax, the
5296following would be incremental regardless of the document default:
5314While using `incremental` and `nonincremental` divs are the
5315recommended method of setting incremental lists on a per-case basis,
5316an older method is also supported: putting lists inside a blockquote
5317will depart from the document default (that is, it will display
5318incrementally without the `-i` option and all at once with the `-i`
5324Both methods allow incremental and nonincremental lists to be mixed
5325in a single document.
5327Note: Neither the `-i/--incremental` option nor any of the
5328methods described here currently works for PowerPoint output.
5332You can add "pauses" within a slide by including a paragraph containing
5333three dots, separated by spaces:
5335 # Slide with a pause
5337 content before the pause
5341 content after the pause
5343Note: this feature is not yet implemented for PowerPoint output.
5345## Styling the slides
5347You can change the style of HTML slides by putting customized CSS files
5348in `$DATADIR/s5/default` (for S5), `$DATADIR/slidy` (for Slidy),
5349or `$DATADIR/slideous` (for Slideous),
5350where `$DATADIR` is the user data directory (see `--data-dir`, above).
5351The originals may be found in pandoc's system data directory (generally
5352`$CABALDIR/pandoc-VERSION/s5/default`). Pandoc will look there for any
5353files it does not find in the user data directory.
5355For dzslides, the CSS is included in the HTML file itself, and may
5358All [reveal.js configuration options] can be set through variables.
5359For example, themes can be used by setting the `theme` variable:
5363Or you can specify a custom stylesheet using the `--css` option.
5365To style beamer slides, you can specify a `theme`, `colortheme`,
5366`fonttheme`, `innertheme`, and `outertheme`, using the `-V` option:
5368 pandoc -t beamer habits.txt -V theme:Warsaw -o habits.pdf
5370Note that heading attributes will turn into slide attributes
5371(on a `<div>` or `<section>`) in HTML slide formats, allowing you
5372to style individual slides. In beamer, the only heading attribute
5373that affects slides is the `allowframebreaks` class, which sets the
5374`allowframebreaks` option, causing multiple slides to be created
5375if the content overfills the frame. This is recommended especially for
5378 # References {.allowframebreaks}
5382Speaker notes are supported in reveal.js and PowerPoint (pptx)
5383output. You can add notes to your Markdown document thus:
5389 - It can contain Markdown
5394To show the notes window in reveal.js, press `s` while viewing the
5395presentation. Speaker notes in PowerPoint will be available, as usual,
5396in handouts and presenter view.
5398Notes are not yet supported for other slide formats, but the notes
5399will not appear on the slides themselves.
5403To put material in side by side columns, you can use a native
5404div container with class `columns`, containing two or more div
5405containers with class `column` and a `width` attribute:
5407 :::::::::::::: {.columns}
5408 ::: {.column width="40%"}
5411 ::: {.column width="60%"}
5416### Additional columns attributes in beamer
5418The div containers with classes `columns` and `column` can optionally have
5419an `align` attribute.
5420The class `columns` can optionally have a `totalwidth` attribute or an
5421`onlytextwidth` class.
5423 :::::::::::::: {.columns align=center totalwidth=8em}
5424 ::: {.column width="40%"}
5427 ::: {.column width="60%" align=bottom}
5432The `align` attributes on `columns` and `column` can be used with the
5433values `top`, `top-baseline`, `center` and `bottom` to vertically align
5434the columns. It defaults to `top` in `columns`.
5436The `totalwidth` attribute limits the width of the columns to the given value.
5438 :::::::::::::: {.columns align=top .onlytextwidth}
5439 ::: {.column width="40%" align=center}
5442 ::: {.column width="60%"}
5447The class `onlytextwidth` sets the `totalwidth` to `\textwidth`.
5449See Section 12.7 of the [Beamer User's Guide] for more details.
5451## Frame attributes in beamer
5453Sometimes it is necessary to add the LaTeX `[fragile]` option to
5454a frame in beamer (for example, when using the `minted` environment).
5455This can be forced by adding the `fragile` class to the heading
5456introducing the slide:
5458 # Fragile slide {.fragile}
5460All of the other frame attributes described in Section 8.1 of
5461the [Beamer User's Guide] may also be used: `allowdisplaybreaks`,
5462`allowframebreaks`, `b`, `c`, `t`, `environment`, `label`, `plain`,
5463`shrink`, `standout`, `noframenumbering`.
5465## Background in reveal.js and beamer
5467Background images can be added to self-contained reveal.js slideshows and
5468to beamer slideshows.
5470For the same image on every slide, use the configuration
5471option `background-image` either in the YAML metadata block
5472or as a command-line variable. (There are no other options in
5473beamer and the rest of this section concerns reveal.js slideshows.)
5475For reveal.js, you can instead use the reveal.js-native option
5476`parallaxBackgroundImage`. You can also set `parallaxBackgroundHorizontal`
5477and `parallaxBackgroundVertical` the same way and must also set
5478`parallaxBackgroundSize` to have your values take effect.
5480To set an image for a particular reveal.js slide, add
5481`{data-background-image="/path/to/image"}`
5482to the first slide-level heading on the slide (which may even be empty).
5484In reveal.js's overview mode, the parallaxBackgroundImage will show up
5485only on the first slide.
5487Other reveal.js background settings also work on individual slides, including
5488`data-background-size`, `data-background-repeat`, `data-background-color`,
5489`data-transition`, and `data-transition-speed`.
5491To add a background image to the automatically generated title slide, use the
5492`title-slide-attributes` variable in the YAML metadata block. It must contain
5493a map of attribute names and values.
5495See the [reveal.js documentation](https://revealjs.com/backgrounds/) for more
5498For example in reveal.js:
5503parallaxBackgroundImage: /path/to/my/background_image.png
5504title-slide-attributes:
5505 data-background-image: /path/to/title_image.png
5506 data-background-size: contain
5511Slide 1 has background_image.png as its background.
5513## {data-background-image="/path/to/special_image.jpg"}
5515Slide 2 has a special image for its background, even though the heading has no content.
5518# Creating EPUBs with pandoc
5522EPUB metadata may be specified using the `--epub-metadata` option, but
5523if the source document is Markdown, it is better to use a [YAML metadata
5524block][Extension: `yaml_metadata_block`]. Here is an example:
5531 text: An investigation of metadata
5539 text: doi:10.234234.234/33
5541 rights: © 2007 John Smith, CC BY-NC
5546The following fields are recognized:
5549 ~ Either a string value or an object with fields `text` and
5550 `scheme`. Valid values for `scheme` are `ISBN-10`,
5551 `GTIN-13`, `UPC`, `ISMN-10`, `DOI`, `LCCN`, `GTIN-14`,
5552 `ISBN-13`, `Legal deposit number`, `URN`, `OCLC`,
5553 `ISMN-13`, `ISBN-A`, `JP`, `OLCC`.
5556 ~ Either a string value, or an object with fields `file-as` and
5557 `type`, or a list of such objects. Valid values for `type` are
5558 `main`, `subtitle`, `short`, `collection`, `edition`, `extended`.
5561 ~ Either a string value, or an object with fields `role`, `file-as`,
5562 and `text`, or a list of such objects. Valid values for `role` are
5563 [MARC relators], but
5564 pandoc will attempt to translate the human-readable versions
5565 (like "author" and "editor") to the appropriate marc relators.
5568 ~ Same format as `creator`.
5571 ~ A string value in `YYYY-MM-DD` format. (Only the year is necessary.)
5572 Pandoc will attempt to convert other common date formats.
5574`lang` (or legacy: `language`)
5575 ~ A string value in [BCP 47] format. Pandoc will default to the local
5576 language if nothing is specified.
5579 ~ A string value or a list of such values.
5600 ~ A string value (path to cover image).
5602`css` (or legacy: `stylesheet`)
5603 ~ A string value (path to CSS stylesheet).
5605`page-progression-direction`
5606 ~ Either `ltr` or `rtl`. Specifies the `page-progression-direction`
5607 attribute for the [`spine` element].
5610 ~ iBooks-specific metadata, with the following fields:
5612 - `version`: (string)
5613 - `specified-fonts`: `true`|`false` (default `false`)
5614 - `ipad-orientation-lock`: `portrait-only`|`landscape-only`
5615 - `iphone-orientation-lock`: `portrait-only`|`landscape-only`
5616 - `binding`: `true`|`false` (default `true`)
5617 - `scroll-axis`: `vertical`|`horizontal`|`default`
5619[MARC relators]: https://loc.gov/marc/relators/relaterm.html
5620[`spine` element]: http://idpf.org/epub/301/spec/epub-publications.html#sec-spine-elem
5622## The `epub:type` attribute
5624For `epub3` output, you can mark up the heading that corresponds to an EPUB
5625chapter using the [`epub:type` attribute][epub-type]. For example, to set
5626the attribute to the value `prologue`, use this markdown:
5628 # My chapter {epub:type=prologue}
5630Which will result in:
5632 <body epub:type="frontmatter">
5633 <section epub:type="prologue">
5636Pandoc will output `<body epub:type="bodymatter">`, unless
5637you use one of the following values, in which case either
5638`frontmatter` or `backmatter` will be output.
5640`epub:type` of first section `epub:type` of body
5641---------------------------- ------------------
5644acknowledgments frontmatter
5645copyright-page frontmatter
5646dedication frontmatter
5650contributors frontmatter
5651other-credits frontmatter
5653revision-history frontmatter
5654titlepage frontmatter
5655halftitlepage frontmatter
5656seriespage frontmatter
5659seriespage frontmatter
5660titlepage frontmatter
5663bibliography backmatter
5666[epub-type]: http://www.idpf.org/epub/31/spec/epub-contentdocs.html#sec-epub-type-attribute
5670By default, pandoc will download media referenced from any `<img>`, `<audio>`,
5671`<video>` or `<source>` element present in the generated EPUB,
5672and include it in the EPUB container, yielding a completely
5673self-contained EPUB. If you want to link to external media resources
5674instead, use raw HTML in your source and add `data-external="1"` to the tag
5675with the `src` attribute. For example:
5677 <audio controls="1">
5678 <source src="https://example.com/music/toccata.mp3"
5679 data-external="1" type="audio/mpeg">
5683# Creating Jupyter notebooks with pandoc
5685When creating a [Jupyter notebook], pandoc will try to infer the
5686notebook structure. Code blocks with the class `code` will be
5687taken as code cells, and intervening content will be taken as
5688Markdown cells. Attachments will automatically be created for
5689images in Markdown cells. Metadata will be taken from the
5690`jupyter` metadata field. For example:
5699 display_name: Python 2
5706 file_extension: ".py"
5707 mimetype: "text/x-python"
5709 nbconvert_exporter: "python"
5710 pygments_lexer: "ipython2"
5716**Lorem ipsum** dolor sit amet, consectetur adipiscing elit. Nunc luctus
5717bibendum felis dictum sodales.
5726from IPython.display import HTML
5729console.log("hello");
5737This image  will be
5738included as a cell attachment.
5741If you want to add cell attributes, group cells differently, or
5742add output to code cells, then you need to include divs to
5743indicate the structure. You can use either [fenced
5744divs][Extension: `fenced_divs`] or [native divs][Extension:
5745`native_divs`] for this. Here is an example:
5748:::::: {.cell .markdown}
5751**Lorem ipsum** dolor sit amet, consectetur adipiscing elit. Nunc luctus
5752bibendum felis dictum sodales.
5755:::::: {.cell .code execution_count=1}
5760::: {.output .stream .stdout}
5767:::::: {.cell .code execution_count=2}
5769from IPython.display import HTML
5772console.log("hello");
5778::: {.output .execute_result execution_count=2}
5781console.log("hello");
5790If you include raw HTML or TeX in an output cell, use the
5791[raw attribute][Extension: `fenced_attribute`], as shown
5792in the last cell of the example above. Although pandoc can
5793process "bare" raw HTML and TeX, the result is often
5794interspersed raw elements and normal textual elements, and
5795in an output cell pandoc expects a single, connected raw
5796block. To avoid using raw HTML or TeX except when
5797marked explicitly using raw attributes, we recommend
5798specifying the extensions `-raw_html-raw_tex+raw_attribute` when
5799translating between Markdown and ipynb notebooks.
5801Note that options and extensions that affect reading and
5802writing of Markdown will also affect Markdown cells in ipynb
5803notebooks. For example, `--wrap=preserve` will preserve
5804soft line breaks in Markdown cells; `--atx-headers` will
5805cause ATX-style headings to be used; and `--preserve-tabs` will
5806prevent tabs from being turned to spaces.
5808# Syntax highlighting
5810Pandoc will automatically highlight syntax in [fenced code blocks] that
5811are marked with a language name. The Haskell library [skylighting] is
5812used for highlighting. Currently highlighting is supported only for
5813HTML, EPUB, Docx, Ms, and LaTeX/PDF output. To see a list of language names
5814that pandoc will recognize, type `pandoc --list-highlight-languages`.
5816The color scheme can be selected using the `--highlight-style` option.
5817The default color scheme is `pygments`, which imitates the default color
5818scheme used by the Python library pygments (though pygments is not actually
5819used to do the highlighting). To see a list of highlight styles,
5820type `pandoc --list-highlight-styles`.
5822If you are not satisfied with the predefined styles, you can
5823use `--print-highlight-style` to generate a JSON `.theme` file which
5824can be modified and used as the argument to `--highlight-style`. To
5825get a JSON version of the `pygments` style, for example:
5827 pandoc --print-highlight-style pygments > my.theme
5829Then edit `my.theme` and use it like this:
5831 pandoc --highlight-style my.theme
5833If you are not satisfied with the built-in highlighting, or you
5834want highlight a language that isn't supported, you can use the
5835`--syntax-definition` option to load a [KDE-style XML syntax definition
5836file](https://docs.kde.org/stable5/en/applications/katepart/highlight.html).
5837Before writing your own, have a look at KDE's [repository of syntax
5838definitions](https://github.com/KDE/syntax-highlighting/tree/master/data/syntax).
5840To disable highlighting, use the `--no-highlight` option.
5842[skylighting]: https://github.com/jgm/skylighting
5846Custom styles can be used in the docx and ICML formats.
5850By default, pandoc's docx and ICML output applies a predefined set of styles
5851for blocks such as paragraphs and block quotes, and uses largely default
5852formatting (italics, bold) for inlines. This will work for most
5853purposes, especially alongside a `reference.docx` file. However, if you
5854need to apply your own styles to blocks, or match a preexisting set of
5855styles, pandoc allows you to define custom styles for blocks and text
5856using `div`s and `span`s, respectively.
5858If you define a `div` or `span` with the attribute `custom-style`,
5859pandoc will apply your specified style to the contained elements (with
5860the exception of elements whose function depends on a style, like
5861headings, code blocks, block quotes, or links). So, for example, using
5862the `bracketed_spans` syntax,
5864 [Get out]{custom-style="Emphatically"}, he said.
5866would produce a docx file with "Get out" styled with character
5867style `Emphatically`. Similarly, using the `fenced_divs` syntax,
5869 Dickinson starts the poem simply:
5871 ::: {custom-style="Poetry"}
5872 | A Bird came down the Walk---
5873 | He did not know I saw---
5876would style the two contained lines with the `Poetry` paragraph style.
5878For docx output, styles will be defined in the output file as inheriting
5879from normal text, if the styles are not yet in your reference.docx.
5880If they are already defined, pandoc will not alter the definition.
5882This feature allows for greatest customization in conjunction with
5883[pandoc filters]. If you want all paragraphs after block quotes to be
5884indented, you can write a filter to apply the styles necessary. If you
5885want all italics to be transformed to the `Emphasis` character style
5886(perhaps to change their color), you can write a filter which will
5887transform all italicized inlines to inlines within an `Emphasis`
5890For docx output, you don't need to enable any extensions for
5891custom styles to work.
5893[pandoc filters]: https://pandoc.org/filters.html
5897The docx reader, by default, only reads those styles that it can
5898convert into pandoc elements, either by direct conversion or
5899interpreting the derivation of the input document's styles.
5901By enabling the [`styles` extension](#ext-styles) in the docx reader
5902(`-f docx+styles`), you can produce output that maintains the styles
5903of the input document, using the `custom-style` class. Paragraph
5904styles are interpreted as divs, while character styles are interpreted
5907For example, using the `custom-style-reference.docx` file in the test
5908directory, we have the following different outputs:
5910Without the `+styles` extension:
5912 $ pandoc test/docx/custom-style-reference.docx -f docx -t markdown
5915 This is text with an *emphasized* text style. And this is text with a
5916 **strengthened** text style.
5918 > Here is a styled paragraph that inherits from Block Text.
5920And with the extension:
5922 $ pandoc test/docx/custom-style-reference.docx -f docx+styles -t markdown
5924 ::: {custom-style="First Paragraph"}
5928 ::: {custom-style="Body Text"}
5929 This is text with an [emphasized]{custom-style="Emphatic"} text style.
5930 And this is text with a [strengthened]{custom-style="Strengthened"}
5934 ::: {custom-style="My Block Style"}
5935 > Here is a styled paragraph that inherits from Block Text.
5938With these custom styles, you can use your input document as a
5939reference-doc while creating docx output (see below), and maintain the
5940same styles in your input and output files.
5944Pandoc can be extended with custom writers written in [Lua]. (Pandoc
5945includes a Lua interpreter, so Lua need not be installed separately.)
5947To use a custom writer, simply specify the path to the Lua script
5948in place of the output format. For example:
5950 pandoc -t data/sample.lua
5952Creating a custom writer requires writing a Lua function for each
5953possible element in a pandoc document. To get a documented example
5954which you can modify according to your needs, do
5956 pandoc --print-default-data-file sample.lua
5958Note that custom writers have no default template. If you want
5959to use `--standalone` with a custom writer, you will need to
5960specify a template manually using `--template` or add a new
5961default template with the name
5962`default.NAME_OF_CUSTOM_WRITER.lua` to the `templates`
5963subdirectory of your user data directory (see [Templates]).
5965[Lua]: https://www.lua.org
5969If you use pandoc to convert user-contributed content in a web
5970application, here are some things to keep in mind:
59721. Although pandoc itself will not create or modify any files other
5973 than those you explicitly ask it create (with the exception
5974 of temporary files used in producing PDFs), a filter or custom
5975 writer could in principle do anything on your file system. Please
5976 audit filters and custom writers very carefully before using them.
59782. If your application uses pandoc as a Haskell library (rather than
5979 shelling out to the executable), it is possible to use it in a mode
5980 that fully isolates pandoc from your file system, by running the
5981 pandoc operations in the `PandocPure` monad. See the document
5982 [Using the pandoc API](https://pandoc.org/using-the-pandoc-api.html)
59853. Pandoc's parsers can exhibit pathological performance on some
5986 corner cases. It is wise to put any pandoc operations under
5987 a timeout, to avoid DOS attacks that exploit these issues.
5988 If you are using the pandoc executable, you can add the
5989 command line options `+RTS -M512M -RTS` (for example) to limit
5990 the heap size to 512MB.
59924. The HTML generated by pandoc is not guaranteed to be safe.
5993 If `raw_html` is enabled for the Markdown input, users can
5994 inject arbitrary HTML. Even if `raw_html` is disabled,
5995 users can include dangerous content in attributes for
5996 headings, spans, and code blocks. To be safe, you should
5997 run all the generated HTML through an HTML sanitizer.
6001Copyright 2006--2020 John MacFarlane (jgm@berkeley.edu). Released
6002under the [GPL], version 2 or greater. This software carries no
6003warranty of any kind. (See COPYRIGHT for full copyright and
6004warranty notices.) For a full list of contributors, see the file
6005AUTHORS.md in the pandoc source code.
6007[GPL]: https://www.gnu.org/copyleft/gpl.html "GNU General Public License"
6008[YAML]: https://yaml.org/spec/1.2/spec.html "YAML v1.2 Spec"
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