git.iko.soy/typeable/pandoc
on 34412cf help sign in
typeable/pandoc/MANUAL.txt
4255 lines 148 kB history raw
1% Pandoc User's Guide
2% John MacFarlane
3% January 29, 2017
5Synopsis
6========
8`pandoc` [*options*] [*input-file*]...
10Description
11===========
13Pandoc is a [Haskell] library for converting from one markup format to
14another, and a command-line tool that uses this library. It can read
15[Markdown], [CommonMark], [PHP Markdown Extra], [GitHub-Flavored Markdown],
16[MultiMarkdown], and (subsets of) [Textile], [reStructuredText], [HTML],
17[LaTeX], [MediaWiki markup], [TWiki markup], [Haddock markup], [OPML], [Emacs
18Org mode], [DocBook], [txt2tags], [EPUB], [ODT] and [Word docx]; and it can
19write plain text, [Markdown], [CommonMark], [PHP Markdown Extra],
20[GitHub-Flavored Markdown], [MultiMarkdown], [reStructuredText], [XHTML],
21[HTML5], [LaTeX] \(including [`beamer`] slide shows\), [ConTeXt], [RTF], [OPML],
22[DocBook], [OpenDocument], [ODT], [Word docx], [GNU Texinfo], [MediaWiki
23markup], [DokuWiki markup], [ZimWiki markup], [Haddock markup],
24[EPUB] \(v2 or v3\), [FictionBook2], [Textile], [groff man] pages,
25[Emacs Org mode], [AsciiDoc], [InDesign ICML], [TEI Simple], and [Slidy],
26[Slideous], [DZSlides], [reveal.js] or [S5] HTML slide shows. It can also
27produce [PDF] output on systems where LaTeX, ConTeXt, or `wkhtmltopdf` is
28installed.
30Pandoc's enhanced version of Markdown includes syntax for [footnotes],
31[tables], flexible [ordered lists], [definition lists], [fenced code blocks],
32[superscripts and subscripts], [strikeout], [metadata blocks], automatic tables of
33contents, embedded LaTeX [math], [citations], and [Markdown inside HTML block
34elements][Extension: `markdown_in_html_blocks`]. (These enhancements, described
35further under [Pandoc's Markdown], can be disabled using the
36`markdown_strict` input or output format.)
38In contrast to most existing tools for converting Markdown to HTML, which
39use regex substitutions, pandoc has a modular design: it consists of a
40set of readers, which parse text in a given format and produce a native
41representation of the document, and a set of writers, which convert
42this native representation into a target format. Thus, adding an input
43or output format requires only adding a reader or writer.
45Because pandoc's intermediate representation of a document is less
46expressive than many of the formats it converts between, one should
47not expect perfect conversions between every format and every other.
48Pandoc attempts to preserve the structural elements of a document, but
49not formatting details such as margin size. And some document elements,
50such as complex tables, may not fit into pandoc's simple document
51model. While conversions from pandoc's Markdown to all formats aspire
52to be perfect, conversions from formats more expressive than pandoc's
53Markdown can be expected to be lossy.
55[Markdown]: http://daringfireball.net/projects/markdown/
56[CommonMark]: http://commonmark.org
57[PHP Markdown Extra]: https://michelf.ca/projects/php-markdown/extra/
58[GitHub-Flavored Markdown]: https://help.github.com/articles/github-flavored-markdown/
59[MultiMarkdown]: http://fletcherpenney.net/multimarkdown/
60[reStructuredText]: http://docutils.sourceforge.net/docs/ref/rst/introduction.html
61[S5]: http://meyerweb.com/eric/tools/s5/
62[Slidy]: http://www.w3.org/Talks/Tools/Slidy/
63[Slideous]: http://goessner.net/articles/slideous/
64[HTML]: http://www.w3.org/html/
65[HTML5]: http://www.w3.org/TR/html5/
66[polyglot markup]: https://www.w3.org/TR/html-polyglot/
67[XHTML]: http://www.w3.org/TR/xhtml1/
68[LaTeX]: http://latex-project.org
69[`beamer`]: https://ctan.org/pkg/beamer
70[Beamer User's Guide]: http://ctan.math.utah.edu/ctan/tex-archive/macros/latex/contrib/beamer/doc/beameruserguide.pdf
71[ConTeXt]: http://www.contextgarden.net/
72[RTF]: http://en.wikipedia.org/wiki/Rich_Text_Format
73[DocBook]: http://docbook.org
74[txt2tags]: http://txt2tags.org
75[EPUB]: http://idpf.org/epub
76[OPML]: http://dev.opml.org/spec2.html
77[OpenDocument]: http://opendocument.xml.org
78[ODT]: http://en.wikipedia.org/wiki/OpenDocument
79[Textile]: http://redcloth.org/textile
80[MediaWiki markup]: https://www.mediawiki.org/wiki/Help:Formatting
81[DokuWiki markup]: https://www.dokuwiki.org/dokuwiki
82[ZimWiki markup]: http://zim-wiki.org/manual/Help/Wiki_Syntax.html
83[TWiki markup]: http://twiki.org/cgi-bin/view/TWiki/TextFormattingRules
84[Haddock markup]: https://www.haskell.org/haddock/doc/html/ch03s08.html
85[groff man]: http://man7.org/linux/man-pages/man7/groff_man.7.html
86[Haskell]: https://www.haskell.org
87[GNU Texinfo]: http://www.gnu.org/software/texinfo/
88[Emacs Org mode]: http://orgmode.org
89[AsciiDoc]: http://www.methods.co.nz/asciidoc/
90[DZSlides]: http://paulrouget.com/dzslides/
91[Word docx]: https://en.wikipedia.org/wiki/Office_Open_XML
92[PDF]: https://www.adobe.com/pdf/
93[reveal.js]: http://lab.hakim.se/reveal-js/
94[FictionBook2]: http://www.fictionbook.org/index.php/Eng:XML_Schema_Fictionbook_2.1
95[InDesign ICML]: https://www.adobe.com/content/dam/Adobe/en/devnet/indesign/cs55-docs/IDML/idml-specification.pdf
96[TEI Simple]: https://github.com/TEIC/TEI-Simple
98Using `pandoc`
99--------------
101If no *input-file* is specified, input is read from *stdin*.
102Otherwise, the *input-files* are concatenated (with a blank
103line between each) and used as input. Output goes to *stdout* by
104default (though output to *stdout* is disabled for the `odt`, `docx`,
105`epub2`, and `epub3` output formats). For output to a file, use the
106`-o` option:
108 pandoc -o output.html input.txt
110By default, pandoc produces a document fragment, not a standalone
111document with a proper header and footer. To produce a standalone
112document, use the `-s` or `--standalone` flag:
114 pandoc -s -o output.html input.txt
116For more information on how standalone documents are produced, see
117[Templates], below.
119Instead of a file, an absolute URI may be given. In this case
120pandoc will fetch the content using HTTP:
122 pandoc -f html -t markdown http://www.fsf.org
124It is possible to supply a custom User-Agent string when requesting a
125document from a URL, by setting an environment variable:
127 USER_AGENT="Mozilla/5.0" pandoc -f html -t markdown http://www.fsf.org
129If multiple input files are given, `pandoc` will concatenate them all (with
130blank lines between them) before parsing. This feature is disabled for
131 binary input formats such as `EPUB`, `odt`, and `docx`.
133The format of the input and output can be specified explicitly using
134command-line options. The input format can be specified using the
135`-r/--read` or `-f/--from` options, the output format using the
136`-w/--write` or `-t/--to` options. Thus, to convert `hello.txt` from
137Markdown to LaTeX, you could type:
139 pandoc -f markdown -t latex hello.txt
141To convert `hello.html` from HTML to Markdown:
143 pandoc -f html -t markdown hello.html
145Supported output formats are listed below under the `-t/--to` option.
146Supported input formats are listed below under the `-f/--from` option. Note
147that the `rst`, `textile`, `latex`, and `html` readers are not complete;
148there are some constructs that they do not parse.
150If the input or output format is not specified explicitly, `pandoc`
151will attempt to guess it from the extensions of
152the input and output filenames. Thus, for example,
154 pandoc -o hello.tex hello.txt
156will convert `hello.txt` from Markdown to LaTeX. If no output file
157is specified (so that output goes to *stdout*), or if the output file's
158extension is unknown, the output format will default to HTML.
159If no input file is specified (so that input comes from *stdin*), or
160if the input files' extensions are unknown, the input format will
161be assumed to be Markdown unless explicitly specified.
163Pandoc uses the UTF-8 character encoding for both input and output.
164If your local character encoding is not UTF-8, you
165should pipe input and output through [`iconv`]:
167 iconv -t utf-8 input.txt | pandoc | iconv -f utf-8
169Note that in some output formats (such as HTML, LaTeX, ConTeXt,
170RTF, OPML, DocBook, and Texinfo), information about
171the character encoding is included in the document header, which
172will only be included if you use the `-s/--standalone` option.
174[`iconv`]: http://www.gnu.org/software/libiconv/
176Creating a PDF
177--------------
179To produce a PDF, specify an output file with a `.pdf` extension.
180By default, pandoc will use LaTeX to convert it to PDF:
182 pandoc test.txt -o test.pdf
184Production of a PDF requires that a LaTeX engine be installed (see
185`--latex-engine`, below), and assumes that the following LaTeX packages
186are available: [`amsfonts`], [`amsmath`], [`lm`], [`unicode-math`],
187[`ifxetex`], [`ifluatex`], [`eurosym`], [`listings`] (if the
188`--listings` option is used), [`fancyvrb`], [`longtable`],
189[`booktabs`], [`graphicx`] and [`grffile`] (if the document
190contains images), [`hyperref`], [`ulem`], [`geometry`] (with the
191`geometry` variable set), [`setspace`] (with `linestretch`), and
192[`babel`] (with `lang`). The use of `xelatex` or `lualatex` as
193the LaTeX engine requires [`fontspec`]. `xelatex` uses
194[`polyglossia`] (with `lang`), [`xecjk`], and [`bidi`] (with the
195`dir` variable set). If the `mathspec` variable is set,
196`xelatex` will use [`mathspec`] instead of [`unicode-math`].
197The [`upquote`] and [`microtype`] packages are used if
198available, and [`csquotes`] will be used for [smart punctuation]
199if added to the template or included in any header file. The
200[`natbib`], [`biblatex`], [`bibtex`], and [`biber`] packages can
201optionally be used for [citation rendering]. These are included
202with all recent versions of [TeX Live].
204Alternatively, pandoc can use ConTeXt or `wkhtmltopdf` to create a PDF.
205To do this, specify an output file with a `.pdf` extension,
206as before, but add `-t context` or `-t html5` to the command line.
208PDF output can be controlled using [variables for LaTeX] (if
209LaTeX is used) and [variables for ConTeXt] (if ConTeXt is used).
210If `wkhtmltopdf` is used, then the variables `margin-left`,
211`margin-right`, `margin-top`, `margin-bottom`, and `papersize`
212will affect the output, as will `--css`.
214[`amsfonts`]: https://ctan.org/pkg/amsfonts
215[`amsmath`]: https://ctan.org/pkg/amsmath
216[`lm`]: https://ctan.org/pkg/lm
217[`ifxetex`]: https://ctan.org/pkg/ifxetex
218[`ifluatex`]: https://ctan.org/pkg/ifluatex
219[`eurosym`]: https://ctan.org/pkg/eurosym
220[`listings`]: https://ctan.org/pkg/listings
221[`fancyvrb`]: https://ctan.org/pkg/fancyvrb
222[`longtable`]: https://ctan.org/pkg/longtable
223[`booktabs`]: https://ctan.org/pkg/booktabs
224[`graphicx`]: https://ctan.org/pkg/graphicx
225[`grffile`]: https://ctan.org/pkg/grffile
226[`geometry`]: https://ctan.org/pkg/geometry
227[`setspace`]: https://ctan.org/pkg/setspace
228[`xecjk`]: https://ctan.org/pkg/xecjk
229[`hyperref`]: https://ctan.org/pkg/hyperref
230[`ulem`]: https://ctan.org/pkg/ulem
231[`babel`]: https://ctan.org/pkg/babel
232[`bidi`]: https://ctan.org/pkg/bidi
233[`mathspec`]: https://ctan.org/pkg/mathspec
234[`unicode-math`]: https://ctan.org/pkg/unicode-math
235[`polyglossia`]: https://ctan.org/pkg/polyglossia
236[`fontspec`]: https://ctan.org/pkg/fontspec
237[`upquote`]: https://ctan.org/pkg/upquote
238[`microtype`]: https://ctan.org/pkg/microtype
239[`csquotes`]: https://ctan.org/pkg/csquotes
240[`natbib`]: https://ctan.org/pkg/natbib
241[`biblatex`]: https://ctan.org/pkg/biblatex
242[`bibtex`]: https://ctan.org/pkg/bibtex
243[`biber`]: https://ctan.org/pkg/biber
244[TeX Live]: http://www.tug.org/texlive/
246Options
247=======
249General options
250---------------
252`-f` *FORMAT*, `-r` *FORMAT*, `--from=`*FORMAT*, `--read=`*FORMAT*
254: Specify input format. *FORMAT* can be `native` (native Haskell),
255 `json` (JSON version of native AST), `markdown` (pandoc's
256 extended Markdown), `markdown_strict` (original unextended
257 Markdown), `markdown_phpextra` (PHP Markdown Extra), `markdown_github`
258 (GitHub-Flavored Markdown), `markdown_mmd` (MultiMarkdown),
259 `commonmark` (CommonMark Markdown), `textile` (Textile), `rst`
260 (reStructuredText), `html` (HTML), `docbook` (DocBook), `t2t`
261 (txt2tags), `docx` (docx), `odt` (ODT), `epub` (EPUB), `opml` (OPML),
262 `org` (Emacs Org mode), `mediawiki` (MediaWiki markup), `twiki` (TWiki
263 markup), `haddock` (Haddock markup), or `latex` (LaTeX). If
264 `+lhs` is appended to `markdown`, `rst`, `latex`, or `html`, the
265 input will be treated as literate Haskell source: see [Literate
266 Haskell support], below. Markdown
267 syntax extensions can be individually enabled or disabled by
268 appending `+EXTENSION` or `-EXTENSION` to the format name. So, for
269 example, `markdown_strict+footnotes+definition_lists` is strict
270 Markdown with footnotes and definition lists enabled, and
271 `markdown-pipe_tables+hard_line_breaks` is pandoc's Markdown
272 without pipe tables and with hard line breaks. See [Pandoc's
273 Markdown], below, for a list of extensions and
274 their names. See `--list-input-formats` and `--list-extensions`,
275 below.
277`-t` *FORMAT*, `-w` *FORMAT*, `--to=`*FORMAT*, `--write=`*FORMAT*
279: Specify output format. *FORMAT* can be `native` (native Haskell),
280 `json` (JSON version of native AST), `plain` (plain text),
281 `markdown` (pandoc's extended Markdown), `markdown_strict`
282 (original unextended Markdown), `markdown_phpextra` (PHP Markdown
283 Extra), `markdown_github` (GitHub-Flavored Markdown), `markdown_mmd`
284 (MultiMarkdown), `commonmark` (CommonMark Markdown), `rst`
285 (reStructuredText), `html4` (XHTML4), `html` or `html5`
286 (HTML5/XHTML [polyglot markup]), `latex`
287 (LaTeX), `beamer` (LaTeX beamer slide show), `context` (ConTeXt),
288 `man` (groff man), `mediawiki` (MediaWiki markup),
289 `dokuwiki` (DokuWiki markup), `zimwiki` (ZimWiki markup),
290 `textile` (Textile), `org` (Emacs Org mode),
291 `texinfo` (GNU Texinfo), `opml` (OPML), `docbook` or `docbook4`
292 (DocBook 4), `docbook5` (DocBook 5), `opendocument` (OpenDocument),
293 `odt` (OpenOffice text document), `docx` (Word docx), `haddock`
294 (Haddock markup), `rtf` (rich text format), `epub2` (EPUB v2 book),
295 `epub` or `epub3` (EPUB v3), `fb2` (FictionBook2 e-book),
296 `asciidoc` (AsciiDoc), `icml` (InDesign ICML), `tei` (TEI
297 Simple), `slidy` (Slidy HTML and JavaScript slide show),
298 `slideous` (Slideous HTML and JavaScript slide show),
299 `dzslides` (DZSlides HTML5 + JavaScript slide show),
300 `revealjs` (reveal.js HTML5 + JavaScript slide show), `s5`
301 (S5 HTML and JavaScript slide show), or the path of a custom
302 lua writer (see [Custom writers], below). Note that `odt`,
303 `epub`, and `epub3` output will not be directed to *stdout*;
304 an output filename must be specified using the `-o/--output`
305 option. If `+lhs` is appended to `markdown`, `rst`, `latex`,
306 `beamer`, `html4`, or `html5`, the output will be rendered as
307 literate Haskell source: see [Literate Haskell support],
308 below. Markdown syntax extensions can be individually
309 enabled or disabled by appending `+EXTENSION` or
310 `-EXTENSION` to the format name, as described above under `-f`.
311 See `--list-output-formats` and `--list-extensions`, below.
313`-o` *FILE*, `--output=`*FILE*
315: Write output to *FILE* instead of *stdout*. If *FILE* is
316 `-`, output will go to *stdout*. (Exception: if the output
317 format is `odt`, `docx`, `epub`, or `epub3`, output to stdout is disabled.)
319`--data-dir=`*DIRECTORY*
321: Specify the user data directory to search for pandoc data files.
322 If this option is not specified, the default user data directory
323 will be used. This is, in Unix:
325 $HOME/.pandoc
327 in Windows XP:
329 C:\Documents And Settings\USERNAME\Application Data\pandoc
331 and in Windows Vista or later:
333 C:\Users\USERNAME\AppData\Roaming\pandoc
335 You can find the default user data directory on your system by
336 looking at the output of `pandoc --version`.
337 A `reference.odt`, `reference.docx`, `epub.css`, `templates`,
338 `slidy`, `slideous`, or `s5` directory
339 placed in this directory will override pandoc's normal defaults.
341`--bash-completion`
343: Generate a bash completion script. To enable bash completion
344 with pandoc, add this to your `.bashrc`:
346 eval "$(pandoc --bash-completion)"
348`--verbose`
350: Give verbose debugging output. Currently this only has an effect
351 with PDF output.
353`--quiet`
355: Suppress warning messages.
357`--fail-if-warnings`
359: Exit with error status if there are any warnings.
361`--log=`*FILE*
363: Write log messages in machine-readable JSON format to
364 *FILE*. All messages above DEBUG level will be written,
365 regardless of verbosity settings (`--verbose`, `--quiet`).
367`--list-input-formats`
369: List supported input formats, one per line.
371`--list-output-formats`
373: List supported output formats, one per line.
375`--list-extensions`
377: List supported Markdown extensions, one per line, followed
378 by a `+` or `-` indicating whether it is enabled by default
379 in pandoc's Markdown.
381`--list-highlight-languages`
383: List supported languages for syntax highlighting, one per
384 line.
386`--list-highlight-styles`
388: List supported styles for syntax highlighting, one per line.
389 See `--highlight-style`.
391`-v`, `--version`
393: Print version.
395`-h`, `--help`
397: Show usage message.
399Reader options
400--------------
402`--base-header-level=`*NUMBER*
404: Specify the base level for headers (defaults to 1).
406`--indented-code-classes=`*CLASSES*
408: Specify classes to use for indented code blocks--for example,
409 `perl,numberLines` or `haskell`. Multiple classes may be separated
410 by spaces or commas.
412`--default-image-extension=`*EXTENSION*
414: Specify a default extension to use when image paths/URLs have no
415 extension. This allows you to use the same source for formats that
416 require different kinds of images. Currently this option only affects
417 the Markdown and LaTeX readers.
419`--file-scope`
421: Parse each file individually before combining for multifile
422 documents. This will allow footnotes in different files with the
423 same identifiers to work as expected. If this option is set,
424 footnotes and links will not work across files. Reading binary
425 files (docx, odt, epub) implies `--file-scope`.
427`--filter=`*PROGRAM*
429: Specify an executable to be used as a filter transforming the
430 pandoc AST after the input is parsed and before the output is
431 written. The executable should read JSON from stdin and write
432 JSON to stdout. The JSON must be formatted like pandoc's own
433 JSON input and output. The name of the output format will be
434 passed to the filter as the first argument. Hence,
436 pandoc --filter ./caps.py -t latex
438 is equivalent to
440 pandoc -t json | ./caps.py latex | pandoc -f json -t latex
442 The latter form may be useful for debugging filters.
444 Filters may be written in any language. `Text.Pandoc.JSON`
445 exports `toJSONFilter` to facilitate writing filters in Haskell.
446 Those who would prefer to write filters in python can use the
447 module [`pandocfilters`], installable from PyPI. There are also
448 pandoc filter libraries in [PHP], [perl], and
449 [javascript/node.js].
451 In order of preference, pandoc will look for filters in
453 1. a specified full or relative path (executable or
454 non-executable)
456 2. `$DATADIR/filters` (executable or non-executable)
458 3. `$PATH` (executable only)
460`-M` *KEY*[`=`*VAL*], `--metadata=`*KEY*[`:`*VAL*]
462: Set the metadata field *KEY* to the value *VAL*. A value specified
463 on the command line overrides a value specified in the document.
464 Values will be parsed as YAML boolean or string values. If no value is
465 specified, the value will be treated as Boolean true. Like
466 `--variable`, `--metadata` causes template variables to be set.
467 But unlike `--variable`, `--metadata` affects the metadata of the
468 underlying document (which is accessible from filters and may be
469 printed in some output formats).
471`-p`, `--preserve-tabs`
473: Preserve tabs instead of converting them to spaces (the default).
474 Note that this will only affect tabs in literal code spans and code
475 blocks; tabs in regular text will be treated as spaces.
477`--tab-stop=`*NUMBER*
479: Specify the number of spaces per tab (default is 4).
481`--track-changes=accept`|`reject`|`all`
483: Specifies what to do with insertions, deletions, and comments
484 produced by the MS Word "Track Changes" feature. `accept` (the
485 default), inserts all insertions, and ignores all
486 deletions. `reject` inserts all deletions and ignores
487 insertions. Both `accept` and `reject` ignore comments. `all` puts
488 in insertions, deletions, and comments, wrapped in spans with
489 `insertion`, `deletion`, `comment-start`, and `comment-end`
490 classes, respectively. The author and time of change is
491 included. `all` is useful for scripting: only accepting changes
492 from a certain reviewer, say, or before a certain date. This
493 option only affects the docx reader.
495`--extract-media=`*DIR*
497: Extract images and other media contained in a docx or epub container
498 to the path *DIR*, creating it if necessary, and adjust the images
499 references in the document so they point to the extracted files.
500 This option only affects the docx and epub readers.
502`--abbreviations=`*FILE*
504: Specifies a custom abbreviations file, with abbreviations
505 one to a line. If this option is not specified, pandoc will
506 read the data file `abbreviations` from the user data
507 directory or fall back on a system default. To see the
508 system default, use
509 `pandoc --print-default-data-file=abbreviations`. The only
510 use pandoc makes of this list is in the Markdown reader.
511 Strings ending in a period that are found in this list will
512 be followed by a nonbreaking space, so that the period will
513 not produce sentence-ending space in formats like LaTeX.
515[`pandocfilters`]: https://github.com/jgm/pandocfilters
516[PHP]: https://github.com/vinai/pandocfilters-php
517[perl]: https://metacpan.org/pod/Pandoc::Filter
518[javascript/node.js]: https://github.com/mvhenderson/pandoc-filter-node
520General writer options
521----------------------
523`-s`, `--standalone`
525: Produce output with an appropriate header and footer (e.g. a
526 standalone HTML, LaTeX, TEI, or RTF file, not a fragment). This option
527 is set automatically for `pdf`, `epub`, `epub3`, `fb2`, `docx`, and `odt`
528 output.
530`--template=`*FILE*
532: Use *FILE* as a custom template for the generated document. Implies
533 `--standalone`. See [Templates], below, for a description
534 of template syntax. If no extension is specified, an extension
535 corresponding to the writer will be added, so that `--template=special`
536 looks for `special.html` for HTML output. If the template is not
537 found, pandoc will search for it in the `templates` subdirectory of
538 the user data directory (see `--data-dir`). If this option is not used,
539 a default template appropriate for the output format will be used (see
540 `-D/--print-default-template`).
542`-V` *KEY*[`=`*VAL*], `--variable=`*KEY*[`:`*VAL*]
544: Set the template variable *KEY* to the value *VAL* when rendering the
545 document in standalone mode. This is generally only useful when the
546 `--template` option is used to specify a custom template, since
547 pandoc automatically sets the variables used in the default
548 templates. If no *VAL* is specified, the key will be given the
549 value `true`.
551`-D` *FORMAT*, `--print-default-template=`*FORMAT*
553: Print the system default template for an output *FORMAT*. (See `-t`
554 for a list of possible *FORMAT*s.) Templates in the user data
555 directory are ignored.
557`--print-default-data-file=`*FILE*
559: Print a system default data file. Files in the user data directory
560 are ignored.
562`--dpi`=*NUMBER*
563: Specify the dpi (dots per inch) value for conversion from pixels
564 to inch/centimeters and vice versa. The default is 96dpi.
565 Technically, the correct term would be ppi (pixels per inch).
567`--wrap=auto`|`none`|`preserve`
569: Determine how text is wrapped in the output (the source
570 code, not the rendered version). With `auto` (the default),
571 pandoc will attempt to wrap lines to the column width specified by
572 `--columns` (default 72). With `none`, pandoc will not wrap
573 lines at all. With `preserve`, pandoc will attempt to
574 preserve the wrapping from the source document (that is,
575 where there are nonsemantic newlines in the source, there
576 will be nonsemantic newlines in the output as well).
577 Automatic wrapping does not currently work in HTML output.
579`--columns=`*NUMBER*
581: Specify length of lines in characters. This affects text wrapping
582 in the generated source code (see `--wrap`). It also affects
583 calculation of column widths for plain text tables (see [Tables] below).
585`--toc`, `--table-of-contents`
587: Include an automatically generated table of contents (or, in
588 the case of `latex`, `context`, `docx`, and `rst`, an instruction to create
589 one) in the output document. This option has no effect on `man`,
590 `docbook4`, `docbook5`, `slidy`, `slideous`, `s5`, or `odt` output.
592`--toc-depth=`*NUMBER*
594: Specify the number of section levels to include in the table
595 of contents. The default is 3 (which means that level 1, 2, and 3
596 headers will be listed in the contents).
598`--no-highlight`
600: Disables syntax highlighting for code blocks and inlines, even when
601 a language attribute is given.
603`--highlight-style=`*STYLE*
605: Specifies the coloring style to be used in highlighted source code.
606 Options are `pygments` (the default), `kate`, `monochrome`,
607 `breezeDark`, `espresso`, `zenburn`, `haddock`, and `tango`.
608 For more information on syntax highlighting in pandoc, see
609 [Syntax highlighting], below. See also
610 `--list-highlight-styles`.
612`-H` *FILE*, `--include-in-header=`*FILE*
614: Include contents of *FILE*, verbatim, at the end of the header.
615 This can be used, for example, to include special
616 CSS or JavaScript in HTML documents. This option can be used
617 repeatedly to include multiple files in the header. They will be
618 included in the order specified. Implies `--standalone`.
620`-B` *FILE*, `--include-before-body=`*FILE*
622: Include contents of *FILE*, verbatim, at the beginning of the
623 document body (e.g. after the `<body>` tag in HTML, or the
624 `\begin{document}` command in LaTeX). This can be used to include
625 navigation bars or banners in HTML documents. This option can be
626 used repeatedly to include multiple files. They will be included in
627 the order specified. Implies `--standalone`.
629`-A` *FILE*, `--include-after-body=`*FILE*
631: Include contents of *FILE*, verbatim, at the end of the document
632 body (before the `</body>` tag in HTML, or the
633 `\end{document}` command in LaTeX). This option can be used
634 repeatedly to include multiple files. They will be included in the
635 order specified. Implies `--standalone`.
637Options affecting specific writers
638----------------------------------
640`--self-contained`
642: Produce a standalone HTML file with no external dependencies, using
643 `data:` URIs to incorporate the contents of linked scripts, stylesheets,
644 images, and videos. The resulting file should be "self-contained,"
645 in the sense that it needs no external files and no net access to be
646 displayed properly by a browser. This option works only with HTML output
647 formats, including `html4`, `html5`, `html+lhs`, `html5+lhs`, `s5`,
648 `slidy`, `slideous`, `dzslides`, and `revealjs`. Scripts, images, and
649 stylesheets at absolute URLs will be downloaded; those at relative URLs
650 will be sought relative to the working directory (if the first source
651 file is local) or relative to the base URL (if the first source
652 file is remote). Elements with the attribute
653 `data-external="1"` will be left alone; the documents they
654 link to will not be incorporated in the document.
655 Limitation: resources that are loaded dynamically through
656 JavaScript cannot be incorporated; as a result,
657 `--self-contained` does not work with `--mathjax`, and some
658 advanced features (e.g. zoom or speaker notes) may not work
659 in an offline "self-contained" `reveal.js` slide show.
661`--html-q-tags`
663: Use `<q>` tags for quotes in HTML.
665`--ascii`
667: Use only ASCII characters in output. Currently supported only for
668 HTML and DocBook output (which uses numerical entities instead of
669 UTF-8 when this option is selected).
671`--reference-links`
673: Use reference-style links, rather than inline links, in writing Markdown
674 or reStructuredText. By default inline links are used. The
675 placement of link references is affected by the
676 `--reference-location` option.
678`--reference-location = block`|`section`|`document`
680: Specify whether footnotes (and references, if `reference-links` is
681 set) are placed at the end of the current (top-level) block, the
682 current section, or the document. The default is
683 `document`. Currently only affects the markdown writer.
685`--atx-headers`
687: Use ATX-style headers in Markdown and AsciiDoc output. The default is
688 to use setext-style headers for levels 1-2, and then ATX headers.
690`--top-level-division=[default|section|chapter|part]`
692: Treat top-level headers as the given division type in LaTeX, ConTeXt,
693 DocBook, and TEI output. The hierarchy order is part, chapter, then section;
694 all headers are shifted such that the top-level header becomes the specified
695 type. The default behavior is to determine the best division type via
696 heuristics: unless other conditions apply, `section` is chosen. When the
697 LaTeX document class is set to `report`, `book`, or `memoir` (unless the
698 `article` option is specified), `chapter` is implied as the setting for this
699 option. If `beamer` is the output format, specifying either `chapter` or
700 `part` will cause top-level headers to become `\part{..}`, while
701 second-level headers remain as their default type.
703`-N`, `--number-sections`
705: Number section headings in LaTeX, ConTeXt, HTML, or EPUB output.
706 By default, sections are not numbered. Sections with class
707 `unnumbered` will never be numbered, even if `--number-sections`
708 is specified.
710`--number-offset=`*NUMBER*[`,`*NUMBER*`,`*...*]
712: Offset for section headings in HTML output (ignored in other
713 output formats). The first number is added to the section number for
714 top-level headers, the second for second-level headers, and so on.
715 So, for example, if you want the first top-level header in your
716 document to be numbered "6", specify `--number-offset=5`.
717 If your document starts with a level-2 header which you want to
718 be numbered "1.5", specify `--number-offset=1,4`.
719 Offsets are 0 by default. Implies `--number-sections`.
721`--listings`
723: Use the [`listings`] package for LaTeX code blocks
725`-i`, `--incremental`
727: Make list items in slide shows display incrementally (one by one).
728 The default is for lists to be displayed all at once.
730`--slide-level=`*NUMBER*
732: Specifies that headers with the specified level create
733 slides (for `beamer`, `s5`, `slidy`, `slideous`, `dzslides`). Headers
734 above this level in the hierarchy are used to divide the
735 slide show into sections; headers below this level create
736 subheads within a slide. Note that content that is
737 not contained under slide-level headers will not appear in
738 the slide show. The default is to set the slide level based
739 on the contents of the document; see [Structuring the slide
740 show].
742`--section-divs`
744: Wrap sections in `<div>` tags (or `<section>` tags in HTML5),
745 and attach identifiers to the enclosing `<div>` (or `<section>`)
746 rather than the header itself. See
747 [Header identifiers], below.
749`--email-obfuscation=none`|`javascript`|`references`
751: Specify a method for obfuscating `mailto:` links in HTML documents.
752 `none` leaves `mailto:` links as they are. `javascript` obfuscates
753 them using JavaScript. `references` obfuscates them by printing their
754 letters as decimal or hexadecimal character references. The default
755 is `none`.
757`--id-prefix=`*STRING*
759: Specify a prefix to be added to all identifiers and internal links
760 in HTML and DocBook output, and to footnote numbers in Markdown
761 and Haddock output. This is useful for preventing duplicate
762 identifiers when generating fragments to be included in other pages.
764`-T` *STRING*, `--title-prefix=`*STRING*
766: Specify *STRING* as a prefix at the beginning of the title
767 that appears in the HTML header (but not in the title as it
768 appears at the beginning of the HTML body). Implies
769 `--standalone`.
771`-c` *URL*, `--css=`*URL*
773: Link to a CSS style sheet. This option can be used repeatedly to
774 include multiple files. They will be included in the order specified.
776 A stylesheet is required for generating EPUB. If none is
777 provided using this option (or the `stylesheet` metadata
778 field), pandoc will look for a file `epub.css` in the
779 user data directory (see `--data-dir`). If it is not
780 found there, sensible defaults will be used.
782`--reference-doc=`*FILE*
784: Use the specified file as a style reference in producing a
785 docx or ODT file.
787 Docx: For best results, the reference docx should be a modified
788 version of a docx file produced using pandoc. The contents
789 of the reference docx are ignored, but its stylesheets and
790 document properties (including margins, page size, header,
791 and footer) are used in the new docx. If no reference docx
792 is specified on the command line, pandoc will look for a
793 file `reference.docx` in the user data directory (see
794 `--data-dir`). If this is not found either, sensible
795 defaults will be used.
797 To produce a custom `reference.docx`, first get a copy of
798 the default `reference.docx`: `pandoc
799 --print-default-data-file reference.docx >
800 custom-reference.docx`. Then open `custom-reference.docx`
801 in Word, modify the styles as you wish, and save the file.
802 For best results, do not make changes to this file other
803 than modifying the styles used by pandoc: [paragraph]
804 Normal, Body Text, First Paragraph, Compact, Title,
805 Subtitle, Author, Date, Abstract, Bibliography, Heading 1,
806 Heading 2, Heading 3, Heading 4, Heading 5, Heading 6,
807 Heading 7, Heading 8, Heading 9, Block Text, Footnote Text,
808 Definition Term, Definition, Caption, Table Caption,
809 Image Caption, Figure, Figure With Caption, TOC Heading;
810 [character] Default Paragraph Font, Body Text Char,
811 Verbatim Char, Footnote Reference, Hyperlink; [table]
812 Normal Table.
814 ODT: For best results, the reference ODT should be a modified
815 version of an ODT produced using pandoc. The contents of
816 the reference ODT are ignored, but its stylesheets are used
817 in the new ODT. If no reference ODT is specified on the
818 command line, pandoc will look for a file `reference.odt` in
819 the user data directory (see `--data-dir`). If this is not
820 found either, sensible defaults will be used.
822 To produce a custom `reference.odt`, first get a copy of
823 the default `reference.odt`: `pandoc
824 --print-default-data-file reference.odt >
825 custom-reference.odt`. Then open `custom-reference.docx` in
826 LibreOffice, modify the styles as you wish, and save the
827 file.
829`--epub-cover-image=`*FILE*
831: Use the specified image as the EPUB cover. It is recommended
832 that the image be less than 1000px in width and height. Note that
833 in a Markdown source document you can also specify `cover-image`
834 in a YAML metadata block (see [EPUB Metadata], below).
836`--epub-metadata=`*FILE*
838: Look in the specified XML file for metadata for the EPUB.
839 The file should contain a series of [Dublin Core elements].
840 For example:
842 <dc:rights>Creative Commons</dc:rights>
843 <dc:language>es-AR</dc:language>
845 By default, pandoc will include the following metadata elements:
846 `<dc:title>` (from the document title), `<dc:creator>` (from the
847 document authors), `<dc:date>` (from the document date, which should
848 be in [ISO 8601 format]), `<dc:language>` (from the `lang`
849 variable, or, if is not set, the locale), and `<dc:identifier
850 id="BookId">` (a randomly generated UUID). Any of these may be
851 overridden by elements in the metadata file.
853 Note: if the source document is Markdown, a YAML metadata block
854 in the document can be used instead. See below under
855 [EPUB Metadata].
857`--epub-embed-font=`*FILE*
859: Embed the specified font in the EPUB. This option can be repeated
860 to embed multiple fonts. Wildcards can also be used: for example,
861 `DejaVuSans-*.ttf`. However, if you use wildcards on the command
862 line, be sure to escape them or put the whole filename in single quotes,
863 to prevent them from being interpreted by the shell. To use the
864 embedded fonts, you will need to add declarations like the following
865 to your CSS (see `--css`):
867 @font-face {
868 font-family: DejaVuSans;
869 font-style: normal;
870 font-weight: normal;
871 src:url("DejaVuSans-Regular.ttf");
872 }
873 @font-face {
874 font-family: DejaVuSans;
875 font-style: normal;
876 font-weight: bold;
877 src:url("DejaVuSans-Bold.ttf");
878 }
879 @font-face {
880 font-family: DejaVuSans;
881 font-style: italic;
882 font-weight: normal;
883 src:url("DejaVuSans-Oblique.ttf");
884 }
885 @font-face {
886 font-family: DejaVuSans;
887 font-style: italic;
888 font-weight: bold;
889 src:url("DejaVuSans-BoldOblique.ttf");
890 }
891 body { font-family: "DejaVuSans"; }
893`--epub-chapter-level=`*NUMBER*
895: Specify the header level at which to split the EPUB into separate
896 "chapter" files. The default is to split into chapters at level 1
897 headers. This option only affects the internal composition of the
898 EPUB, not the way chapters and sections are displayed to users. Some
899 readers may be slow if the chapter files are too large, so for large
900 documents with few level 1 headers, one might want to use a chapter
901 level of 2 or 3.
903`--latex-engine=pdflatex`|`lualatex`|`xelatex`
905: Use the specified LaTeX engine when producing PDF output.
906 The default is `pdflatex`. If the engine is not in your PATH,
907 the full path of the engine may be specified here.
909`--latex-engine-opt=`*STRING*
911: Use the given string as a command-line argument to the `latex-engine`.
912 If used multiple times, the arguments are provided with spaces between
913 them. Note that no check for duplicate options is done.
915[Dublin Core elements]: http://dublincore.org/documents/dces/
916[ISO 8601 format]: http://www.w3.org/TR/NOTE-datetime
918Citation rendering
919------------------
921`--bibliography=`*FILE*
923: Set the `bibliography` field in the document's metadata to *FILE*,
924 overriding any value set in the metadata, and process citations
925 using `pandoc-citeproc`. (This is equivalent to
926 `--metadata bibliography=FILE --filter pandoc-citeproc`.)
927 If `--natbib` or `--biblatex` is also supplied, `pandoc-citeproc` is not
928 used, making this equivalent to `--metadata bibliography=FILE`.
929 If you supply this argument multiple times, each *FILE* will be added
930 to bibliography.
932`--csl=`*FILE*
934: Set the `csl` field in the document's metadata to *FILE*,
935 overriding any value set in the metadata. (This is equivalent to
936 `--metadata csl=FILE`.)
937 This option is only relevant with `pandoc-citeproc`.
939`--citation-abbreviations=`*FILE*
941: Set the `citation-abbreviations` field in the document's metadata to
942 *FILE*, overriding any value set in the metadata. (This is equivalent to
943 `--metadata citation-abbreviations=FILE`.)
944 This option is only relevant with `pandoc-citeproc`.
946`--natbib`
948: Use [`natbib`] for citations in LaTeX output. This option is not for use
949 with the `pandoc-citeproc` filter or with PDF output. It is intended for
950 use in producing a LaTeX file that can be processed with [`bibtex`].
952`--biblatex`
954: Use [`biblatex`] for citations in LaTeX output. This option is not for use
955 with the `pandoc-citeproc` filter or with PDF output. It is intended for
956 use in producing a LaTeX file that can be processed with [`bibtex`] or [`biber`].
958Math rendering in HTML
959----------------------
961`-m` [*URL*], `--latexmathml`[`=`*URL*]
963: Use the [LaTeXMathML] script to display embedded TeX math in HTML output.
964 To insert a link to a local copy of the `LaTeXMathML.js` script,
965 provide a *URL*. If no *URL* is provided, the contents of the
966 script will be inserted directly into the HTML header, preserving
967 portability at the price of efficiency. If you plan to use math on
968 several pages, it is much better to link to a copy of the script,
969 so it can be cached.
971`--mathml`
973: Convert TeX math to [MathML] (in `docbook4`, `docbook5`,
974 `html4` and `html5`).
976`--jsmath`[`=`*URL*]
978: Use [jsMath] to display embedded TeX math in HTML output.
979 The *URL* should point to the jsMath load script (e.g.
980 `jsMath/easy/load.js`); if provided, it will be linked to in
981 the header of standalone HTML documents. If a *URL* is not provided,
982 no link to the jsMath load script will be inserted; it is then
983 up to the author to provide such a link in the HTML template.
985`--mathjax`[`=`*URL*]
987: Use [MathJax] to display embedded TeX math in HTML output.
988 The *URL* should point to the `MathJax.js` load script.
989 If a *URL* is not provided, a link to the MathJax CDN will
990 be inserted.
992`--gladtex`
994: Enclose TeX math in `<eq>` tags in HTML output. These can then
995 be processed by [gladTeX] to produce links to images of the typeset
996 formulas.
998`--mimetex`[`=`*URL*]
1000: Render TeX math using the [mimeTeX] CGI script. If *URL* is not
1001 specified, it is assumed that the script is at `/cgi-bin/mimetex.cgi`.
1003`--webtex`[`=`*URL*]
1005: Render TeX formulas using an external script that converts TeX
1006 formulas to images. The formula will be concatenated with the URL
1007 provided. If *URL* is not specified, the CodeCogs will be used.
1008 Note: the `--webtex` option will affect Markdown output
1009 as well as HTML, which is useful if you're targeting a
1010 version of Markdown without native math support.
1012`--katex`[`=`*URL*]
1014: Use [KaTeX] to display embedded TeX math in HTML output.
1015 The *URL* should point to the `katex.js` load script. If a *URL* is
1016 not provided, a link to the KaTeX CDN will be inserted.
1017 Note: [KaTeX] seems to work best with `html5` output.
1019`--katex-stylesheet=`*URL*
1021: The *URL* should point to the `katex.css` stylesheet. If this option is
1022 not specified, a link to the KaTeX CDN will be inserted. Note that this
1023 option does not imply `--katex`.
1025[MathML]: http://www.w3.org/Math/
1026[LaTeXMathML]: http://math.etsu.edu/LaTeXMathML/
1027[jsMath]: http://www.math.union.edu/~dpvc/jsmath/
1028[MathJax]: https://www.mathjax.org
1029[gladTeX]: http://ans.hsh.no/home/mgg/gladtex/
1030[mimeTeX]: http://www.forkosh.com/mimetex.html
1031[KaTeX]: https://github.com/Khan/KaTeX
1033Options for wrapper scripts
1034---------------------------
1036`--dump-args`
1038: Print information about command-line arguments to *stdout*, then exit.
1039 This option is intended primarily for use in wrapper scripts.
1040 The first line of output contains the name of the output file specified
1041 with the `-o` option, or `-` (for *stdout*) if no output file was
1042 specified. The remaining lines contain the command-line arguments,
1043 one per line, in the order they appear. These do not include regular
1044 pandoc options and their arguments, but do include any options appearing
1045 after a `--` separator at the end of the line.
1047`--ignore-args`
1049: Ignore command-line arguments (for use in wrapper scripts).
1050 Regular pandoc options are not ignored. Thus, for example,
1052 pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1
1054 is equivalent to
1056 pandoc -o foo.html -s
1058Templates
1059=========
1061When the `-s/--standalone` option is used, pandoc uses a template to
1062add header and footer material that is needed for a self-standing
1063document. To see the default template that is used, just type
1065 pandoc -D *FORMAT*
1067where *FORMAT* is the name of the output format. A custom template
1068can be specified using the `--template` option. You can also override
1069the system default templates for a given output format *FORMAT*
1070by putting a file `templates/default.*FORMAT*` in the user data
1071directory (see `--data-dir`, above). *Exceptions:*
1073- For `odt` output, customize the `default.opendocument`
1074 template.
1075- For `pdf` output, customize the `default.latex` template
1076 (or the `default.beamer` template, if you use `-t beamer`,
1077 or the `default.context` template, if you use `-t context`).
1078- `docx` has no template (however, you can use
1079 `--reference-doc` to customize the output).
1081Templates contain *variables*, which allow for the inclusion of
1082arbitrary information at any point in the file. Variables may be set
1083within the document using [YAML metadata blocks][Extension:
1084`yaml_metadata_block`]. They may also be set at the
1085command line using the `-V/--variable` option: variables set in this
1086way override metadata fields with the same name.
1088Variables set by pandoc
1089-----------------------
1091Some variables are set automatically by pandoc. These vary somewhat
1092depending on the output format, but include metadata fields as well
1093as the following:
1095`sourcefile`, `outputfile`
1096: source and destination filenames, as given on the command line.
1097 `sourcefile` can also be a list if input comes from multiple files, or empty
1098 if input is from stdin. You can use the following snippet in your template
1099 to distinguish them:
1101 $if(sourcefile)$
1102 $for(sourcefile)$
1103 $sourcefile$
1104 $endfor$
1105 $else$
1106 (stdin)
1107 $endif$
1109 Similarly, `outputfile` can be `-` if output goes to the terminal.
1111`title`, `author`, `date`
1112: allow identification of basic aspects of the document. Included
1113 in PDF metadata through LaTeX and ConTeXt. These can be set
1114 through a [pandoc title block][Extension: `pandoc_title_block`],
1115 which allows for multiple authors, or through a YAML metadata block:
1117 ---
1118 author:
1119 - Aristotle
1120 - Peter Abelard
1121 ...
1123`subtitle`
1124: document subtitle, included in HTML, EPUB, LaTeX, ConTeXt, and Word docx;
1125 renders in LaTeX only when using a document class that supports
1126 `\subtitle`, such as `beamer` or the [KOMA-Script] series (`scrartcl`,
1127 `scrreprt`, `scrbook`).[^subtitle]
1129`institute`
1130: author affiliations (in LaTeX and Beamer only). Can be a
1131 list, when there are multiple authors.
1133`abstract`
1134: document summary, included in LaTeX, ConTeXt, AsciiDoc, and Word docx
1136`keywords`
1137: list of keywords to be included in HTML, PDF, and AsciiDoc metadata;
1138 may be repeated as for `author`, above
1140`header-includes`
1141: contents specified by `-H/--include-in-header` (may have multiple
1142 values)
1144`toc`
1145: non-null value if `--toc/--table-of-contents` was specified
1147`toc-title`
1148: title of table of contents (works only with EPUB and docx)
1150`include-before`
1151: contents specified by `-B/--include-before-body` (may have
1152 multiple values)
1154`include-after`
1155: contents specified by `-A/--include-after-body` (may have
1156 multiple values)
1158`body`
1159: body of document
1161`meta-json`
1162: JSON representation of all of the document's metadata. Field
1163 values are transformed to the selected output format.
1165[^subtitle]: To make `subtitle` work with other LaTeX
1166 document classes, you can add the following to `header-includes`:
1168 \providecommand{\subtitle}[1]{%
1169 \usepackage{titling}
1170 \posttitle{%
1171 \par\large#1\end{center}}
1174Language variables
1175------------------
1177`lang`
1178: identifies the main language of the document,
1179 using a code according to [BCP 47] (e.g. `en` or `en-GB`).
1180 For some output formats, pandoc will convert it to an appropriate
1181 format stored in the additional variables `babel-lang`,
1182 `polyglossia-lang` (LaTeX) and `context-lang` (ConTeXt).
1184 Native pandoc `span`s and `div`s with the lang attribute
1185 (value in BCP 47) can be used to switch the language in
1186 that range.
1188`otherlangs`
1189: a list of other languages used in the document
1190 in the YAML metadata, according to [BCP 47]. For example:
1191 `otherlangs: [en-GB, fr]`.
1192 This is automatically generated from the `lang` attributes
1193 in all `span`s and `div`s but can be overridden.
1194 Currently only used by LaTeX through the generated
1195 `babel-otherlangs` and `polyglossia-otherlangs` variables.
1196 The LaTeX writer outputs polyglossia commands in the text but
1197 the `babel-newcommands` variable contains mappings for them
1198 to the corresponding babel.
1200`dir`
1201: the base direction of the document, either `rtl` (right-to-left)
1202 or `ltr` (left-to-right).
1204 For bidirectional documents, native pandoc `span`s and `div`s
1205 with the `dir` attribute (value `rtl` or `ltr`) can be used to
1206 override the base direction in some output formats.
1207 This may not always be necessary if the final renderer
1208 (e.g. the browser, when generating HTML) supports the
1209 [Unicode Bidirectional Algorithm].
1211 When using LaTeX for bidirectional documents, only the `xelatex` engine
1212 is fully supported (use `--latex-engine=xelatex`).
1214[BCP 47]: https://tools.ietf.org/html/bcp47
1215[Unicode Bidirectional Algorithm]: http://www.w3.org/International/articles/inline-bidi-markup/uba-basics
1217Variables for slides
1218--------------------
1220Variables are available for [producing slide shows with pandoc],
1221including all [reveal.js configuration options].
1223`titlegraphic`
1224: title graphic for Beamer documents
1226`logo`
1227: logo for Beamer documents
1229`slidy-url`
1230: base URL for Slidy documents (defaults to
1231 `http://www.w3.org/Talks/Tools/Slidy2`)
1233`slideous-url`
1234: base URL for Slideous documents (defaults to `slideous`)
1236`s5-url`
1237: base URL for S5 documents (defaults to `s5/default`)
1239`revealjs-url`
1240: base URL for reveal.js documents (defaults to `reveal.js`)
1242`theme`, `colortheme`, `fonttheme`, `innertheme`, `outertheme`
1243: themes for LaTeX [`beamer`] documents
1245`themeoptions`
1246: options for LaTeX beamer themes (a list).
1248`navigation`
1249: controls navigation symbols in `beamer` documents
1250 (default is `empty` for no navigation symbols; other valid values
1251 are `frame`, `vertical`, and `horizontal`).
1253`section-titles`
1254: enables on "title pages" for new sections in `beamer`
1255 documents (default = true).
1257`beamerarticle`
1258: when true, the `beamerarticle` package is loaded (for
1259 producing an article from beamer slides).
1261`colorlinks`
1262: add color to link text; automatically enabled if any of `linkcolor`, `citecolor`,
1263 `urlcolor`, or `toccolor` are set (for beamer only).
1265`linkcolor`, `citecolor`, `urlcolor`, `toccolor`
1266: color for internal links, citation links, external links, and links in table
1267 of contents: uses any of the [predefined LaTeX colors] (for beamer only).
1269[reveal.js configuration options]: https://github.com/hakimel/reveal.js#configuration
1271Variables for LaTeX
1272-------------------
1274LaTeX variables are used when [creating a PDF].
1276`papersize`
1277: paper size, e.g. `letter`, `A4`
1279`fontsize`
1280: font size for body text (e.g. `10pt`, `12pt`)
1282`documentclass`
1283: document class, e.g. [`article`], [`report`], [`book`], [`memoir`]
1285`classoption`
1286: option for document class, e.g. `oneside`; may be repeated
1287 for multiple options
1289`geometry`
1290: option for [`geometry`] package, e.g. `margin=1in`;
1291 may be repeated for multiple options
1293`margin-left`, `margin-right`, `margin-top`, `margin-bottom`
1294: sets margins, if `geometry` is not used (otherwise `geometry`
1295 overrides these)
1297`linestretch`
1298: adjusts line spacing using the [`setspace`]
1299 package, e.g. `1.25`, `1.5`
1301`fontfamily`
1302: font package for use with `pdflatex`:
1303 [TeX Live] includes many options, documented in the [LaTeX Font Catalogue].
1304 The default is [Latin Modern][`lm`].
1306`fontfamilyoptions`
1307: options for package used as `fontfamily`: e.g. `osf,sc` with
1308 `fontfamily` set to [`mathpazo`] provides Palatino with old-style
1309 figures and true small caps; may be repeated for multiple options
1311`mainfont`, `sansfont`, `monofont`, `mathfont`, `CJKmainfont`
1312: font families for use with `xelatex` or
1313 `lualatex`: take the name of any system font, using the
1314 [`fontspec`] package. Note that if `CJKmainfont` is used,
1315 the [`xecjk`] package must be available.
1317`mainfontoptions`, `sansfontoptions`, `monofontoptions`, `mathfontoptions`, `CJKoptions`
1318: options to use with `mainfont`, `sansfont`, `monofont`, `mathfont`,
1319 `CJKmainfont` in `xelatex` and `lualatex`. Allow for any choices
1320 available through [`fontspec`], such as the OpenType features
1321 `Numbers=OldStyle,Numbers=Proportional`. May be repeated for multiple options.
1323`fontenc`
1324: allows font encoding to be specified through `fontenc` package (with `pdflatex`);
1325 default is `T1` (see guide to [LaTeX font encodings])
1327`microtypeoptions`
1328: options to pass to the microtype package
1330`colorlinks`
1331: add color to link text; automatically enabled if any of `linkcolor`, `citecolor`,
1332 `urlcolor`, or `toccolor` are set
1334`linkcolor`, `citecolor`, `urlcolor`, `toccolor`
1335: color for internal links, citation links, external links, and links in table of contents:
1336 uses any of the [predefined LaTeX colors]
1338`links-as-notes`
1339: causes links to be printed as footnotes
1341`indent`
1342: uses document class settings for indentation (the default LaTeX template
1343 otherwise removes indentation and adds space between paragraphs)
1345`subparagraph`
1346: disables default behavior of LaTeX template that redefines (sub)paragraphs
1347 as sections, changing the appearance of nested headings in some classes
1349`thanks`
1350: specifies contents of acknowledgments footnote after document title.
1352`toc`
1353: include table of contents (can also be set using `--toc/--table-of-contents`)
1355`toc-depth`
1356: level of section to include in table of contents
1358`secnumdepth`
1359: numbering depth for sections, if sections are numbered
1361`lof`, `lot`
1362: include list of figures, list of tables
1364`bibliography`
1365: bibliography to use for resolving references
1367`biblio-style`
1368: bibliography style, when used with `--natbib` and `--biblatex`.
1370`biblio-title`
1371: bibliography title, when used with `--natbib` and `--biblatex`.
1373`biblatexoptions`
1374: list of options for biblatex.
1376[`article`]: https://ctan.org/pkg/article
1377[`report`]: https://ctan.org/pkg/report
1378[`book`]: https://ctan.org/pkg/book
1379[KOMA-Script]: https://ctan.org/pkg/koma-script
1380[`memoir`]: https://ctan.org/pkg/memoir
1381[predefined LaTeX colors]: https://en.wikibooks.org/wiki/LaTeX/Colors#Predefined_colors
1382[LaTeX Font Catalogue]: http://www.tug.dk/FontCatalogue/
1383[`mathpazo`]: https://ctan.org/pkg/mathpazo
1384[LaTeX font encodings]: https://ctan.org/pkg/encguide
1386Variables for ConTeXt
1387---------------------
1389`papersize`
1390: paper size, e.g. `letter`, `A4`, `landscape` (see [ConTeXt Paper Setup]);
1391 may be repeated for multiple options
1393`layout`
1394: options for page margins and text arrangement (see [ConTeXt Layout]);
1395 may be repeated for multiple options
1397`margin-left`, `margin-right`, `margin-top`, `margin-bottom`
1398: sets margins, if `layout` is not used (otherwise `layout`
1399 overrides these)
1401`fontsize`
1402: font size for body text (e.g. `10pt`, `12pt`)
1404`mainfont`, `sansfont`, `monofont`, `mathfont`
1405: font families: take the name of any system font (see [ConTeXt Font Switching])
1407`linkcolor`, `contrastcolor`
1408: color for links outside and inside a page, e.g. `red`, `blue` (see [ConTeXt Color])
1410`linkstyle`
1411: typeface style for links, e.g. `normal`, `bold`, `slanted`, `boldslanted`, `type`, `cap`, `small`
1413`indenting`
1414: controls indentation of paragraphs, e.g. `yes,small,next` (see [ConTeXt Indentation]);
1415 may be repeated for multiple options
1417`whitespace`
1418: spacing between paragraphs, e.g. `none`, `small` (using [`setupwhitespace`])
1420`interlinespace`
1421: adjusts line spacing, e.g. `4ex` (using [`setupinterlinespace`]);
1422 may be repeated for multiple options
1424`headertext`, `footertext`
1425: text to be placed in running header or footer (see [ConTeXt Headers and Footers]);
1426 may be repeated up to four times for different placement
1428`pagenumbering`
1429: page number style and location (using [`setuppagenumbering`]);
1430 may be repeated for multiple options
1432`toc`
1433: include table of contents (can also be set using `--toc/--table-of-contents`)
1435`lof`, `lot`
1436: include list of figures, list of tables
1438[ConTeXt Paper Setup]: http://wiki.contextgarden.net/PaperSetup
1439[ConTeXt Layout]: http://wiki.contextgarden.net/Layout
1440[ConTeXt Font Switching]: http://wiki.contextgarden.net/Font_Switching
1441[ConTeXt Color]: http://wiki.contextgarden.net/Color
1442[ConTeXt Headers and Footers]: http://wiki.contextgarden.net/Headers_and_Footers
1443[ConTeXt Indentation]: http://wiki.contextgarden.net/Indentation
1444[`setupwhitespace`]: http://wiki.contextgarden.net/Command/setupwhitespace
1445[`setupinterlinespace`]: http://wiki.contextgarden.net/Command/setupinterlinespace
1446[`setuppagenumbering`]: http://wiki.contextgarden.net/Command/setuppagenumbering
1448Variables for man pages
1449-----------------------
1451`section`
1452: section number in man pages
1454`header`
1455: header in man pages
1457`footer`
1458: footer in man pages
1460`adjusting`
1461: adjusts text to left (`l`), right (`r`), center (`c`),
1462 or both (`b`) margins
1464`hyphenate`
1465: if `true` (the default), hyphenation will be used
1467Using variables in templates
1468----------------------------
1470Variable names are sequences of alphanumerics, `-`, and `_`,
1471starting with a letter. A variable name surrounded by `$` signs
1472will be replaced by its value. For example, the string `$title$` in
1474 <title>$title$</title>
1476will be replaced by the document title.
1478To write a literal `$` in a template, use `$$`.
1480Templates may contain conditionals. The syntax is as follows:
1482 $if(variable)$
1484 $else$
1486 $endif$
1488This will include `X` in the template if `variable` has a non-null
1489value; otherwise it will include `Y`. `X` and `Y` are placeholders for
1490any valid template text, and may include interpolated variables or other
1491conditionals. The `$else$` section may be omitted.
1493When variables can have multiple values (for example, `author` in
1494a multi-author document), you can use the `$for$` keyword:
1496 $for(author)$
1497 <meta name="author" content="$author$" />
1498 $endfor$
1500You can optionally specify a separator to be used between
1501consecutive items:
1503 $for(author)$$author$$sep$, $endfor$
1505A dot can be used to select a field of a variable that takes
1506an object as its value. So, for example:
1508 $author.name$ ($author.affiliation$)
1510If you use custom templates, you may need to revise them as pandoc
1511changes. We recommend tracking the changes in the default templates,
1512and modifying your custom templates accordingly. An easy way to do this
1513is to fork the [pandoc-templates] repository and merge in changes after each
1514pandoc release.
1516[pandoc-templates]: https://github.com/jgm/pandoc-templates
1518Pandoc's Markdown
1519=================
1521Pandoc understands an extended and slightly revised version of
1522John Gruber's [Markdown] syntax. This document explains the syntax,
1523noting differences from standard Markdown. Except where noted, these
1524differences can be suppressed by using the `markdown_strict` format instead
1525of `markdown`. An extensions can be enabled by adding `+EXTENSION`
1526to the format name and disabled by adding `-EXTENSION`. For example,
1527`markdown_strict+footnotes` is strict Markdown with footnotes
1528enabled, while `markdown-footnotes-pipe_tables` is pandoc's
1529Markdown without footnotes or pipe tables.
1531Philosophy
1532----------
1534Markdown is designed to be easy to write, and, even more importantly,
1535easy to read:
1537> A Markdown-formatted document should be publishable as-is, as plain
1538> text, without looking like it's been marked up with tags or formatting
1539> instructions.
1540> -- [John Gruber](http://daringfireball.net/projects/markdown/syntax#philosophy)
1542This principle has guided pandoc's decisions in finding syntax for
1543tables, footnotes, and other extensions.
1545There is, however, one respect in which pandoc's aims are different
1546from the original aims of Markdown. Whereas Markdown was originally
1547designed with HTML generation in mind, pandoc is designed for multiple
1548output formats. Thus, while pandoc allows the embedding of raw HTML,
1549it discourages it, and provides other, non-HTMLish ways of representing
1550important document elements like definition lists, tables, mathematics, and
1551footnotes.
1553Paragraphs
1554----------
1556A paragraph is one or more lines of text followed by one or more blank lines.
1557Newlines are treated as spaces, so you can reflow your paragraphs as you like.
1558If you need a hard line break, put two or more spaces at the end of a line.
1560#### Extension: `escaped_line_breaks` ####
1562A backslash followed by a newline is also a hard line break.
1563Note: in multiline and grid table cells, this is the only way
1564to create a hard line break, since trailing spaces in the cells
1565are ignored.
1567Headers
1568-------
1570There are two kinds of headers: Setext and ATX.
1572### Setext-style headers ###
1574A setext-style header is a line of text "underlined" with a row of `=` signs
1575(for a level one header) or `-` signs (for a level two header):
1577 A level-one header
1578 ==================
1580 A level-two header
1581 ------------------
1583The header text can contain inline formatting, such as emphasis (see
1584[Inline formatting], below).
1587### ATX-style headers ###
1589An ATX-style header consists of one to six `#` signs and a line of
1590text, optionally followed by any number of `#` signs. The number of
1591`#` signs at the beginning of the line is the header level:
1593 ## A level-two header
1595 ### A level-three header ###
1597As with setext-style headers, the header text can contain formatting:
1599 # A level-one header with a [link](/url) and *emphasis*
1601#### Extension: `blank_before_header` ####
1603Standard Markdown syntax does not require a blank line before a header.
1604Pandoc does require this (except, of course, at the beginning of the
1605document). The reason for the requirement is that it is all too easy for a
1606`#` to end up at the beginning of a line by accident (perhaps through line
1607wrapping). Consider, for example:
1609 I like several of their flavors of ice cream:
1610 #22, for example, and #5.
1613### Header identifiers ###
1615#### Extension: `header_attributes` ####
1617Headers can be assigned attributes using this syntax at the end
1618of the line containing the header text:
1620 {#identifier .class .class key=value key=value}
1622Thus, for example, the following headers will all be assigned the identifier
1623`foo`:
1625 # My header {#foo}
1627 ## My header ## {#foo}
1629 My other header {#foo}
1630 ---------------
1632(This syntax is compatible with [PHP Markdown Extra].)
1634Note that although this syntax allows assignment of classes and key/value
1635attributes, writers generally don't use all of this information. Identifiers,
1636classes, and key/value attributes are used in HTML and HTML-based formats such
1637as EPUB and slidy. Identifiers are used for labels and link anchors in the
1638LaTeX, ConTeXt, Textile, and AsciiDoc writers.
1640Headers with the class `unnumbered` will not be numbered, even if
1641`--number-sections` is specified. A single hyphen (`-`) in an attribute
1642context is equivalent to `.unnumbered`, and preferable in non-English
1643documents. So,
1645 # My header {-}
1647is just the same as
1649 # My header {.unnumbered}
1651#### Extension: `auto_identifiers` ####
1653A header without an explicitly specified identifier will be
1654automatically assigned a unique identifier based on the header text.
1655To derive the identifier from the header text,
1657 - Remove all formatting, links, etc.
1658 - Remove all footnotes.
1659 - Remove all punctuation, except underscores, hyphens, and periods.
1660 - Replace all spaces and newlines with hyphens.
1661 - Convert all alphabetic characters to lowercase.
1662 - Remove everything up to the first letter (identifiers may
1663 not begin with a number or punctuation mark).
1664 - If nothing is left after this, use the identifier `section`.
1666Thus, for example,
1668 Header Identifier
1669 ------------------------------- ----------------------------
1670 `Header identifiers in HTML` `header-identifiers-in-html`
1671 `*Dogs*?--in *my* house?` `dogs--in-my-house`
1672 `[HTML], [S5], or [RTF]?` `html-s5-or-rtf`
1673 `3. Applications` `applications`
1674 `33` `section`
1676These rules should, in most cases, allow one to determine the identifier
1677from the header text. The exception is when several headers have the
1678same text; in this case, the first will get an identifier as described
1679above; the second will get the same identifier with `-1` appended; the
1680third with `-2`; and so on.
1682These identifiers are used to provide link targets in the table of
1683contents generated by the `--toc|--table-of-contents` option. They
1684also make it easy to provide links from one section of a document to
1685another. A link to this section, for example, might look like this:
1687 See the section on
1688 [header identifiers](#header-identifiers-in-html-latex-and-context).
1690Note, however, that this method of providing links to sections works
1691only in HTML, LaTeX, and ConTeXt formats.
1693If the `--section-divs` option is specified, then each section will
1694be wrapped in a `div` (or a `section`, if `html5` was specified),
1695and the identifier will be attached to the enclosing `<div>`
1696(or `<section>`) tag rather than the header itself. This allows entire
1697sections to be manipulated using JavaScript or treated differently in
1698CSS.
1700#### Extension: `implicit_header_references` ####
1702Pandoc behaves as if reference links have been defined for each header.
1703So, to link to a header
1705 # Header identifiers in HTML
1707you can simply write
1709 [Header identifiers in HTML]
1713 [Header identifiers in HTML][]
1717 [the section on header identifiers][header identifiers in
1718 HTML]
1720instead of giving the identifier explicitly:
1722 [Header identifiers in HTML](#header-identifiers-in-html)
1724If there are multiple headers with identical text, the corresponding
1725reference will link to the first one only, and you will need to use explicit
1726links to link to the others, as described above.
1728Like regular reference links, these references are case-insensitive.
1730Explicit link reference definitions always take priority over
1731implicit header references. So, in the following example, the
1732link will point to `bar`, not to `#foo`:
1734 # Foo
1736 [foo]: bar
1738 See [foo]
1740Block quotations
1741----------------
1743Markdown uses email conventions for quoting blocks of text.
1744A block quotation is one or more paragraphs or other block elements
1745(such as lists or headers), with each line preceded by a `>` character
1746and an optional space. (The `>` need not start at the left margin, but
1747it should not be indented more than three spaces.)
1749 > This is a block quote. This
1750 > paragraph has two lines.
1752 > 1. This is a list inside a block quote.
1753 > 2. Second item.
1755A "lazy" form, which requires the `>` character only on the first
1756line of each block, is also allowed:
1758 > This is a block quote. This
1759 paragraph has two lines.
1761 > 1. This is a list inside a block quote.
1762 2. Second item.
1764Among the block elements that can be contained in a block quote are
1765other block quotes. That is, block quotes can be nested:
1767 > This is a block quote.
1769 > > A block quote within a block quote.
1771If the `>` character is followed by an optional space, that space
1772will be considered part of the block quote marker and not part of
1773the indentation of the contents. Thus, to put an indented code
1774block in a block quote, you need five spaces after the `>`:
1776 > code
1778#### Extension: `blank_before_blockquote` ####
1780Standard Markdown syntax does not require a blank line before a block
1781quote. Pandoc does require this (except, of course, at the beginning of the
1782document). The reason for the requirement is that it is all too easy for a
1783`>` to end up at the beginning of a line by accident (perhaps through line
1784wrapping). So, unless the `markdown_strict` format is used, the following does
1785not produce a nested block quote in pandoc:
1787 > This is a block quote.
1788 >> Nested.
1791Verbatim (code) blocks
1792----------------------
1794### Indented code blocks ###
1796A block of text indented four spaces (or one tab) is treated as verbatim
1797text: that is, special characters do not trigger special formatting,
1798and all spaces and line breaks are preserved. For example,
1800 if (a > 3) {
1801 moveShip(5 * gravity, DOWN);
1804The initial (four space or one tab) indentation is not considered part
1805of the verbatim text, and is removed in the output.
1807Note: blank lines in the verbatim text need not begin with four spaces.
1810### Fenced code blocks ###
1812#### Extension: `fenced_code_blocks` ####
1814In addition to standard indented code blocks, pandoc supports
1815*fenced* code blocks. These begin with a row of three or more
1816tildes (`~`) and end with a row of tildes that must be at least as long as
1817the starting row. Everything between these lines is treated as code. No
1818indentation is necessary:
1820 ~~~~~~~
1821 if (a > 3) {
1822 moveShip(5 * gravity, DOWN);
1824 ~~~~~~~
1826Like regular code blocks, fenced code blocks must be separated
1827from surrounding text by blank lines.
1829If the code itself contains a row of tildes or backticks, just use a longer
1830row of tildes or backticks at the start and end:
1832 ~~~~~~~~~~~~~~~~
1833 ~~~~~~~~~~
1834 code including tildes
1835 ~~~~~~~~~~
1836 ~~~~~~~~~~~~~~~~
1838#### Extension: `backtick_code_blocks` ####
1840Same as `fenced_code_blocks`, but uses backticks (`` ` ``) instead of tildes
1841(`~`).
1843#### Extension: `fenced_code_attributes` ####
1845Optionally, you may attach attributes to fenced or backtick code block using
1846this syntax:
1848 ~~~~ {#mycode .haskell .numberLines startFrom="100"}
1849 qsort [] = []
1850 qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
1851 qsort (filter (>= x) xs)
1852 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1854Here `mycode` is an identifier, `haskell` and `numberLines` are classes, and
1855`startFrom` is an attribute with value `100`. Some output formats can use this
1856information to do syntax highlighting. Currently, the only output formats
1857that uses this information are HTML and LaTeX. If highlighting is supported
1858for your output format and language, then the code block above will appear
1859highlighted, with numbered lines. (To see which languages are supported, type
1860`pandoc --list-highlight-languages`.) Otherwise, the code block above will
1861appear as follows:
1863 <pre id="mycode" class="haskell numberLines" startFrom="100">
1864 <code>
1865 ...
1866 </code>
1867 </pre>
1869A shortcut form can also be used for specifying the language of
1870the code block:
1872 ```haskell
1873 qsort [] = []
1874 ```
1876This is equivalent to:
1878 ``` {.haskell}
1879 qsort [] = []
1880 ```
1882If the `fenced_code_attributes` extension is disabled, but
1883input contains class attribute(s) for the code block, the first
1884class attribute will be printed after the opening fence as a bare
1885word.
1887To prevent all highlighting, use the `--no-highlight` flag.
1888To set the highlighting style, use `--highlight-style`.
1889For more information on highlighting, see [Syntax highlighting],
1890below.
1892Line blocks
1893-----------
1895#### Extension: `line_blocks` ####
1897A line block is a sequence of lines beginning with a vertical bar (`|`)
1898followed by a space. The division into lines will be preserved in
1899the output, as will any leading spaces; otherwise, the lines will
1900be formatted as Markdown. This is useful for verse and addresses:
1902 | The limerick packs laughs anatomical
1903 | In space that is quite economical.
1904 | But the good ones I've seen
1905 | So seldom are clean
1906 | And the clean ones so seldom are comical
1908 | 200 Main St.
1909 | Berkeley, CA 94718
1911The lines can be hard-wrapped if needed, but the continuation
1912line must begin with a space.
1914 | The Right Honorable Most Venerable and Righteous Samuel L.
1915 Constable, Jr.
1916 | 200 Main St.
1917 | Berkeley, CA 94718
1919This syntax is borrowed from [reStructuredText].
1921Lists
1922-----
1924### Bullet lists ###
1926A bullet list is a list of bulleted list items. A bulleted list
1927item begins with a bullet (`*`, `+`, or `-`). Here is a simple
1928example:
1930 * one
1931 * two
1932 * three
1934This will produce a "compact" list. If you want a "loose" list, in which
1935each item is formatted as a paragraph, put spaces between the items:
1937 * one
1939 * two
1941 * three
1943The bullets need not be flush with the left margin; they may be
1944indented one, two, or three spaces. The bullet must be followed
1945by whitespace.
1947List items look best if subsequent lines are flush with the first
1948line (after the bullet):
1950 * here is my first
1951 list item.
1952 * and my second.
1954But Markdown also allows a "lazy" format:
1956 * here is my first
1957 list item.
1958 * and my second.
1960### The four-space rule ###
1962A list item may contain multiple paragraphs and other block-level
1963content. However, subsequent paragraphs must be preceded by a blank line
1964and indented four spaces or a tab. The list will look better if the first
1965paragraph is aligned with the rest:
1967 * First paragraph.
1969 Continued.
1971 * Second paragraph. With a code block, which must be indented
1972 eight spaces:
1974 { code }
1976List items may include other lists. In this case the preceding blank
1977line is optional. The nested list must be indented four spaces or
1978one tab:
1980 * fruits
1981 + apples
1982 - macintosh
1983 - red delicious
1984 + pears
1985 + peaches
1986 * vegetables
1987 + broccoli
1988 + chard
1990As noted above, Markdown allows you to write list items "lazily," instead of
1991indenting continuation lines. However, if there are multiple paragraphs or
1992other blocks in a list item, the first line of each must be indented.
1994 + A lazy, lazy, list
1995 item.
1997 + Another one; this looks
1998 bad but is legal.
2000 Second paragraph of second
2001 list item.
2003**Note:** Although the four-space rule for continuation paragraphs
2004comes from the official [Markdown syntax guide], the reference implementation,
2005`Markdown.pl`, does not follow it. So pandoc will give different results than
2006`Markdown.pl` when authors have indented continuation paragraphs fewer than
2007four spaces.
2009The [Markdown syntax guide] is not explicit whether the four-space
2010rule applies to *all* block-level content in a list item; it only
2011mentions paragraphs and code blocks. But it implies that the rule
2012applies to all block-level content (including nested lists), and
2013pandoc interprets it that way.
2015 [Markdown syntax guide]:
2016 http://daringfireball.net/projects/markdown/syntax#list
2018### Ordered lists ###
2020Ordered lists work just like bulleted lists, except that the items
2021begin with enumerators rather than bullets.
2023In standard Markdown, enumerators are decimal numbers followed
2024by a period and a space. The numbers themselves are ignored, so
2025there is no difference between this list:
2027 1. one
2028 2. two
2029 3. three
2031and this one:
2033 5. one
2034 7. two
2035 1. three
2037#### Extension: `fancy_lists` ####
2039Unlike standard Markdown, pandoc allows ordered list items to be marked
2040with uppercase and lowercase letters and roman numerals, in addition to
2041Arabic numerals. List markers may be enclosed in parentheses or followed by a
2042single right-parentheses or period. They must be separated from the
2043text that follows by at least one space, and, if the list marker is a
2044capital letter with a period, by at least two spaces.[^2]
2046[^2]: The point of this rule is to ensure that normal paragraphs
2047 starting with people's initials, like
2049 B. Russell was an English philosopher.
2051 do not get treated as list items.
2053 This rule will not prevent
2055 (C) 2007 Joe Smith
2057 from being interpreted as a list item. In this case, a backslash
2058 escape can be used:
2060 (C\) 2007 Joe Smith
2062The `fancy_lists` extension also allows '`#`' to be used as an
2063ordered list marker in place of a numeral:
2065 #. one
2066 #. two
2068#### Extension: `startnum` ####
2070Pandoc also pays attention to the type of list marker used, and to the
2071starting number, and both of these are preserved where possible in the
2072output format. Thus, the following yields a list with numbers followed
2073by a single parenthesis, starting with 9, and a sublist with lowercase
2074roman numerals:
2076 9) Ninth
2077 10) Tenth
2078 11) Eleventh
2079 i. subone
2080 ii. subtwo
2081 iii. subthree
2083Pandoc will start a new list each time a different type of list
2084marker is used. So, the following will create three lists:
2086 (2) Two
2087 (5) Three
2088 1. Four
2089 * Five
2091If default list markers are desired, use `#.`:
2093 #. one
2094 #. two
2095 #. three
2098### Definition lists ###
2100#### Extension: `definition_lists` ####
2102Pandoc supports definition lists, using the syntax of
2103[PHP Markdown Extra] with some extensions.[^3]
2105 Term 1
2107 : Definition 1
2109 Term 2 with *inline markup*
2111 : Definition 2
2113 { some code, part of Definition 2 }
2115 Third paragraph of definition 2.
2117Each term must fit on one line, which may optionally be followed by
2118a blank line, and must be followed by one or more definitions.
2119A definition begins with a colon or tilde, which may be indented one
2120or two spaces.
2122A term may have multiple definitions, and each definition may consist of one or
2123more block elements (paragraph, code block, list, etc.), each indented four
2124spaces or one tab stop. The body of the definition (including the first line,
2125aside from the colon or tilde) should be indented four spaces. However,
2126as with other Markdown lists, you can "lazily" omit indentation except
2127at the beginning of a paragraph or other block element:
2129 Term 1
2131 : Definition
2132 with lazy continuation.
2134 Second paragraph of the definition.
2136If you leave space before the definition (as in the example above),
2137the text of the definition will be treated as a paragraph. In some
2138output formats, this will mean greater spacing between term/definition
2139pairs. For a more compact definition list, omit the space before the
2140definition:
2142 Term 1
2143 ~ Definition 1
2145 Term 2
2146 ~ Definition 2a
2147 ~ Definition 2b
2149Note that space between items in a definition list is required.
2150(A variant that loosens this requirement, but disallows "lazy"
2151hard wrapping, can be activated with `compact_definition_lists`: see
2152[Non-pandoc extensions], below.)
2154[^3]: I have been influenced by the suggestions of [David Wheeler](http://www.justatheory.com/computers/markup/modest-markdown-proposal.html).
2156### Numbered example lists ###
2158#### Extension: `example_lists` ####
2160The special list marker `@` can be used for sequentially numbered
2161examples. The first list item with a `@` marker will be numbered '1',
2162the next '2', and so on, throughout the document. The numbered examples
2163need not occur in a single list; each new list using `@` will take up
2164where the last stopped. So, for example:
2166 (@) My first example will be numbered (1).
2167 (@) My second example will be numbered (2).
2169 Explanation of examples.
2171 (@) My third example will be numbered (3).
2173Numbered examples can be labeled and referred to elsewhere in the
2174document:
2176 (@good) This is a good example.
2178 As (@good) illustrates, ...
2180The label can be any string of alphanumeric characters, underscores,
2181or hyphens.
2184### Compact and loose lists ###
2186Pandoc behaves differently from `Markdown.pl` on some "edge
2187cases" involving lists. Consider this source:
2189 + First
2190 + Second:
2191 - Fee
2192 - Fie
2193 - Foe
2195 + Third
2197Pandoc transforms this into a "compact list" (with no `<p>` tags around
2198"First", "Second", or "Third"), while Markdown puts `<p>` tags around
2199"Second" and "Third" (but not "First"), because of the blank space
2200around "Third". Pandoc follows a simple rule: if the text is followed by
2201a blank line, it is treated as a paragraph. Since "Second" is followed
2202by a list, and not a blank line, it isn't treated as a paragraph. The
2203fact that the list is followed by a blank line is irrelevant. (Note:
2204Pandoc works this way even when the `markdown_strict` format is specified. This
2205behavior is consistent with the official Markdown syntax description,
2206even though it is different from that of `Markdown.pl`.)
2209### Ending a list ###
2211What if you want to put an indented code block after a list?
2213 - item one
2214 - item two
2216 { my code block }
2218Trouble! Here pandoc (like other Markdown implementations) will treat
2219`{ my code block }` as the second paragraph of item two, and not as
2220a code block.
2222To "cut off" the list after item two, you can insert some non-indented
2223content, like an HTML comment, which won't produce visible output in
2224any format:
2226 - item one
2227 - item two
2229 <!-- end of list -->
2231 { my code block }
2233You can use the same trick if you want two consecutive lists instead
2234of one big list:
2236 1. one
2237 2. two
2238 3. three
2240 <!-- -->
2242 1. uno
2243 2. dos
2244 3. tres
2246Horizontal rules
2247----------------
2249A line containing a row of three or more `*`, `-`, or `_` characters
2250(optionally separated by spaces) produces a horizontal rule:
2252 * * * *
2254 ---------------
2257Tables
2258------
2260Four kinds of tables may be used. The first three kinds presuppose the use of
2261a fixed-width font, such as Courier. The fourth kind can be used with
2262proportionally spaced fonts, as it does not require lining up columns.
2264#### Extension: `table_captions` ####
2266A caption may optionally be provided with all 4 kinds of tables (as
2267illustrated in the examples below). A caption is a paragraph beginning
2268with the string `Table:` (or just `:`), which will be stripped off.
2269It may appear either before or after the table.
2271#### Extension: `simple_tables` ####
2273Simple tables look like this:
2275 Right Left Center Default
2276 ------- ------ ---------- -------
2277 12 12 12 12
2278 123 123 123 123
2279 1 1 1 1
2281 Table: Demonstration of simple table syntax.
2283The headers and table rows must each fit on one line. Column
2284alignments are determined by the position of the header text relative
2285to the dashed line below it:[^4]
2287 - If the dashed line is flush with the header text on the right side
2288 but extends beyond it on the left, the column is right-aligned.
2289 - If the dashed line is flush with the header text on the left side
2290 but extends beyond it on the right, the column is left-aligned.
2291 - If the dashed line extends beyond the header text on both sides,
2292 the column is centered.
2293 - If the dashed line is flush with the header text on both sides,
2294 the default alignment is used (in most cases, this will be left).
2296[^4]: This scheme is due to Michel Fortin, who proposed it on the
2297 [Markdown discussion list](http://six.pairlist.net/pipermail/markdown-discuss/2005-March/001097.html).
2299The table must end with a blank line, or a line of dashes followed by
2300a blank line.
2302The column headers may be omitted, provided a dashed line is used
2303to end the table. For example:
2305 ------- ------ ---------- -------
2306 12 12 12 12
2307 123 123 123 123
2308 1 1 1 1
2309 ------- ------ ---------- -------
2311When headers are omitted, column alignments are determined on the basis
2312of the first line of the table body. So, in the tables above, the columns
2313would be right, left, center, and right aligned, respectively.
2315#### Extension: `multiline_tables` ####
2317Multiline tables allow headers and table rows to span multiple lines
2318of text (but cells that span multiple columns or rows of the table are
2319not supported). Here is an example:
2321 -------------------------------------------------------------
2322 Centered Default Right Left
2323 Header Aligned Aligned Aligned
2324 ----------- ------- --------------- -------------------------
2325 First row 12.0 Example of a row that
2326 spans multiple lines.
2328 Second row 5.0 Here's another one. Note
2329 the blank line between
2330 rows.
2331 -------------------------------------------------------------
2333 Table: Here's the caption. It, too, may span
2334 multiple lines.
2336These work like simple tables, but with the following differences:
2338 - They must begin with a row of dashes, before the header text
2339 (unless the headers are omitted).
2340 - They must end with a row of dashes, then a blank line.
2341 - The rows must be separated by blank lines.
2343In multiline tables, the table parser pays attention to the widths of
2344the columns, and the writers try to reproduce these relative widths in
2345the output. So, if you find that one of the columns is too narrow in the
2346output, try widening it in the Markdown source.
2348Headers may be omitted in multiline tables as well as simple tables:
2350 ----------- ------- --------------- -------------------------
2351 First row 12.0 Example of a row that
2352 spans multiple lines.
2354 Second row 5.0 Here's another one. Note
2355 the blank line between
2356 rows.
2357 ----------- ------- --------------- -------------------------
2359 : Here's a multiline table without headers.
2361It is possible for a multiline table to have just one row, but the row
2362should be followed by a blank line (and then the row of dashes that ends
2363the table), or the table may be interpreted as a simple table.
2365#### Extension: `grid_tables` ####
2367Grid tables look like this:
2369 : Sample grid table.
2371 +---------------+---------------+--------------------+
2372 | Fruit | Price | Advantages |
2373 +===============+===============+====================+
2374 | Bananas | $1.34 | - built-in wrapper |
2375 | | | - bright color |
2376 +---------------+---------------+--------------------+
2377 | Oranges | $2.10 | - cures scurvy |
2378 | | | - tasty |
2379 +---------------+---------------+--------------------+
2381The row of `=`s separates the header from the table body, and can be
2382omitted for a headerless table. The cells of grid tables may contain
2383arbitrary block elements (multiple paragraphs, code blocks, lists,
2384etc.). Cells that span multiple columns or rows are not
2385supported. Grid tables can be created easily using [Emacs table mode].
2387[Emacs table mode]: http://table.sourceforge.net/
2389Alignments can be specified as with pipe tables, by putting
2390colons at the boundaries of the separator line after the
2391header:
2393 +---------------+---------------+--------------------+
2394 | Right | Left | Centered |
2395 +==============:+:==============+:==================:+
2396 | Bananas | $1.34 | built-in wrapper |
2397 +---------------+---------------+--------------------+
2399For headerless tables, the colons go on the top line instead:
2401 +--------------:+:--------------+:------------------:+
2402 | Right | Left | Centered |
2403 +---------------+---------------+--------------------+
2406#### Extension: `pipe_tables` ####
2408Pipe tables look like this:
2410 | Right | Left | Default | Center |
2411 |------:|:-----|---------|:------:|
2412 | 12 | 12 | 12 | 12 |
2413 | 123 | 123 | 123 | 123 |
2414 | 1 | 1 | 1 | 1 |
2416 : Demonstration of pipe table syntax.
2418The syntax is identical to [PHP Markdown Extra tables]. The beginning and
2419ending pipe characters are optional, but pipes are required between all
2420columns. The colons indicate column alignment as shown. The header
2421cannot be omitted. To simulate a headerless table, include a header
2422with blank cells.
2424Since the pipes indicate column boundaries, columns need not be vertically
2425aligned, as they are in the above example. So, this is a perfectly
2426legal (though ugly) pipe table:
2428 fruit| price
2429 -----|-----:
2430 apple|2.05
2431 pear|1.37
2432 orange|3.09
2434The cells of pipe tables cannot contain block elements like paragraphs
2435and lists, and cannot span multiple lines. If a pipe table contains a
2436row whose printable content is wider than the column width (see
2437`--columns`), then the cell contents will wrap, with the
2438relative cell widths determined by the widths of the separator
2439lines.
2441Note: pandoc also recognizes pipe tables of the following
2442form, as can be produced by Emacs' orgtbl-mode:
2444 | One | Two |
2445 |-----+-------|
2446 | my | table |
2447 | is | nice |
2449The difference is that `+` is used instead of `|`. Other orgtbl features
2450are not supported. In particular, to get non-default column alignment,
2451you'll need to add colons as above.
2453[PHP Markdown Extra tables]: https://michelf.ca/projects/php-markdown/extra/#table
2455Metadata blocks
2456---------------
2458#### Extension: `pandoc_title_block` ####
2460If the file begins with a title block
2462 % title
2463 % author(s) (separated by semicolons)
2464 % date
2466it will be parsed as bibliographic information, not regular text. (It
2467will be used, for example, in the title of standalone LaTeX or HTML
2468output.) The block may contain just a title, a title and an author,
2469or all three elements. If you want to include an author but no
2470title, or a title and a date but no author, you need a blank line:
2473 % Author
2475 % My title
2477 % June 15, 2006
2479The title may occupy multiple lines, but continuation lines must
2480begin with leading space, thus:
2482 % My title
2483 on multiple lines
2485If a document has multiple authors, the authors may be put on
2486separate lines with leading space, or separated by semicolons, or
2487both. So, all of the following are equivalent:
2489 % Author One
2490 Author Two
2492 % Author One; Author Two
2494 % Author One;
2495 Author Two
2497The date must fit on one line.
2499All three metadata fields may contain standard inline formatting
2500(italics, links, footnotes, etc.).
2502Title blocks will always be parsed, but they will affect the output only
2503when the `--standalone` (`-s`) option is chosen. In HTML output, titles
2504will appear twice: once in the document head -- this is the title that
2505will appear at the top of the window in a browser -- and once at the
2506beginning of the document body. The title in the document head can have
2507an optional prefix attached (`--title-prefix` or `-T` option). The title
2508in the body appears as an H1 element with class "title", so it can be
2509suppressed or reformatted with CSS. If a title prefix is specified with
2510`-T` and no title block appears in the document, the title prefix will
2511be used by itself as the HTML title.
2513The man page writer extracts a title, man page section number, and
2514other header and footer information from the title line. The title
2515is assumed to be the first word on the title line, which may optionally
2516end with a (single-digit) section number in parentheses. (There should
2517be no space between the title and the parentheses.) Anything after
2518this is assumed to be additional footer and header text. A single pipe
2519character (`|`) should be used to separate the footer text from the header
2520text. Thus,
2522 % PANDOC(1)
2524will yield a man page with the title `PANDOC` and section 1.
2526 % PANDOC(1) Pandoc User Manuals
2528will also have "Pandoc User Manuals" in the footer.
2530 % PANDOC(1) Pandoc User Manuals | Version 4.0
2532will also have "Version 4.0" in the header.
2534#### Extension: `yaml_metadata_block` ####
2536A YAML metadata block is a valid YAML object, delimited by a line of three
2537hyphens (`---`) at the top and a line of three hyphens (`---`) or three dots
2538(`...`) at the bottom. A YAML metadata block may occur anywhere in the
2539document, but if it is not at the beginning, it must be preceded by a blank
2540line. (Note that, because of the way pandoc concatenates input files when
2541several are provided, you may also keep the metadata in a separate YAML file
2542and pass it to pandoc as an argument, along with your Markdown files:
2544 pandoc chap1.md chap2.md chap3.md metadata.yaml -s -o book.html
2546Just be sure that the YAML file begins with `---` and ends with `---` or
2547`...`.)
2549Metadata will be taken from the fields of the YAML object and added to any
2550existing document metadata. Metadata can contain lists and objects (nested
2551arbitrarily), but all string scalars will be interpreted as Markdown. Fields
2552with names ending in an underscore will be ignored by pandoc. (They may be
2553given a role by external processors.)
2555A document may contain multiple metadata blocks. The metadata fields will
2556be combined through a *left-biased union*: if two metadata blocks attempt
2557to set the same field, the value from the first block will be taken.
2559When pandoc is used with `-t markdown` to create a Markdown document,
2560a YAML metadata block will be produced only if the `-s/--standalone`
2561option is used. All of the metadata will appear in a single block
2562at the beginning of the document.
2564Note that YAML escaping rules must be followed. Thus, for example,
2565if a title contains a colon, it must be quoted. The pipe character
2566(`|`) can be used to begin an indented block that will be interpreted
2567literally, without need for escaping. This form is necessary
2568when the field contains blank lines or block-level formatting:
2570 ---
2571 title: 'This is the title: it contains a colon'
2572 author:
2573 - Author One
2574 - Author Two
2575 tags: [nothing, nothingness]
2576 abstract: |
2577 This is the abstract.
2579 It consists of two paragraphs.
2580 ...
2582Template variables will be set automatically from the metadata. Thus, for
2583example, in writing HTML, the variable `abstract` will be set to the HTML
2584equivalent of the Markdown in the `abstract` field:
2586 <p>This is the abstract.</p>
2587 <p>It consists of two paragraphs.</p>
2589Variables can contain arbitrary YAML structures, but the template must match
2590this structure. The `author` variable in the default templates expects a
2591simple list or string, but can be changed to support more complicated
2592structures. The following combination, for example, would add an affiliation
2593to the author if one is given:
2595 ---
2596 title: The document title
2597 author:
2598 - name: Author One
2599 affiliation: University of Somewhere
2600 - name: Author Two
2601 affiliation: University of Nowhere
2602 ...
2604To use the structured authors in the example above, you would need a custom
2605template:
2607 $for(author)$
2608 $if(author.name)$
2609 $author.name$$if(author.affiliation)$ ($author.affiliation$)$endif$
2610 $else$
2611 $author$
2612 $endif$
2613 $endfor$
2616Backslash escapes
2617-----------------
2619#### Extension: `all_symbols_escapable` ####
2621Except inside a code block or inline code, any punctuation or space
2622character preceded by a backslash will be treated literally, even if it
2623would normally indicate formatting. Thus, for example, if one writes
2625 *\*hello\**
2627one will get
2629 <em>*hello*</em>
2631instead of
2633 <strong>hello</strong>
2635This rule is easier to remember than standard Markdown's rule,
2636which allows only the following characters to be backslash-escaped:
2638 \`*_{}[]()>#+-.!
2640(However, if the `markdown_strict` format is used, the standard Markdown rule
2641will be used.)
2643A backslash-escaped space is parsed as a nonbreaking space. It will
2644appear in TeX output as `~` and in HTML and XML as `\&#160;` or
2645`\&nbsp;`.
2647A backslash-escaped newline (i.e. a backslash occurring at the end of
2648a line) is parsed as a hard line break. It will appear in TeX output as
2649`\\` and in HTML as `<br />`. This is a nice alternative to
2650Markdown's "invisible" way of indicating hard line breaks using
2651two trailing spaces on a line.
2653Backslash escapes do not work in verbatim contexts.
2655Inline formatting
2656-----------------
2658### Emphasis ###
2660To *emphasize* some text, surround it with `*`s or `_`, like this:
2662 This text is _emphasized with underscores_, and this
2663 is *emphasized with asterisks*.
2665Double `*` or `_` produces **strong emphasis**:
2667 This is **strong emphasis** and __with underscores__.
2669A `*` or `_` character surrounded by spaces, or backslash-escaped,
2670will not trigger emphasis:
2672 This is * not emphasized *, and \*neither is this\*.
2674#### Extension: `intraword_underscores` ####
2676Because `_` is sometimes used inside words and identifiers,
2677pandoc does not interpret a `_` surrounded by alphanumeric
2678characters as an emphasis marker. If you want to emphasize
2679just part of a word, use `*`:
2681 feas*ible*, not feas*able*.
2684### Strikeout ###
2686#### Extension: `strikeout` ####
2688To strikeout a section of text with a horizontal line, begin and end it
2689with `~~`. Thus, for example,
2691 This ~~is deleted text.~~
2694### Superscripts and subscripts ###
2696#### Extension: `superscript`, `subscript` ####
2698Superscripts may be written by surrounding the superscripted text by `^`
2699characters; subscripts may be written by surrounding the subscripted
2700text by `~` characters. Thus, for example,
2702 H~2~O is a liquid. 2^10^ is 1024.
2704If the superscripted or subscripted text contains spaces, these spaces
2705must be escaped with backslashes. (This is to prevent accidental
2706superscripting and subscripting through the ordinary use of `~` and `^`.)
2707Thus, if you want the letter P with 'a cat' in subscripts, use
2708`P~a\ cat~`, not `P~a cat~`.
2711### Verbatim ###
2713To make a short span of text verbatim, put it inside backticks:
2715 What is the difference between `>>=` and `>>`?
2717If the verbatim text includes a backtick, use double backticks:
2719 Here is a literal backtick `` ` ``.
2721(The spaces after the opening backticks and before the closing
2722backticks will be ignored.)
2724The general rule is that a verbatim span starts with a string
2725of consecutive backticks (optionally followed by a space)
2726and ends with a string of the same number of backticks (optionally
2727preceded by a space).
2729Note that backslash-escapes (and other Markdown constructs) do not
2730work in verbatim contexts:
2732 This is a backslash followed by an asterisk: `\*`.
2734#### Extension: `inline_code_attributes` ####
2736Attributes can be attached to verbatim text, just as with
2737[fenced code blocks]:
2739 `<$>`{.haskell}
2741### Small caps ###
2743To write small caps, you can use an HTML span tag:
2745 <span style="font-variant:small-caps;">Small caps</span>
2747(The semicolon is optional and there may be space after the
2748colon.) This will work in all output formats that support small caps.
2750Alternatively, you can also use the new `bracketed_spans` syntax:
2752 [Small caps]{style="font-variant:small-caps;"}
2754Math
2755----
2757#### Extension: `tex_math_dollars` ####
2759Anything between two `$` characters will be treated as TeX math. The
2760opening `$` must have a non-space character immediately to its right,
2761while the closing `$` must have a non-space character immediately to its
2762left, and must not be followed immediately by a digit. Thus,
2763`$20,000 and $30,000` won't parse as math. If for some reason
2764you need to enclose text in literal `$` characters, backslash-escape
2765them and they won't be treated as math delimiters.
2767TeX math will be printed in all output formats. How it is rendered
2768depends on the output format:
2770Markdown, LaTeX, Emacs Org mode, ConTeXt, ZimWiki
2771 ~ It will appear verbatim between `$` characters.
2773reStructuredText
2774 ~ It will be rendered using an [interpreted text role `:math:`].
2776AsciiDoc
2777 ~ It will be rendered as `latexmath:[...]`.
2779Texinfo
2780 ~ It will be rendered inside a `@math` command.
2782groff man
2783 ~ It will be rendered verbatim without `$`'s.
2785MediaWiki, DokuWiki
2786 ~ It will be rendered inside `<math>` tags.
2788Textile
2789 ~ It will be rendered inside `<span class="math">` tags.
2791RTF, OpenDocument, ODT
2792 ~ It will be rendered, if possible, using Unicode characters,
2793 and will otherwise appear verbatim.
2795DocBook
2796 ~ If the `--mathml` flag is used, it will be rendered using MathML
2797 in an `inlineequation` or `informalequation` tag. Otherwise it
2798 will be rendered, if possible, using Unicode characters.
2800Docx
2801 ~ It will be rendered using OMML math markup.
2803FictionBook2
2804 ~ If the `--webtex` option is used, formulas are rendered as images
2805 using CodeCogs or other compatible web service, downloaded
2806 and embedded in the e-book. Otherwise, they will appear verbatim.
2808HTML, Slidy, DZSlides, S5, EPUB
2809 ~ The way math is rendered in HTML will depend on the
2810 command-line options selected:
2812 1. The default is to render TeX math as far as possible using Unicode
2813 characters, as with RTF, DocBook, and OpenDocument output. Formulas
2814 are put inside a `span` with `class="math"`, so that they may be
2815 styled differently from the surrounding text if needed.
2817 2. If the `--latexmathml` option is used, TeX math will be displayed
2818 between `$` or `$$` characters and put in `<span>` tags with class `LaTeX`.
2819 The [LaTeXMathML] script will be used to render it as formulas.
2820 (This trick does not work in all browsers, but it works in Firefox.
2821 In browsers that do not support LaTeXMathML, TeX math will appear
2822 verbatim between `$` characters.)
2824 3. If the `--jsmath` option is used, TeX math will be put inside
2825 `<span>` tags (for inline math) or `<div>` tags (for display math)
2826 with class `math`. The [jsMath] script will be used to render
2827 it.
2829 4. If the `--mimetex` option is used, the [mimeTeX] CGI script will
2830 be called to generate images for each TeX formula. This should
2831 work in all browsers. The `--mimetex` option takes an optional URL
2832 as argument. If no URL is specified, it will be assumed that the
2833 mimeTeX CGI script is at `/cgi-bin/mimetex.cgi`.
2835 5. If the `--gladtex` option is used, TeX formulas will be enclosed
2836 in `<eq>` tags in the HTML output. The resulting `htex` file may then
2837 be processed by [gladTeX], which will produce image files for each
2838 formula and an HTML file with links to these images. So, the
2839 procedure is:
2841 pandoc -s --gladtex myfile.txt -o myfile.htex
2842 gladtex -d myfile-images myfile.htex
2843 # produces myfile.html and images in myfile-images
2845 6. If the `--webtex` option is used, TeX formulas will be converted
2846 to `<img>` tags that link to an external script that converts
2847 formulas to images. The formula will be URL-encoded and concatenated
2848 with the URL provided. For SVG images you can for example use
2849 `--webtex https://latex.codecogs.com/svg.latex?`.
2850 If no URL is specified, the CodeCogs URL generating PNGs
2851 will be used (`https://latex.codecogs.com/png.latex?`).
2853 7. If the `--mathjax` option is used, TeX math will be displayed
2854 between `\(...\)` (for inline math) or `\[...\]` (for display
2855 math) and put in `<span>` tags with class `math`.
2856 The [MathJax] script will be used to render it as formulas.
2858[interpreted text role `:math:`]: http://docutils.sourceforge.net/docs/ref/rst/roles.html#math
2860Raw HTML
2861--------
2863#### Extension: `raw_html` ####
2865Markdown allows you to insert raw HTML (or DocBook) anywhere in a document
2866(except verbatim contexts, where `<`, `>`, and `&` are interpreted
2867literally). (Technically this is not an extension, since standard
2868Markdown allows it, but it has been made an extension so that it can
2869be disabled if desired.)
2871The raw HTML is passed through unchanged in HTML, S5, Slidy, Slideous,
2872DZSlides, EPUB, Markdown, Emacs Org mode, and Textile output, and suppressed
2873in other formats.
2875#### Extension: `markdown_in_html_blocks` ####
2877Standard Markdown allows you to include HTML "blocks": blocks
2878of HTML between balanced tags that are separated from the surrounding text
2879with blank lines, and start and end at the left margin. Within
2880these blocks, everything is interpreted as HTML, not Markdown;
2881so (for example), `*` does not signify emphasis.
2883Pandoc behaves this way when the `markdown_strict` format is used; but
2884by default, pandoc interprets material between HTML block tags as Markdown.
2885Thus, for example, pandoc will turn
2887 <table>
2888 <tr>
2889 <td>*one*</td>
2890 <td>[a link](http://google.com)</td>
2891 </tr>
2892 </table>
2894into
2896 <table>
2897 <tr>
2898 <td><em>one</em></td>
2899 <td><a href="http://google.com">a link</a></td>
2900 </tr>
2901 </table>
2903whereas `Markdown.pl` will preserve it as is.
2905There is one exception to this rule: text between `<script>` and
2906`<style>` tags is not interpreted as Markdown.
2908This departure from standard Markdown should make it easier to mix
2909Markdown with HTML block elements. For example, one can surround
2910a block of Markdown text with `<div>` tags without preventing it
2911from being interpreted as Markdown.
2913#### Extension: `native_divs` ####
2915Use native pandoc `Div` blocks for content inside `<div>` tags.
2916For the most part this should give the same output as
2917`markdown_in_html_blocks`, but it makes it easier to write pandoc
2918filters to manipulate groups of blocks.
2920#### Extension: `native_spans` ####
2922Use native pandoc `Span` blocks for content inside `<span>` tags.
2923For the most part this should give the same output as `raw_html`,
2924but it makes it easier to write pandoc filters to manipulate groups
2925of inlines.
2927Raw TeX
2928-------
2930#### Extension: `raw_tex` ####
2932In addition to raw HTML, pandoc allows raw LaTeX, TeX, and ConTeXt to be
2933included in a document. Inline TeX commands will be preserved and passed
2934unchanged to the LaTeX and ConTeXt writers. Thus, for example, you can use
2935LaTeX to include BibTeX citations:
2937 This result was proved in \cite{jones.1967}.
2939Note that in LaTeX environments, like
2941 \begin{tabular}{|l|l|}\hline
2942 Age & Frequency \\ \hline
2943 18--25 & 15 \\
2944 26--35 & 33 \\
2945 36--45 & 22 \\ \hline
2946 \end{tabular}
2948the material between the begin and end tags will be interpreted as raw
2949LaTeX, not as Markdown.
2951Inline LaTeX is ignored in output formats other than Markdown, LaTeX,
2952Emacs Org mode, and ConTeXt.
2954LaTeX macros
2955------------
2957#### Extension: `latex_macros` ####
2959For output formats other than LaTeX, pandoc will parse LaTeX `\newcommand` and
2960`\renewcommand` definitions and apply the resulting macros to all LaTeX
2961math. So, for example, the following will work in all output formats,
2962not just LaTeX:
2964 \newcommand{\tuple}[1]{\langle #1 \rangle}
2966 $\tuple{a, b, c}$
2968In LaTeX output, the `\newcommand` definition will simply be passed
2969unchanged to the output.
2972Links
2973-----
2975Markdown allows links to be specified in several ways.
2977### Automatic links ###
2979If you enclose a URL or email address in pointy brackets, it
2980will become a link:
2982 <http://google.com>
2983 <sam@green.eggs.ham>
2985### Inline links ###
2987An inline link consists of the link text in square brackets,
2988followed by the URL in parentheses. (Optionally, the URL can
2989be followed by a link title, in quotes.)
2991 This is an [inline link](/url), and here's [one with
2992 a title](http://fsf.org "click here for a good time!").
2994There can be no space between the bracketed part and the parenthesized part.
2995The link text can contain formatting (such as emphasis), but the title cannot.
2997Email addresses in inline links are not autodetected, so they have to be
2998prefixed with `mailto`:
3000 [Write me!](mailto:sam@green.eggs.ham)
3002### Reference links ###
3004An *explicit* reference link has two parts, the link itself and the link
3005definition, which may occur elsewhere in the document (either
3006before or after the link).
3008The link consists of link text in square brackets, followed by a label in
3009square brackets. (There can be space between the two.) The link definition
3010consists of the bracketed label, followed by a colon and a space, followed by
3011the URL, and optionally (after a space) a link title either in quotes or in
3012parentheses. The label must not be parseable as a citation (assuming
3013the `citations` extension is enabled): citations take precedence over
3014link labels.
3016Here are some examples:
3018 [my label 1]: /foo/bar.html "My title, optional"
3019 [my label 2]: /foo
3020 [my label 3]: http://fsf.org (The free software foundation)
3021 [my label 4]: /bar#special 'A title in single quotes'
3023The URL may optionally be surrounded by angle brackets:
3025 [my label 5]: <http://foo.bar.baz>
3027The title may go on the next line:
3029 [my label 3]: http://fsf.org
3030 "The free software foundation"
3032Note that link labels are not case sensitive. So, this will work:
3034 Here is [my link][FOO]
3036 [Foo]: /bar/baz
3038In an *implicit* reference link, the second pair of brackets is
3039empty:
3041 See [my website][].
3043 [my website]: http://foo.bar.baz
3045Note: In `Markdown.pl` and most other Markdown implementations,
3046reference link definitions cannot occur in nested constructions
3047such as list items or block quotes. Pandoc lifts this arbitrary
3048seeming restriction. So the following is fine in pandoc, though
3049not in most other implementations:
3051 > My block [quote].
3053 > [quote]: /foo
3055#### Extension: `shortcut_reference_links` ####
3057In a *shortcut* reference link, the second pair of brackets may
3058be omitted entirely:
3060 See [my website].
3062 [my website]: http://foo.bar.baz
3064### Internal links ###
3066To link to another section of the same document, use the automatically
3067generated identifier (see [Header identifiers]). For example:
3069 See the [Introduction](#introduction).
3073 See the [Introduction].
3075 [Introduction]: #introduction
3077Internal links are currently supported for HTML formats (including
3078HTML slide shows and EPUB), LaTeX, and ConTeXt.
3080Images
3081------
3083A link immediately preceded by a `!` will be treated as an image.
3084The link text will be used as the image's alt text:
3086 ![la lune](lalune.jpg "Voyage to the moon")
3088 ![movie reel]
3090 [movie reel]: movie.gif
3092#### Extension: `implicit_figures` ####
3094An image occurring by itself in a paragraph will be rendered as
3095a figure with a caption.[^5] (In LaTeX, a figure environment will be
3096used; in HTML, the image will be placed in a `div` with class
3097`figure`, together with a caption in a `p` with class `caption`.)
3098The image's alt text will be used as the caption.
3100 ![This is the caption](/url/of/image.png)
3102[^5]: This feature is not yet implemented for RTF, OpenDocument, or
3103 ODT. In those formats, you'll just get an image in a paragraph by
3104 itself, with no caption.
3106If you just want a regular inline image, just make sure it is not
3107the only thing in the paragraph. One way to do this is to insert a
3108nonbreaking space after the image:
3110 ![This image won't be a figure](/url/of/image.png)\
3112Note that in reveal.js slide shows, an image in a paragraph
3113by itself that has the `stretch` class will fill the screen,
3114and the caption and figure tags will be omitted.
3116#### Extension: `link_attributes` ####
3118Attributes can be set on links and images:
3120 An inline ![image](foo.jpg){#id .class width=30 height=20px}
3121 and a reference ![image][ref] with attributes.
3123 [ref]: foo.jpg "optional title" {#id .class key=val key2="val 2"}
3125(This syntax is compatible with [PHP Markdown Extra] when only `#id`
3126and `.class` are used.)
3128For HTML and EPUB, all attributes except `width` and `height` (but
3129including `srcset` and `sizes`) are passed through as is. The other
3130writers ignore attributes that are not supported by their output
3131format.
3133The `width` and `height` attributes on images are treated specially. When
3134used without a unit, the unit is assumed to be pixels. However, any of
3135the following unit identifiers can be used: `px`, `cm`, `mm`, `in`, `inch`
3136and `%`. There must not be any spaces between the number and the unit.
3137For example:
3139```
3140![](file.jpg){ width=50% }
3141```
3143- Dimensions are converted to inches for output in page-based formats like
3144 LaTeX. Dimensions are converted to pixels for output in HTML-like
3145 formats. Use the `--dpi` option to specify the number of pixels per
3146 inch. The default is 96dpi.
3147- The `%` unit is generally relative to some available space.
3148 For example the above example will render to
3149 `<img href="file.jpg" style="width: 50%;" />` (HTML),
3150 `\includegraphics[width=0.5\textwidth]{file.jpg}` (LaTeX), or
3151 `\externalfigure[file.jpg][width=0.5\textwidth]` (ConTeXt).
3152- Some output formats have a notion of a class
3153 ([ConTeXt](http://wiki.contextgarden.net/Using_Graphics#Multiple_Image_Settings))
3154 or a unique identifier (LaTeX `\caption`), or both (HTML).
3155- When no `width` or `height` attributes are specified, the fallback
3156 is to look at the image resolution and the dpi metadata embedded in
3157 the image file.
3159Spans
3160-----
3162#### Extension: `bracketed_spans` ####
3164A bracketed sequence of inlines, as one would use to begin
3165a link, will be treated as a span with attributes if it is
3166followed immediately by attributes:
3168 [This is *some text*]{.class key="val"}
3170Footnotes
3171---------
3173#### Extension: `footnotes` ####
3175Pandoc's Markdown allows footnotes, using the following syntax:
3177 Here is a footnote reference,[^1] and another.[^longnote]
3179 [^1]: Here is the footnote.
3181 [^longnote]: Here's one with multiple blocks.
3183 Subsequent paragraphs are indented to show that they
3184 belong to the previous footnote.
3186 { some.code }
3188 The whole paragraph can be indented, or just the first
3189 line. In this way, multi-paragraph footnotes work like
3190 multi-paragraph list items.
3192 This paragraph won't be part of the note, because it
3193 isn't indented.
3195The identifiers in footnote references may not contain spaces, tabs,
3196or newlines. These identifiers are used only to correlate the
3197footnote reference with the note itself; in the output, footnotes
3198will be numbered sequentially.
3200The footnotes themselves need not be placed at the end of the
3201document. They may appear anywhere except inside other block elements
3202(lists, block quotes, tables, etc.). Each footnote should be
3203separated from surrounding content (including other footnotes)
3204by blank lines.
3206#### Extension: `inline_notes` ####
3208Inline footnotes are also allowed (though, unlike regular notes,
3209they cannot contain multiple paragraphs). The syntax is as follows:
3211 Here is an inline note.^[Inlines notes are easier to write, since
3212 you don't have to pick an identifier and move down to type the
3213 note.]
3215Inline and regular footnotes may be mixed freely.
3217Typography
3218----------
3220#### Extension: `smart` ####
3222Interpret straight quotes as curly quotes, `---` as em-dashes,
3223`--` as en-dashes, and `...` as ellipses. Nonbreaking spaces are
3224inserted after certain abbreviations, such as "Mr." This
3225option currently affects the input formats `markdown`,
3226`commonmark`, `latex`, `mediawiki`, `org`, `rst`, and `twiki`,
3227and the output formats `markdown`, `latex`, and `context`.
3229Note: If you are *writing* Markdown, then the `smart` extension
3230has the reverse effect: what would have been curly quotes comes
3231out straight.
3233In LaTeX, `smart` means to use the standard TeX ligatures
3234for quotation marks (` `` ` and ` '' ` for double quotes,
3235`` ` `` and `` ' `` for single quotes) and dashes (`--` for
3236en-dash and `---` for em-dash). If `smart` is disabled,
3237then in reading LaTeX pandoc will parse these characters
3238literally. In writing LaTeX, enabling `smart` tells pandoc
3239to use the ligatures when possible; if `smart` is disabled
3240pandoc will use unicode quotation mark and dash characters.
3242Citations
3243---------
3245#### Extension: `citations` ####
3247Using an external filter, `pandoc-citeproc`, pandoc can automatically generate
3248citations and a bibliography in a number of styles. Basic usage is
3250 pandoc --filter pandoc-citeproc myinput.txt
3252In order to use this feature, you will need to specify a bibliography file
3253using the `bibliography` metadata field in a YAML metadata section, or
3254`--bibliography` command line argument. You can supply multiple `--bibliography`
3255arguments or set `bibliography` metadata field to YAML array, if you want to
3256use multiple bibliography files. The bibliography may have any of these
3257formats:
3259 Format File extension
3260 ------------ --------------
3261 BibLaTeX .bib
3262 BibTeX .bibtex
3263 Copac .copac
3264 CSL JSON .json
3265 CSL YAML .yaml
3266 EndNote .enl
3267 EndNote XML .xml
3268 ISI .wos
3269 MEDLINE .medline
3270 MODS .mods
3271 RIS .ris
3273Note that `.bib` can be used with both BibTeX and BibLaTeX files;
3274use `.bibtex` to force BibTeX.
3276Note that `pandoc-citeproc --bib2json` and `pandoc-citeproc --bib2yaml`
3277can produce `.json` and `.yaml` files from any of the supported formats.
3279In-field markup: In BibTeX and BibLaTeX databases, pandoc-citeproc parses
3280a subset of LaTeX markup; in CSL YAML databases, pandoc Markdown; and in CSL JSON databases, an [HTML-like markup][CSL markup specs]:
3282`<i>...</i>`
3283: italics
3285`<b>...</b>`
3286: bold
3288`<span style="font-variant:small-caps;">...</span>` or `<sc>...</sc>`
3289: small capitals
3291`<sub>...</sub>`
3292: subscript
3294`<sup>...</sup>`
3295: superscript
3297`<span class="nocase">...</span>`
3298: prevent a phrase from being capitalized as title case
3300`pandoc-citeproc -j` and `-y` interconvert the CSL JSON
3301and CSL YAML formats as far as possible.
3303As an alternative to specifying a bibliography file using `--bibliography`
3304or the YAML metadata field `bibliography`, you can include
3305the citation data directly in the `references` field of the
3306document's YAML metadata. The field should contain an array of
3307YAML-encoded references, for example:
3309 ---
3310 references:
3311 - type: article-journal
3312 id: WatsonCrick1953
3313 author:
3314 - family: Watson
3315 given: J. D.
3316 - family: Crick
3317 given: F. H. C.
3318 issued:
3319 date-parts:
3320 - - 1953
3321 - 4
3322 - 25
3323 title: 'Molecular structure of nucleic acids: a structure for deoxyribose
3324 nucleic acid'
3325 title-short: Molecular structure of nucleic acids
3326 container-title: Nature
3327 volume: 171
3328 issue: 4356
3329 page: 737-738
3330 DOI: 10.1038/171737a0
3331 URL: http://www.nature.com/nature/journal/v171/n4356/abs/171737a0.html
3332 language: en-GB
3333 ...
3335(`pandoc-citeproc --bib2yaml` can produce these from a bibliography file in one
3336of the supported formats.)
3338Citations and references can be formatted using any style supported by the
3339[Citation Style Language], listed in the [Zotero Style Repository].
3340These files are specified using the `--csl` option or the `csl` metadata field.
3341By default, `pandoc-citeproc` will use the [Chicago Manual of Style] author-date
3342format. The CSL project provides further information on [finding and editing styles].
3344To make your citations hyperlinks to the corresponding bibliography
3345entries, add `link-citations: true` to your YAML metadata.
3347Citations go inside square brackets and are separated by semicolons.
3348Each citation must have a key, composed of '@' + the citation
3349identifier from the database, and may optionally have a prefix,
3350a locator, and a suffix. The citation key must begin with a letter, digit,
3351or `_`, and may contain alphanumerics, `_`, and internal punctuation
3352characters (`:.#$%&-+?<>~/`). Here are some examples:
3354 Blah blah [see @doe99, pp. 33-35; also @smith04, chap. 1].
3356 Blah blah [@doe99, pp. 33-35, 38-39 and *passim*].
3358 Blah blah [@smith04; @doe99].
3360`pandoc-citeproc` detects locator terms in the [CSL locale files].
3361Either abbreviated or unabbreviated forms are accepted. In the `en-US`
3362locale, locator terms can be written in either singular or plural forms,
3363as `book`, `bk.`/`bks.`; `chapter`, `chap.`/`chaps.`; `column`,
3364`col.`/`cols.`; `figure`, `fig.`/`figs.`; `folio`, `fol.`/`fols.`;
3365`number`, `no.`/`nos.`; `line`, `l.`/`ll.`; `note`, `n.`/`nn.`; `opus`,
3366`op.`/`opp.`; `page`, `p.`/`pp.`; `paragraph`, `para.`/`paras.`; `part`,
3367`pt.`/`pts.`; `section`, `sec.`/`secs.`; `sub verbo`, `s.v.`/`s.vv.`;
3368`verse`, `v.`/`vv.`; `volume`, `vol.`/`vols.`; `¶`/`¶¶`; `§`/`§§`. If no
3369locator term is used, "page" is assumed.
3371A minus sign (`-`) before the `@` will suppress mention of
3372the author in the citation. This can be useful when the
3373author is already mentioned in the text:
3375 Smith says blah [-@smith04].
3377You can also write an in-text citation, as follows:
3379 @smith04 says blah.
3381 @smith04 [p. 33] says blah.
3383If the style calls for a list of works cited, it will be placed
3384at the end of the document. Normally, you will want to end your
3385document with an appropriate header:
3387 last paragraph...
3389 # References
3391The bibliography will be inserted after this header. Note that
3392the `unnumbered` class will be added to this header, so that the
3393section will not be numbered.
3395If you want to include items in the bibliography without actually
3396citing them in the body text, you can define a dummy `nocite` metadata
3397field and put the citations there:
3399 ---
3400 nocite: |
3401 @item1, @item2
3402 ...
3404 @item3
3406In this example, the document will contain a citation for `item3`
3407only, but the bibliography will contain entries for `item1`, `item2`, and
3408`item3`.
3410It is possible to create a bibliography with all the citations,
3411whether or not they appear in the document, by using a wildcard:
3413 ---
3414 nocite: |
3415 @*
3416 ...
3418For LaTeX or PDF output, you can also use [`natbib`] or [`biblatex`]
3419to render bibliography. In order to do so, specify bibliography files as
3420outlined above, and add `--natbib` or `--biblatex` argument to `pandoc`
3421invocation. Bear in mind that bibliography files have to be in respective
3422format (either BibTeX or BibLaTeX).
3424For more information, see the [pandoc-citeproc man page].
3426[CSL markup specs]: http://docs.citationstyles.org/en/1.0/release-notes.html#rich-text-markup-within-fields
3427[Chicago Manual of Style]: http://chicagomanualofstyle.org
3428[Citation Style Language]: http://citationstyles.org
3429[Zotero Style Repository]: https://www.zotero.org/styles
3430[finding and editing styles]: http://citationstyles.org/styles/
3431[CSL locale files]: https://github.com/citation-style-language/locales
3432[pandoc-citeproc man page]: https://github.com/jgm/pandoc-citeproc/blob/master/man/pandoc-citeproc.1.md
3434Non-pandoc extensions
3435---------------------
3437The following Markdown syntax extensions are not enabled by default
3438in pandoc, but may be enabled by adding `+EXTENSION` to the format
3439name, where `EXTENSION` is the name of the extension. Thus, for
3440example, `markdown+hard_line_breaks` is Markdown with hard line breaks.
3442#### Extension: `old_dashes` ####
3444Selects the pandoc <= 1.8.2.1 behavior for parsing smart dashes:
3445`-` before a numeral is an en-dash, and `--` is an em-dash.
3446This option only has an effect if `smart` is enabled. It is
3447selected automatically for `textile` input.
3449#### Extension: `angle_brackets_escapable` ####
3451Allow `<` and `>` to be backslash-escaped, as they can be in
3452GitHub flavored Markdown but not original Markdown. This is
3453implied by pandoc's default `all_symbols_escapable`.
3455#### Extension: `lists_without_preceding_blankline` ####
3457Allow a list to occur right after a paragraph, with no intervening
3458blank space.
3460#### Extension: `hard_line_breaks` ####
3462Causes all newlines within a paragraph to be interpreted as hard line
3463breaks instead of spaces.
3465#### Extension: `ignore_line_breaks` ####
3467Causes newlines within a paragraph to be ignored, rather than being
3468treated as spaces or as hard line breaks. This option is intended for
3469use with East Asian languages where spaces are not used between words,
3470but text is divided into lines for readability.
3472#### Extension: `east_asian_line_breaks` ####
3474Causes newlines within a paragraph to be ignored, rather than
3475being treated as spaces or as hard line breaks, when they occur
3476between two East Asian wide characters. This is a better choice
3477than `ignore_line_breaks` for texts that include a mix of East
3478Asian wide characters and other characters.
3480##### Extension: `emoji` ####
3482Parses textual emojis like `:smile:` as Unicode emoticons.
3484#### Extension: `tex_math_single_backslash` ####
3486Causes anything between `\(` and `\)` to be interpreted as inline
3487TeX math, and anything between `\[` and `\]` to be interpreted
3488as display TeX math. Note: a drawback of this extension is that
3489it precludes escaping `(` and `[`.
3491#### Extension: `tex_math_double_backslash` ####
3493Causes anything between `\\(` and `\\)` to be interpreted as inline
3494TeX math, and anything between `\\[` and `\\]` to be interpreted
3495as display TeX math.
3497#### Extension: `markdown_attribute` ####
3499By default, pandoc interprets material inside block-level tags as Markdown.
3500This extension changes the behavior so that Markdown is only parsed
3501inside block-level tags if the tags have the attribute `markdown=1`.
3503#### Extension: `mmd_title_block` ####
3505Enables a [MultiMarkdown] style title block at the top of
3506the document, for example:
3508 Title: My title
3509 Author: John Doe
3510 Date: September 1, 2008
3511 Comment: This is a sample mmd title block, with
3512 a field spanning multiple lines.
3514See the MultiMarkdown documentation for details. If `pandoc_title_block` or
3515`yaml_metadata_block` is enabled, it will take precedence over
3516`mmd_title_block`.
3518#### Extension: `abbreviations` ####
3520Parses PHP Markdown Extra abbreviation keys, like
3522 *[HTML]: Hypertext Markup Language
3524Note that the pandoc document model does not support
3525abbreviations, so if this extension is enabled, abbreviation keys are
3526simply skipped (as opposed to being parsed as paragraphs).
3528#### Extension: `autolink_bare_uris` ####
3530Makes all absolute URIs into links, even when not surrounded by
3531pointy braces `<...>`.
3533#### Extension: `ascii_identifiers` ####
3535Causes the identifiers produced by `auto_identifiers` to be pure ASCII.
3536Accents are stripped off of accented Latin letters, and non-Latin
3537letters are omitted.
3539#### Extension: `mmd_link_attributes` ####
3541Parses multimarkdown style key-value attributes on link
3542and image references. This extension should not be confused with the
3543[`link_attributes`](#extension-link_attributes) extension.
3545 This is a reference ![image][ref] with multimarkdown attributes.
3547 [ref]: http://path.to/image "Image title" width=20px height=30px
3548 id=myId class="myClass1 myClass2"
3550#### Extension: `mmd_header_identifiers` ####
3552Parses multimarkdown style header identifiers (in square brackets,
3553after the header but before any trailing `#`s in an ATX header).
3555#### Extension: `compact_definition_lists` ####
3557Activates the definition list syntax of pandoc 1.12.x and earlier.
3558This syntax differs from the one described above under [Definition lists]
3559in several respects:
3561 - No blank line is required between consecutive items of the
3562 definition list.
3563 - To get a "tight" or "compact" list, omit space between consecutive
3564 items; the space between a term and its definition does not affect
3565 anything.
3566 - Lazy wrapping of paragraphs is not allowed: the entire definition must
3567 be indented four spaces.[^6]
3569[^6]: To see why laziness is incompatible with relaxing the requirement
3570 of a blank line between items, consider the following example:
3572 bar
3573 : definition
3574 foo
3575 : definition
3577 Is this a single list item with two definitions of "bar," the first of
3578 which is lazily wrapped, or two list items? To remove the ambiguity
3579 we must either disallow lazy wrapping or require a blank line between
3580 list items.
3582Markdown variants
3583-----------------
3585In addition to pandoc's extended Markdown, the following Markdown
3586variants are supported:
3588`markdown_phpextra` (PHP Markdown Extra)
3589: `footnotes`, `pipe_tables`, `raw_html`, `markdown_attribute`,
3590 `fenced_code_blocks`, `definition_lists`, `intraword_underscores`,
3591 `header_attributes`, `link_attributes`, `abbreviations`,
3592 `shortcut_reference_links`.
3594`markdown_github` (GitHub-Flavored Markdown)
3595: `pipe_tables`, `raw_html`, `fenced_code_blocks`, `auto_identifiers`,
3596 `ascii_identifiers`, `backtick_code_blocks`, `autolink_bare_uris`,
3597 `intraword_underscores`, `strikeout`, `hard_line_breaks`, `emoji`,
3598 `shortcut_reference_links`, `angle_brackets_escapable`.
3600`markdown_mmd` (MultiMarkdown)
3601: `pipe_tables`, `raw_html`, `markdown_attribute`, `mmd_link_attributes`,
3602 `tex_math_double_backslash`, `intraword_underscores`,
3603 `mmd_title_block`, `footnotes`, `definition_lists`,
3604 `all_symbols_escapable`, `implicit_header_references`,
3605 `auto_identifiers`, `mmd_header_identifiers`,
3606 `shortcut_reference_links`.
3608`markdown_strict` (Markdown.pl)
3609: `raw_html`
3611Extensions with formats other than Markdown
3612-------------------------------------------
3614Some of the extensions discussed above can be used with formats
3615other than Markdown:
3617* `auto_identifiers` can be used with `latex`, `rst`, `mediawiki`,
3618 and `textile` input (and is used by default).
3620* `tex_math_dollars`, `tex_math_single_backslash`, and
3621 `tex_math_double_backslash` can be used with `html` input.
3622 (This is handy for reading web pages formatted using MathJax,
3623 for example.)
3625Producing slide shows with pandoc
3626=================================
3628You can use pandoc to produce an HTML + JavaScript slide presentation
3629that can be viewed via a web browser. There are five ways to do this,
3630using [S5], [DZSlides], [Slidy], [Slideous], or [reveal.js].
3631You can also produce a PDF slide show using LaTeX [`beamer`].
3633Here's the Markdown source for a simple slide show, `habits.txt`:
3635 % Habits
3636 % John Doe
3637 % March 22, 2005
3639 # In the morning
3641 ## Getting up
3643 - Turn off alarm
3644 - Get out of bed
3646 ## Breakfast
3648 - Eat eggs
3649 - Drink coffee
3651 # In the evening
3653 ## Dinner
3655 - Eat spaghetti
3656 - Drink wine
3658 ------------------
3660 ![picture of spaghetti](images/spaghetti.jpg)
3662 ## Going to sleep
3664 - Get in bed
3665 - Count sheep
3667To produce an HTML/JavaScript slide show, simply type
3669 pandoc -t FORMAT -s habits.txt -o habits.html
3671where `FORMAT` is either `s5`, `slidy`, `slideous`, `dzslides`, or `revealjs`.
3673For Slidy, Slideous, reveal.js, and S5, the file produced by pandoc with the
3674`-s/--standalone` option embeds a link to JavaScript and CSS files, which are
3675assumed to be available at the relative path `s5/default` (for S5), `slideous`
3676(for Slideous), `reveal.js` (for reveal.js), or at the Slidy website at
3677`w3.org` (for Slidy). (These paths can be changed by setting the `slidy-url`,
3678`slideous-url`, `revealjs-url`, or `s5-url` variables; see [Variables for slides],
3679above.) For DZSlides, the (relatively short) JavaScript and CSS are included in
3680the file by default.
3682With all HTML slide formats, the `--self-contained` option can be used to
3683produce a single file that contains all of the data necessary to display the
3684slide show, including linked scripts, stylesheets, images, and videos.
3686To produce a PDF slide show using beamer, type
3688 pandoc -t beamer habits.txt -o habits.pdf
3690Note that a reveal.js slide show can also be converted to a PDF
3691by printing it to a file from the browser.
3693Structuring the slide show
3694--------------------------
3696By default, the *slide level* is the highest header level in
3697the hierarchy that is followed immediately by content, and not another
3698header, somewhere in the document. In the example above, level 1 headers
3699are always followed by level 2 headers, which are followed by content,
3700so 2 is the slide level. This default can be overridden using
3701the `--slide-level` option.
3703The document is carved up into slides according to the following
3704rules:
3706 * A horizontal rule always starts a new slide.
3708 * A header at the slide level always starts a new slide.
3710 * Headers *below* the slide level in the hierarchy create
3711 headers *within* a slide.
3713 * Headers *above* the slide level in the hierarchy create
3714 "title slides," which just contain the section title
3715 and help to break the slide show into sections.
3717 * Content *above* the slide level will not appear in the slide
3718 show.
3720 * A title page is constructed automatically from the document's title
3721 block, if present. (In the case of beamer, this can be disabled
3722 by commenting out some lines in the default template.)
3724These rules are designed to support many different styles of slide show. If
3725you don't care about structuring your slides into sections and subsections,
3726you can just use level 1 headers for all each slide. (In that case, level 1
3727will be the slide level.) But you can also structure the slide show into
3728sections, as in the example above.
3730Note: in reveal.js slide shows, if slide level is 2, a two-dimensional
3731layout will be produced, with level 1 headers building horizontally
3732and level 2 headers building vertically. It is not recommended that
3733you use deeper nesting of section levels with reveal.js.
3735Incremental lists
3736-----------------
3738By default, these writers produce lists that display "all at once."
3739If you want your lists to display incrementally (one item at a time),
3740use the `-i` option. If you want a particular list to depart from the
3741default (that is, to display incrementally without the `-i` option and
3742all at once with the `-i` option), put it in a block quote:
3744 > - Eat spaghetti
3745 > - Drink wine
3747In this way incremental and nonincremental lists can be mixed in
3748a single document.
3750Inserting pauses
3751----------------
3753You can add "pauses" within a slide by including a paragraph containing
3754three dots, separated by spaces:
3756 # Slide with a pause
3758 content before the pause
3760 . . .
3762 content after the pause
3764Styling the slides
3765------------------
3767You can change the style of HTML slides by putting customized CSS files
3768in `$DATADIR/s5/default` (for S5), `$DATADIR/slidy` (for Slidy),
3769or `$DATADIR/slideous` (for Slideous),
3770where `$DATADIR` is the user data directory (see `--data-dir`, above).
3771The originals may be found in pandoc's system data directory (generally
3772`$CABALDIR/pandoc-VERSION/s5/default`). Pandoc will look there for any
3773files it does not find in the user data directory.
3775For dzslides, the CSS is included in the HTML file itself, and may
3776be modified there.
3778All [reveal.js configuration options] can be set through variables.
3779For example, themes can be used by setting the `theme` variable:
3781 -V theme=moon
3783Or you can specify a custom stylesheet using the `--css` option.
3785To style beamer slides, you can specify a `theme`, `colortheme`,
3786`fonttheme`, `innertheme`, and `outertheme`, using the `-V` option:
3788 pandoc -t beamer habits.txt -V theme:Warsaw -o habits.pdf
3790Note that header attributes will turn into slide attributes
3791(on a `<div>` or `<section>`) in HTML slide formats, allowing you
3792to style individual slides. In beamer, the only header attribute
3793that affects slides is the `allowframebreaks` class, which sets the
3794`allowframebreaks` option, causing multiple slides to be created
3795if the content overfills the frame. This is recommended especially for
3796bibliographies:
3798 # References {.allowframebreaks}
3800Speaker notes
3801-------------
3803reveal.js has good support for speaker notes. You can add notes to your
3804Markdown document thus:
3806 <div class="notes">
3807 This is my note.
3809 - It can contain Markdown
3810 - like this list
3812 </div>
3814To show the notes window, press `s` while viewing the presentation.
3815Notes are not yet supported for other slide formats, but the notes
3816will not appear on the slides themselves.
3818Frame attributes in beamer
3819--------------------------
3821Sometimes it is necessary to add the LaTeX `[fragile]` option to
3822a frame in beamer (for example, when using the `minted` environment).
3823This can be forced by adding the `fragile` class to the header
3824introducing the slide:
3826 # Fragile slide {.fragile}
3828All of the other frame attributes described in Section 8.1 of
3829the [Beamer User's Guide] may also be used: `allowdisplaybreaks`,
3830`allowframebreaks`, `b`, `c`, `t`, `environment`, `label`, `plain`,
3831`shrink`.
3833Creating EPUBs with pandoc
3834==========================
3836EPUB Metadata
3837-------------
3839EPUB metadata may be specified using the `--epub-metadata` option, but
3840if the source document is Markdown, it is better to use a [YAML metadata
3841block][Extension: `yaml_metadata_block`]. Here is an example:
3843 ---
3844 title:
3845 - type: main
3846 text: My Book
3847 - type: subtitle
3848 text: An investigation of metadata
3849 creator:
3850 - role: author
3851 text: John Smith
3852 - role: editor
3853 text: Sarah Jones
3854 identifier:
3855 - scheme: DOI
3856 text: doi:10.234234.234/33
3857 publisher: My Press
3858 rights: © 2007 John Smith, CC BY-NC
3859 ...
3861The following fields are recognized:
3863`identifier`
3864 ~ Either a string value or an object with fields `text` and
3865 `scheme`. Valid values for `scheme` are `ISBN-10`,
3866 `GTIN-13`, `UPC`, `ISMN-10`, `DOI`, `LCCN`, `GTIN-14`,
3867 `ISBN-13`, `Legal deposit number`, `URN`, `OCLC`,
3868 `ISMN-13`, `ISBN-A`, `JP`, `OLCC`.
3870`title`
3871 ~ Either a string value, or an object with fields `file-as` and
3872 `type`, or a list of such objects. Valid values for `type` are
3873 `main`, `subtitle`, `short`, `collection`, `edition`, `extended`.
3875`creator`
3876 ~ Either a string value, or an object with fields `role`, `file-as`,
3877 and `text`, or a list of such objects. Valid values for `role` are
3878 [MARC relators], but
3879 pandoc will attempt to translate the human-readable versions
3880 (like "author" and "editor") to the appropriate marc relators.
3882`contributor`
3883 ~ Same format as `creator`.
3885`date`
3886 ~ A string value in `YYYY-MM-DD` format. (Only the year is necessary.)
3887 Pandoc will attempt to convert other common date formats.
3889`lang` (or legacy: `language`)
3890 ~ A string value in [BCP 47] format. Pandoc will default to the local
3891 language if nothing is specified.
3893`subject`
3894 ~ A string value or a list of such values.
3896`description`
3897 ~ A string value.
3899`type`
3900 ~ A string value.
3902`format`
3903 ~ A string value.
3905`relation`
3906 ~ A string value.
3908`coverage`
3909 ~ A string value.
3911`rights`
3912 ~ A string value.
3914`cover-image`
3915 ~ A string value (path to cover image).
3917`stylesheet`
3918 ~ A string value (path to CSS stylesheet).
3920`page-progression-direction`
3921 ~ Either `ltr` or `rtl`. Specifies the `page-progression-direction`
3922 attribute for the [`spine` element].
3924[MARC relators]: http://loc.gov/marc/relators/relaterm.html
3925[`spine` element]: http://idpf.org/epub/301/spec/epub-publications.html#sec-spine-elem
3927Linked media
3928------------
3930By default, pandoc will download linked media (including audio and
3931video) and include it in the EPUB container, yielding a completely
3932self-contained EPUB. If you want to link to external media resources
3933instead, use raw HTML in your source and add `data-external="1"` to the tag
3934with the `src` attribute. For example:
3936 <audio controls="1">
3937 <source src="http://example.com/music/toccata.mp3"
3938 data-external="1" type="audio/mpeg">
3939 </source>
3940 </audio>
3942Literate Haskell support
3943========================
3945If you append `+lhs` (or `+literate_haskell`) to an appropriate input or output
3946format (`markdown`, `markdown_strict`, `rst`, or `latex` for input or output;
3947`beamer`, `html4` or `html5` for output only), pandoc will treat the document as
3948literate Haskell source. This means that
3950 - In Markdown input, "bird track" sections will be parsed as Haskell
3951 code rather than block quotations. Text between `\begin{code}`
3952 and `\end{code}` will also be treated as Haskell code. For
3953 ATX-style headers the character '=' will be used instead of '#'.
3955 - In Markdown output, code blocks with classes `haskell` and `literate`
3956 will be rendered using bird tracks, and block quotations will be
3957 indented one space, so they will not be treated as Haskell code.
3958 In addition, headers will be rendered setext-style (with underlines)
3959 rather than ATX-style (with '#' characters). (This is because ghc
3960 treats '#' characters in column 1 as introducing line numbers.)
3962 - In restructured text input, "bird track" sections will be parsed
3963 as Haskell code.
3965 - In restructured text output, code blocks with class `haskell` will
3966 be rendered using bird tracks.
3968 - In LaTeX input, text in `code` environments will be parsed as
3969 Haskell code.
3971 - In LaTeX output, code blocks with class `haskell` will be rendered
3972 inside `code` environments.
3974 - In HTML output, code blocks with class `haskell` will be rendered
3975 with class `literatehaskell` and bird tracks.
3977Examples:
3979 pandoc -f markdown+lhs -t html
3981reads literate Haskell source formatted with Markdown conventions and writes
3982ordinary HTML (without bird tracks).
3984 pandoc -f markdown+lhs -t html+lhs
3986writes HTML with the Haskell code in bird tracks, so it can be copied
3987and pasted as literate Haskell source.
3989Note that GHC expects the bird tracks in the first column, so indentend literate
3990code blocks (e.g. inside an itemized environment) will not be picked up by the
3991Haskell compiler.
3993Syntax highlighting
3994===================
3996Pandoc will automatically highlight syntax in [fenced code blocks] that
3997are marked with a language name. The Haskell library [highlighting-kate] is
3998used for highlighting, which works in HTML, Docx, and LaTeX/PDF output.
3999To see a list of language names that pandoc will recognize, type
4000`pandoc --list-highlight-languages`.
4002The color scheme can be selected using the `--highlight-style` option.
4003The default color scheme is `pygments`, which imitates the default color
4004scheme used by the Python library pygments (though pygments is not actually
4005used to do the highlighting). To see a list of highlight styles,
4006type `pandoc --list-highlight-styles`.
4008To disable highlighting, use the `--no-highlight` option.
4010[highlighting-kate]: https://github.com/jgm/highlighting-kate
4012Custom Styles in Docx Output
4013============================
4015By default, pandoc's docx output applies a predefined set of styles for
4016blocks such as paragraphs and block quotes, and uses largely default
4017formatting (italics, bold) for inlines. This will work for most
4018purposes, especially alongside a `reference.docx` file. However, if you
4019need to apply your own styles to blocks, or match a preexisting set of
4020styles, pandoc allows you to define custom styles for blocks and text
4021using `div`s and `span`s, respectively.
4023If you define a `div` or `span` with the attribute `custom-style`,
4024pandoc will apply your specified style to the contained elements. So,
4025for example,
4027 <span custom-style="Emphatically">Get out,</span> he said.
4029would produce a docx file with "Get out," styled with character
4030style `Emphatically`. Similarly,
4032 Dickinson starts the poem simply:
4034 <div custom-style="Poetry">
4035 | A Bird came down the Walk---
4036 | He did not know I saw---
4037 </div>
4039would style the two contained lines with the `Poetry` paragraph style.
4041If the styles are not yet in your reference.docx, they will be defined
4042in the output file as inheriting from normal text. If they are already
4043defined, pandoc will not alter the definition.
4045This feature allows for greatest customization in conjunction with
4046[pandoc filters]. If you want all paragraphs after block quotes to be
4047indented, you can write a filter to apply the styles necessary. If you
4048want all italics to be transformed to the `Emphasis` character style
4049(perhaps to change their color), you can write a filter which will
4050transform all italicized inlines to inlines within an `Emphasis`
4051custom-style `span`.
4053[pandoc filters]: http://pandoc.org/scripting.html
4055Custom writers
4056==============
4058Pandoc can be extended with custom writers written in [lua]. (Pandoc
4059includes a lua interpreter, so lua need not be installed separately.)
4061To use a custom writer, simply specify the path to the lua script
4062in place of the output format. For example:
4064 pandoc -t data/sample.lua
4066Creating a custom writer requires writing a lua function for each
4067possible element in a pandoc document. To get a documented example
4068which you can modify according to your needs, do
4070 pandoc --print-default-data-file sample.lua
4072[lua]: http://www.lua.org
4074Authors
4075=======
4077© 2006-2016 John MacFarlane (jgm@berkeley.edu). Released under the
4078[GPL], version 2 or greater. This software carries no warranty of
4079any kind. (See COPYRIGHT for full copyright and warranty notices.)
4081Contributors include
4082Arata Mizuki,
4083Aaron Wolen,
4084Albert Krewinkel,
4085Alex Ivkin,
4086Alex Vong,
4087Alexander Kondratskiy,
4088Alexander Sulfrian,
4089Alexander V Vershilov,
4090Alfred Wechselberger,
4091Andreas Lööw,
4092Andrew Dunning,
4093Antoine Latter,
4094Arata Mizuki,
4095Arlo O'Keeffe,
4096Artyom Kazak,
4097B. Scott Michel,
4098Ben Gamari,
4099Beni Cherniavsky-Paskin,
4100Benoit Schweblin,
4101Bjorn Buckwalter,
4102Bradley Kuhn,
4103Brent Yorgey,
4104Bryan O'Sullivan,
4105Caleb McDaniel,
4106Calvin Beck,
4107Carlos Sosa,
4108Chris Black,
4109Christian Conkle,
4110Christoffer Ackelman,
4111Christoffer Sawicki,
4112Clare Macrae,
4113Clint Adams,
4114Conal Elliott,
4115Craig S. Bosma,
4116Daniel Bergey,
4117Daniel T. Staal,
4118Daniele D'Orazio,
4119David Lazar,
4120David Röthlisberger,
4121Denis Laxalde,
4122Douglas Calvert,
4123Emanuel Evans,
4124Emily Eisenberg,
4125Eric Kow,
4126Eric Seidel,
4127Felix Yan,
4128Florian Eitel,
4129François Gannaz,
4130Freiric Barral,
4131Freirich Raabe,
4132Frerich Raabe,
4133Fyodor Sheremetyev,
4134Gabor Pali,
4135Gavin Beatty,
4136Gottfried Haider,
4137Greg Maslov,
4138Greg Rundlett,
4139Grégory Bataille,
4140Gwern Branwen,
4141Hans-Peter Deifel,
4142Henrik Tramberend,
4143Henry de Valence,
4144Hubert Plociniczak,
4145Ilya V. Portnov,
4146Ivo Clarysse,
4147J. Lewis Muir,
4148Jaime Marquínez Ferrándiz,
4149Jakob Voß,
4150James Aspnes,
4151Jamie F. Olson,
4152Jan Larres,
4153Jan Schulz,
4154Jason Ronallo,
4155Jeff Arnold,
4156Jeff Runningen,
4157Jens Petersen,
4158Jesse Rosenthal,
4159Joe Hillenbrand,
4160John MacFarlane,
4161John Muccigrosso,
4162Jonas Smedegaard,
4163Jonathan Daugherty,
4164Jose Luis Duran,
4165Josef Svenningsson,
4166Julien Cretel,
4167Juliusz Gonera,
4168Justin Bogner,
4169Jérémy Bobbio,
4170Kelsey Hightower,
4171Kolen Cheung,
4172Konstantin Zudov,
4173Kristof Bastiaensen,
4174Lars-Dominik Braun,
4175Luke Plant,
4176Mark Szepieniec,
4177Mark Wright,
4178Martin Linn,
4179Masayoshi Takahashi,
4180Matej Kollar,
4181Mathias Schenner,
4182Mathieu Duponchelle,
4183Matthew Eddey,
4184Matthew Pickering,
4185Matthias C. M. Troffaes,
4186Mauro Bieg,
4187Max Bolingbroke,
4188Max Rydahl Andersen,
4189Merijn Verstraaten,
4190Michael Beaumont,
4191Michael Chladek,
4192Michael Snoyman,
4193Michael Thompson,
4194MinRK,
4195Morton Fox,
4196Nathan Gass,
4197Neil Mayhew,
4198Nick Bart,
4199Nicolas Kaiser,
4200Nikolay Yakimov,
4201Oliver Matthews,
4202Ophir Lifshitz,
4203Pablo Rodríguez,
4204Paul Rivier,
4205Paulo Tanimoto,
4206Peter Wang,
4207Philippe Ombredanne,
4208Phillip Alday,
4209Prayag Verma,
4210Puneeth Chaganti,
4211Ralf Stephan,
4212Raniere Silva,
4213Recai Oktaş,
4214RyanGlScott,
4215Scott Morrison,
4216Sergei Trofimovich,
4217Sergey Astanin,
4218Shahbaz Youssefi,
4219Shaun Attfield,
4220Sidarth Kapur,
4221Sidharth Kapur,
4222Simon Hengel,
4223Sumit Sahrawat,
4224Thomas Hodgson,
4225Thomas Weißschuh,
4226Tim Lin,
4227Timothy Humphries,
4228Tiziano Müller,
4229Todd Sifleet,
4230Tom Leese,
4231Uli Köhler,
4232Václav Zeman,
4233Viktor Kronvall,
4234Vincent,
4235Václav Haisman,
4236Václav Zeman,
4237Wandmalfarbe,
4238Waldir Pimenta,
4239Wikiwide,
4240Xavier Olive,
4241bumper314,
4242csforste,
4243infinity0x,
4244nkalvi,
4245qerub,
4246robabla,
4247roblabla,
4248rodja.trappe,
4249rski,
4250shreevatsa.public,
4251takahashim,
4252tgkokk,
4253thsutton.
4255[GPL]: http://www.gnu.org/copyleft/gpl.html "GNU General Public License"