git.iko.soy/typeable/pandoc
on 2eb5d2d help sign in
3906 lines 136 kB history raw
1% Pandoc User's Guide
2% John MacFarlane
3% November 12, 2015
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],
16and (subsets of) [Textile], [reStructuredText], [HTML], [LaTeX], [MediaWiki markup], [TWiki
17markup], [Haddock markup], [OPML], [Emacs Org mode], [DocBook],
18[txt2tags], [EPUB], [ODT] and [Word docx]; and it can write plain text,
19[Markdown], [CommonMark], [PHP Markdown Extra], [GitHub-Flavored Markdown],
20[reStructuredText], [XHTML], [HTML5], [LaTeX] (including
21[`beamer`] slide shows), [ConTeXt], [RTF], [OPML], [DocBook],
22[OpenDocument], [ODT], [Word docx], [GNU Texinfo], [MediaWiki markup],
23[DokuWiki markup], [Haddock markup], [EPUB] (v2 or v3),
24[FictionBook2], [Textile], [groff man] pages, [Emacs Org mode],
25[AsciiDoc], [InDesign ICML], and [Slidy], [Slideous], [DZSlides],
26[reveal.js] or [S5] HTML slide shows. It can also produce [PDF] output
27on systems where LaTeX or ConTeXt is installed.
29Pandoc's enhanced version of Markdown includes syntax for [footnotes],
30[tables], flexible [ordered lists], [definition lists], [fenced code blocks],
31[superscripts and subscripts], [strikeout], [metadata blocks], automatic tables of
32contents, embedded LaTeX [math], [citations], and [Markdown inside HTML block
33elements][Extension: `markdown_in_html_blocks`]. (These enhancements, described below under
34[Pandoc's Markdown], can be disabled using the
35`markdown_strict` input or output format.)
37In contrast to most existing tools for converting Markdown to HTML, which
38use regex substitutions, pandoc has a modular design: it consists of a
39set of readers, which parse text in a given format and produce a native
40representation of the document, and a set of writers, which convert
41this native representation into a target format. Thus, adding an input
42or output format requires only adding a reader or writer.
44Because pandoc's intermediate representation of a document is less
45expressive than many of the formats it converts between, one should
46not expect perfect conversions between every format and every other.
47Pandoc attempts to preserve the structural elements of a document, but
48not formatting details such as margin size. And some document elements,
49such as complex tables, may not fit into pandoc's simple document
50model. While conversions from pandoc's Markdown to all formats aspire
51to be perfect, conversions from formats more expressive than pandoc's
52Markdown can be expected to be lossy.
54[Markdown]: http://daringfireball.net/projects/markdown/
55[CommonMark]: http://commonmark.org
56[PHP Markdown Extra]: https://michelf.ca/projects/php-markdown/extra/
57[GitHub-Flavored Markdown]: https://help.github.com/articles/github-flavored-markdown/
58[reStructuredText]: http://docutils.sourceforge.net/docs/ref/rst/introduction.html
59[S5]: http://meyerweb.com/eric/tools/s5/
60[Slidy]: http://www.w3.org/Talks/Tools/Slidy/
61[Slideous]: http://goessner.net/articles/slideous/
62[HTML]: http://www.w3.org/html/
63[HTML5]: http://www.w3.org/TR/html5/
64[XHTML]: http://www.w3.org/TR/xhtml1/
65[LaTeX]: http://latex-project.org
66[`beamer`]: https://ctan.org/pkg/beamer
67[Beamer User's Guide]: http://ctan.math.utah.edu/ctan/tex-archive/macros/latex/contrib/beamer/doc/beameruserguide.pdf
68[ConTeXt]: http://contextgarden.net/
69[RTF]: http://en.wikipedia.org/wiki/Rich_Text_Format
70[DocBook]: http://docbook.org
71[txt2tags]: http://txt2tags.org
72[EPUB]: http://idpf.org/epub
73[OPML]: http://dev.opml.org/spec2.html
74[OpenDocument]: http://opendocument.xml.org
75[ODT]: http://en.wikipedia.org/wiki/OpenDocument
76[Textile]: http://redcloth.org/textile
77[MediaWiki markup]: https://www.mediawiki.org/wiki/Help:Formatting
78[DokuWiki markup]: https://www.dokuwiki.org/dokuwiki
79[TWiki markup]: http://twiki.org/cgi-bin/view/TWiki/TextFormattingRules
80[Haddock markup]: https://www.haskell.org/haddock/doc/html/ch03s08.html
81[groff man]: http://developer.apple.com/DOCUMENTATION/Darwin/Reference/ManPages/man7/groff_man.7.html
82[Haskell]: https://www.haskell.org
83[GNU Texinfo]: http://www.gnu.org/software/texinfo/
84[Emacs Org mode]: http://orgmode.org
85[AsciiDoc]: http://www.methods.co.nz/asciidoc/
86[DZSlides]: http://paulrouget.com/dzslides/
87[Word docx]: http://www.microsoft.com/interop/openup/openxml/default.aspx
88[PDF]: https://www.adobe.com/pdf/
89[reveal.js]: http://lab.hakim.se/reveal-js/
90[FictionBook2]: http://www.fictionbook.org/index.php/Eng:XML_Schema_Fictionbook_2.1
91[InDesign ICML]: https://www.adobe.com/content/dam/Adobe/en/devnet/indesign/cs55-docs/IDML/idml-specification.pdf
93Using `pandoc`
94--------------
96If no *input-file* is specified, input is read from *stdin*.
97Otherwise, the *input-files* are concatenated (with a blank
98line between each) and used as input. Output goes to *stdout* by
99default (though output to *stdout* is disabled for the `odt`, `docx`,
100`epub`, and `epub3` output formats). For output to a file, use the
101`-o` option:
103 pandoc -o output.html input.txt
105By default, pandoc produces a document fragment, not a standalone
106document with a proper header and footer. To produce a standalone
107document, use the `-s` or `--standalone` flag:
109 pandoc -s -o output.html input.txt
111For more information on how standalone documents are produced, see
112[Templates], below.
114Instead of a file, an absolute URI may be given. In this case
115pandoc will fetch the content using HTTP:
117 pandoc -f html -t markdown http://www.fsf.org
119If multiple input files are given, `pandoc` will concatenate them all (with
120blank lines between them) before parsing. This feature is disabled for
121 binary input formats such as `EPUB`, `odt`, and `docx`.
123The format of the input and output can be specified explicitly using
124command-line options. The input format can be specified using the
125`-r/--read` or `-f/--from` options, the output format using the
126`-w/--write` or `-t/--to` options. Thus, to convert `hello.txt` from
127Markdown to LaTeX, you could type:
129 pandoc -f markdown -t latex hello.txt
131To convert `hello.html` from HTML to Markdown:
133 pandoc -f html -t markdown hello.html
135Supported output formats are listed below under the `-t/--to` option.
136Supported input formats are listed below under the `-f/--from` option. Note
137that the `rst`, `textile`, `latex`, and `html` readers are not complete;
138there are some constructs that they do not parse.
140If the input or output format is not specified explicitly, `pandoc`
141will attempt to guess it from the extensions of
142the input and output filenames. Thus, for example,
144 pandoc -o hello.tex hello.txt
146will convert `hello.txt` from Markdown to LaTeX. If no output file
147is specified (so that output goes to *stdout*), or if the output file's
148extension is unknown, the output format will default to HTML.
149If no input file is specified (so that input comes from *stdin*), or
150if the input files' extensions are unknown, the input format will
151be assumed to be Markdown unless explicitly specified.
153Pandoc uses the UTF-8 character encoding for both input and output.
154If your local character encoding is not UTF-8, you
155should pipe input and output through [`iconv`]:
157 iconv -t utf-8 input.txt | pandoc | iconv -f utf-8
159Note that in some output formats (such as HTML, LaTeX, ConTeXt,
160RTF, OPML, DocBook, and Texinfo), information about
161the character encoding is included in the document header, which
162will only be included if you use the `-s/--standalone` option.
164[`iconv`]: http://www.gnu.org/software/libiconv/
166Creating a PDF
167--------------
169To produce a PDF, specify an output file with a `.pdf` extension.
170By default, pandoc will use LaTeX to convert it to PDF:
172 pandoc test.txt -o test.pdf
174Production of a PDF requires that a LaTeX engine be installed (see
175`--latex-engine`, below), and assumes that the following LaTeX packages
176are available: [`amsfonts`], [`amsmath`], [`lm`],
177[`ifxetex`], [`ifluatex`], [`eurosym`], [`listings`] (if the
178`--listings` option is used), [`fancyvrb`], [`longtable`],
179[`booktabs`], [`graphicx`] and [`grffile`] (if the
180document contains images), [`hyperref`], [`ulem`],
181[`geometry`] (with the `geometry` variable set), [`setspace`] (with
182`linestretch`), and [`babel`] (with `lang`). The use of `xelatex` or
183`lualatex` as the LaTeX engine requires [`fontspec`]; `xelatex` uses
184[`mathspec`], [`polyglossia`] (with `lang`), [`xecjk`], and
185[`bidi`] (with the `dir` variable set). The [`upquote`] and
186[`microtype`] packages are used if available, and [`csquotes`] will
187be used for [smart punctuation] if added to the template. The
188[`natbib`], [`biblatex`], [`bibtex`], and [`biber`] packages can
189optionally be used for [citation rendering]. These are included with
190all recent versions of [TeX Live].
192Alternatively, pandoc can use ConTeXt to create a PDF.
193To do this, specify an output file with a `.pdf` extension,
194as before, but add `-t context` to the command line.
196PDF output can be controlled using [variables for LaTeX]
197or [variables for ConTeXt].
199[`amsfonts`]: https://ctan.org/pkg/amsfonts
200[`amsmath`]: https://ctan.org/pkg/amsmath
201[`lm`]: https://ctan.org/pkg/lm
202[`ifxetex`]: https://ctan.org/pkg/ifxetex
203[`ifluatex`]: https://ctan.org/pkg/ifluatex
204[`eurosym`]: https://ctan.org/pkg/eurosym
205[`listings`]: https://ctan.org/pkg/listings
206[`fancyvrb`]: https://ctan.org/pkg/fancyvrb
207[`longtable`]: https://ctan.org/pkg/longtable
208[`booktabs`]: https://ctan.org/pkg/booktabs
209[`graphicx`]: https://ctan.org/pkg/graphicx
210[`grffile`]: https://ctan.org/pkg/grffile
211[`geometry`]: https://ctan.org/pkg/geometry
212[`setspace`]: https://ctan.org/pkg/setspace
213[`xecjk`]: https://ctan.org/pkg/xecjk
214[`hyperref`]: https://ctan.org/pkg/hyperref
215[`ulem`]: https://ctan.org/pkg/ulem
216[`babel`]: https://ctan.org/pkg/babel
217[`bidi`]: https://ctan.org/pkg/bidi
218[`mathspec`]: https://ctan.org/pkg/mathspec
219[`polyglossia`]: https://ctan.org/pkg/polyglossia
220[`fontspec`]: https://ctan.org/pkg/fontspec
221[`upquote`]: https://ctan.org/pkg/upquote
222[`microtype`]: https://ctan.org/pkg/microtype
223[`csquotes`]: https://ctan.org/pkg/csquotes
224[`natbib`]: https://ctan.org/pkg/natbib
225[`biblatex`]: https://ctan.org/pkg/biblatex
226[`bibtex`]: https://ctan.org/pkg/bibtex
227[`biber`]: https://ctan.org/pkg/biber
228[TeX Live]: http://www.tug.org/texlive/
230`hsmarkdown`
231------------
233A user who wants a drop-in replacement for `Markdown.pl` may create
234a symbolic link to the `pandoc` executable called `hsmarkdown`. When
235invoked under the name `hsmarkdown`, `pandoc` will behave as if
236invoked with `-f markdown_strict --email-obfuscation=references`,
237and all command-line options will be treated as regular arguments.
238This approach does not work under [Cygwin], due to problems with
239its simulation of symbolic links.
241[Cygwin]: https://cygwin.com
243Options
244=======
246General options
247---------------
249`-f` *FORMAT*, `-r` *FORMAT*, `--from=`*FORMAT*, `--read=`*FORMAT*
251: Specify input format. *FORMAT* can be `native` (native Haskell),
252 `json` (JSON version of native AST), `markdown` (pandoc's
253 extended Markdown), `markdown_strict` (original unextended
254 Markdown), `markdown_phpextra` (PHP Markdown Extra),
255 `markdown_github` (GitHub-Flavored Markdown),
256 `commonmark` (CommonMark Markdown), `textile` (Textile), `rst`
257 (reStructuredText), `html` (HTML), `docbook` (DocBook), `t2t`
258 (txt2tags), `docx` (docx), `odt` (ODT), `epub` (EPUB), `opml` (OPML),
259 `org` (Emacs Org mode), `mediawiki` (MediaWiki markup), `twiki` (TWiki
260 markup), `haddock` (Haddock markup), or `latex` (LaTeX). If
261 `+lhs` is appended to `markdown`, `rst`, `latex`, or `html`, the
262 input will be treated as literate Haskell source: see [Literate
263 Haskell support], below. Markdown
264 syntax extensions can be individually enabled or disabled by
265 appending `+EXTENSION` or `-EXTENSION` to the format name. So, for
266 example, `markdown_strict+footnotes+definition_lists` is strict
267 Markdown with footnotes and definition lists enabled, and
268 `markdown-pipe_tables+hard_line_breaks` is pandoc's Markdown
269 without pipe tables and with hard line breaks. See [Pandoc's
270 Markdown], below, for a list of extensions and
271 their names.
273`-t` *FORMAT*, `-w` *FORMAT*, `--to=`*FORMAT*, `--write=`*FORMAT*
275: Specify output format. *FORMAT* can be `native` (native Haskell),
276 `json` (JSON version of native AST), `plain` (plain text),
277 `markdown` (pandoc's extended Markdown), `markdown_strict`
278 (original unextended Markdown), `markdown_phpextra` (PHP Markdown
279 Extra), `markdown_github` (GitHub-Flavored
280 Markdown), `commonmark` (CommonMark Markdown), `rst`
281 (reStructuredText), `html` (XHTML), `html5` (HTML5), `latex`
282 (LaTeX), `beamer` (LaTeX beamer slide show), `context` (ConTeXt),
283 `man` (groff man), `mediawiki` (MediaWiki markup), `dokuwiki`
284 (DokuWiki markup), `textile` (Textile), `org` (Emacs Org mode),
285 `texinfo` (GNU Texinfo), `opml` (OPML), `docbook` (DocBook),
286 `opendocument` (OpenDocument), `odt` (OpenOffice text document),
287 `docx` (Word docx), `haddock` (Haddock markup), `rtf` (rich text
288 format), `epub` (EPUB v2 book), `epub3` (EPUB v3), `fb2`
289 (FictionBook2 e-book), `asciidoc` (AsciiDoc), `icml` (InDesign
290 ICML), `slidy` (Slidy HTML and javascript slide show), `slideous`
291 (Slideous HTML and javascript slide show), `dzslides` (DZSlides
292 HTML5 + javascript slide show), `revealjs` (reveal.js HTML5 +
293 javascript slide show), `s5` (S5 HTML and javascript slide show),
294 or the path of a custom lua writer (see [Custom
295 writers], below). Note that `odt`, `epub`, and
296 `epub3` output will not be directed to *stdout*; an output
297 filename must be specified using the `-o/--output` option. If
298 `+lhs` is appended to `markdown`, `rst`, `latex`, `beamer`,
299 `html`, or `html5`, the output will be rendered as literate
300 Haskell source: see [Literate Haskell
301 support], below. Markdown syntax
302 extensions can be individually enabled or disabled by appending
303 `+EXTENSION` or `-EXTENSION` to the format name, as described
304 above under `-f`.
306`-o` *FILE*, `--output=`*FILE*
308: Write output to *FILE* instead of *stdout*. If *FILE* is
309 `-`, output will go to *stdout*. (Exception: if the output
310 format is `odt`, `docx`, `epub`, or `epub3`, output to stdout is disabled.)
312`--data-dir=`*DIRECTORY*
314: Specify the user data directory to search for pandoc data files.
315 If this option is not specified, the default user data directory
316 will be used. This is, in Unix:
318 $HOME/.pandoc
320 in Windows XP:
322 C:\Documents And Settings\USERNAME\Application Data\pandoc
324 and in Windows Vista or later:
326 C:\Users\USERNAME\AppData\Roaming\pandoc
328 You can find the default user data directory on your system by
329 looking at the output of `pandoc --version`.
330 A `reference.odt`, `reference.docx`, `epub.css`, `templates`,
331 `slidy`, `slideous`, or `s5` directory
332 placed in this directory will override pandoc's normal defaults.
334`--bash-completion`
336: Generate a bash completion script. To enable bash completion
337 with pandoc, add this to your `.bashrc`:
339 eval "$(pandoc --bash-completion)"
341`--verbose`
343: Give verbose debugging output. Currently this only has an effect
344 with PDF output.
346`-v`, `--version`
348: Print version.
350`-h`, `--help`
352: Show usage message.
354Reader options
355--------------
357`-R`, `--parse-raw`
359: Parse untranslatable HTML codes and LaTeX environments as raw HTML
360 or LaTeX, instead of ignoring them. Affects only HTML and LaTeX
361 input. Raw HTML can be printed in Markdown, reStructuredText, HTML,
362 Slidy, Slideous, DZSlides, reveal.js, and S5 output; raw LaTeX
363 can be printed in Markdown, reStructuredText, LaTeX, and ConTeXt output.
364 The default is for the readers to omit untranslatable HTML codes and
365 LaTeX environments. (The LaTeX reader does pass through untranslatable
366 LaTeX *commands*, even if `-R` is not specified.)
368`-S`, `--smart`
370: Produce typographically correct output, converting straight quotes
371 to curly quotes, `---` to em-dashes, `--` to en-dashes, and
372 `...` to ellipses. Nonbreaking spaces are inserted after certain
373 abbreviations, such as "Mr." (Note: This option is selected automatically
374 when the output format is `latex` or `context`, unless `--no-tex-ligatures`
375 is used. It has no effect for `latex` input.)
377`--old-dashes`
379: Selects the pandoc <= 1.8.2.1 behavior for parsing smart dashes: `-` before
380 a numeral is an en-dash, and `--` is an em-dash. This option is selected
381 automatically for `textile` input.
383`--base-header-level=`*NUMBER*
385: Specify the base level for headers (defaults to 1).
387`--indented-code-classes=`*CLASSES*
389: Specify classes to use for indented code blocks--for example,
390 `perl,numberLines` or `haskell`. Multiple classes may be separated
391 by spaces or commas.
393`--default-image-extension=`*EXTENSION*
395: Specify a default extension to use when image paths/URLs have no
396 extension. This allows you to use the same source for formats that
397 require different kinds of images. Currently this option only affects
398 the Markdown and LaTeX readers.
400`--filter=`*EXECUTABLE*
402: Specify an executable to be used as a filter transforming the
403 pandoc AST after the input is parsed and before the output is
404 written. The executable should read JSON from stdin and write
405 JSON to stdout. The JSON must be formatted like pandoc's own
406 JSON input and output. The name of the output format will be
407 passed to the filter as the first argument. Hence,
409 pandoc --filter ./caps.py -t latex
411 is equivalent to
413 pandoc -t json | ./caps.py latex | pandoc -f json -t latex
415 The latter form may be useful for debugging filters.
417 Filters may be written in any language. `Text.Pandoc.JSON`
418 exports `toJSONFilter` to facilitate writing filters in Haskell.
419 Those who would prefer to write filters in python can use the
420 module [`pandocfilters`], installable from PyPI. There are also
421 pandoc filter libraries in [PHP], [perl], and [javascript/node.js].
423 Note that the *EXECUTABLE* will be sought in the user's
424 `PATH`, and not in the working directory, if no directory is
425 provided. If you want to run a script in the working directory,
426 preface the filename with `./`.
428`-M` *KEY*[`=`*VAL*], `--metadata=`*KEY*[`:`*VAL*]
430: Set the metadata field *KEY* to the value *VAL*. A value specified
431 on the command line overrides a value specified in the document.
432 Values will be parsed as YAML boolean or string values. If no value is
433 specified, the value will be treated as Boolean true. Like
434 `--variable`, `--metadata` causes template variables to be set.
435 But unlike `--variable`, `--metadata` affects the metadata of the
436 underlying document (which is accessible from filters and may be
437 printed in some output formats).
439`--normalize`
441: Normalize the document after reading: merge adjacent
442 `Str` or `Emph` elements, for example, and remove repeated `Space`s.
444`-p`, `--preserve-tabs`
446: Preserve tabs instead of converting them to spaces (the default).
447 Note that this will only affect tabs in literal code spans and code
448 blocks; tabs in regular text will be treated as spaces.
450`--tab-stop=`*NUMBER*
452: Specify the number of spaces per tab (default is 4).
454`--track-changes=accept`|`reject`|`all`
456: Specifies what to do with insertions and deletions produced by the MS
457 Word "Track Changes" feature. `accept` (the default), inserts all
458 insertions, and ignores all deletions. `reject` inserts all
459 deletions and ignores insertions. `all` puts in both insertions
460 and deletions, wrapped in spans with `insertion` and `deletion`
461 classes, respectively. The author and time of change is
462 included. `all` is useful for scripting: only accepting changes
463 from a certain reviewer, say, or before a certain date. This
464 option only affects the docx reader.
466`--extract-media=`*DIR*
468: Extract images and other media contained in a docx or epub container
469 to the path *DIR*, creating it if necessary, and adjust the images
470 references in the document so they point to the extracted files.
471 This option only affects the docx and epub readers.
473[`pandocfilters`]: https://github.com/jgm/pandocfilters
474[PHP]: https://github.com/vinai/pandocfilters-php
475[perl]: https://metacpan.org/pod/Pandoc::Filter
476[javascript/node.js]: https://github.com/mvhenderson/pandoc-filter-node
478General writer options
479----------------------
481`-s`, `--standalone`
483: Produce output with an appropriate header and footer (e.g. a
484 standalone HTML, LaTeX, or RTF file, not a fragment). This option
485 is set automatically for `pdf`, `epub`, `epub3`, `fb2`, `docx`, and `odt`
486 output.
488`--template=`*FILE*
490: Use *FILE* as a custom template for the generated document. Implies
491 `--standalone`. See [Templates], below, for a description
492 of template syntax. If no extension is specified, an extension
493 corresponding to the writer will be added, so that `--template=special`
494 looks for `special.html` for HTML output. If the template is not
495 found, pandoc will search for it in the `templates` subdirectory of
496 the user data directory (see `--data-dir`). If this option is not used,
497 a default template appropriate for the output format will be used (see
498 `-D/--print-default-template`).
500`-V` *KEY*[`=`*VAL*], `--variable=`*KEY*[`:`*VAL*]
502: Set the template variable *KEY* to the value *VAL* when rendering the
503 document in standalone mode. This is generally only useful when the
504 `--template` option is used to specify a custom template, since
505 pandoc automatically sets the variables used in the default
506 templates. If no *VAL* is specified, the key will be given the
507 value `true`.
509`-D` *FORMAT*, `--print-default-template=`*FORMAT*
511: Print the system default template for an output *FORMAT*. (See `-t`
512 for a list of possible *FORMAT*s.) Templates in the user data
513 directory are ignored.
515`--print-default-data-file=`*FILE*
517: Print a system default data file. Files in the user data directory
518 are ignored.
520`--dpi`=*NUMBER*
521: Specify the dpi (dots per inch) value for conversion from pixels
522 to inch/centimeters and vice versa. The default is 96dpi.
523 Technically, the correct term would be ppi (pixels per inch).
525`--no-wrap`
527: Disable text wrapping in output. By default, text is wrapped
528 appropriately for the output format. This affects only the
529 generated source code, not the layout on the rendered page.
531`--columns=`*NUMBER*
533: Specify length of lines in characters (for text wrapping).
534 This affects only the generated source code, not the layout on
535 the rendered page.
537`--toc`, `--table-of-contents`
539: Include an automatically generated table of contents (or, in
540 the case of `latex`, `context`, and `rst`, an instruction to create
541 one) in the output document. This option has no effect on `man`,
542 `docbook`, `slidy`, `slideous`, `s5`, `docx`, or `odt` output.
544`--toc-depth=`*NUMBER*
546: Specify the number of section levels to include in the table
547 of contents. The default is 3 (which means that level 1, 2, and 3
548 headers will be listed in the contents).
550`--no-highlight`
552: Disables syntax highlighting for code blocks and inlines, even when
553 a language attribute is given.
555`--highlight-style=`*STYLE*
557: Specifies the coloring style to be used in highlighted source code.
558 Options are `pygments` (the default), `kate`, `monochrome`,
559 `espresso`, `zenburn`, `haddock`, and `tango`. For more information
560 on syntax highlighting in pandoc, see [Syntax highlighting], below.
562`-H` *FILE*, `--include-in-header=`*FILE*
564: Include contents of *FILE*, verbatim, at the end of the header.
565 This can be used, for example, to include special
566 CSS or javascript in HTML documents. This option can be used
567 repeatedly to include multiple files in the header. They will be
568 included in the order specified. Implies `--standalone`.
570`-B` *FILE*, `--include-before-body=`*FILE*
572: Include contents of *FILE*, verbatim, at the beginning of the
573 document body (e.g. after the `<body>` tag in HTML, or the
574 `\begin{document}` command in LaTeX). This can be used to include
575 navigation bars or banners in HTML documents. This option can be
576 used repeatedly to include multiple files. They will be included in
577 the order specified. Implies `--standalone`.
579`-A` *FILE*, `--include-after-body=`*FILE*
581: Include contents of *FILE*, verbatim, at the end of the document
582 body (before the `</body>` tag in HTML, or the
583 `\end{document}` command in LaTeX). This option can be be used
584 repeatedly to include multiple files. They will be included in the
585 order specified. Implies `--standalone`.
587Options affecting specific writers
588----------------------------------
590`--self-contained`
592: Produce a standalone HTML file with no external dependencies, using
593 `data:` URIs to incorporate the contents of linked scripts, stylesheets,
594 images, and videos. The resulting file should be "self-contained,"
595 in the sense that it needs no external files and no net access to be
596 displayed properly by a browser. This option works only with HTML output
597 formats, including `html`, `html5`, `html+lhs`, `html5+lhs`, `s5`,
598 `slidy`, `slideous`, `dzslides`, and `revealjs`. Scripts, images, and
599 stylesheets at absolute URLs will be downloaded; those at relative URLs
600 will be sought relative to the working directory (if the first source
601 file is local) or relative to the base URL (if the first source
602 file is remote). Limitation: resources that are loaded dynamically
603 through JavaScript cannot be incorporated; as a result, `--self-contained`
604 does not work with `--mathjax`, and some advanced features (e.g.
605 zoom or speaker notes) may not work in an offline "self-contained"
606 `reveal.js` slide show.
608`--offline`
610: Deprecated synonym for `--self-contained`.
612`-5`, `--html5`
614: Produce HTML5 instead of HTML4. This option has no effect for writers
615 other than `html`. (*Deprecated:* Use the `html5` output format instead.)
617`--html-q-tags`
619: Use `<q>` tags for quotes in HTML.
621`--ascii`
623: Use only ascii characters in output. Currently supported only
624 for HTML output (which uses numerical entities instead of
625 UTF-8 when this option is selected).
627`--reference-links`
629: Use reference-style links, rather than inline links, in writing Markdown
630 or reStructuredText. By default inline links are used.
632`--atx-headers`
634: Use ATX-style headers in Markdown and asciidoc output. The default is
635 to use setext-style headers for levels 1-2, and then ATX headers.
637`--chapters`
639: Treat top-level headers as chapters in LaTeX, ConTeXt, and DocBook
640 output. When the LaTeX document class is set to `report`, `book`, or
641 `memoir`, this option is implied. If `beamer` is the output
642 format, top-level headers will become `\part{..}`.
644`-N`, `--number-sections`
646: Number section headings in LaTeX, ConTeXt, HTML, or EPUB output.
647 By default, sections are not numbered. Sections with class
648 `unnumbered` will never be numbered, even if `--number-sections`
649 is specified.
651`--number-offset=`*NUMBER*[`,`*NUMBER*`,`*...*]
653: Offset for section headings in HTML output (ignored in other
654 output formats). The first number is added to the section number for
655 top-level headers, the second for second-level headers, and so on.
656 So, for example, if you want the first top-level header in your
657 document to be numbered "6", specify `--number-offset=5`.
658 If your document starts with a level-2 header which you want to
659 be numbered "1.5", specify `--number-offset=1,4`.
660 Offsets are 0 by default. Implies `--number-sections`.
662`--no-tex-ligatures`
664: Do not use the TeX ligatures for quotation marks, apostrophes,
665 and dashes (`` `...' ``, ` ``..'' `, `--`, `---`) when
666 writing or reading LaTeX or ConTeXt. In reading LaTeX,
667 parse the characters `` ` ``, `'`, and `-` literally, rather
668 than parsing ligatures for quotation marks and dashes. In
669 writing LaTeX or ConTeXt, print unicode quotation mark and
670 dash characters literally, rather than converting them to
671 the standard ASCII TeX ligatures. Note: normally `--smart`
672 is selected automatically for LaTeX and ConTeXt output, but
673 it must be specified explicitly if `--no-tex-ligatures` is
674 selected. If you use literal curly quotes, dashes, and
675 ellipses in your source, then you may want to use
676 `--no-tex-ligatures` without `--smart`.
678`--listings`
680: Use the [`listings`] package for LaTeX code blocks
682`-i`, `--incremental`
684: Make list items in slide shows display incrementally (one by one).
685 The default is for lists to be displayed all at once.
687`--slide-level=`*NUMBER*
689: Specifies that headers with the specified level create
690 slides (for `beamer`, `s5`, `slidy`, `slideous`, `dzslides`). Headers
691 above this level in the hierarchy are used to divide the
692 slide show into sections; headers below this level create
693 subheads within a slide. The default is to set the slide level
694 based on the contents of the document; see
695 [Structuring the slide show].
697`--section-divs`
699: Wrap sections in `<div>` tags (or `<section>` tags in HTML5),
700 and attach identifiers to the enclosing `<div>` (or `<section>`)
701 rather than the header itself. See
702 [Header identifiers], below.
704`--email-obfuscation=none`|`javascript`|`references`
706: Specify a method for obfuscating `mailto:` links in HTML documents.
707 `none` leaves `mailto:` links as they are. `javascript` obfuscates
708 them using javascript. `references` obfuscates them by printing their
709 letters as decimal or hexadecimal character references. The default
710 is `javascript`.
712`--id-prefix=`*STRING*
714: Specify a prefix to be added to all automatically generated identifiers
715 in HTML and DocBook output, and to footnote numbers in Markdown output.
716 This is useful for preventing duplicate identifiers when generating
717 fragments to be included in other pages.
719`-T` *STRING*, `--title-prefix=`*STRING*
721: Specify *STRING* as a prefix at the beginning of the title
722 that appears in the HTML header (but not in the title as it
723 appears at the beginning of the HTML body). Implies
724 `--standalone`.
726`-c` *URL*, `--css=`*URL*
728: Link to a CSS style sheet. This option can be be used repeatedly to
729 include multiple files. They will be included in the order specified.
731`--reference-odt=`*FILE*
733: Use the specified file as a style reference in producing an ODT.
734 For best results, the reference ODT should be a modified version
735 of an ODT produced using pandoc. The contents of the reference ODT
736 are ignored, but its stylesheets are used in the new ODT. If no
737 reference ODT is specified on the command line, pandoc will look
738 for a file `reference.odt` in the user data directory (see
739 `--data-dir`). If this is not found either, sensible defaults will be
740 used.
742`--reference-docx=`*FILE*
744: Use the specified file as a style reference in producing a docx file.
745 For best results, the reference docx should be a modified version
746 of a docx file produced using pandoc. The contents of the reference docx
747 are ignored, but its stylesheets and document properties (including
748 margins, page size, header, and footer) are used in the new docx. If no
749 reference docx is specified on the command line, pandoc will look
750 for a file `reference.docx` in the user data directory (see
751 `--data-dir`). If this is not found either, sensible defaults will be
752 used. The following styles are used by pandoc: [paragraph]
753 Normal, Body Text, First Paragraph, Compact, Title, Subtitle, Author, Date,
754 Abstract, Bibliography, Heading 1, Heading 2, Heading 3, Heading 4,
755 Heading 5, Heading 6, Block Text, Footnote Text, Definition Term,
756 Definition, Caption, Table Caption, Image Caption, Figure,
757 Figure With Caption, TOC Heading;
758 [character] Default Paragraph Font, Body Text Char, Verbatim Char,
759 Footnote Reference, Hyperlink; [table] Normal Table.
761`--epub-stylesheet=`*FILE*
763: Use the specified CSS file to style the EPUB. If no stylesheet
764 is specified, pandoc will look for a file `epub.css` in the
765 user data directory (see `--data-dir`). If it is not
766 found there, sensible defaults will be used.
768`--epub-cover-image=`*FILE*
770: Use the specified image as the EPUB cover. It is recommended
771 that the image be less than 1000px in width and height. Note that
772 in a Markdown source document you can also specify `cover-image`
773 in a YAML metadata block (see [EPUB Metadata], below).
775`--epub-metadata=`*FILE*
777: Look in the specified XML file for metadata for the EPUB.
778 The file should contain a series of [Dublin Core elements].
779 For example:
781 <dc:rights>Creative Commons</dc:rights>
782 <dc:language>es-AR</dc:language>
784 By default, pandoc will include the following metadata elements:
785 `<dc:title>` (from the document title), `<dc:creator>` (from the
786 document authors), `<dc:date>` (from the document date, which should
787 be in [ISO 8601 format]), `<dc:language>` (from the `lang`
788 variable, or, if is not set, the locale), and `<dc:identifier
789 id="BookId">` (a randomly generated UUID). Any of these may be
790 overridden by elements in the metadata file.
792 Note: if the source document is Markdown, a YAML metadata block
793 in the document can be used instead. See below under
794 [EPUB Metadata].
796`--epub-embed-font=`*FILE*
798: Embed the specified font in the EPUB. This option can be repeated
799 to embed multiple fonts. Wildcards can also be used: for example,
800 `DejaVuSans-*.ttf`. However, if you use wildcards on the command
801 line, be sure to escape them or put the whole filename in single quotes,
802 to prevent them from being interpreted by the shell. To use the
803 embedded fonts, you will need to add declarations like the following
804 to your CSS (see `--epub-stylesheet`):
806 @font-face {
807 font-family: DejaVuSans;
808 font-style: normal;
809 font-weight: normal;
810 src:url("DejaVuSans-Regular.ttf");
811 }
812 @font-face {
813 font-family: DejaVuSans;
814 font-style: normal;
815 font-weight: bold;
816 src:url("DejaVuSans-Bold.ttf");
817 }
818 @font-face {
819 font-family: DejaVuSans;
820 font-style: italic;
821 font-weight: normal;
822 src:url("DejaVuSans-Oblique.ttf");
823 }
824 @font-face {
825 font-family: DejaVuSans;
826 font-style: italic;
827 font-weight: bold;
828 src:url("DejaVuSans-BoldOblique.ttf");
829 }
830 body { font-family: "DejaVuSans"; }
832`--epub-chapter-level=`*NUMBER*
834: Specify the header level at which to split the EPUB into separate
835 "chapter" files. The default is to split into chapters at level 1
836 headers. This option only affects the internal composition of the
837 EPUB, not the way chapters and sections are displayed to users. Some
838 readers may be slow if the chapter files are too large, so for large
839 documents with few level 1 headers, one might want to use a chapter
840 level of 2 or 3.
842`--latex-engine=pdflatex`|`lualatex`|`xelatex`
844: Use the specified LaTeX engine when producing PDF output.
845 The default is `pdflatex`. If the engine is not in your PATH,
846 the full path of the engine may be specified here.
848`--latex-engine-opt=`*STRING*
850: Use the given string as a command-line argument to the `latex-engine`.
851 If used multiple times, the arguments are provided with spaces between
852 them. Note that no check for duplicate options is done.
854[Dublin Core elements]: http://dublincore.org/documents/dces/
855[ISO 8601 format]: http://www.w3.org/TR/NOTE-datetime
857Citation rendering
858------------------
860`--bibliography=`*FILE*
862: Set the `bibliography` field in the document's metadata to *FILE*,
863 overriding any value set in the metadata, and process citations
864 using `pandoc-citeproc`. (This is equivalent to
865 `--metadata bibliography=FILE --filter pandoc-citeproc`.)
866 If `--natbib` or `--biblatex` is also supplied, `pandoc-citeproc` is not
867 used, making this equivalent to `--metadata bibliography=FILE`.
868 If you supply this argument multiple times, each *FILE* will be added
869 to bibliography.
871`--csl=`*FILE*
873: Set the `csl` field in the document's metadata to *FILE*,
874 overriding any value set in the metadata. (This is equivalent to
875 `--metadata csl=FILE`.)
876 This option is only relevant with `pandoc-citeproc`.
878`--citation-abbreviations=`*FILE*
880: Set the `citation-abbreviations` field in the document's metadata to
881 *FILE*, overriding any value set in the metadata. (This is equivalent to
882 `--metadata citation-abbreviations=FILE`.)
883 This option is only relevant with `pandoc-citeproc`.
885`--natbib`
887: Use [`natbib`] for citations in LaTeX output. This option is not for use
888 with the `pandoc-citeproc` filter or with PDF output. It is intended for
889 use in producing a LaTeX file that can be processed with [`bibtex`].
891`--biblatex`
893: Use [`biblatex`] for citations in LaTeX output. This option is not for use
894 with the `pandoc-citeproc` filter or with PDF output. It is intended for
895 use in producing a LaTeX file that can be processed with [`bibtex`] or [`biber`].
897Math rendering in HTML
898----------------------
900`-m` [*URL*], `--latexmathml`[`=`*URL*]
902: Use the [LaTeXMathML] script to display embedded TeX math in HTML output.
903 To insert a link to a local copy of the `LaTeXMathML.js` script,
904 provide a *URL*. If no *URL* is provided, the contents of the
905 script will be inserted directly into the HTML header, preserving
906 portability at the price of efficiency. If you plan to use math on
907 several pages, it is much better to link to a copy of the script,
908 so it can be cached.
910`--mathml`[`=`*URL*]
912: Convert TeX math to [MathML] (in `docbook` as well as `html` and `html5`).
913 In standalone `html` output, a small javascript (or a link to such a
914 script if a *URL* is supplied) will be inserted that allows the MathML to
915 be viewed on some browsers.
917`--jsmath`[`=`*URL*]
919: Use [jsMath] to display embedded TeX math in HTML output.
920 The *URL* should point to the jsMath load script (e.g.
921 `jsMath/easy/load.js`); if provided, it will be linked to in
922 the header of standalone HTML documents. If a *URL* is not provided,
923 no link to the jsMath load script will be inserted; it is then
924 up to the author to provide such a link in the HTML template.
926`--mathjax`[`=`*URL*]
928: Use [MathJax] to display embedded TeX math in HTML output.
929 The *URL* should point to the `MathJax.js` load script.
930 If a *URL* is not provided, a link to the MathJax CDN will
931 be inserted.
933`--gladtex`
935: Enclose TeX math in `<eq>` tags in HTML output. These can then
936 be processed by [gladTeX] to produce links to images of the typeset
937 formulas.
939`--mimetex`[`=`*URL*]
941: Render TeX math using the [mimeTeX] CGI script. If *URL* is not
942 specified, it is assumed that the script is at `/cgi-bin/mimetex.cgi`.
944`--webtex`[`=`*URL*]
946: Render TeX formulas using an external script that converts TeX
947 formulas to images. The formula will be concatenated with the URL
948 provided. If *URL* is not specified, the Google Chart API will be used.
950`--katex`[`=`*URL*]
952: Use [KaTeX] to display embedded TeX math in HTML output.
953 The *URL* should point to the `katex.js` load script. If a *URL* is
954 not provided, a link to the KaTeX CDN will be inserted.
956`--katex-stylesheet=`*URL*
958: The *URL* should point to the `katex.css` stylesheet. If this option is
959 not specified, a link to the KaTeX CDN will be inserted. Note that this
960 option does not imply `--katex`.
962[MathML]: http://www.w3.org/Math/
963[LaTeXMathML]: http://math.etsu.edu/LaTeXMathML/
964[jsMath]: http://www.math.union.edu/~dpvc/jsmath/
965[MathJax]: https://www.mathjax.org
966[gladTeX]: http://ans.hsh.no/home/mgg/gladtex/
967[mimeTeX]: http://www.forkosh.com/mimetex.html
968[KaTeX]: https://github.com/Khan/KaTeX
970Options for wrapper scripts
971---------------------------
973`--dump-args`
975: Print information about command-line arguments to *stdout*, then exit.
976 This option is intended primarily for use in wrapper scripts.
977 The first line of output contains the name of the output file specified
978 with the `-o` option, or `-` (for *stdout*) if no output file was
979 specified. The remaining lines contain the command-line arguments,
980 one per line, in the order they appear. These do not include regular
981 pandoc options and their arguments, but do include any options appearing
982 after a `--` separator at the end of the line.
984`--ignore-args`
986: Ignore command-line arguments (for use in wrapper scripts).
987 Regular pandoc options are not ignored. Thus, for example,
989 pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1
991 is equivalent to
993 pandoc -o foo.html -s
995Templates
996=========
998When the `-s/--standalone` option is used, pandoc uses a template to
999add header and footer material that is needed for a self-standing
1000document. To see the default template that is used, just type
1002 pandoc -D *FORMAT*
1004where *FORMAT* is the name of the output format. A custom template
1005can be specified using the `--template` option. You can also override
1006the system default templates for a given output format *FORMAT*
1007by putting a file `templates/default.*FORMAT*` in the user data
1008directory (see `--data-dir`, above). *Exceptions:* For `odt` output,
1009customize the `default.opendocument` template. For `pdf` output,
1010customize the `default.latex` template.
1012Templates contain *variables*, which allow for the inclusion of
1013arbitrary information at any point in the file. Variables may be set
1014within the document using [YAML metadata blocks][Extension:
1015`yaml_metadata_block`]. They may also be set at the
1016command line using the `-V/--variable` option: variables set in this
1017way override metadata fields with the same name.
1019Variables set by pandoc
1020-----------------------
1022Some variables are set automatically by pandoc. These vary somewhat
1023depending on the output format, but include metadata fields as well as the following:
1025`title`, `author`, `date`
1026: allow identification of basic aspects of the document.
1027 Included in PDF metadata through LaTeX and ConTeXt.
1028 These can be set through a [pandoc title block][Extension: `pandoc_title_block`],
1029 which allows for multiple authors, or through a YAML metadata block:
1031 ---
1032 author:
1033 - Aristotle
1034 - Peter Abelard
1035 ...
1037`subtitle`
1038: document subtitle
1040`abstract`
1041: document summary, included in LaTeX, ConTeXt, AsciiDoc, and Word docx
1043`keywords`
1044: list of keywords to be included in HTML, PDF, and AsciiDoc metadata; may be repeated as for `author`, above
1046`header-includes`
1047: contents specified by `-H/--include-in-header` (may have multiple
1048 values)
1050`toc`
1051: non-null value if `--toc/--table-of-contents` was specified
1053`toc-title`
1054: title of table of contents (works only with EPUB and docx)
1056`include-before`
1057: contents specified by `-B/--include-before-body` (may have
1058 multiple values)
1060`include-after`
1061: contents specified by `-A/--include-after-body` (may have
1062 multiple values)
1064`body`
1065: body of document
1067`meta-json`
1068: JSON representation of all of the document's metadata
1070Language variables
1071------------------
1073`lang`
1074: identifies the main language of the document,
1075 using a code according to [BCP 47] (e.g. `en` or `en-GB`).
1076 For some output formats, pandoc will convert it to an appropriate
1077 format stored in the additional variables `babel-lang`,
1078 `polyglossia-lang` (LaTeX) and `context-lang` (ConTeXt).
1080 Native pandoc `span`s and `div`s with the lang attribute
1081 (value in BCP 47) can be used to switch the language in
1082 that range.
1084`otherlangs`
1085: a list of other languages used in the document
1086 in the YAML metadata, according to [BCP 47]. For example:
1087 `otherlangs: [en-GB, fr]`.
1088 This is automatically generated from the `lang` attributes
1089 in all `span`s and `div`s but can be overriden.
1090 Currently only used by LaTeX through the generated
1091 `babel-otherlangs` and `polyglossia-otherlangs` variables.
1092 The LaTeX writer outputs polyglossia commands in the text but
1093 the `babel-newcommands` variable contains mappings for them
1094 to the corresponding babel.
1096`dir`
1097: the base direction of the document, either `rtl` (right-to-left)
1098 or `ltr` (left-to-right).
1100 For bidirectional documents, native pandoc `span`s and `div`s
1101 with the `dir` attribute (value `rtl` or `ltr`) can be used to
1102 override the base direction in some output formats.
1103 This may not always be necessary if the final renderer
1104 (e.g. the browser, when generating HTML) supports the
1105 [Unicode Bidirectional Algorithm].
1107 When using LaTeX for bidirectional documents, only the `xelatex` engine
1108 is fully supported (use `--latex-engine=xelatex`).
1110[BCP 47]: https://tools.ietf.org/html/bcp47
1111[Unicode Bidirectional Algorithm]: http://www.w3.org/International/articles/inline-bidi-markup/uba-basics
1113Variables for slides
1114--------------------
1116Variables are available for [producing slide shows with pandoc],
1117including all [reveal.js configuration options].
1119`slidy-url`
1120: base URL for Slidy documents (defaults to
1121 `http://www.w3.org/Talks/Tools/Slidy2`)
1123`slideous-url`
1124: base URL for Slideous documents (defaults to `slideous`)
1126`s5-url`
1127: base URL for S5 documents (defaults to `s5/default`)
1129`revealjs-url`
1130: base URL for reveal.js documents (defaults to `reveal.js`)
1132`theme`, `colortheme`, `fonttheme`, `innertheme`, `outertheme`
1133: themes for LaTeX [`beamer`] documents
1135`navigation`
1136: controls navigation symbols in `beamer` documents
1137 (default is `empty` for no navigation symbols; other valid values
1138 are `frame`, `vertical`, and `horizontal`).
1140[reveal.js configuration options]: https://github.com/hakimel/reveal.js#configuration
1142Variables for LaTeX
1143-------------------
1145LaTeX variables are used when [creating a PDF].
1147`fontsize`
1148: font size for body text (e.g. `10pt`, `12pt`)
1150`documentclass`
1151: document class, e.g. [`article`], [`report`], [`book`], [`memoir`]
1153`classoption`
1154: option for document class, e.g. `oneside`; may be repeated
1155 for multiple options
1157`geometry`
1158: option for [`geometry`] package, e.g. `margin=1in`;
1159 may be repeated for multiple options
1161`linestretch`
1162: adjusts line spacing using the [`setspace`]
1163 package, e.g. `1.25`, `1.5`
1165`fontfamily`
1166: font package for use with `pdflatex`:
1167 [TeX Live] includes many options, documented in the [LaTeX Font Catalogue].
1168 The default is [Latin Modern][`lm`].
1170`fontfamilyoptions`
1171: options for package used as `fontfamily`: e.g. `osf,sc` with
1172 `fontfamily` set to [`mathpazo`] provides Palatino with old-style
1173 figures and true small caps; may be repeated for multiple options
1175`mainfont`, `sansfont`, `monofont`, `mathfont`, `CJKmainfont`
1176: font families for use with `xelatex` or
1177 `lualatex`: take the name of any system font, using the
1178 [`fontspec`] package. Note that if `CJKmainfont` is used,
1179 the [`xecjk`] package must be available.
1181`mainfontoptions`, `sansfontoptions`, `monofontoptions`, `mathfontoptions`, `CJKoptions`
1182: options to use with `mainfont`, `sansfont`, `monofont`, `mathfont`,
1183 `CJKmainfont` in `xelatex` and `lualatex`. Allow for any choices
1184 available through [`fontspec`], such as the OpenType features
1185 `Numbers=OldStyle,Numbers=Proportional`. May be repeated for multiple options.
1187`fontenc`
1188: allows font encoding to be specified through `fontenc` package (with `pdflatex`);
1189 default is `T1` (see guide to [LaTeX font encodings])
1191`colorlinks`
1192: add color to link text; automatically enabled if any of `linkcolor`, `citecolor`,
1193 `urlcolor`, or `toccolor` are set
1195`linkcolor`, `citecolor`, `urlcolor`, `toccolor`
1196: color for internal links, citation links, external links, and links in table of contents:
1197 uses any of the [predefined LaTeX colors]
1199`links-as-notes`
1200: causes links to be printed as footnotes
1202`indent`
1203: uses document class settings for indentation (the default LaTeX template
1204 otherwise removes indentation and adds space between paragraphs)
1206`subparagraph`
1207: disables default behavior of LaTeX template that redefines (sub)paragraphs
1208 as sections, changing the appearance of nested headings in some classes
1210`toc`
1211: include table of contents (can also be set using `--toc/--table-of-contents`)
1213`toc-depth`
1214: level of section to include in table of contents
1216`lof`, `lot`
1217: include list of figures, list of tables
1219`bibliography`
1220: bibliography to use for resolving references
1222`biblio-style`
1223: bibliography style, when used with `--natbib`
1225[`article`]: https://ctan.org/pkg/article
1226[`report`]: https://ctan.org/pkg/report
1227[`book`]: https://ctan.org/pkg/book
1228[`memoir`]: https://ctan.org/pkg/memoir
1229[predefined LaTeX colors]: https://en.wikibooks.org/wiki/LaTeX/Colors#Predefined_colors
1230[LaTeX Font Catalogue]: http://www.tug.dk/FontCatalogue/
1231[`mathpazo`]: https://ctan.org/pkg/mathpazo
1232[LaTeX font encodings]: https://ctan.org/pkg/encguide
1234Variables for ConTeXt
1235---------------------
1237`papersize`
1238: paper size, e.g. `letter`, `A4`, `landscape` (see [ConTeXt Paper Setup]);
1239 may be repeated for multiple options
1241`layout`
1242: options for page margins and text arrangement (see [ConTeXt Layout]);
1243 may be repeated for multiple options
1245`fontsize`
1246: font size for body text (e.g. `10pt`, `12pt`)
1248`mainfont`, `sansfont`, `monofont`, `mathfont`
1249: font families: take the name of any system font (see [ConTeXt Font Switching])
1251`linkcolor`, `contrastcolor`
1252: color for links outside and inside a page, e.g. `red`, `blue` (see [ConTeXt Color])
1254`linkstyle`
1255: typeface style for links, e.g. `normal`, `bold`, `slanted`, `boldslanted`, `type`, `cap`, `small`
1257`indenting`
1258: controls indentation of paragraphs, e.g. `yes,small,next` (see [ConTeXt Indentation]);
1259 may be repeated for multiple options
1261`whitespace`
1262: spacing between paragraphs, e.g. `none`, `small` (using [`setupwhitespace`])
1264`interlinespace`
1265: adjusts line spacing, e.g. `4ex` (using [`setupinterlinespace`]);
1266 may be repeated for multiple options
1268`headertext`, `footertext`
1269: text to be placed in running header or footer (see [ConTeXt Headers and Footers]);
1270 may be repeated up to four times for different placement
1272`pagenumbering`
1273: page number style and location (using [`setuppagenumbering`]);
1274 may be repeated for multiple options
1276`toc`
1277: include table of contents (can also be set using `--toc/--table-of-contents`)
1279`lof`, `lot`
1280: include list of figures, list of tables
1282[ConTeXt Paper Setup]: http://wiki.contextgarden.net/PaperSetup
1283[ConTeXt Layout]: http://wiki.contextgarden.net/Layout
1284[ConTeXt Font Switching]: http://wiki.contextgarden.net/Font_Switching
1285[ConTeXt Color]: http://wiki.contextgarden.net/Color
1286[ConTeXt Headers and Footers]: http://wiki.contextgarden.net/Headers_and_Footers
1287[ConTeXt Indentation]: http://wiki.contextgarden.net/Indentation
1288[`setupwhitespace`]: http://wiki.contextgarden.net/Command/setupwhitespace
1289[`setupinterlinespace`]: http://wiki.contextgarden.net/Command/setupinterlinespace
1290[`setuppagenumbering`]: http://wiki.contextgarden.net/Command/setuppagenumbering
1292Variables for man pages
1293-----------------------
1295`section`
1296: section number in man pages
1298`header`
1299: header in man pages
1301`footer`
1302: footer in man pages
1304`adjusting`
1305: adjusts text to left (`l`), right (`r`), center (`c`),
1306 or both (`b`) margins
1308`hyphenate`
1309: if `true` (the default), hyphenation will be used
1311Using variables in templates
1312----------------------------
1314Variable names are sequences of alphanumerics, `-`, and `_`,
1315starting with a letter. A variable name surrounded by `$` signs
1316will be replaced by its value. For example, the string `$title$` in
1318 <title>$title$</title>
1320will be replaced by the document title.
1322To write a literal `$` in a template, use `$$`.
1324Templates may contain conditionals. The syntax is as follows:
1326 $if(variable)$
1328 $else$
1330 $endif$
1332This will include `X` in the template if `variable` has a non-null
1333value; otherwise it will include `Y`. `X` and `Y` are placeholders for
1334any valid template text, and may include interpolated variables or other
1335conditionals. The `$else$` section may be omitted.
1337When variables can have multiple values (for example, `author` in
1338a multi-author document), you can use the `$for$` keyword:
1340 $for(author)$
1341 <meta name="author" content="$author$" />
1342 $endfor$
1344You can optionally specify a separator to be used between
1345consecutive items:
1347 $for(author)$$author$$sep$, $endfor$
1349A dot can be used to select a field of a variable that takes
1350an object as its value. So, for example:
1352 $author.name$ ($author.affiliation$)
1354If you use custom templates, you may need to revise them as pandoc
1355changes. We recommend tracking the changes in the default templates,
1356and modifying your custom templates accordingly. An easy way to do this
1357is to fork the [pandoc-templates] repository and merge in changes after each
1358pandoc release.
1360[pandoc-templates]: https://github.com/jgm/pandoc-templates
1362Pandoc's Markdown
1363=================
1365Pandoc understands an extended and slightly revised version of
1366John Gruber's [Markdown] syntax. This document explains the syntax,
1367noting differences from standard Markdown. Except where noted, these
1368differences can be suppressed by using the `markdown_strict` format instead
1369of `markdown`. An extensions can be enabled by adding `+EXTENSION`
1370to the format name and disabled by adding `-EXTENSION`. For example,
1371`markdown_strict+footnotes` is strict Markdown with footnotes
1372enabled, while `markdown-footnotes-pipe_tables` is pandoc's
1373Markdown without footnotes or pipe tables.
1375Philosophy
1376----------
1378Markdown is designed to be easy to write, and, even more importantly,
1379easy to read:
1381> A Markdown-formatted document should be publishable as-is, as plain
1382> text, without looking like it's been marked up with tags or formatting
1383> instructions.
1384> -- [John Gruber](http://daringfireball.net/projects/markdown/syntax#philosophy)
1386This principle has guided pandoc's decisions in finding syntax for
1387tables, footnotes, and other extensions.
1389There is, however, one respect in which pandoc's aims are different
1390from the original aims of Markdown. Whereas Markdown was originally
1391designed with HTML generation in mind, pandoc is designed for multiple
1392output formats. Thus, while pandoc allows the embedding of raw HTML,
1393it discourages it, and provides other, non-HTMLish ways of representing
1394important document elements like definition lists, tables, mathematics, and
1395footnotes.
1397Paragraphs
1398----------
1400A paragraph is one or more lines of text followed by one or more blank lines.
1401Newlines are treated as spaces, so you can reflow your paragraphs as you like.
1402If you need a hard line break, put two or more spaces at the end of a line.
1404#### Extension: `escaped_line_breaks` ####
1406A backslash followed by a newline is also a hard line break.
1407Note: in multiline and grid table cells, this is the only way
1408to create a hard line break, since trailing spaces in the cells
1409are ignored.
1411Headers
1412-------
1414There are two kinds of headers: Setext and ATX.
1416### Setext-style headers ###
1418A setext-style header is a line of text "underlined" with a row of `=` signs
1419(for a level one header) or `-` signs (for a level two header):
1421 A level-one header
1422 ==================
1424 A level-two header
1425 ------------------
1427The header text can contain inline formatting, such as emphasis (see
1428[Inline formatting], below).
1431### ATX-style headers ###
1433An ATX-style header consists of one to six `#` signs and a line of
1434text, optionally followed by any number of `#` signs. The number of
1435`#` signs at the beginning of the line is the header level:
1437 ## A level-two header
1439 ### A level-three header ###
1441As with setext-style headers, the header text can contain formatting:
1443 # A level-one header with a [link](/url) and *emphasis*
1445#### Extension: `blank_before_header` ####
1447Standard Markdown syntax does not require a blank line before a header.
1448Pandoc does require this (except, of course, at the beginning of the
1449document). The reason for the requirement is that it is all too easy for a
1450`#` to end up at the beginning of a line by accident (perhaps through line
1451wrapping). Consider, for example:
1453 I like several of their flavors of ice cream:
1454 #22, for example, and #5.
1457### Header identifiers ###
1459#### Extension: `header_attributes` ####
1461Headers can be assigned attributes using this syntax at the end
1462of the line containing the header text:
1464 {#identifier .class .class key=value key=value}
1466Thus, for example, the following headers will all be assigned the identifier
1467`foo`:
1469 # My header {#foo}
1471 ## My header ## {#foo}
1473 My other header {#foo}
1474 ---------------
1476(This syntax is compatible with [PHP Markdown Extra].)
1478Note that although this syntax allows assignment of classes and key/value
1479attributes, writers generally don't use all of this information. Identifiers,
1480classes, and key/value attributes are used in HTML and HTML-based formats such
1481as EPUB and slidy. Identifiers are used for labels and link anchors in the
1482LaTeX, ConTeXt, Textile, and AsciiDoc writers.
1484Headers with the class `unnumbered` will not be numbered, even if
1485`--number-sections` is specified. A single hyphen (`-`) in an attribute
1486context is equivalent to `.unnumbered`, and preferable in non-English
1487documents. So,
1489 # My header {-}
1491is just the same as
1493 # My header {.unnumbered}
1495#### Extension: `auto_identifiers` ####
1497A header without an explicitly specified identifier will be
1498automatically assigned a unique identifier based on the header text.
1499To derive the identifier from the header text,
1501 - Remove all formatting, links, etc.
1502 - Remove all footnotes.
1503 - Remove all punctuation, except underscores, hyphens, and periods.
1504 - Replace all spaces and newlines with hyphens.
1505 - Convert all alphabetic characters to lowercase.
1506 - Remove everything up to the first letter (identifiers may
1507 not begin with a number or punctuation mark).
1508 - If nothing is left after this, use the identifier `section`.
1510Thus, for example,
1512 Header Identifier
1513 ------------------------------- ----------------------------
1514 `Header identifiers in HTML` `header-identifiers-in-html`
1515 `*Dogs*?--in *my* house?` `dogs--in-my-house`
1516 `[HTML], [S5], or [RTF]?` `html-s5-or-rtf`
1517 `3. Applications` `applications`
1518 `33` `section`
1520These rules should, in most cases, allow one to determine the identifier
1521from the header text. The exception is when several headers have the
1522same text; in this case, the first will get an identifier as described
1523above; the second will get the same identifier with `-1` appended; the
1524third with `-2`; and so on.
1526These identifiers are used to provide link targets in the table of
1527contents generated by the `--toc|--table-of-contents` option. They
1528also make it easy to provide links from one section of a document to
1529another. A link to this section, for example, might look like this:
1531 See the section on
1532 [header identifiers](#header-identifiers-in-html-latex-and-context).
1534Note, however, that this method of providing links to sections works
1535only in HTML, LaTeX, and ConTeXt formats.
1537If the `--section-divs` option is specified, then each section will
1538be wrapped in a `div` (or a `section`, if `--html5` was specified),
1539and the identifier will be attached to the enclosing `<div>`
1540(or `<section>`) tag rather than the header itself. This allows entire
1541sections to be manipulated using javascript or treated differently in
1542CSS.
1544#### Extension: `implicit_header_references` ####
1546Pandoc behaves as if reference links have been defined for each header.
1547So, instead of
1549 [header identifiers](#header-identifiers-in-html)
1551you can simply write
1553 [header identifiers]
1557 [header identifiers][]
1561 [the section on header identifiers][header identifiers]
1563If there are multiple headers with identical text, the corresponding
1564reference will link to the first one only, and you will need to use explicit
1565links to link to the others, as described above.
1567Like regular reference links, these references are case-insensitive.
1569Explicit link reference definitions always take priority over
1570implicit header references. So, in the following example, the
1571link will point to `bar`, not to `#foo`:
1573 # Foo
1575 [foo]: bar
1577 See [foo]
1579Block quotations
1580----------------
1582Markdown uses email conventions for quoting blocks of text.
1583A block quotation is one or more paragraphs or other block elements
1584(such as lists or headers), with each line preceded by a `>` character
1585and an optional space. (The `>` need not start at the left margin, but
1586it should not be indented more than three spaces.)
1588 > This is a block quote. This
1589 > paragraph has two lines.
1591 > 1. This is a list inside a block quote.
1592 > 2. Second item.
1594A "lazy" form, which requires the `>` character only on the first
1595line of each block, is also allowed:
1597 > This is a block quote. This
1598 paragraph has two lines.
1600 > 1. This is a list inside a block quote.
1601 2. Second item.
1603Among the block elements that can be contained in a block quote are
1604other block quotes. That is, block quotes can be nested:
1606 > This is a block quote.
1608 > > A block quote within a block quote.
1610If the `>` character is followed by an optional space, that space
1611will be considered part of the block quote marker and not part of
1612the indentation of the contents. Thus, to put an indented code
1613block in a block quote, you need five spaces after the `>`:
1615 > code
1617#### Extension: `blank_before_blockquote` ####
1619Standard Markdown syntax does not require a blank line before a block
1620quote. Pandoc does require this (except, of course, at the beginning of the
1621document). The reason for the requirement is that it is all too easy for a
1622`>` to end up at the beginning of a line by accident (perhaps through line
1623wrapping). So, unless the `markdown_strict` format is used, the following does
1624not produce a nested block quote in pandoc:
1626 > This is a block quote.
1627 >> Nested.
1630Verbatim (code) blocks
1631----------------------
1633### Indented code blocks ###
1635A block of text indented four spaces (or one tab) is treated as verbatim
1636text: that is, special characters do not trigger special formatting,
1637and all spaces and line breaks are preserved. For example,
1639 if (a > 3) {
1640 moveShip(5 * gravity, DOWN);
1643The initial (four space or one tab) indentation is not considered part
1644of the verbatim text, and is removed in the output.
1646Note: blank lines in the verbatim text need not begin with four spaces.
1649### Fenced code blocks ###
1651#### Extension: `fenced_code_blocks` ####
1653In addition to standard indented code blocks, pandoc supports
1654*fenced* code blocks. These begin with a row of three or more
1655tildes (`~`) and end with a row of tildes that must be at least as long as
1656the starting row. Everything between these lines is treated as code. No
1657indentation is necessary:
1659 ~~~~~~~
1660 if (a > 3) {
1661 moveShip(5 * gravity, DOWN);
1663 ~~~~~~~
1665Like regular code blocks, fenced code blocks must be separated
1666from surrounding text by blank lines.
1668If the code itself contains a row of tildes or backticks, just use a longer
1669row of tildes or backticks at the start and end:
1671 ~~~~~~~~~~~~~~~~
1672 ~~~~~~~~~~
1673 code including tildes
1674 ~~~~~~~~~~
1675 ~~~~~~~~~~~~~~~~
1677#### Extension: `backtick_code_blocks` ####
1679Same as `fenced_code_blocks`, but uses backticks (`` ` ``) instead of tildes
1680(`~`).
1682#### Extension: `fenced_code_attributes` ####
1684Optionally, you may attach attributes to fenced or backtick code block using
1685this syntax:
1687 ~~~~ {#mycode .haskell .numberLines startFrom="100"}
1688 qsort [] = []
1689 qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
1690 qsort (filter (>= x) xs)
1691 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1693Here `mycode` is an identifier, `haskell` and `numberLines` are classes, and
1694`startFrom` is an attribute with value `100`. Some output formats can use this
1695information to do syntax highlighting. Currently, the only output formats
1696that uses this information are HTML and LaTeX. If highlighting is supported
1697for your output format and language, then the code block above will appear
1698highlighted, with numbered lines. (To see which languages are supported, do
1699`pandoc --version`.) Otherwise, the code block above will appear as follows:
1701 <pre id="mycode" class="haskell numberLines" startFrom="100">
1702 <code>
1703 ...
1704 </code>
1705 </pre>
1707A shortcut form can also be used for specifying the language of
1708the code block:
1710 ```haskell
1711 qsort [] = []
1712 ```
1714This is equivalent to:
1716 ``` {.haskell}
1717 qsort [] = []
1718 ```
1720If the `fenced_code_attributes` extension is disabled, but
1721input contains class attribute(s) for the codeblock, the first
1722class attribute will be printed after the opening fence as a bare
1723word.
1725To prevent all highlighting, use the `--no-highlight` flag.
1726To set the highlighting style, use `--highlight-style`.
1727For more information on highlighting, see [Syntax highlighting],
1728below.
1730Line blocks
1731-----------
1733#### Extension: `line_blocks` ####
1735A line block is a sequence of lines beginning with a vertical bar (`|`)
1736followed by a space. The division into lines will be preserved in
1737the output, as will any leading spaces; otherwise, the lines will
1738be formatted as Markdown. This is useful for verse and addresses:
1740 | The limerick packs laughs anatomical
1741 | In space that is quite economical.
1742 | But the good ones I've seen
1743 | So seldom are clean
1744 | And the clean ones so seldom are comical
1746 | 200 Main St.
1747 | Berkeley, CA 94718
1749The lines can be hard-wrapped if needed, but the continuation
1750line must begin with a space.
1752 | The Right Honorable Most Venerable and Righteous Samuel L.
1753 Constable, Jr.
1754 | 200 Main St.
1755 | Berkeley, CA 94718
1757This syntax is borrowed from [reStructuredText].
1759Lists
1760-----
1762### Bullet lists ###
1764A bullet list is a list of bulleted list items. A bulleted list
1765item begins with a bullet (`*`, `+`, or `-`). Here is a simple
1766example:
1768 * one
1769 * two
1770 * three
1772This will produce a "compact" list. If you want a "loose" list, in which
1773each item is formatted as a paragraph, put spaces between the items:
1775 * one
1777 * two
1779 * three
1781The bullets need not be flush with the left margin; they may be
1782indented one, two, or three spaces. The bullet must be followed
1783by whitespace.
1785List items look best if subsequent lines are flush with the first
1786line (after the bullet):
1788 * here is my first
1789 list item.
1790 * and my second.
1792But Markdown also allows a "lazy" format:
1794 * here is my first
1795 list item.
1796 * and my second.
1798### The four-space rule ###
1800A list item may contain multiple paragraphs and other block-level
1801content. However, subsequent paragraphs must be preceded by a blank line
1802and indented four spaces or a tab. The list will look better if the first
1803paragraph is aligned with the rest:
1805 * First paragraph.
1807 Continued.
1809 * Second paragraph. With a code block, which must be indented
1810 eight spaces:
1812 { code }
1814List items may include other lists. In this case the preceding blank
1815line is optional. The nested list must be indented four spaces or
1816one tab:
1818 * fruits
1819 + apples
1820 - macintosh
1821 - red delicious
1822 + pears
1823 + peaches
1824 * vegetables
1825 + broccoli
1826 + chard
1828As noted above, Markdown allows you to write list items "lazily," instead of
1829indenting continuation lines. However, if there are multiple paragraphs or
1830other blocks in a list item, the first line of each must be indented.
1832 + A lazy, lazy, list
1833 item.
1835 + Another one; this looks
1836 bad but is legal.
1838 Second paragraph of second
1839 list item.
1841**Note:** Although the four-space rule for continuation paragraphs
1842comes from the official [Markdown syntax guide], the reference implementation,
1843`Markdown.pl`, does not follow it. So pandoc will give different results than
1844`Markdown.pl` when authors have indented continuation paragraphs fewer than
1845four spaces.
1847The [Markdown syntax guide] is not explicit whether the four-space
1848rule applies to *all* block-level content in a list item; it only
1849mentions paragraphs and code blocks. But it implies that the rule
1850applies to all block-level content (including nested lists), and
1851pandoc interprets it that way.
1853 [Markdown syntax guide]:
1854 http://daringfireball.net/projects/markdown/syntax#list
1856### Ordered lists ###
1858Ordered lists work just like bulleted lists, except that the items
1859begin with enumerators rather than bullets.
1861In standard Markdown, enumerators are decimal numbers followed
1862by a period and a space. The numbers themselves are ignored, so
1863there is no difference between this list:
1865 1. one
1866 2. two
1867 3. three
1869and this one:
1871 5. one
1872 7. two
1873 1. three
1875#### Extension: `fancy_lists` ####
1877Unlike standard Markdown, pandoc allows ordered list items to be marked
1878with uppercase and lowercase letters and roman numerals, in addition to
1879arabic numerals. List markers may be enclosed in parentheses or followed by a
1880single right-parentheses or period. They must be separated from the
1881text that follows by at least one space, and, if the list marker is a
1882capital letter with a period, by at least two spaces.[^2]
1884[^2]: The point of this rule is to ensure that normal paragraphs
1885 starting with people's initials, like
1887 B. Russell was an English philosopher.
1889 do not get treated as list items.
1891 This rule will not prevent
1893 (C) 2007 Joe Smith
1895 from being interpreted as a list item. In this case, a backslash
1896 escape can be used:
1898 (C\) 2007 Joe Smith
1900The `fancy_lists` extension also allows '`#`' to be used as an
1901ordered list marker in place of a numeral:
1903 #. one
1904 #. two
1906#### Extension: `startnum` ####
1908Pandoc also pays attention to the type of list marker used, and to the
1909starting number, and both of these are preserved where possible in the
1910output format. Thus, the following yields a list with numbers followed
1911by a single parenthesis, starting with 9, and a sublist with lowercase
1912roman numerals:
1914 9) Ninth
1915 10) Tenth
1916 11) Eleventh
1917 i. subone
1918 ii. subtwo
1919 iii. subthree
1921Pandoc will start a new list each time a different type of list
1922marker is used. So, the following will create three lists:
1924 (2) Two
1925 (5) Three
1926 1. Four
1927 * Five
1929If default list markers are desired, use `#.`:
1931 #. one
1932 #. two
1933 #. three
1936### Definition lists ###
1938#### Extension: `definition_lists` ####
1940Pandoc supports definition lists, using the syntax of
1941[PHP Markdown Extra] with some extensions.[^3]
1943 Term 1
1945 : Definition 1
1947 Term 2 with *inline markup*
1949 : Definition 2
1951 { some code, part of Definition 2 }
1953 Third paragraph of definition 2.
1955Each term must fit on one line, which may optionally be followed by
1956a blank line, and must be followed by one or more definitions.
1957A definition begins with a colon or tilde, which may be indented one
1958or two spaces.
1960A term may have multiple definitions, and each definition may consist of one or
1961more block elements (paragraph, code block, list, etc.), each indented four
1962spaces or one tab stop. The body of the definition (including the first line,
1963aside from the colon or tilde) should be indented four spaces. However,
1964as with other Markdown lists, you can "lazily" omit indentation except
1965at the beginning of a paragraph or other block element:
1967 Term 1
1969 : Definition
1970 with lazy continuation.
1972 Second paragraph of the definition.
1974If you leave space before the definition (as in the example above),
1975the text of the definition will be treated as a paragraph. In some
1976output formats, this will mean greater spacing between term/definition
1977pairs. For a more compact definition list, omit the space before the
1978definition:
1980 Term 1
1981 ~ Definition 1
1983 Term 2
1984 ~ Definition 2a
1985 ~ Definition 2b
1987Note that space between items in a definition list is required.
1988(A variant that loosens this requirement, but disallows "lazy"
1989hard wrapping, can be activated with `compact_definition_lists`: see
1990[Non-pandoc extensions], below.)
1992[^3]: I have been influenced by the suggestions of [David Wheeler](http://www.justatheory.com/computers/markup/modest-markdown-proposal.html).
1994### Numbered example lists ###
1996#### Extension: `example_lists` ####
1998The special list marker `@` can be used for sequentially numbered
1999examples. The first list item with a `@` marker will be numbered '1',
2000the next '2', and so on, throughout the document. The numbered examples
2001need not occur in a single list; each new list using `@` will take up
2002where the last stopped. So, for example:
2004 (@) My first example will be numbered (1).
2005 (@) My second example will be numbered (2).
2007 Explanation of examples.
2009 (@) My third example will be numbered (3).
2011Numbered examples can be labeled and referred to elsewhere in the
2012document:
2014 (@good) This is a good example.
2016 As (@good) illustrates, ...
2018The label can be any string of alphanumeric characters, underscores,
2019or hyphens.
2022### Compact and loose lists ###
2024Pandoc behaves differently from `Markdown.pl` on some "edge
2025cases" involving lists. Consider this source:
2027 + First
2028 + Second:
2029 - Fee
2030 - Fie
2031 - Foe
2033 + Third
2035Pandoc transforms this into a "compact list" (with no `<p>` tags around
2036"First", "Second", or "Third"), while Markdown puts `<p>` tags around
2037"Second" and "Third" (but not "First"), because of the blank space
2038around "Third". Pandoc follows a simple rule: if the text is followed by
2039a blank line, it is treated as a paragraph. Since "Second" is followed
2040by a list, and not a blank line, it isn't treated as a paragraph. The
2041fact that the list is followed by a blank line is irrelevant. (Note:
2042Pandoc works this way even when the `markdown_strict` format is specified. This
2043behavior is consistent with the official Markdown syntax description,
2044even though it is different from that of `Markdown.pl`.)
2047### Ending a list ###
2049What if you want to put an indented code block after a list?
2051 - item one
2052 - item two
2054 { my code block }
2056Trouble! Here pandoc (like other Markdown implementations) will treat
2057`{ my code block }` as the second paragraph of item two, and not as
2058a code block.
2060To "cut off" the list after item two, you can insert some non-indented
2061content, like an HTML comment, which won't produce visible output in
2062any format:
2064 - item one
2065 - item two
2067 <!-- end of list -->
2069 { my code block }
2071You can use the same trick if you want two consecutive lists instead
2072of one big list:
2074 1. one
2075 2. two
2076 3. three
2078 <!-- -->
2080 1. uno
2081 2. dos
2082 3. tres
2084Horizontal rules
2085----------------
2087A line containing a row of three or more `*`, `-`, or `_` characters
2088(optionally separated by spaces) produces a horizontal rule:
2090 * * * *
2092 ---------------
2095Tables
2096------
2098Four kinds of tables may be used. The first three kinds presuppose the use of
2099a fixed-width font, such as Courier. The fourth kind can be used with
2100proportionally spaced fonts, as it does not require lining up columns.
2102#### Extension: `table_captions` ####
2104A caption may optionally be provided with all 4 kinds of tables (as
2105illustrated in the examples below). A caption is a paragraph beginning
2106with the string `Table:` (or just `:`), which will be stripped off.
2107It may appear either before or after the table.
2109#### Extension: `simple_tables` ####
2111Simple tables look like this:
2113 Right Left Center Default
2114 ------- ------ ---------- -------
2115 12 12 12 12
2116 123 123 123 123
2117 1 1 1 1
2119 Table: Demonstration of simple table syntax.
2121The headers and table rows must each fit on one line. Column
2122alignments are determined by the position of the header text relative
2123to the dashed line below it:[^4]
2125 - If the dashed line is flush with the header text on the right side
2126 but extends beyond it on the left, the column is right-aligned.
2127 - If the dashed line is flush with the header text on the left side
2128 but extends beyond it on the right, the column is left-aligned.
2129 - If the dashed line extends beyond the header text on both sides,
2130 the column is centered.
2131 - If the dashed line is flush with the header text on both sides,
2132 the default alignment is used (in most cases, this will be left).
2134[^4]: This scheme is due to Michel Fortin, who proposed it on the
2135 [Markdown discussion list](http://six.pairlist.net/pipermail/markdown-discuss/2005-March/001097.html).
2137The table must end with a blank line, or a line of dashes followed by
2138a blank line.
2140The column headers may be omitted, provided a dashed line is used
2141to end the table. For example:
2143 ------- ------ ---------- -------
2144 12 12 12 12
2145 123 123 123 123
2146 1 1 1 1
2147 ------- ------ ---------- -------
2149When headers are omitted, column alignments are determined on the basis
2150of the first line of the table body. So, in the tables above, the columns
2151would be right, left, center, and right aligned, respectively.
2153#### Extension: `multiline_tables` ####
2155Multiline tables allow headers and table rows to span multiple lines
2156of text (but cells that span multiple columns or rows of the table are
2157not supported). Here is an example:
2159 -------------------------------------------------------------
2160 Centered Default Right Left
2161 Header Aligned Aligned Aligned
2162 ----------- ------- --------------- -------------------------
2163 First row 12.0 Example of a row that
2164 spans multiple lines.
2166 Second row 5.0 Here's another one. Note
2167 the blank line between
2168 rows.
2169 -------------------------------------------------------------
2171 Table: Here's the caption. It, too, may span
2172 multiple lines.
2174These work like simple tables, but with the following differences:
2176 - They must begin with a row of dashes, before the header text
2177 (unless the headers are omitted).
2178 - They must end with a row of dashes, then a blank line.
2179 - The rows must be separated by blank lines.
2181In multiline tables, the table parser pays attention to the widths of
2182the columns, and the writers try to reproduce these relative widths in
2183the output. So, if you find that one of the columns is too narrow in the
2184output, try widening it in the Markdown source.
2186Headers may be omitted in multiline tables as well as simple tables:
2188 ----------- ------- --------------- -------------------------
2189 First row 12.0 Example of a row that
2190 spans multiple lines.
2192 Second row 5.0 Here's another one. Note
2193 the blank line between
2194 rows.
2195 ----------- ------- --------------- -------------------------
2197 : Here's a multiline table without headers.
2199It is possible for a multiline table to have just one row, but the row
2200should be followed by a blank line (and then the row of dashes that ends
2201the table), or the table may be interpreted as a simple table.
2203#### Extension: `grid_tables` ####
2205Grid tables look like this:
2207 : Sample grid table.
2209 +---------------+---------------+--------------------+
2210 | Fruit | Price | Advantages |
2211 +===============+===============+====================+
2212 | Bananas | $1.34 | - built-in wrapper |
2213 | | | - bright color |
2214 +---------------+---------------+--------------------+
2215 | Oranges | $2.10 | - cures scurvy |
2216 | | | - tasty |
2217 +---------------+---------------+--------------------+
2219The row of `=`s separates the header from the table body, and can be
2220omitted for a headerless table. The cells of grid tables may contain
2221arbitrary block elements (multiple paragraphs, code blocks, lists,
2222etc.). Alignments are not supported, nor are cells that span multiple
2223columns or rows. Grid tables can be created easily using [Emacs table mode].
2225[Emacs table mode]: http://table.sourceforge.net/
2227#### Extension: `pipe_tables` ####
2229Pipe tables look like this:
2231 | Right | Left | Default | Center |
2232 |------:|:-----|---------|:------:|
2233 | 12 | 12 | 12 | 12 |
2234 | 123 | 123 | 123 | 123 |
2235 | 1 | 1 | 1 | 1 |
2237 : Demonstration of pipe table syntax.
2239The syntax is identical to [PHP Markdown Extra tables]. The beginning and
2240ending pipe characters are optional, but pipes are required between all
2241columns. The colons indicate column alignment as shown. The header
2242cannot be omitted. To simulate a headerless table, include a header
2243with blank cells.
2245Since the pipes indicate column boundaries, columns need not be vertically
2246aligned, as they are in the above example. So, this is a perfectly
2247legal (though ugly) pipe table:
2249 fruit| price
2250 -----|-----:
2251 apple|2.05
2252 pear|1.37
2253 orange|3.09
2255The cells of pipe tables cannot contain block elements like paragraphs
2256and lists, and cannot span multiple lines. Note also that in LaTeX/PDF
2257output, the cells produced by pipe tables will not wrap, since there
2258is no information available about relative widths. If you want content
2259to wrap within cells, use multiline or grid tables.
2261Note: pandoc also recognizes pipe tables of the following
2262form, as can be produced by Emacs' orgtbl-mode:
2264 | One | Two |
2265 |-----+-------|
2266 | my | table |
2267 | is | nice |
2269The difference is that `+` is used instead of `|`. Other orgtbl features
2270are not supported. In particular, to get non-default column alignment,
2271you'll need to add colons as above.
2273[PHP Markdown Extra tables]: https://michelf.ca/projects/php-markdown/extra/#table
2275Metadata blocks
2276---------------
2278#### Extension: `pandoc_title_block` ####
2280If the file begins with a title block
2282 % title
2283 % author(s) (separated by semicolons)
2284 % date
2286it will be parsed as bibliographic information, not regular text. (It
2287will be used, for example, in the title of standalone LaTeX or HTML
2288output.) The block may contain just a title, a title and an author,
2289or all three elements. If you want to include an author but no
2290title, or a title and a date but no author, you need a blank line:
2293 % Author
2295 % My title
2297 % June 15, 2006
2299The title may occupy multiple lines, but continuation lines must
2300begin with leading space, thus:
2302 % My title
2303 on multiple lines
2305If a document has multiple authors, the authors may be put on
2306separate lines with leading space, or separated by semicolons, or
2307both. So, all of the following are equivalent:
2309 % Author One
2310 Author Two
2312 % Author One; Author Two
2314 % Author One;
2315 Author Two
2317The date must fit on one line.
2319All three metadata fields may contain standard inline formatting
2320(italics, links, footnotes, etc.).
2322Title blocks will always be parsed, but they will affect the output only
2323when the `--standalone` (`-s`) option is chosen. In HTML output, titles
2324will appear twice: once in the document head -- this is the title that
2325will appear at the top of the window in a browser -- and once at the
2326beginning of the document body. The title in the document head can have
2327an optional prefix attached (`--title-prefix` or `-T` option). The title
2328in the body appears as an H1 element with class "title", so it can be
2329suppressed or reformatted with CSS. If a title prefix is specified with
2330`-T` and no title block appears in the document, the title prefix will
2331be used by itself as the HTML title.
2333The man page writer extracts a title, man page section number, and
2334other header and footer information from the title line. The title
2335is assumed to be the first word on the title line, which may optionally
2336end with a (single-digit) section number in parentheses. (There should
2337be no space between the title and the parentheses.) Anything after
2338this is assumed to be additional footer and header text. A single pipe
2339character (`|`) should be used to separate the footer text from the header
2340text. Thus,
2342 % PANDOC(1)
2344will yield a man page with the title `PANDOC` and section 1.
2346 % PANDOC(1) Pandoc User Manuals
2348will also have "Pandoc User Manuals" in the footer.
2350 % PANDOC(1) Pandoc User Manuals | Version 4.0
2352will also have "Version 4.0" in the header.
2354#### Extension: `yaml_metadata_block` ####
2356A YAML metadata block is a valid YAML object, delimited by a line of three
2357hyphens (`---`) at the top and a line of three hyphens (`---`) or three dots
2358(`...`) at the bottom. A YAML metadata block may occur anywhere in the
2359document, but if it is not at the beginning, it must be preceded by a blank
2360line. (Note that, because of the way pandoc concatenates input files when
2361several are provided, you may also keep the metadata in a separate YAML file
2362and pass it to pandoc as an argument, along with your Markdown files:
2364 pandoc chap1.md chap2.md chap3.md metadata.yaml -s -o book.html
2366Just be sure that the YAML file begins with `---` and ends with `---` or
2367`...`.)
2369Metadata will be taken from the fields of the YAML object and added to any
2370existing document metadata. Metadata can contain lists and objects (nested
2371arbitrarily), but all string scalars will be interpreted as Markdown. Fields
2372with names ending in an underscore will be ignored by pandoc. (They may be
2373given a role by external processors.)
2375A document may contain multiple metadata blocks. The metadata fields will
2376be combined through a *left-biased union*: if two metadata blocks attempt
2377to set the same field, the value from the first block will be taken.
2379When pandoc is used with `-t markdown` to create a Markdown document,
2380a YAML metadata block will be produced only if the `-s/--standalone`
2381option is used. All of the metadata will appear in a single block
2382at the beginning of the document.
2384Note that YAML escaping rules must be followed. Thus, for example,
2385if a title contains a colon, it must be quoted. The pipe character
2386(`|`) can be used to begin an indented block that will be interpreted
2387literally, without need for escaping. This form is necessary
2388when the field contains blank lines:
2390 ---
2391 title: 'This is the title: it contains a colon'
2392 author:
2393 - name: Author One
2394 affiliation: University of Somewhere
2395 - name: Author Two
2396 affiliation: University of Nowhere
2397 tags: [nothing, nothingness]
2398 abstract: |
2399 This is the abstract.
2401 It consists of two paragraphs.
2402 ...
2404Template variables will be set automatically from the metadata. Thus, for
2405example, in writing HTML, the variable `abstract` will be set to the HTML
2406equivalent of the Markdown in the `abstract` field:
2408 <p>This is the abstract.</p>
2409 <p>It consists of two paragraphs.</p>
2411Note: The `author` variable in the default templates expects a simple list or
2412string. To use the structured authors in the example, you would need a
2413custom template. For example:
2415 $for(author)$
2416 $if(author.name)$
2417 $author.name$$if(author.affiliation)$ ($author.affiliation$)$endif$
2418 $else$
2419 $author$
2420 $endif$
2421 $endfor$
2424Backslash escapes
2425-----------------
2427#### Extension: `all_symbols_escapable` ####
2429Except inside a code block or inline code, any punctuation or space
2430character preceded by a backslash will be treated literally, even if it
2431would normally indicate formatting. Thus, for example, if one writes
2433 *\*hello\**
2435one will get
2437 <em>*hello*</em>
2439instead of
2441 <strong>hello</strong>
2443This rule is easier to remember than standard Markdown's rule,
2444which allows only the following characters to be backslash-escaped:
2446 \`*_{}[]()>#+-.!
2448(However, if the `markdown_strict` format is used, the standard Markdown rule
2449will be used.)
2451A backslash-escaped space is parsed as a nonbreaking space. It will
2452appear in TeX output as `~` and in HTML and XML as `\&#160;` or
2453`\&nbsp;`.
2455A backslash-escaped newline (i.e. a backslash occurring at the end of
2456a line) is parsed as a hard line break. It will appear in TeX output as
2457`\\` and in HTML as `<br />`. This is a nice alternative to
2458Markdown's "invisible" way of indicating hard line breaks using
2459two trailing spaces on a line.
2461Backslash escapes do not work in verbatim contexts.
2463Smart punctuation
2464-----------------
2466#### Extension ####
2468If the `--smart` option is specified, pandoc will produce typographically
2469correct output, converting straight quotes to curly quotes, `---` to
2470em-dashes, `--` to en-dashes, and `...` to ellipses. Nonbreaking spaces
2471are inserted after certain abbreviations, such as "Mr."
2473Note: if your LaTeX template calls for the [`csquotes`] package, pandoc will
2474detect this automatically and use `\enquote{...}` for quoted text.
2476Inline formatting
2477-----------------
2479### Emphasis ###
2481To *emphasize* some text, surround it with `*`s or `_`, like this:
2483 This text is _emphasized with underscores_, and this
2484 is *emphasized with asterisks*.
2486Double `*` or `_` produces **strong emphasis**:
2488 This is **strong emphasis** and __with underscores__.
2490A `*` or `_` character surrounded by spaces, or backslash-escaped,
2491will not trigger emphasis:
2493 This is * not emphasized *, and \*neither is this\*.
2495#### Extension: `intraword_underscores` ####
2497Because `_` is sometimes used inside words and identifiers,
2498pandoc does not interpret a `_` surrounded by alphanumeric
2499characters as an emphasis marker. If you want to emphasize
2500just part of a word, use `*`:
2502 feas*ible*, not feas*able*.
2505### Strikeout ###
2507#### Extension: `strikeout` ####
2509To strikeout a section of text with a horizontal line, begin and end it
2510with `~~`. Thus, for example,
2512 This ~~is deleted text.~~
2515### Superscripts and subscripts ###
2517#### Extension: `superscript`, `subscript` ####
2519Superscripts may be written by surrounding the superscripted text by `^`
2520characters; subscripts may be written by surrounding the subscripted
2521text by `~` characters. Thus, for example,
2523 H~2~O is a liquid. 2^10^ is 1024.
2525If the superscripted or subscripted text contains spaces, these spaces
2526must be escaped with backslashes. (This is to prevent accidental
2527superscripting and subscripting through the ordinary use of `~` and `^`.)
2528Thus, if you want the letter P with 'a cat' in subscripts, use
2529`P~a\ cat~`, not `P~a cat~`.
2532### Verbatim ###
2534To make a short span of text verbatim, put it inside backticks:
2536 What is the difference between `>>=` and `>>`?
2538If the verbatim text includes a backtick, use double backticks:
2540 Here is a literal backtick `` ` ``.
2542(The spaces after the opening backticks and before the closing
2543backticks will be ignored.)
2545The general rule is that a verbatim span starts with a string
2546of consecutive backticks (optionally followed by a space)
2547and ends with a string of the same number of backticks (optionally
2548preceded by a space).
2550Note that backslash-escapes (and other Markdown constructs) do not
2551work in verbatim contexts:
2553 This is a backslash followed by an asterisk: `\*`.
2555#### Extension: `inline_code_attributes` ####
2557Attributes can be attached to verbatim text, just as with
2558[fenced code blocks]:
2560 `<$>`{.haskell}
2562### Small caps ###
2564To write small caps, you can use an HTML span tag:
2566 <span style="font-variant:small-caps;">Small caps</span>
2568(The semicolon is optional and there may be space after the
2569colon.) This will work in all output formats that support small caps.
2571Math
2572----
2574#### Extension: `tex_math_dollars` ####
2576Anything between two `$` characters will be treated as TeX math. The
2577opening `$` must have a non-space character immediately to its right,
2578while the closing `$` must have a non-space character immediately to its
2579left, and must not be followed immediately by a digit. Thus,
2580`$20,000 and $30,000` won't parse as math. If for some reason
2581you need to enclose text in literal `$` characters, backslash-escape
2582them and they won't be treated as math delimiters.
2584TeX math will be printed in all output formats. How it is rendered
2585depends on the output format:
2587Markdown, LaTeX, Emacs Org mode, ConTeXt
2588 ~ It will appear verbatim between `$` characters.
2590reStructuredText
2591 ~ It will be rendered using an [interpreted text role `:math:`].
2593AsciiDoc
2594 ~ It will be rendered as `latexmath:[...]`.
2596Texinfo
2597 ~ It will be rendered inside a `@math` command.
2599groff man
2600 ~ It will be rendered verbatim without `$`'s.
2602MediaWiki, DokuWiki
2603 ~ It will be rendered inside `<math>` tags.
2605Textile
2606 ~ It will be rendered inside `<span class="math">` tags.
2608RTF, OpenDocument, ODT
2609 ~ It will be rendered, if possible, using unicode characters,
2610 and will otherwise appear verbatim.
2612DocBook
2613 ~ If the `--mathml` flag is used, it will be rendered using MathML
2614 in an `inlineequation` or `informalequation` tag. Otherwise it
2615 will be rendered, if possible, using unicode characters.
2617Docx
2618 ~ It will be rendered using OMML math markup.
2620FictionBook2
2621 ~ If the `--webtex` option is used, formulas are rendered as images
2622 using Google Charts or other compatible web service, downloaded
2623 and embedded in the e-book. Otherwise, they will appear verbatim.
2625HTML, Slidy, DZSlides, S5, EPUB
2626 ~ The way math is rendered in HTML will depend on the
2627 command-line options selected:
2629 1. The default is to render TeX math as far as possible using unicode
2630 characters, as with RTF, DocBook, and OpenDocument output. Formulas
2631 are put inside a `span` with `class="math"`, so that they may be
2632 styled differently from the surrounding text if needed.
2634 2. If the `--latexmathml` option is used, TeX math will be displayed
2635 between `$` or `$$` characters and put in `<span>` tags with class `LaTeX`.
2636 The [LaTeXMathML] script will be used to render it as formulas.
2637 (This trick does not work in all browsers, but it works in Firefox.
2638 In browsers that do not support LaTeXMathML, TeX math will appear
2639 verbatim between `$` characters.)
2641 3. If the `--jsmath` option is used, TeX math will be put inside
2642 `<span>` tags (for inline math) or `<div>` tags (for display math)
2643 with class `math`. The [jsMath] script will be used to render
2644 it.
2646 4. If the `--mimetex` option is used, the [mimeTeX] CGI script will
2647 be called to generate images for each TeX formula. This should
2648 work in all browsers. The `--mimetex` option takes an optional URL
2649 as argument. If no URL is specified, it will be assumed that the
2650 mimeTeX CGI script is at `/cgi-bin/mimetex.cgi`.
2652 5. If the `--gladtex` option is used, TeX formulas will be enclosed
2653 in `<eq>` tags in the HTML output. The resulting `htex` file may then
2654 be processed by [gladTeX], which will produce image files for each
2655 formula and an HTML file with links to these images. So, the
2656 procedure is:
2658 pandoc -s --gladtex myfile.txt -o myfile.htex
2659 gladtex -d myfile-images myfile.htex
2660 # produces myfile.html and images in myfile-images
2662 6. If the `--webtex` option is used, TeX formulas will be converted
2663 to `<img>` tags that link to an external script that converts
2664 formulas to images. The formula will be URL-encoded and concatenated
2665 with the URL provided. If no URL is specified, the Google Chart
2666 API will be used (`http://chart.apis.google.com/chart?cht=tx&chl=`).
2668 7. If the `--mathjax` option is used, TeX math will be displayed
2669 between `\(...\)` (for inline math) or `\[...\]` (for display
2670 math) and put in `<span>` tags with class `math`.
2671 The [MathJax] script will be used to render it as formulas.
2673[interpreted text role `:math:`]: http://docutils.sourceforge.net/docs/ref/rst/roles.html#math
2675Raw HTML
2676--------
2678#### Extension: `raw_html` ####
2680Markdown allows you to insert raw HTML (or DocBook) anywhere in a document
2681(except verbatim contexts, where `<`, `>`, and `&` are interpreted
2682literally). (Technically this is not an extension, since standard
2683Markdown allows it, but it has been made an extension so that it can
2684be disabled if desired.)
2686The raw HTML is passed through unchanged in HTML, S5, Slidy, Slideous,
2687DZSlides, EPUB, Markdown, and Textile output, and suppressed in other
2688formats.
2690#### Extension: `markdown_in_html_blocks` ####
2692Standard Markdown allows you to include HTML "blocks": blocks
2693of HTML between balanced tags that are separated from the surrounding text
2694with blank lines, and start and end at the left margin. Within
2695these blocks, everything is interpreted as HTML, not Markdown;
2696so (for example), `*` does not signify emphasis.
2698Pandoc behaves this way when the `markdown_strict` format is used; but
2699by default, pandoc interprets material between HTML block tags as Markdown.
2700Thus, for example, pandoc will turn
2702 <table>
2703 <tr>
2704 <td>*one*</td>
2705 <td>[a link](http://google.com)</td>
2706 </tr>
2707 </table>
2709into
2711 <table>
2712 <tr>
2713 <td><em>one</em></td>
2714 <td><a href="http://google.com">a link</a></td>
2715 </tr>
2716 </table>
2718whereas `Markdown.pl` will preserve it as is.
2720There is one exception to this rule: text between `<script>` and
2721`<style>` tags is not interpreted as Markdown.
2723This departure from standard Markdown should make it easier to mix
2724Markdown with HTML block elements. For example, one can surround
2725a block of Markdown text with `<div>` tags without preventing it
2726from being interpreted as Markdown.
2728#### Extension: `native_divs` ####
2730Use native pandoc `Div` blocks for content inside `<div>` tags.
2731For the most part this should give the same output as
2732`markdown_in_html_blocks`, but it makes it easier to write pandoc
2733filters to manipulate groups of blocks.
2735#### Extension: `native_spans` ####
2737Use native pandoc `Span` blocks for content inside `<span>` tags.
2738For the most part this should give the same output as `raw_html`,
2739but it makes it easier to write pandoc filters to manipulate groups
2740of inlines.
2742Raw TeX
2743-------
2745#### Extension: `raw_tex` ####
2747In addition to raw HTML, pandoc allows raw LaTeX, TeX, and ConTeXt to be
2748included in a document. Inline TeX commands will be preserved and passed
2749unchanged to the LaTeX and ConTeXt writers. Thus, for example, you can use
2750LaTeX to include BibTeX citations:
2752 This result was proved in \cite{jones.1967}.
2754Note that in LaTeX environments, like
2756 \begin{tabular}{|l|l|}\hline
2757 Age & Frequency \\ \hline
2758 18--25 & 15 \\
2759 26--35 & 33 \\
2760 36--45 & 22 \\ \hline
2761 \end{tabular}
2763the material between the begin and end tags will be interpreted as raw
2764LaTeX, not as Markdown.
2766Inline LaTeX is ignored in output formats other than Markdown, LaTeX,
2767and ConTeXt.
2769LaTeX macros
2770------------
2772#### Extension: `latex_macros` ####
2774For output formats other than LaTeX, pandoc will parse LaTeX `\newcommand` and
2775`\renewcommand` definitions and apply the resulting macros to all LaTeX
2776math. So, for example, the following will work in all output formats,
2777not just LaTeX:
2779 \newcommand{\tuple}[1]{\langle #1 \rangle}
2781 $\tuple{a, b, c}$
2783In LaTeX output, the `\newcommand` definition will simply be passed
2784unchanged to the output.
2787Links
2788-----
2790Markdown allows links to be specified in several ways.
2792### Automatic links ###
2794If you enclose a URL or email address in pointy brackets, it
2795will become a link:
2797 <http://google.com>
2798 <sam@green.eggs.ham>
2800### Inline links ###
2802An inline link consists of the link text in square brackets,
2803followed by the URL in parentheses. (Optionally, the URL can
2804be followed by a link title, in quotes.)
2806 This is an [inline link](/url), and here's [one with
2807 a title](http://fsf.org "click here for a good time!").
2809There can be no space between the bracketed part and the parenthesized part.
2810The link text can contain formatting (such as emphasis), but the title cannot.
2812Email addresses in inline links are not autodetected, so they have to be
2813prefixed with `mailto`:
2815 [Write me!](mailto:sam@green.eggs.ham)
2817### Reference links ###
2819An *explicit* reference link has two parts, the link itself and the link
2820definition, which may occur elsewhere in the document (either
2821before or after the link).
2823The link consists of link text in square brackets, followed by a label in
2824square brackets. (There can be space between the two.) The link definition
2825consists of the bracketed label, followed by a colon and a space, followed by
2826the URL, and optionally (after a space) a link title either in quotes or in
2827parentheses. The label must not be parseable as a citation (assuming
2828the `citations` extension is enabled): citations take precedence over
2829link labels.
2831Here are some examples:
2833 [my label 1]: /foo/bar.html "My title, optional"
2834 [my label 2]: /foo
2835 [my label 3]: http://fsf.org (The free software foundation)
2836 [my label 4]: /bar#special 'A title in single quotes'
2838The URL may optionally be surrounded by angle brackets:
2840 [my label 5]: <http://foo.bar.baz>
2842The title may go on the next line:
2844 [my label 3]: http://fsf.org
2845 "The free software foundation"
2847Note that link labels are not case sensitive. So, this will work:
2849 Here is [my link][FOO]
2851 [Foo]: /bar/baz
2853In an *implicit* reference link, the second pair of brackets is
2854empty:
2856 See [my website][].
2858 [my website]: http://foo.bar.baz
2860Note: In `Markdown.pl` and most other Markdown implementations,
2861reference link definitions cannot occur in nested constructions
2862such as list items or block quotes. Pandoc lifts this arbitrary
2863seeming restriction. So the following is fine in pandoc, though
2864not in most other implementations:
2866 > My block [quote].
2868 > [quote]: /foo
2870#### Extension: `shortcut_reference_links` ####
2872In a *shortcut* reference link, the second pair of brackets may
2873be omitted entirely:
2875 See [my website].
2877 [my website]: http://foo.bar.baz
2879### Internal links ###
2881To link to another section of the same document, use the automatically
2882generated identifier (see [Header identifiers]). For example:
2884 See the [Introduction](#introduction).
2888 See the [Introduction].
2890 [Introduction]: #introduction
2892Internal links are currently supported for HTML formats (including
2893HTML slide shows and EPUB), LaTeX, and ConTeXt.
2895Images
2896------
2898A link immediately preceded by a `!` will be treated as an image.
2899The link text will be used as the image's alt text:
2901 ![la lune](lalune.jpg "Voyage to the moon")
2903 ![movie reel]
2905 [movie reel]: movie.gif
2907#### Extension: `implicit_figures` ####
2909An image occurring by itself in a paragraph will be rendered as
2910a figure with a caption.[^5] (In LaTeX, a figure environment will be
2911used; in HTML, the image will be placed in a `div` with class
2912`figure`, together with a caption in a `p` with class `caption`.)
2913The image's alt text will be used as the caption.
2915 ![This is the caption](/url/of/image.png)
2917[^5]: This feature is not yet implemented for RTF, OpenDocument, or
2918 ODT. In those formats, you'll just get an image in a paragraph by
2919 itself, with no caption.
2921If you just want a regular inline image, just make sure it is not
2922the only thing in the paragraph. One way to do this is to insert a
2923nonbreaking space after the image:
2925 ![This image won't be a figure](/url/of/image.png)\
2927#### Extension: `link_attributes` ####
2929Attributes can be set on links and images:
2931 An inline ![image](foo.jpg){#id .class width=30 height=20px}
2932 and a reference ![image][ref] with attributes.
2934 [ref]: foo.jpg "optional title" {#id .class key=val key2="val 2"}
2936(This syntax is compatible with [PHP Markdown Extra] when only `#id`
2937and `.class` are used.)
2939For HTML and EPUB, all attributes except `width` and `height` (but
2940including `srcset` and `sizes`) are passed through as is. The other
2941writers ignore attributes that are not supported by their output
2942format.
2944The `width` and `height` attributes on images are treated specially. When
2945used without a unit, the unit is assumed to be pixels. However, any of
2946the following unit identifiers can be used: `px`, `cm`, `mm`, `in`, `inch`
2947and `%`. There must not be any spaces between the number and the unit.
2948For example:
2950```
2951![](file.jpg){ width=50% }
2952```
2954- Dimensions are converted to inches for output in page-based formats like
2955 LaTeX. Dimensions are converted to pixels for output in HTML-like
2956 formats. Use the `--dpi` option to specify the number of pixels per
2957 inch. The default is 96dpi.
2958- The `%` unit is generally relative to some available space.
2959 For example the above example will render to
2960 `<img href="file.jpg" style="width: 50%;" />` (HTML),
2961 `\includegraphics[width=0.5\textwidth]{file.jpg}` (LaTeX), or
2962 `\externalfigure[file.jpg][width=0.5\textwidth]` (ConTeXt).
2963- Some output formats have a notion of a class
2964 ([ConTeXt](http://wiki.contextgarden.net/Using_Graphics#Multiple_Image_Settings))
2965 or a unique identifier (LaTeX `\caption`), or both (HTML).
2966- When no `width` or `height` attributes are specified, the fallback
2967 is to look at the image resolution and the dpi metadata embedded in
2968 the image file.
2971Footnotes
2972---------
2974#### Extension: `footnotes` ####
2976Pandoc's Markdown allows footnotes, using the following syntax:
2978 Here is a footnote reference,[^1] and another.[^longnote]
2980 [^1]: Here is the footnote.
2982 [^longnote]: Here's one with multiple blocks.
2984 Subsequent paragraphs are indented to show that they
2985 belong to the previous footnote.
2987 { some.code }
2989 The whole paragraph can be indented, or just the first
2990 line. In this way, multi-paragraph footnotes work like
2991 multi-paragraph list items.
2993 This paragraph won't be part of the note, because it
2994 isn't indented.
2996The identifiers in footnote references may not contain spaces, tabs,
2997or newlines. These identifiers are used only to correlate the
2998footnote reference with the note itself; in the output, footnotes
2999will be numbered sequentially.
3001The footnotes themselves need not be placed at the end of the
3002document. They may appear anywhere except inside other block elements
3003(lists, block quotes, tables, etc.).
3005#### Extension: `inline_notes` ####
3007Inline footnotes are also allowed (though, unlike regular notes,
3008they cannot contain multiple paragraphs). The syntax is as follows:
3010 Here is an inline note.^[Inlines notes are easier to write, since
3011 you don't have to pick an identifier and move down to type the
3012 note.]
3014Inline and regular footnotes may be mixed freely.
3017Citations
3018---------
3020#### Extension: `citations` ####
3022Using an external filter, `pandoc-citeproc`, pandoc can automatically generate
3023citations and a bibliography in a number of styles. Basic usage is
3025 pandoc --filter pandoc-citeproc myinput.txt
3027In order to use this feature, you will need to specify a bibliography file
3028using the `bibliography` metadata field in a YAML metadata section, or
3029`--bibliography` command line argument. You can supply multiple `--bibliography`
3030arguments or set `bibliography` metadata field to YAML array, if you want to
3031use multiple bibliography files. The bibliography may have any of these
3032formats:
3034 Format File extension
3035 ------------ --------------
3036 BibLaTeX .bib
3037 BibTeX .bibtex
3038 Copac .copac
3039 CSL JSON .json
3040 CSL YAML .yaml
3041 EndNote .enl
3042 EndNote XML .xml
3043 ISI .wos
3044 MEDLINE .medline
3045 MODS .mods
3046 RIS .ris
3048Note that `.bib` can be used with both BibTeX and BibLaTeX files;
3049use `.bibtex` to force BibTeX.
3051Note that `pandoc-citeproc --bib2json` and `pandoc-citeproc --bib2yaml`
3052can produce `.json` and `.yaml` files from any of the supported formats.
3054In-field markup: In BibTeX and BibLaTeX databases, pandoc-citeproc parses
3055a subset of LaTeX markup; in CSL YAML databases, pandoc Markdown; and in CSL JSON databases, an [HTML-like markup][CSL markup specs]:
3057`<i>...</i>`
3058: italics
3060`<b>...</b>`
3061: bold
3063`<span style="font-variant:small-caps;">...</span>` or `<sc>...</sc>`
3064: small capitals
3066`<sub>...</sub>`
3067: subscript
3069`<sup>...</sup>`
3070: superscript
3072`<span class="nocase">...</span>`
3073: prevent a phrase from being capitalized as title case
3075`pandoc-citeproc -j` and `-y` interconvert the CSL JSON
3076and CSL YAML formats as far as possible.
3078As an alternative to specifying a bibliography file using `--bibliography`
3079or the YAML metadata field `bibliography`, you can include
3080the citation data directly in the `references` field of the
3081document's YAML metadata. The field should contain an array of
3082YAML-encoded references, for example:
3084 ---
3085 references:
3086 - type: article-journal
3087 id: WatsonCrick1953
3088 author:
3089 - family: Watson
3090 given: J. D.
3091 - family: Crick
3092 given: F. H. C.
3093 issued:
3094 date-parts:
3095 - - 1953
3096 - 4
3097 - 25
3098 title: 'Molecular structure of nucleic acids: a structure for deoxyribose
3099 nucleic acid'
3100 title-short: Molecular structure of nucleic acids
3101 container-title: Nature
3102 volume: 171
3103 issue: 4356
3104 page: 737-738
3105 DOI: 10.1038/171737a0
3106 URL: http://www.nature.com/nature/journal/v171/n4356/abs/171737a0.html
3107 language: en-GB
3108 ...
3110(`pandoc-citeproc --bib2yaml` can produce these from a bibliography file in one
3111of the supported formats.)
3113Citations and references can be formatted using any style supported by the
3114[Citation Style Language], listed in the [Zotero Style Repository].
3115These files are specified using the `--csl` option or the `csl` metadata field.
3116By default, `pandoc-citeproc` will use the [Chicago Manual of Style] author-date
3117format. The CSL project provides further information on [finding and editing styles].
3119To make your citations hyperlinks to the corresponding bibliography
3120entries, add `link-citations: true` to your YAML metadata.
3122Citations go inside square brackets and are separated by semicolons.
3123Each citation must have a key, composed of '@' + the citation
3124identifier from the database, and may optionally have a prefix,
3125a locator, and a suffix. The citation key must begin with a letter, digit,
3126or `_`, and may contain alphanumerics, `_`, and internal punctuation
3127characters (`:.#$%&-+?<>~/`). Here are some examples:
3129 Blah blah [see @doe99, pp. 33-35; also @smith04, chap. 1].
3131 Blah blah [@doe99, pp. 33-35, 38-39 and *passim*].
3133 Blah blah [@smith04; @doe99].
3135`pandoc-citeproc` detects locator terms in the [CSL locale files].
3136Either abbreviated or unabbreviated forms are accepted. In the `en-US`
3137locale, locator terms can be written in either singular or plural forms,
3138as `book`, `bk.`/`bks.`; `chapter`, `chap.`/`chaps.`; `column`,
3139`col.`/`cols.`; `figure`, `fig.`/`figs.`; `folio`, `fol.`/`fols.`;
3140`number`, `no.`/`nos.`; `line`, `l.`/`ll.`; `note`, `n.`/`nn.`; `opus`,
3141`op.`/`opp.`; `page`, `p.`/`pp.`; `paragraph`, `para.`/`paras.`; `part`,
3142`pt.`/`pts.`; `section`, `sec.`/`secs.`; `sub verbo`, `s.v.`/`s.vv.`;
3143`verse`, `v.`/`vv.`; `volume`, `vol.`/`vols.`; `¶`/`¶¶`; `§`/`§§`. If no
3144locator term is used, "page" is assumed.
3146A minus sign (`-`) before the `@` will suppress mention of
3147the author in the citation. This can be useful when the
3148author is already mentioned in the text:
3150 Smith says blah [-@smith04].
3152You can also write an in-text citation, as follows:
3154 @smith04 says blah.
3156 @smith04 [p. 33] says blah.
3158If the style calls for a list of works cited, it will be placed
3159at the end of the document. Normally, you will want to end your
3160document with an appropriate header:
3162 last paragraph...
3164 # References
3166The bibliography will be inserted after this header. Note that
3167the `unnumbered` class will be added to this header, so that the
3168section will not be numbered.
3170If you want to include items in the bibliography without actually
3171citing them in the body text, you can define a dummy `nocite` metadata
3172field and put the citations there:
3174 ---
3175 nocite: |
3176 @item1, @item2
3177 ...
3179 @item3
3181In this example, the document will contain a citation for `item3`
3182only, but the bibliography will contain entries for `item1`, `item2`, and
3183`item3`.
3185For LaTeX or PDF output, you can also use [`natbib`] or [`biblatex`]
3186to render bibliography. In order to do so, specify bibliography files as
3187outlined above, and add `--natbib` or `--biblatex` argument to `pandoc`
3188invocation. Bear in mind that bibliography files have to be in respective
3189format (either BibTeX or BibLaTeX).
3191For more information, see the [pandoc-citeproc man page].
3193[CSL markup specs]: http://docs.citationstyles.org/en/1.0/release-notes.html#rich-text-markup-within-fields
3194[Chicago Manual of Style]: http://chicagomanualofstyle.org
3195[Citation Style Language]: http://citationstyles.org
3196[Zotero Style Repository]: https://www.zotero.org/styles
3197[finding and editing styles]: http://citationstyles.org/styles/
3198[CSL locale files]: https://github.com/citation-style-language/locales
3199[pandoc-citeproc man page]: https://github.com/jgm/pandoc-citeproc/blob/master/man/pandoc-citeproc.1.md
3201Non-pandoc extensions
3202---------------------
3204The following Markdown syntax extensions are not enabled by default
3205in pandoc, but may be enabled by adding `+EXTENSION` to the format
3206name, where `EXTENSION` is the name of the extension. Thus, for
3207example, `markdown+hard_line_breaks` is Markdown with hard line breaks.
3209#### Extension: `lists_without_preceding_blankline` ####
3211Allow a list to occur right after a paragraph, with no intervening
3212blank space.
3214#### Extension: `hard_line_breaks` ####
3216Causes all newlines within a paragraph to be interpreted as hard line
3217breaks instead of spaces.
3219#### Extension: `ignore_line_breaks` ####
3221Causes newlines within a paragraph to be ignored, rather than being
3222treated as spaces or as hard line breaks. This option is intended for
3223use with East Asian languages where spaces are not used between words,
3224but text is divided into lines for readability.
3226#### Extension: `emoji` ####
3228Parses textual emojis like `:smile:` as Unicode emoticons.
3230#### Extension: `tex_math_single_backslash` ####
3232Causes anything between `\(` and `\)` to be interpreted as inline
3233TeX math, and anything between `\[` and `\]` to be interpreted
3234as display TeX math. Note: a drawback of this extension is that
3235it precludes escaping `(` and `[`.
3237#### Extension: `tex_math_double_backslash` ####
3239Causes anything between `\\(` and `\\)` to be interpreted as inline
3240TeX math, and anything between `\\[` and `\\]` to be interpreted
3241as display TeX math.
3243#### Extension: `markdown_attribute` ####
3245By default, pandoc interprets material inside block-level tags as Markdown.
3246This extension changes the behavior so that Markdown is only parsed
3247inside block-level tags if the tags have the attribute `markdown=1`.
3249#### Extension: `mmd_title_block` ####
3251Enables a [MultiMarkdown] style title block at the top of
3252the document, for example:
3254 Title: My title
3255 Author: John Doe
3256 Date: September 1, 2008
3257 Comment: This is a sample mmd title block, with
3258 a field spanning multiple lines.
3260See the MultiMarkdown documentation for details. If `pandoc_title_block` or
3261`yaml_metadata_block` is enabled, it will take precedence over
3262`mmd_title_block`.
3264[MultiMarkdown]: http://fletcherpenney.net/multimarkdown/
3266#### Extension: `abbreviations` ####
3268Parses PHP Markdown Extra abbreviation keys, like
3270 *[HTML]: Hypertext Markup Language
3272Note that the pandoc document model does not support
3273abbreviations, so if this extension is enabled, abbreviation keys are
3274simply skipped (as opposed to being parsed as paragraphs).
3276#### Extension: `autolink_bare_uris` ####
3278Makes all absolute URIs into links, even when not surrounded by
3279pointy braces `<...>`.
3281#### Extension: `ascii_identifiers` ####
3283Causes the identifiers produced by `auto_identifiers` to be pure ASCII.
3284Accents are stripped off of accented latin letters, and non-latin
3285letters are omitted.
3287#### Extension: `mmd_link_attributes` ####
3289Parses multimarkdown style key-value attributes on link
3290and image references. This extension should not be confused with the
3291[`link_attributes`](#extension-link_attributes) extension.
3293 This is a reference ![image][ref] with multimarkdown attributes.
3295 [ref]: http://path.to/image "Image title" width=20px height=30px
3296 id=myId class="myClass1 myClass2"
3298#### Extension: `mmd_header_identifiers` ####
3300Parses multimarkdown style header identifiers (in square brackets,
3301after the header but before any trailing `#`s in an ATX header).
3303#### Extension: `compact_definition_lists` ####
3305Activates the definition list syntax of pandoc 1.12.x and earlier.
3306This syntax differs from the one described above under [Definition lists]
3307in several respects:
3309 - No blank line is required between consecutive items of the
3310 definition list.
3311 - To get a "tight" or "compact" list, omit space between consecutive
3312 items; the space between a term and its definition does not affect
3313 anything.
3314 - Lazy wrapping of paragraphs is not allowed: the entire definition must
3315 be indented four spaces.[^6]
3317[^6]: To see why laziness is incompatible with relaxing the requirement
3318 of a blank line between items, consider the following example:
3320 bar
3321 : definition
3322 foo
3323 : definition
3325 Is this a single list item with two definitions of "bar," the first of
3326 which is lazily wrapped, or two list items? To remove the ambiguity
3327 we must either disallow lazy wrapping or require a blank line between
3328 list items.
3330Markdown variants
3331-----------------
3333In addition to pandoc's extended Markdown, the following Markdown
3334variants are supported:
3336`markdown_phpextra` (PHP Markdown Extra)
3337: `footnotes`, `pipe_tables`, `raw_html`, `markdown_attribute`,
3338 `fenced_code_blocks`, `definition_lists`, `intraword_underscores`,
3339 `header_attributes`, `link_attributes`, `abbreviations`,
3340 `shortcut_reference_links`.
3342`markdown_github` (GitHub-Flavored Markdown)
3343: `pipe_tables`, `raw_html`, `tex_math_single_backslash`,
3344 `fenced_code_blocks`, `auto_identifiers`,
3345 `ascii_identifiers`, `backtick_code_blocks`, `autolink_bare_uris`,
3346 `intraword_underscores`, `strikeout`, `hard_line_breaks`, `emoji`,
3347 `shortcut_reference_links`.
3349`markdown_mmd` (MultiMarkdown)
3350: `pipe_tables` `raw_html`, `markdown_attribute`, `mmd_link_attributes`,
3351 `raw_tex`, `tex_math_double_backslash`, `intraword_underscores`,
3352 `mmd_title_block`, `footnotes`, `definition_lists`,
3353 `all_symbols_escapable`, `implicit_header_references`,
3354 `auto_identifiers`, `mmd_header_identifiers`,
3355 `shortcut_reference_links`.
3357`markdown_strict` (Markdown.pl)
3358: `raw_html`
3360Extensions with formats other than Markdown
3361-------------------------------------------
3363Some of the extensions discussed above can be used with formats
3364other than Markdown:
3366* `auto_identifiers` can be used with `latex`, `rst`, `mediawiki`,
3367 and `textile` input (and is used by default).
3369* `tex_math_dollars`, `tex_math_single_backslash`, and
3370 `tex_math_double_backslash` can be used with `html` input.
3371 (This is handy for reading web pages formatted using MathJax,
3372 for example.)
3374Producing slide shows with pandoc
3375=================================
3377You can use pandoc to produce an HTML + javascript slide presentation
3378that can be viewed via a web browser. There are five ways to do this,
3379using [S5], [DZSlides], [Slidy], [Slideous], or [reveal.js].
3380You can also produce a PDF slide show using LaTeX [`beamer`].
3382Here's the Markdown source for a simple slide show, `habits.txt`:
3384 % Habits
3385 % John Doe
3386 % March 22, 2005
3388 # In the morning
3390 ## Getting up
3392 - Turn off alarm
3393 - Get out of bed
3395 ## Breakfast
3397 - Eat eggs
3398 - Drink coffee
3400 # In the evening
3402 ## Dinner
3404 - Eat spaghetti
3405 - Drink wine
3407 ------------------
3409 ![picture of spaghetti](images/spaghetti.jpg)
3411 ## Going to sleep
3413 - Get in bed
3414 - Count sheep
3416To produce an HTML/javascript slide show, simply type
3418 pandoc -t FORMAT -s habits.txt -o habits.html
3420where `FORMAT` is either `s5`, `slidy`, `slideous`, `dzslides`, or `revealjs`.
3422For Slidy, Slideous, reveal.js, and S5, the file produced by pandoc with the
3423`-s/--standalone` option embeds a link to javascripts and CSS files, which are
3424assumed to be available at the relative path `s5/default` (for S5), `slideous`
3425(for Slideous), `reveal.js` (for reveal.js), or at the Slidy website at
3426`w3.org` (for Slidy). (These paths can be changed by setting the `slidy-url`,
3427`slideous-url`, `revealjs-url`, or `s5-url` variables; see [Variables for slides],
3428above.) For DZSlides, the (relatively short) javascript and css are included in
3429the file by default.
3431With all HTML slide formats, the `--self-contained` option can be used to
3432produce a single file that contains all of the data necessary to display the
3433slide show, including linked scripts, stylesheets, images, and videos.
3435To produce a PDF slide show using beamer, type
3437 pandoc -t beamer habits.txt -o habits.pdf
3439Note that a reveal.js slide show can also be converted to a PDF
3440by printing it to a file from the browser.
3442Structuring the slide show
3443--------------------------
3445By default, the *slide level* is the highest header level in
3446the hierarchy that is followed immediately by content, and not another
3447header, somewhere in the document. In the example above, level 1 headers
3448are always followed by level 2 headers, which are followed by content,
3449so 2 is the slide level. This default can be overridden using
3450the `--slide-level` option.
3452The document is carved up into slides according to the following
3453rules:
3455 * A horizontal rule always starts a new slide.
3457 * A header at the slide level always starts a new slide.
3459 * Headers *below* the slide level in the hierarchy create
3460 headers *within* a slide.
3462 * Headers *above* the slide level in the hierarchy create
3463 "title slides," which just contain the section title
3464 and help to break the slide show into sections.
3466 * A title page is constructed automatically from the document's title
3467 block, if present. (In the case of beamer, this can be disabled
3468 by commenting out some lines in the default template.)
3470These rules are designed to support many different styles of slide show. If
3471you don't care about structuring your slides into sections and subsections,
3472you can just use level 1 headers for all each slide. (In that case, level 1
3473will be the slide level.) But you can also structure the slide show into
3474sections, as in the example above.
3476Note: in reveal.js slide shows, if slide level is 2, a two-dimensional
3477layout will be produced, with level 1 headers building horizontally
3478and level 2 headers building vertically. It is not recommended that
3479you use deeper nesting of section levels with reveal.js.
3481Incremental lists
3482-----------------
3484By default, these writers produce lists that display "all at once."
3485If you want your lists to display incrementally (one item at a time),
3486use the `-i` option. If you want a particular list to depart from the
3487default (that is, to display incrementally without the `-i` option and
3488all at once with the `-i` option), put it in a block quote:
3490 > - Eat spaghetti
3491 > - Drink wine
3493In this way incremental and nonincremental lists can be mixed in
3494a single document.
3496Inserting pauses
3497----------------
3499You can add "pauses" within a slide by including a paragraph containing
3500three dots, separated by spaces:
3502 # Slide with a pause
3504 content before the pause
3506 . . .
3508 content after the pause
3510Styling the slides
3511------------------
3513You can change the style of HTML slides by putting customized CSS files
3514in `$DATADIR/s5/default` (for S5), `$DATADIR/slidy` (for Slidy),
3515or `$DATADIR/slideous` (for Slideous),
3516where `$DATADIR` is the user data directory (see `--data-dir`, above).
3517The originals may be found in pandoc's system data directory (generally
3518`$CABALDIR/pandoc-VERSION/s5/default`). Pandoc will look there for any
3519files it does not find in the user data directory.
3521For dzslides, the CSS is included in the HTML file itself, and may
3522be modified there.
3524All [reveal.js configuration options] can be set through variables.
3525For example, themes can be used by setting the `theme` variable:
3527 -V theme=moon
3529Or you can specify a custom stylesheet using the `--css` option.
3531To style beamer slides, you can specify a `theme`, `colortheme`,
3532`fonttheme`, `innertheme`, and `outertheme`, using the `-V` option:
3534 pandoc -t beamer habits.txt -V theme:Warsaw -o habits.pdf
3536Note that header attributes will turn into slide attributes
3537(on a `<div>` or `<section>`) in HTML slide formats, allowing you
3538to style individual slides. In beamer, the only header attribute
3539that affects slides is the `allowframebreaks` class, which sets the
3540`allowframebreaks` option, causing multiple slides to be created
3541if the content overfills the frame. This is recommended especially for
3542bibliographies:
3544 # References {.allowframebreaks}
3546Speaker notes
3547-------------
3549reveal.js has good support for speaker notes. You can add notes to your
3550Markdown document thus:
3552 <div class="notes">
3553 This is my note.
3555 - It can contain Markdown
3556 - like this list
3558 </div>
3560To show the notes window, press `s` while viewing the presentation.
3561Notes are not yet supported for other slide formats, but the notes
3562will not appear on the slides themselves.
3564Frame attributes in beamer
3565--------------------------
3567Sometimes it is necessary to add the LaTeX `[fragile]` option to
3568a frame in beamer (for example, when using the `minted` environment).
3569This can be forced by adding the `fragile` class to the header
3570introducing the slide:
3572 # Fragile slide {.fragile}
3574All of the other frame attributes described in Section 8.1 of
3575the [Beamer User's Guide] may also be used: `allowdisplaybreaks`,
3576`allowframebreaks`, `b`, `c`, `t`, `environment`, `label`, `plain`,
3577`shrink`.
3579Creating EPUBs with pandoc
3580==========================
3582EPUB Metadata
3583-------------
3585EPUB metadata may be specified using the `--epub-metadata` option, but
3586if the source document is Markdown, it is better to use a [YAML metadata
3587block][Extension: `yaml_metadata_block`]. Here is an example:
3589 ---
3590 title:
3591 - type: main
3592 text: My Book
3593 - type: subtitle
3594 text: An investigation of metadata
3595 creator:
3596 - role: author
3597 text: John Smith
3598 - role: editor
3599 text: Sarah Jones
3600 identifier:
3601 - scheme: DOI
3602 text: doi:10.234234.234/33
3603 publisher: My Press
3604 rights: © 2007 John Smith, CC BY-NC
3605 ...
3607The following fields are recognized:
3609`identifier`
3610 ~ Either a string value or an object with fields `text` and
3611 `scheme`. Valid values for `scheme` are `ISBN-10`,
3612 `GTIN-13`, `UPC`, `ISMN-10`, `DOI`, `LCCN`, `GTIN-14`,
3613 `ISBN-13`, `Legal deposit number`, `URN`, `OCLC`,
3614 `ISMN-13`, `ISBN-A`, `JP`, `OLCC`.
3616`title`
3617 ~ Either a string value, or an object with fields `file-as` and
3618 `type`, or a list of such objects. Valid values for `type` are
3619 `main`, `subtitle`, `short`, `collection`, `edition`, `extended`.
3621`creator`
3622 ~ Either a string value, or an object with fields `role`, `file-as`,
3623 and `text`, or a list of such objects. Valid values for `role` are
3624 [MARC relators], but
3625 pandoc will attempt to translate the human-readable versions
3626 (like "author" and "editor") to the appropriate marc relators.
3628`contributor`
3629 ~ Same format as `creator`.
3631`date`
3632 ~ A string value in `YYYY-MM-DD` format. (Only the year is necessary.)
3633 Pandoc will attempt to convert other common date formats.
3635`lang` (or legacy: `language`)
3636 ~ A string value in [BCP 47] format. Pandoc will default to the local
3637 language if nothing is specified.
3639`subject`
3640 ~ A string value or a list of such values.
3642`description`
3643 ~ A string value.
3645`type`
3646 ~ A string value.
3648`format`
3649 ~ A string value.
3651`relation`
3652 ~ A string value.
3654`coverage`
3655 ~ A string value.
3657`rights`
3658 ~ A string value.
3660`cover-image`
3661 ~ A string value (path to cover image).
3663`stylesheet`
3664 ~ A string value (path to CSS stylesheet).
3666`page-progression-direction`
3667 ~ Either `ltr` or `rtl`. Specifies the `page-progression-direction`
3668 attribute for the [`spine` element].
3670[MARC relators]: http://loc.gov/marc/relators/relaterm.html
3671[`spine` element]: http://idpf.org/epub/301/spec/epub-publications.html#sec-spine-elem
3673Linked media
3674------------
3676By default, pandoc will download linked media (including audio and
3677video) and include it in the EPUB container, yielding a completely
3678self-contained EPUB. If you want to link to external media resources
3679instead, use raw HTML in your source and add `data-external="1"` to the tag
3680with the `src` attribute. For example:
3682 <audio controls="1">
3683 <source src="http://example.com/music/toccata.mp3"
3684 data-external="1" type="audio/mpeg">
3685 </source>
3686 </audio>
3688Literate Haskell support
3689========================
3691If you append `+lhs` (or `+literate_haskell`) to an appropriate input or output
3692format (`markdown`, `markdown_strict`, `rst`, or `latex` for input or output;
3693`beamer`, `html` or `html5` for output only), pandoc will treat the document as
3694literate Haskell source. This means that
3696 - In Markdown input, "bird track" sections will be parsed as Haskell
3697 code rather than block quotations. Text between `\begin{code}`
3698 and `\end{code}` will also be treated as Haskell code. For
3699 ATX-style headers the character '=' will be used instead of '#'.
3701 - In Markdown output, code blocks with classes `haskell` and `literate`
3702 will be rendered using bird tracks, and block quotations will be
3703 indented one space, so they will not be treated as Haskell code.
3704 In addition, headers will be rendered setext-style (with underlines)
3705 rather than ATX-style (with '#' characters). (This is because ghc
3706 treats '#' characters in column 1 as introducing line numbers.)
3708 - In restructured text input, "bird track" sections will be parsed
3709 as Haskell code.
3711 - In restructured text output, code blocks with class `haskell` will
3712 be rendered using bird tracks.
3714 - In LaTeX input, text in `code` environments will be parsed as
3715 Haskell code.
3717 - In LaTeX output, code blocks with class `haskell` will be rendered
3718 inside `code` environments.
3720 - In HTML output, code blocks with class `haskell` will be rendered
3721 with class `literatehaskell` and bird tracks.
3723Examples:
3725 pandoc -f markdown+lhs -t html
3727reads literate Haskell source formatted with Markdown conventions and writes
3728ordinary HTML (without bird tracks).
3730 pandoc -f markdown+lhs -t html+lhs
3732writes HTML with the Haskell code in bird tracks, so it can be copied
3733and pasted as literate Haskell source.
3735Syntax highlighting
3736===================
3738Pandoc will automatically highlight syntax in [fenced code blocks] that
3739are marked with a language name. The Haskell library [highlighting-kate] is used for
3740highlighting, which works in HTML, Docx, and LaTeX/PDF output.
3741The color scheme can be selected using the `--highlight-style` option.
3742The default color scheme is `pygments`, which imitates the default color
3743scheme used by the Python library pygments, but pygments is not actually
3744used to do the highlighting.
3746To see a list of language names that pandoc will recognize, type
3747`pandoc --version`.
3749To disable highlighting, use the `--no-highlight` option.
3751[highlighting-kate]: https://github.com/jgm/highlighting-kate
3753Custom writers
3754==============
3756Pandoc can be extended with custom writers written in [lua]. (Pandoc
3757includes a lua interpreter, so lua need not be installed separately.)
3759To use a custom writer, simply specify the path to the lua script
3760in place of the output format. For example:
3762 pandoc -t data/sample.lua
3764Creating a custom writer requires writing a lua function for each
3765possible element in a pandoc document. To get a documented example
3766which you can modify according to your needs, do
3768 pandoc --print-default-data-file sample.lua
3770[lua]: http://www.lua.org
3772Authors
3773=======
3775© 2006-2015 John MacFarlane (jgm@berkeley.edu). Released under the
3776[GPL], version 2 or greater. This software carries no warranty of
3777any kind. (See COPYRIGHT for full copyright and warranty notices.)
3779Contributors include
3780Aaron Wolen,
3781Albert Krewinkel,
3782Alexander Kondratskiy,
3783Alexander Sulfrian,
3784Alexander V Vershilov,
3785Alfred Wechselberger,
3786Andreas Lööw,
3787Andrew Dunning,
3788Antoine Latter,
3789Arata Mizuki,
3790Arlo O'Keeffe,
3791Artyom Kazak,
3792Ben Gamari,
3793Beni Cherniavsky-Paskin,
3794Bjorn Buckwalter,
3795Bradley Kuhn,
3796Brent Yorgey,
3797Bryan O'Sullivan,
3798B. Scott Michel,
3799Caleb McDaniel,
3800Calvin Beck,
3801Christoffer Ackelman,
3802Christoffer Sawicki,
3803Clare Macrae,
3804Clint Adams,
3805Conal Elliott,
3806Craig S. Bosma,
3807Daniel Bergey,
3808Daniel T. Staal,
3809David Lazar,
3810David Röthlisberger,
3811Denis Laxalde,
3812Douglas Calvert,
3813Douglas F. Calvert,
3814Eric Kow,
3815Eric Seidel,
3816Florian Eitel,
3817François Gannaz,
3818Freiric Barral,
3819Fyodor Sheremetyev,
3820Gabor Pali,
3821Gavin Beatty,
3822Greg Maslov,
3823Grégory Bataille,
3824Greg Rundlett,
3825gwern,
3826Gwern Branwen,
3827Hans-Peter Deifel,
3828Henry de Valence,
3829Ilya V. Portnov,
3830infinity0x,
3831Jaime Marquínez Ferrándiz,
3832James Aspnes,
3833Jamie F. Olson,
3834Jan Larres,
3835Jason Ronallo,
3836Jeff Arnold,
3837Jeff Runningen,
3838Jens Petersen,
3839Jérémy Bobbio,
3840Jesse Rosenthal,
3841J. Lewis Muir,
3842Joe Hillenbrand,
3843John MacFarlane,
3844Jonas Smedegaard,
3845Jonathan Daugherty,
3846Josef Svenningsson,
3847Jose Luis Duran,
3848Julien Cretel,
3849Justin Bogner,
3850Kelsey Hightower,
3851Konstantin Zudov,
3852Lars-Dominik Braun,
3853Luke Plant,
3854Mark Szepieniec,
3855Mark Wright,
3856Masayoshi Takahashi,
3857Matej Kollar,
3858Mathias Schenner,
3859Matthew Pickering,
3860Matthias C. M. Troffaes,
3861Max Bolingbroke,
3862Max Rydahl Andersen,
3863mb21,
3864Merijn Verstraaten,
3865Michael Snoyman,
3866Michael Thompson,
3867MinRK,
3868Nathan Gass,
3869Neil Mayhew,
3870Nick Bart,
3871Nicolas Kaiser,
3872Nikolay Yakimov,
3873nkalvi,
3874Paulo Tanimoto,
3875Paul Rivier,
3876Peter Wang,
3877Philippe Ombredanne,
3878Phillip Alday,
3879Puneeth Chaganti,
3880qerub,
3881Ralf Stephan,
3882Recai Oktaş,
3883rodja.trappe,
3884RyanGlScott,
3885Scott Morrison,
3886Sergei Trofimovich,
3887Sergey Astanin,
3888Shahbaz Youssefi,
3889Shaun Attfield,
3890shreevatsa.public,
3891Simon Hengel,
3892Sumit Sahrawat,
3893takahashim,
3894thsutton,
3895Tim Lin,
3896Timothy Humphries,
3897Todd Sifleet,
3898Tom Leese,
3899Uli Köhler,
3900Václav Zeman,
3901Viktor Kronvall,
3902Vincent,
3903Wikiwide, and
3904Xavier Olive.
3906[GPL]: http://www.gnu.org/copyleft/gpl.html "GNU General Public License"