git.iko.soy/typeable/pandoc
on 2.0.2 help sign in
typeable/pandoc/MANUAL.txt
4349 lines 154 kB history raw
1% Pandoc User's Guide
2% John MacFarlane
3% November 11, 2017
5Synopsis
6========
8`pandoc` [*options*] [*input-file*]...
10Description
11===========
13Pandoc is a [Haskell] library for converting from one markup format to
14another, and a command-line tool that uses this library. It can read
15[Markdown], [CommonMark], [PHP Markdown Extra], [GitHub-Flavored
16Markdown], [MultiMarkdown], and (subsets of) [Textile],
17[reStructuredText], [HTML], [LaTeX], [MediaWiki markup], [TWiki markup],
18[TikiWiki markup], [Creole 1.0], [Haddock markup], [OPML], [Emacs Org mode],
19[DocBook], [Muse], [txt2tags], [Vimwiki], [EPUB], [ODT], and [Word docx];
20and it can write plain text, [Markdown], [CommonMark], [PHP Markdown
21Extra], [GitHub-Flavored Markdown], [MultiMarkdown],
22[reStructuredText], [XHTML], [HTML5], [LaTeX] \(including
23[`beamer`] slide shows\), [ConTeXt], [RTF], [OPML], [DocBook],
24[OpenDocument], [ODT], [Word docx], [GNU Texinfo], [MediaWiki
25markup], [DokuWiki markup], [ZimWiki markup], [Haddock markup],
26[EPUB] \(v2 or v3\), [FictionBook2], [Textile], [groff man],
27[groff ms], [Emacs Org mode], [AsciiDoc], [InDesign ICML], [TEI
28Simple], [Muse] and [Slidy], [Slideous], [DZSlides], [reveal.js]
29or [S5] HTML slide shows. It can also produce [PDF] output on
30systems where LaTeX, ConTeXt, `pdfroff`, `wkhtmltopdf`,
31`prince`, or `weasyprint` is installed.
33Pandoc's enhanced version of Markdown includes syntax for [footnotes],
34[tables], flexible [ordered lists], [definition lists], [fenced code
35blocks], [superscripts and subscripts], [strikeout], [metadata blocks],
36automatic tables of contents, embedded LaTeX [math], [citations], and
37[Markdown inside HTML block elements][Extension:
38`markdown_in_html_blocks`]. (These enhancements, described further under
39[Pandoc's Markdown], can be disabled using the `markdown_strict` input
40or output format.)
42In contrast to most existing tools for converting Markdown to HTML, which
43use regex substitutions, pandoc has a modular design: it consists of a
44set of readers, which parse text in a given format and produce a native
45representation of the document, and a set of writers, which convert
46this native representation into a target format. Thus, adding an input
47or output format requires only adding a reader or writer.
49Because pandoc's intermediate representation of a document is less
50expressive than many of the formats it converts between, one should
51not expect perfect conversions between every format and every other.
52Pandoc attempts to preserve the structural elements of a document, but
53not formatting details such as margin size. And some document elements,
54such as complex tables, may not fit into pandoc's simple document
55model. While conversions from pandoc's Markdown to all formats aspire
56to be perfect, conversions from formats more expressive than pandoc's
57Markdown can be expected to be lossy.
59[Markdown]: http://daringfireball.net/projects/markdown/
60[CommonMark]: http://commonmark.org
61[PHP Markdown Extra]: https://michelf.ca/projects/php-markdown/extra/
62[GitHub-Flavored Markdown]: https://help.github.com/articles/github-flavored-markdown/
63[MultiMarkdown]: http://fletcherpenney.net/multimarkdown/
64[reStructuredText]: http://docutils.sourceforge.net/docs/ref/rst/introduction.html
65[S5]: http://meyerweb.com/eric/tools/s5/
66[Slidy]: http://www.w3.org/Talks/Tools/Slidy/
67[Slideous]: http://goessner.net/articles/slideous/
68[HTML]: http://www.w3.org/html/
69[HTML5]: http://www.w3.org/TR/html5/
70[polyglot markup]: https://www.w3.org/TR/html-polyglot/
71[XHTML]: http://www.w3.org/TR/xhtml1/
72[LaTeX]: http://latex-project.org
73[`beamer`]: https://ctan.org/pkg/beamer
74[Beamer User's Guide]: http://ctan.math.utah.edu/ctan/tex-archive/macros/latex/contrib/beamer/doc/beameruserguide.pdf
75[ConTeXt]: http://www.contextgarden.net/
76[RTF]: http://en.wikipedia.org/wiki/Rich_Text_Format
77[DocBook]: http://docbook.org
78[txt2tags]: http://txt2tags.org
79[EPUB]: http://idpf.org/epub
80[OPML]: http://dev.opml.org/spec2.html
81[OpenDocument]: http://opendocument.xml.org
82[ODT]: http://en.wikipedia.org/wiki/OpenDocument
83[Textile]: http://redcloth.org/textile
84[MediaWiki markup]: https://www.mediawiki.org/wiki/Help:Formatting
85[DokuWiki markup]: https://www.dokuwiki.org/dokuwiki
86[ZimWiki markup]: http://zim-wiki.org/manual/Help/Wiki_Syntax.html
87[TWiki markup]: http://twiki.org/cgi-bin/view/TWiki/TextFormattingRules
88[TikiWiki markup]: https://doc.tiki.org/Wiki-Syntax-Text#The_Markup_Language_Wiki-Syntax
89[Haddock markup]: https://www.haskell.org/haddock/doc/html/ch03s08.html
90[Creole 1.0]: http://www.wikicreole.org/wiki/Creole1.0
91[groff man]: http://man7.org/linux/man-pages/man7/groff_man.7.html
92[groff ms]: http://man7.org/linux/man-pages/man7/groff_ms.7.html
93[Haskell]: https://www.haskell.org
94[GNU Texinfo]: http://www.gnu.org/software/texinfo/
95[Emacs Org mode]: http://orgmode.org
96[AsciiDoc]: http://www.methods.co.nz/asciidoc/
97[DZSlides]: http://paulrouget.com/dzslides/
98[Word docx]: https://en.wikipedia.org/wiki/Office_Open_XML
99[PDF]: https://www.adobe.com/pdf/
100[reveal.js]: http://lab.hakim.se/reveal-js/
101[FictionBook2]: http://www.fictionbook.org/index.php/Eng:XML_Schema_Fictionbook_2.1
102[InDesign ICML]: https://www.adobe.com/content/dam/Adobe/en/devnet/indesign/cs55-docs/IDML/idml-specification.pdf
103[TEI Simple]: https://github.com/TEIC/TEI-Simple
104[Muse]: https://amusewiki.org/library/manual
105[Vimwiki]: https://vimwiki.github.io
107Using `pandoc`
108--------------
110If no *input-file* is specified, input is read from *stdin*.
111Otherwise, the *input-files* are concatenated (with a blank
112line between each) and used as input. Output goes to *stdout* by
113default (though output to the terminal is disabled for the
114`odt`, `docx`, `epub2`, and `epub3` output formats, unless it is
115forced using `-o -`). For output to a file, use the `-o`
116option:
118 pandoc -o output.html input.txt
120By default, pandoc produces a document fragment, not a standalone
121document with a proper header and footer. To produce a standalone
122document, use the `-s` or `--standalone` flag:
124 pandoc -s -o output.html input.txt
126For more information on how standalone documents are produced, see
127[Templates], below.
129Instead of a file, an absolute URI may be given. In this case
130pandoc will fetch the content using HTTP:
132 pandoc -f html -t markdown http://www.fsf.org
134It is possible to supply a custom User-Agent string or other
135header when requesting a document from a URL:
137 pandoc -f html -t markdown --request-header User-Agent:"Mozilla/5.0" \
138 http://www.fsf.org
140If multiple input files are given, `pandoc` will concatenate them all (with
141blank lines between them) before parsing. This feature is disabled for
142 binary input formats such as `EPUB`, `odt`, and `docx`.
144The format of the input and output can be specified explicitly using
145command-line options. The input format can be specified using the
146`-r/--read` or `-f/--from` options, the output format using the
147`-w/--write` or `-t/--to` options. Thus, to convert `hello.txt` from
148Markdown to LaTeX, you could type:
150 pandoc -f markdown -t latex hello.txt
152To convert `hello.html` from HTML to Markdown:
154 pandoc -f html -t markdown hello.html
156Supported output formats are listed below under the `-t/--to` option.
157Supported input formats are listed below under the `-f/--from` option. Note
158that the `rst`, `textile`, `latex`, and `html` readers are not complete;
159there are some constructs that they do not parse.
161If the input or output format is not specified explicitly, `pandoc`
162will attempt to guess it from the extensions of
163the input and output filenames. Thus, for example,
165 pandoc -o hello.tex hello.txt
167will convert `hello.txt` from Markdown to LaTeX. If no output file
168is specified (so that output goes to *stdout*), or if the output file's
169extension is unknown, the output format will default to HTML.
170If no input file is specified (so that input comes from *stdin*), or
171if the input files' extensions are unknown, the input format will
172be assumed to be Markdown unless explicitly specified.
174Pandoc uses the UTF-8 character encoding for both input and output.
175If your local character encoding is not UTF-8, you
176should pipe input and output through [`iconv`]:
178 iconv -t utf-8 input.txt | pandoc | iconv -f utf-8
180Note that in some output formats (such as HTML, LaTeX, ConTeXt,
181RTF, OPML, DocBook, and Texinfo), information about
182the character encoding is included in the document header, which
183will only be included if you use the `-s/--standalone` option.
185[`iconv`]: http://www.gnu.org/software/libiconv/
187Creating a PDF
188--------------
190To produce a PDF, specify an output file with a `.pdf` extension.
191By default, pandoc will use LaTeX to create the PDF:
193 pandoc test.txt -o test.pdf
195Production of a PDF requires that a LaTeX engine be installed (see
196`--pdf-engine`, below), and assumes that the following LaTeX packages
197are available: [`amsfonts`], [`amsmath`], [`lm`], [`unicode-math`],
198[`ifxetex`], [`ifluatex`], [`listings`] (if the
199`--listings` option is used), [`fancyvrb`], [`longtable`],
200[`booktabs`], [`graphicx`] and [`grffile`] (if the document
201contains images), [`hyperref`], [`xcolor`] (with `colorlinks`), [`ulem`], [`geometry`] (with the
202`geometry` variable set), [`setspace`] (with `linestretch`), and
203[`babel`] (with `lang`). The use of `xelatex` or `lualatex` as
204the LaTeX engine requires [`fontspec`]. `xelatex` uses
205[`polyglossia`] (with `lang`), [`xecjk`], and [`bidi`] (with the
206`dir` variable set). If the `mathspec` variable is set,
207`xelatex` will use [`mathspec`] instead of [`unicode-math`].
208The [`upquote`] and [`microtype`] packages are used if
209available, and [`csquotes`] will be used for [typography]
210if added to the template or included in any header file. The
211[`natbib`], [`biblatex`], [`bibtex`], and [`biber`] packages can
212optionally be used for [citation rendering]. These are included
213with all recent versions of [TeX Live].
215Alternatively, pandoc can use [ConTeXt], `pdfroff`, or any of the
216following HTML/CSS-to-PDF-engines, to create a PDF: [`wkhtmltopdf`],
217[`weasyprint`] or [`prince`].
218To do this, specify an output file with a `.pdf` extension, as before,
219but add the `--pdf-engine` option or `-t context`, `-t html`, or `-t ms`
220to the command line (`-t html` defaults to `--pdf-engine=wkhtmltopdf`).
222PDF output can be controlled using [variables for LaTeX] (if
223LaTeX is used) and [variables for ConTeXt] (if ConTeXt is used).
224When using an HTML/CSS-to-PDF-engine, `--css` affects the output.
225If `wkhtmltopdf` is used, then the variables `margin-left`,
226`margin-right`, `margin-top`, `margin-bottom`, and `papersize`
227will affect the output.
229[`amsfonts`]: https://ctan.org/pkg/amsfonts
230[`amsmath`]: https://ctan.org/pkg/amsmath
231[`lm`]: https://ctan.org/pkg/lm
232[`ifxetex`]: https://ctan.org/pkg/ifxetex
233[`ifluatex`]: https://ctan.org/pkg/ifluatex
234[`listings`]: https://ctan.org/pkg/listings
235[`fancyvrb`]: https://ctan.org/pkg/fancyvrb
236[`longtable`]: https://ctan.org/pkg/longtable
237[`booktabs`]: https://ctan.org/pkg/booktabs
238[`graphicx`]: https://ctan.org/pkg/graphicx
239[`grffile`]: https://ctan.org/pkg/grffile
240[`geometry`]: https://ctan.org/pkg/geometry
241[`setspace`]: https://ctan.org/pkg/setspace
242[`xecjk`]: https://ctan.org/pkg/xecjk
243[`hyperref`]: https://ctan.org/pkg/hyperref
244[`ulem`]: https://ctan.org/pkg/ulem
245[`babel`]: https://ctan.org/pkg/babel
246[`bidi`]: https://ctan.org/pkg/bidi
247[`mathspec`]: https://ctan.org/pkg/mathspec
248[`unicode-math`]: https://ctan.org/pkg/unicode-math
249[`polyglossia`]: https://ctan.org/pkg/polyglossia
250[`fontspec`]: https://ctan.org/pkg/fontspec
251[`upquote`]: https://ctan.org/pkg/upquote
252[`microtype`]: https://ctan.org/pkg/microtype
253[`csquotes`]: https://ctan.org/pkg/csquotes
254[`natbib`]: https://ctan.org/pkg/natbib
255[`biblatex`]: https://ctan.org/pkg/biblatex
256[`bibtex`]: https://ctan.org/pkg/bibtex
257[`biber`]: https://ctan.org/pkg/biber
258[TeX Live]: http://www.tug.org/texlive/
259[`wkhtmltopdf`]: https://wkhtmltopdf.org
260[`weasyprint`]: http://weasyprint.org
261[`prince`]: https://www.princexml.com/
263Options
264=======
266General options
267---------------
269`-f` *FORMAT*, `-r` *FORMAT*, `--from=`*FORMAT*, `--read=`*FORMAT*
271: Specify input format. *FORMAT* can be `native` (native Haskell),
272 `json` (JSON version of native AST), `markdown` (pandoc's
273 extended Markdown), `markdown_strict` (original unextended
274 Markdown), `markdown_phpextra` (PHP Markdown Extra),
275 `markdown_mmd` (MultiMarkdown), `gfm` (GitHub-Flavored Markdown),
276 `commonmark` (CommonMark Markdown), `textile` (Textile), `rst`
277 (reStructuredText), `html` (HTML), `docbook` (DocBook), `t2t`
278 (txt2tags), `docx` (docx), `odt` (ODT), `epub` (EPUB), `opml` (OPML),
279 `org` (Emacs Org mode), `mediawiki` (MediaWiki markup), `twiki` (TWiki
280 markup), `tikiwiki` (TikiWiki markup), `creole` (Creole 1.0),
281 `haddock` (Haddock markup), or `latex` (LaTeX).
282 (`markdown_github` provides deprecated and less accurate support
283 for Github-Flavored Markdown; please use `gfm` instead, unless you
284 need to use extensions other than `smart`.)
285 If `+lhs` is appended to `markdown`, `rst`, `latex`, or
286 `html`, the input will be treated as literate Haskell source: see
287 [Literate Haskell support], below. Markdown
288 syntax extensions can be individually enabled or disabled by
289 appending `+EXTENSION` or `-EXTENSION` to the format name. So, for
290 example, `markdown_strict+footnotes+definition_lists` is strict
291 Markdown with footnotes and definition lists enabled, and
292 `markdown-pipe_tables+hard_line_breaks` is pandoc's Markdown
293 without pipe tables and with hard line breaks. See [Pandoc's
294 Markdown], below, for a list of extensions and
295 their names. See `--list-input-formats` and `--list-extensions`,
296 below.
298`-t` *FORMAT*, `-w` *FORMAT*, `--to=`*FORMAT*, `--write=`*FORMAT*
300: Specify output format. *FORMAT* can be `native` (native Haskell),
301 `json` (JSON version of native AST), `plain` (plain text),
302 `markdown` (pandoc's extended Markdown), `markdown_strict`
303 (original unextended Markdown), `markdown_phpextra` (PHP Markdown
304 Extra), `markdown_mmd` (MultiMarkdown), `gfm` (GitHub-Flavored
305 Markdown), `commonmark` (CommonMark Markdown), `rst`
306 (reStructuredText), `html4` (XHTML 1.0 Transitional), `html`
307 or `html5` (HTML5/XHTML [polyglot markup]), `latex`
308 (LaTeX), `beamer` (LaTeX beamer slide show), `context` (ConTeXt),
309 `man` (groff man), `mediawiki` (MediaWiki markup),
310 `dokuwiki` (DokuWiki markup), `zimwiki` (ZimWiki markup),
311 `textile` (Textile), `org` (Emacs Org mode), `texinfo` (GNU Texinfo),
312 `opml` (OPML), `docbook` or `docbook4` (DocBook 4), `docbook5`
313 (DocBook 5), `jats` (JATS XML), `opendocument` (OpenDocument),
314 `odt` (OpenOffice text document), `docx` (Word docx), `haddock`
315 (Haddock markup), `rtf` (rich text format), `epub2` (EPUB v2 book),
316 `epub` or `epub3` (EPUB v3), `fb2` (FictionBook2 e-book),
317 `asciidoc` (AsciiDoc), `icml` (InDesign ICML), `tei` (TEI
318 Simple), `slidy` (Slidy HTML and JavaScript slide show),
319 `slideous` (Slideous HTML and JavaScript slide show),
320 `dzslides` (DZSlides HTML5 + JavaScript slide show),
321 `revealjs` (reveal.js HTML5 + JavaScript slide show), `s5`
322 (S5 HTML and JavaScript slide show), or the path of a custom
323 lua writer (see [Custom writers], below). (`markdown_github`
324 provides deprecated and less accurate support for
325 Github-Flavored Markdown; please use `gfm` instead, unless
326 you use extensions that do not work with `gfm`.) Note that `odt`,
327 `epub`, and `epub3` output will not be directed to *stdout*;
328 an output filename must be specified using the `-o/--output`
329 option. If `+lhs` is appended to `markdown`, `rst`, `latex`,
330 `beamer`, `html4`, or `html5`, the output will be rendered as
331 literate Haskell source: see [Literate Haskell support],
332 below. Markdown syntax extensions can be individually
333 enabled or disabled by appending `+EXTENSION` or
334 `-EXTENSION` to the format name, as described above under `-f`.
335 See `--list-output-formats` and `--list-extensions`, below.
337`-o` *FILE*, `--output=`*FILE*
339: Write output to *FILE* instead of *stdout*. If *FILE* is
340 `-`, output will go to *stdout*, even if a non-textual format
341 (`docx`, `odt`, `epub2`, `epub3`) is specified.
343`--data-dir=`*DIRECTORY*
345: Specify the user data directory to search for pandoc data files.
346 If this option is not specified, the default user data directory
347 will be used. This is, in UNIX:
349 $HOME/.pandoc
351 in Windows XP:
353 C:\Documents And Settings\USERNAME\Application Data\pandoc
355 and in Windows Vista or later:
357 C:\Users\USERNAME\AppData\Roaming\pandoc
359 You can find the default user data directory on your system by
360 looking at the output of `pandoc --version`.
361 A `reference.odt`, `reference.docx`, `epub.css`, `templates`,
362 `slidy`, `slideous`, or `s5` directory
363 placed in this directory will override pandoc's normal defaults.
365`--bash-completion`
367: Generate a bash completion script. To enable bash completion
368 with pandoc, add this to your `.bashrc`:
370 eval "$(pandoc --bash-completion)"
372`--verbose`
374: Give verbose debugging output. Currently this only has an effect
375 with PDF output.
377`--quiet`
379: Suppress warning messages.
381`--fail-if-warnings`
383: Exit with error status if there are any warnings.
385`--log=`*FILE*
387: Write log messages in machine-readable JSON format to
388 *FILE*. All messages above DEBUG level will be written,
389 regardless of verbosity settings (`--verbose`, `--quiet`).
391`--list-input-formats`
393: List supported input formats, one per line.
395`--list-output-formats`
397: List supported output formats, one per line.
399`--list-extensions`
401: List supported Markdown extensions, one per line, followed
402 by a `+` or `-` indicating whether it is enabled by default
403 in pandoc's Markdown.
405`--list-highlight-languages`
407: List supported languages for syntax highlighting, one per
408 line.
410`--list-highlight-styles`
412: List supported styles for syntax highlighting, one per line.
413 See `--highlight-style`.
415`-v`, `--version`
417: Print version.
419`-h`, `--help`
421: Show usage message.
423Reader options
424--------------
426`--base-header-level=`*NUMBER*
428: Specify the base level for headers (defaults to 1).
430`--indented-code-classes=`*CLASSES*
432: Specify classes to use for indented code blocks--for example,
433 `perl,numberLines` or `haskell`. Multiple classes may be separated
434 by spaces or commas.
436`--default-image-extension=`*EXTENSION*
438: Specify a default extension to use when image paths/URLs have no
439 extension. This allows you to use the same source for formats that
440 require different kinds of images. Currently this option only affects
441 the Markdown and LaTeX readers.
443`--file-scope`
445: Parse each file individually before combining for multifile
446 documents. This will allow footnotes in different files with the
447 same identifiers to work as expected. If this option is set,
448 footnotes and links will not work across files. Reading binary
449 files (docx, odt, epub) implies `--file-scope`.
451`--filter=`*PROGRAM*
453: Specify an executable to be used as a filter transforming the
454 pandoc AST after the input is parsed and before the output is
455 written. The executable should read JSON from stdin and write
456 JSON to stdout. The JSON must be formatted like pandoc's own
457 JSON input and output. The name of the output format will be
458 passed to the filter as the first argument. Hence,
460 pandoc --filter ./caps.py -t latex
462 is equivalent to
464 pandoc -t json | ./caps.py latex | pandoc -f json -t latex
466 The latter form may be useful for debugging filters.
468 Filters may be written in any language. `Text.Pandoc.JSON`
469 exports `toJSONFilter` to facilitate writing filters in Haskell.
470 Those who would prefer to write filters in python can use the
471 module [`pandocfilters`], installable from PyPI. There are also
472 pandoc filter libraries in [PHP], [perl], and
473 [JavaScript/node.js].
475 In order of preference, pandoc will look for filters in
477 1. a specified full or relative path (executable or
478 non-executable)
480 2. `$DATADIR/filters` (executable or non-executable)
481 where `$DATADIR` is the user data directory (see
482 `--data-dir`, above).
484 3. `$PATH` (executable only)
486`--lua-filter=`*SCRIPT*
488: Transform the document in a similar fashion as JSON filters (see
489 `--filter`), but use pandoc's build-in lua filtering system. The given
490 lua script is expected to return a list of lua filters which will be
491 applied in order. Each lua filter must contain element-transforming
492 functions indexed by the name of the AST element on which the filter
493 function should be applied.
495 The `pandoc` lua module provides helper functions for element
496 creation. It is always loaded into the script's lua environment.
498 The following is an example lua script for macro-expansion:
500 function expand_hello_world(inline)
501 if inline.c == '{{helloworld}}' then
502 return pandoc.Emph{ pandoc.Str "Hello, World" }
503 else
504 return inline
505 end
506 end
508 return {{Str = expand_hello_world}}
511`-M` *KEY*[`=`*VAL*], `--metadata=`*KEY*[`:`*VAL*]
513: Set the metadata field *KEY* to the value *VAL*. A value specified
514 on the command line overrides a value specified in the document.
515 Values will be parsed as YAML boolean or string values. If no value is
516 specified, the value will be treated as Boolean true. Like
517 `--variable`, `--metadata` causes template variables to be set.
518 But unlike `--variable`, `--metadata` affects the metadata of the
519 underlying document (which is accessible from filters and may be
520 printed in some output formats).
522`-p`, `--preserve-tabs`
524: Preserve tabs instead of converting them to spaces (the default).
525 Note that this will only affect tabs in literal code spans and code
526 blocks; tabs in regular text will be treated as spaces.
528`--tab-stop=`*NUMBER*
530: Specify the number of spaces per tab (default is 4).
532`--track-changes=accept`|`reject`|`all`
534: Specifies what to do with insertions, deletions, and comments
535 produced by the MS Word "Track Changes" feature. `accept` (the
536 default), inserts all insertions, and ignores all
537 deletions. `reject` inserts all deletions and ignores
538 insertions. Both `accept` and `reject` ignore comments. `all` puts
539 in insertions, deletions, and comments, wrapped in spans with
540 `insertion`, `deletion`, `comment-start`, and `comment-end`
541 classes, respectively. The author and time of change is
542 included. `all` is useful for scripting: only accepting changes
543 from a certain reviewer, say, or before a certain date. This
544 option only affects the docx reader.
546`--extract-media=`*DIR*
548: Extract images and other media contained in or linked from
549 the source document to the path *DIR*, creating it if
550 necessary, and adjust the images references in the document
551 so they point to the extracted files. If the source format is
552 a binary container (docx, epub, or odt), the media is
553 extracted from the container and the original
554 filenames are used. Otherwise the media is read from the
555 file system or downloaded, and new filenames are constructed
556 based on SHA1 hashes of the contents.
558`--abbreviations=`*FILE*
560: Specifies a custom abbreviations file, with abbreviations
561 one to a line. If this option is not specified, pandoc will
562 read the data file `abbreviations` from the user data
563 directory or fall back on a system default. To see the
564 system default, use
565 `pandoc --print-default-data-file=abbreviations`. The only
566 use pandoc makes of this list is in the Markdown reader.
567 Strings ending in a period that are found in this list will
568 be followed by a nonbreaking space, so that the period will
569 not produce sentence-ending space in formats like LaTeX.
571[`pandocfilters`]: https://github.com/jgm/pandocfilters
572[PHP]: https://github.com/vinai/pandocfilters-php
573[perl]: https://metacpan.org/pod/Pandoc::Filter
574[JavaScript/node.js]: https://github.com/mvhenderson/pandoc-filter-node
576General writer options
577----------------------
579`-s`, `--standalone`
581: Produce output with an appropriate header and footer (e.g. a
582 standalone HTML, LaTeX, TEI, or RTF file, not a fragment). This option
583 is set automatically for `pdf`, `epub`, `epub3`, `fb2`, `docx`, and `odt`
584 output.
586`--template=`*FILE*
588: Use *FILE* as a custom template for the generated document. Implies
589 `--standalone`. See [Templates], below, for a description
590 of template syntax. If no extension is specified, an extension
591 corresponding to the writer will be added, so that `--template=special`
592 looks for `special.html` for HTML output. If the template is not
593 found, pandoc will search for it in the `templates` subdirectory of
594 the user data directory (see `--data-dir`). If this option is not used,
595 a default template appropriate for the output format will be used (see
596 `-D/--print-default-template`).
598`-V` *KEY*[`=`*VAL*], `--variable=`*KEY*[`:`*VAL*]
600: Set the template variable *KEY* to the value *VAL* when rendering the
601 document in standalone mode. This is generally only useful when the
602 `--template` option is used to specify a custom template, since
603 pandoc automatically sets the variables used in the default
604 templates. If no *VAL* is specified, the key will be given the
605 value `true`.
607`-D` *FORMAT*, `--print-default-template=`*FORMAT*
609: Print the system default template for an output *FORMAT*. (See `-t`
610 for a list of possible *FORMAT*s.) Templates in the user data
611 directory are ignored.
613`--print-default-data-file=`*FILE*
615: Print a system default data file. Files in the user data directory
616 are ignored.
618`--eol=crlf`|`lf`|`native`
620: Manually specify line endings: `crlf` (Windows), `lf`
621 (macOS/Linux/UNIX), or `native` (line endings appropriate
622 to the OS on which pandoc is being run). The default is
623 `native`.
625`--dpi`=*NUMBER*
627: Specify the dpi (dots per inch) value for conversion from pixels
628 to inch/centimeters and vice versa. The default is 96dpi.
629 Technically, the correct term would be ppi (pixels per inch).
631`--wrap=auto`|`none`|`preserve`
633: Determine how text is wrapped in the output (the source
634 code, not the rendered version). With `auto` (the default),
635 pandoc will attempt to wrap lines to the column width specified by
636 `--columns` (default 72). With `none`, pandoc will not wrap
637 lines at all. With `preserve`, pandoc will attempt to
638 preserve the wrapping from the source document (that is,
639 where there are nonsemantic newlines in the source, there
640 will be nonsemantic newlines in the output as well).
641 Automatic wrapping does not currently work in HTML output.
643`--columns=`*NUMBER*
645: Specify length of lines in characters. This affects text wrapping
646 in the generated source code (see `--wrap`). It also affects
647 calculation of column widths for plain text tables (see [Tables] below).
649`--toc`, `--table-of-contents`
651: Include an automatically generated table of contents (or, in
652 the case of `latex`, `context`, `docx`, `odt`,
653 `opendocument`, `rst`, or `ms`, an instruction to create
654 one) in the output document. This option has no effect on
655 `man`, `docbook4`, `docbook5`, or `jats` output.
657`--toc-depth=`*NUMBER*
659: Specify the number of section levels to include in the table
660 of contents. The default is 3 (which means that level 1, 2, and 3
661 headers will be listed in the contents).
663`--strip-comments`
665: Strip out HTML comments in the Markdown or Textile source,
666 rather than passing them on to Markdown, Textile or HTML
667 output as raw HTML. This does not apply to HTML comments
668 inside raw HTML blocks when the `markdown_in_html_blocks`
669 extension is not set.
671`--no-highlight`
673: Disables syntax highlighting for code blocks and inlines, even when
674 a language attribute is given.
676`--highlight-style=`*STYLE*|*FILE*
678: Specifies the coloring style to be used in highlighted source code.
679 Options are `pygments` (the default), `kate`, `monochrome`,
680 `breezeDark`, `espresso`, `zenburn`, `haddock`, and `tango`.
681 For more information on syntax highlighting in pandoc, see
682 [Syntax highlighting], below. See also
683 `--list-highlight-styles`.
685 Instead of a *STYLE* name, a JSON file with extension
686 `.theme` may be supplied. This will be parsed as a KDE
687 syntax highlighting theme and (if valid) used as the
688 highlighting style. To see a sample theme that can be
689 modified, `pandoc --print-default-data-file default.theme`.
691`--syntax-definition=`*FILE*
693: Instructs pandoc to load a KDE XML syntax definition file,
694 which will be used for syntax highlighting of appropriately
695 marked code blocks. This can be used to add support for
696 new languages or to use altered syntax definitions for
697 existing languages.
699`-H` *FILE*, `--include-in-header=`*FILE*
701: Include contents of *FILE*, verbatim, at the end of the header.
702 This can be used, for example, to include special
703 CSS or JavaScript in HTML documents. This option can be used
704 repeatedly to include multiple files in the header. They will be
705 included in the order specified. Implies `--standalone`.
707`-B` *FILE*, `--include-before-body=`*FILE*
709: Include contents of *FILE*, verbatim, at the beginning of the
710 document body (e.g. after the `<body>` tag in HTML, or the
711 `\begin{document}` command in LaTeX). This can be used to include
712 navigation bars or banners in HTML documents. This option can be
713 used repeatedly to include multiple files. They will be included in
714 the order specified. Implies `--standalone`.
716`-A` *FILE*, `--include-after-body=`*FILE*
718: Include contents of *FILE*, verbatim, at the end of the document
719 body (before the `</body>` tag in HTML, or the
720 `\end{document}` command in LaTeX). This option can be used
721 repeatedly to include multiple files. They will be included in the
722 order specified. Implies `--standalone`.
724`--resource-path=`*SEARCHPATH*
726: List of paths to search for images and other resources.
727 The paths should be separated by `:` on Linux, UNIX, and
728 macOS systems, and by `;` on Windows. If `--resource-path`
729 is not specified, the default resource path is the working
730 directory. Note that, if `--resource-path` is specified,
731 the working directory must be explicitly listed or it
732 will not be searched. For example:
733 `--resource-path=.:test` will search the working directory
734 and the `test` subdirectory, in that order.
736`--request-header=`*NAME*`:`*VAL*
738: Set the request header *NAME* to the value *VAL* when making
739 HTTP requests (for example, when a URL is given on the
740 command line, or when resources used in a document must be
741 downloaded).
743Options affecting specific writers
744----------------------------------
746`--self-contained`
748: Produce a standalone HTML file with no external dependencies, using
749 `data:` URIs to incorporate the contents of linked scripts, stylesheets,
750 images, and videos. The resulting file should be "self-contained,"
751 in the sense that it needs no external files and no net access to be
752 displayed properly by a browser. This option works only with HTML output
753 formats, including `html4`, `html5`, `html+lhs`, `html5+lhs`, `s5`,
754 `slidy`, `slideous`, `dzslides`, and `revealjs`. Scripts, images, and
755 stylesheets at absolute URLs will be downloaded; those at relative URLs
756 will be sought relative to the working directory (if the first source
757 file is local) or relative to the base URL (if the first source
758 file is remote). Elements with the attribute
759 `data-external="1"` will be left alone; the documents they
760 link to will not be incorporated in the document.
761 Limitation: resources that are loaded dynamically through
762 JavaScript cannot be incorporated; as a result,
763 `--self-contained` does not work with `--mathjax`, and some
764 advanced features (e.g. zoom or speaker notes) may not work
765 in an offline "self-contained" `reveal.js` slide show.
767`--html-q-tags`
769: Use `<q>` tags for quotes in HTML.
771`--ascii`
773: Use only ASCII characters in output. Currently supported only for
774 HTML and DocBook output (which uses numerical entities instead of
775 UTF-8 when this option is selected).
777`--reference-links`
779: Use reference-style links, rather than inline links, in writing Markdown
780 or reStructuredText. By default inline links are used. The
781 placement of link references is affected by the
782 `--reference-location` option.
784`--reference-location = block`|`section`|`document`
786: Specify whether footnotes (and references, if `reference-links` is
787 set) are placed at the end of the current (top-level) block, the
788 current section, or the document. The default is
789 `document`. Currently only affects the markdown writer.
791`--atx-headers`
793: Use ATX-style headers in Markdown and AsciiDoc output. The default is
794 to use setext-style headers for levels 1-2, and then ATX headers.
795 (Note: for `gfm` output, ATX headers are always used.)
797`--top-level-division=[default|section|chapter|part]`
799: Treat top-level headers as the given division type in LaTeX, ConTeXt,
800 DocBook, and TEI output. The hierarchy order is part, chapter, then section;
801 all headers are shifted such that the top-level header becomes the specified
802 type. The default behavior is to determine the best division type via
803 heuristics: unless other conditions apply, `section` is chosen. When the
804 LaTeX document class is set to `report`, `book`, or `memoir` (unless the
805 `article` option is specified), `chapter` is implied as the setting for this
806 option. If `beamer` is the output format, specifying either `chapter` or
807 `part` will cause top-level headers to become `\part{..}`, while
808 second-level headers remain as their default type.
810`-N`, `--number-sections`
812: Number section headings in LaTeX, ConTeXt, HTML, or EPUB output.
813 By default, sections are not numbered. Sections with class
814 `unnumbered` will never be numbered, even if `--number-sections`
815 is specified.
817`--number-offset=`*NUMBER*[`,`*NUMBER*`,`*...*]
819: Offset for section headings in HTML output (ignored in other
820 output formats). The first number is added to the section number for
821 top-level headers, the second for second-level headers, and so on.
822 So, for example, if you want the first top-level header in your
823 document to be numbered "6", specify `--number-offset=5`.
824 If your document starts with a level-2 header which you want to
825 be numbered "1.5", specify `--number-offset=1,4`.
826 Offsets are 0 by default. Implies `--number-sections`.
828`--listings`
830: Use the [`listings`] package for LaTeX code blocks
832`-i`, `--incremental`
834: Make list items in slide shows display incrementally (one by one).
835 The default is for lists to be displayed all at once.
837`--slide-level=`*NUMBER*
839: Specifies that headers with the specified level create
840 slides (for `beamer`, `s5`, `slidy`, `slideous`, `dzslides`). Headers
841 above this level in the hierarchy are used to divide the
842 slide show into sections; headers below this level create
843 subheads within a slide. Note that content that is
844 not contained under slide-level headers will not appear in
845 the slide show. The default is to set the slide level based
846 on the contents of the document; see [Structuring the slide
847 show].
849`--section-divs`
851: Wrap sections in `<div>` tags (or `<section>` tags in HTML5),
852 and attach identifiers to the enclosing `<div>` (or `<section>`)
853 rather than the header itself. See
854 [Header identifiers], below.
856`--email-obfuscation=none`|`javascript`|`references`
858: Specify a method for obfuscating `mailto:` links in HTML documents.
859 `none` leaves `mailto:` links as they are. `javascript` obfuscates
860 them using JavaScript. `references` obfuscates them by printing their
861 letters as decimal or hexadecimal character references. The default
862 is `none`.
864`--id-prefix=`*STRING*
866: Specify a prefix to be added to all identifiers and internal links
867 in HTML and DocBook output, and to footnote numbers in Markdown
868 and Haddock output. This is useful for preventing duplicate
869 identifiers when generating fragments to be included in other pages.
871`-T` *STRING*, `--title-prefix=`*STRING*
873: Specify *STRING* as a prefix at the beginning of the title
874 that appears in the HTML header (but not in the title as it
875 appears at the beginning of the HTML body). Implies
876 `--standalone`.
878`-c` *URL*, `--css=`*URL*
880: Link to a CSS style sheet. This option can be used repeatedly to
881 include multiple files. They will be included in the order specified.
883 A stylesheet is required for generating EPUB. If none is
884 provided using this option (or the `stylesheet` metadata
885 field), pandoc will look for a file `epub.css` in the
886 user data directory (see `--data-dir`). If it is not
887 found there, sensible defaults will be used.
889`--reference-doc=`*FILE*
891: Use the specified file as a style reference in producing a
892 docx or ODT file.
894 Docx
896 : For best results, the reference docx should be a modified
897 version of a docx file produced using pandoc. The contents
898 of the reference docx are ignored, but its stylesheets and
899 document properties (including margins, page size, header,
900 and footer) are used in the new docx. If no reference docx
901 is specified on the command line, pandoc will look for a
902 file `reference.docx` in the user data directory (see
903 `--data-dir`). If this is not found either, sensible
904 defaults will be used.
906 To produce a custom `reference.docx`, first get a copy of
907 the default `reference.docx`: `pandoc
908 --print-default-data-file reference.docx >
909 custom-reference.docx`. Then open `custom-reference.docx`
910 in Word, modify the styles as you wish, and save the file.
911 For best results, do not make changes to this file other
912 than modifying the styles used by pandoc: [paragraph]
913 Normal, Body Text, First Paragraph, Compact, Title,
914 Subtitle, Author, Date, Abstract, Bibliography, Heading 1,
915 Heading 2, Heading 3, Heading 4, Heading 5, Heading 6,
916 Heading 7, Heading 8, Heading 9, Block Text, Footnote Text,
917 Definition Term, Definition, Caption, Table Caption,
918 Image Caption, Figure, Captioned Figure, TOC Heading;
919 [character] Default Paragraph Font, Body Text Char,
920 Verbatim Char, Footnote Reference, Hyperlink; [table]
921 Table.
923 ODT
925 : For best results, the reference ODT should be a modified
926 version of an ODT produced using pandoc. The contents of
927 the reference ODT are ignored, but its stylesheets are used
928 in the new ODT. If no reference ODT is specified on the
929 command line, pandoc will look for a file `reference.odt` in
930 the user data directory (see `--data-dir`). If this is not
931 found either, sensible defaults will be used.
933 To produce a custom `reference.odt`, first get a copy of
934 the default `reference.odt`: `pandoc
935 --print-default-data-file reference.odt >
936 custom-reference.odt`. Then open `custom-reference.odt` in
937 LibreOffice, modify the styles as you wish, and save the
938 file.
940`--epub-cover-image=`*FILE*
942: Use the specified image as the EPUB cover. It is recommended
943 that the image be less than 1000px in width and height. Note that
944 in a Markdown source document you can also specify `cover-image`
945 in a YAML metadata block (see [EPUB Metadata], below).
947`--epub-metadata=`*FILE*
949: Look in the specified XML file for metadata for the EPUB.
950 The file should contain a series of [Dublin Core elements].
951 For example:
953 <dc:rights>Creative Commons</dc:rights>
954 <dc:language>es-AR</dc:language>
956 By default, pandoc will include the following metadata elements:
957 `<dc:title>` (from the document title), `<dc:creator>` (from the
958 document authors), `<dc:date>` (from the document date, which should
959 be in [ISO 8601 format]), `<dc:language>` (from the `lang`
960 variable, or, if is not set, the locale), and `<dc:identifier
961 id="BookId">` (a randomly generated UUID). Any of these may be
962 overridden by elements in the metadata file.
964 Note: if the source document is Markdown, a YAML metadata block
965 in the document can be used instead. See below under
966 [EPUB Metadata].
968`--epub-embed-font=`*FILE*
970: Embed the specified font in the EPUB. This option can be repeated
971 to embed multiple fonts. Wildcards can also be used: for example,
972 `DejaVuSans-*.ttf`. However, if you use wildcards on the command
973 line, be sure to escape them or put the whole filename in single quotes,
974 to prevent them from being interpreted by the shell. To use the
975 embedded fonts, you will need to add declarations like the following
976 to your CSS (see `--css`):
978 @font-face {
979 font-family: DejaVuSans;
980 font-style: normal;
981 font-weight: normal;
982 src:url("DejaVuSans-Regular.ttf");
983 }
984 @font-face {
985 font-family: DejaVuSans;
986 font-style: normal;
987 font-weight: bold;
988 src:url("DejaVuSans-Bold.ttf");
989 }
990 @font-face {
991 font-family: DejaVuSans;
992 font-style: italic;
993 font-weight: normal;
994 src:url("DejaVuSans-Oblique.ttf");
995 }
996 @font-face {
997 font-family: DejaVuSans;
998 font-style: italic;
999 font-weight: bold;
1000 src:url("DejaVuSans-BoldOblique.ttf");
1002 body { font-family: "DejaVuSans"; }
1004`--epub-chapter-level=`*NUMBER*
1006: Specify the header level at which to split the EPUB into separate
1007 "chapter" files. The default is to split into chapters at level 1
1008 headers. This option only affects the internal composition of the
1009 EPUB, not the way chapters and sections are displayed to users. Some
1010 readers may be slow if the chapter files are too large, so for large
1011 documents with few level 1 headers, one might want to use a chapter
1012 level of 2 or 3.
1014`--epub-subdirectory=`*DIRNAME*
1016: Specify the subdirectory in the OCF container that is to hold
1017 the EPUB-specific contents. The default is `EPUB`. To put
1018 the EPUB contents in the top level, use an empty string.
1020`--pdf-engine=pdflatex`|`lualatex`|`xelatex`|`wkhtmltopdf`|`weasyprint`|`prince`|`context`|`pdfroff`
1022: Use the specified engine when producing PDF output.
1023 The default is `pdflatex`. If the engine is not in your PATH,
1024 the full path of the engine may be specified here.
1026`--pdf-engine-opt=`*STRING*
1028: Use the given string as a command-line argument to the `pdf-engine`.
1029 If used multiple times, the arguments are provided with spaces between
1030 them. Note that no check for duplicate options is done.
1032[Dublin Core elements]: http://dublincore.org/documents/dces/
1033[ISO 8601 format]: http://www.w3.org/TR/NOTE-datetime
1035Citation rendering
1036------------------
1038`--bibliography=`*FILE*
1040: Set the `bibliography` field in the document's metadata to *FILE*,
1041 overriding any value set in the metadata, and process citations
1042 using `pandoc-citeproc`. (This is equivalent to
1043 `--metadata bibliography=FILE --filter pandoc-citeproc`.)
1044 If `--natbib` or `--biblatex` is also supplied, `pandoc-citeproc` is not
1045 used, making this equivalent to `--metadata bibliography=FILE`.
1046 If you supply this argument multiple times, each *FILE* will be added
1047 to bibliography.
1049`--csl=`*FILE*
1051: Set the `csl` field in the document's metadata to *FILE*,
1052 overriding any value set in the metadata. (This is equivalent to
1053 `--metadata csl=FILE`.)
1054 This option is only relevant with `pandoc-citeproc`.
1056`--citation-abbreviations=`*FILE*
1058: Set the `citation-abbreviations` field in the document's metadata to
1059 *FILE*, overriding any value set in the metadata. (This is equivalent to
1060 `--metadata citation-abbreviations=FILE`.)
1061 This option is only relevant with `pandoc-citeproc`.
1063`--natbib`
1065: Use [`natbib`] for citations in LaTeX output. This option is not for use
1066 with the `pandoc-citeproc` filter or with PDF output. It is intended for
1067 use in producing a LaTeX file that can be processed with [`bibtex`].
1069`--biblatex`
1071: Use [`biblatex`] for citations in LaTeX output. This option is not for use
1072 with the `pandoc-citeproc` filter or with PDF output. It is intended for
1073 use in producing a LaTeX file that can be processed with [`bibtex`] or [`biber`].
1075Math rendering in HTML
1076----------------------
1078The default is to render TeX math as far as possible using Unicode characters.
1079Formulas are put inside a `span` with `class="math"`, so that they may be styled
1080differently from the surrounding text if needed. However, this gives acceptable
1081results only for basic math, usually you will want to use `--mathjax` or another
1082of the following options.
1084`--mathjax`[`=`*URL*]
1086: Use [MathJax] to display embedded TeX math in HTML output.
1087 TeX math will be put between `\(...\)` (for inline math)
1088 or `\[...\]` (for display math) and wrapped in `<span>` tags
1089 with class `math`. Then the MathJax JavaScript will render it.
1090 The *URL* should point to the `MathJax.js` load script.
1091 If a *URL* is not provided, a link to the Cloudflare CDN will
1092 be inserted.
1094`--mathml`
1096: Convert TeX math to [MathML] (in `epub3`, `docbook4`, `docbook5`, `jats`,
1097 `html4` and `html5`). This is the default in `odt` output. Note that
1098 currently only Firefox and Safari (and select e-book readers) natively
1099 support MathML.
1101`--webtex`[`=`*URL*]
1103: Convert TeX formulas to `<img>` tags that link to an external script
1104 that converts formulas to images. The formula will be URL-encoded
1105 and concatenated with the URL provided. For SVG images you can for
1106 example use `--webtex https://latex.codecogs.com/svg.latex?`.
1107 If no URL is specified, the CodeCogs URL generating PNGs
1108 will be used (`https://latex.codecogs.com/png.latex?`).
1109 Note: the `--webtex` option will affect Markdown output
1110 as well as HTML, which is useful if you're targeting a
1111 version of Markdown without native math support.
1113`--katex`[`=`*URL*]
1115: Use [KaTeX] to display embedded TeX math in HTML output.
1116 The *URL* is the base URL for the KaTeX library. If a *URL* is
1117 not provided, a link to the KaTeX CDN will be inserted.
1119`--katex-stylesheet=`*URL*
1121: The *URL* should point to the `katex.css` stylesheet. If this option is
1122 not specified, a link to the KaTeX CDN will be inserted. Note that this
1123 option does not imply `--katex`.
1125`-m` [*URL*], `--latexmathml`[`=`*URL*]
1127: *Deprecated.*
1128 Use the [LaTeXMathML] script to display embedded TeX math in HTML output.
1129 TeX math will be displayed between `$` or `$$` characters and put in
1130 `<span>` tags with class `LaTeX`. The LaTeXMathML JavaScript will then
1131 change it to MathML. Note that currently only Firefox and Safari
1132 (and select e-book readers) natively support MathML.
1133 To insert a link the `LaTeXMathML.js` script, provide a *URL*.
1135`--jsmath`[`=`*URL*]
1137: *Deprecated.*
1138 Use [jsMath] (the predecessor of MathJax) to display embedded TeX
1139 math in HTML output. TeX math will be put inside `<span>` tags
1140 (for inline math) or `<div>` tags (for display math) with class
1141 `math` and rendered by the jsMath script. The *URL* should point to
1142 the script (e.g. `jsMath/easy/load.js`); if provided, it will be linked
1143 to in the header of standalone HTML documents. If a *URL* is not provided,
1144 no link to the jsMath load script will be inserted; it is then
1145 up to the author to provide such a link in the HTML template.
1147`--gladtex`
1149: *Deprecated.*
1150 Enclose TeX math in `<eq>` tags in HTML output. The resulting HTML
1151 can then be processed by [gladTeX] to produce images of the typeset
1152 formulas and an HTML file with links to these images.
1153 So, the procedure is:
1155 pandoc -s --gladtex input.md -o myfile.htex
1156 gladtex -d myfile-images myfile.htex
1157 # produces myfile.html and images in myfile-images
1159`--mimetex`[`=`*URL*]
1161: *Deprecated.*
1162 Render TeX math using the [mimeTeX] CGI script, which generates an
1163 image for each TeX formula. This should work in all browsers. If
1164 *URL* is not specified, it is assumed that the script is at
1165 `/cgi-bin/mimetex.cgi`.
1167[MathML]: http://www.w3.org/Math/
1168[LaTeXMathML]: http://math.etsu.edu/LaTeXMathML/
1169[jsMath]: http://www.math.union.edu/~dpvc/jsmath/
1170[MathJax]: https://www.mathjax.org
1171[gladTeX]: http://ans.hsh.no/home/mgg/gladtex/
1172[mimeTeX]: http://www.forkosh.com/mimetex.html
1173[KaTeX]: https://github.com/Khan/KaTeX
1175Options for wrapper scripts
1176---------------------------
1178`--dump-args`
1180: Print information about command-line arguments to *stdout*, then exit.
1181 This option is intended primarily for use in wrapper scripts.
1182 The first line of output contains the name of the output file specified
1183 with the `-o` option, or `-` (for *stdout*) if no output file was
1184 specified. The remaining lines contain the command-line arguments,
1185 one per line, in the order they appear. These do not include regular
1186 pandoc options and their arguments, but do include any options appearing
1187 after a `--` separator at the end of the line.
1189`--ignore-args`
1191: Ignore command-line arguments (for use in wrapper scripts).
1192 Regular pandoc options are not ignored. Thus, for example,
1194 pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1
1196 is equivalent to
1198 pandoc -o foo.html -s
1200Templates
1201=========
1203When the `-s/--standalone` option is used, pandoc uses a template to
1204add header and footer material that is needed for a self-standing
1205document. To see the default template that is used, just type
1207 pandoc -D *FORMAT*
1209where *FORMAT* is the name of the output format. A custom template
1210can be specified using the `--template` option. You can also override
1211the system default templates for a given output format *FORMAT*
1212by putting a file `templates/default.*FORMAT*` in the user data
1213directory (see `--data-dir`, above). *Exceptions:*
1215- For `odt` output, customize the `default.opendocument`
1216 template.
1217- For `pdf` output, customize the `default.latex` template
1218 (or the `default.context` template, if you use `-t context`,
1219 or the `default.ms` template, if you use `-t ms`, or the
1220 `default.html5` template, if you use `-t html5`).
1221- `docx` has no template (however, you can use
1222 `--reference-doc` to customize the output).
1224Templates contain *variables*, which allow for the inclusion of
1225arbitrary information at any point in the file. Variables may be set
1226within the document using [YAML metadata blocks][Extension:
1227`yaml_metadata_block`]. They may also be set at the
1228command line using the `-V/--variable` option: variables set in this
1229way override metadata fields with the same name.
1231Variables set by pandoc
1232-----------------------
1234Some variables are set automatically by pandoc. These vary somewhat
1235depending on the output format, but include metadata fields as well
1236as the following:
1238`sourcefile`, `outputfile`
1239: source and destination filenames, as given on the command line.
1240 `sourcefile` can also be a list if input comes from multiple files, or empty
1241 if input is from stdin. You can use the following snippet in your template
1242 to distinguish them:
1244 $if(sourcefile)$
1245 $for(sourcefile)$
1246 $sourcefile$
1247 $endfor$
1248 $else$
1249 (stdin)
1250 $endif$
1252 Similarly, `outputfile` can be `-` if output goes to the terminal.
1254`title`, `author`, `date`
1255: allow identification of basic aspects of the document. Included
1256 in PDF metadata through LaTeX and ConTeXt. These can be set
1257 through a [pandoc title block][Extension: `pandoc_title_block`],
1258 which allows for multiple authors, or through a YAML metadata block:
1260 ---
1261 author:
1262 - Aristotle
1263 - Peter Abelard
1264 ...
1266`subtitle`
1267: document subtitle, included in HTML, EPUB, LaTeX, ConTeXt, and Word docx;
1268 renders in LaTeX only when using a document class that supports
1269 `\subtitle`, such as `beamer` or the [KOMA-Script] series (`scrartcl`,
1270 `scrreprt`, `scrbook`).[^subtitle]
1272`institute`
1273: author affiliations (in LaTeX and Beamer only). Can be a
1274 list, when there are multiple authors.
1276`abstract`
1277: document summary, included in LaTeX, ConTeXt, AsciiDoc, and Word docx
1279`keywords`
1280: list of keywords to be included in HTML, PDF, and AsciiDoc metadata;
1281 may be repeated as for `author`, above
1283`header-includes`
1284: contents specified by `-H/--include-in-header` (may have multiple
1285 values)
1287`toc`
1288: non-null value if `--toc/--table-of-contents` was specified
1290`toc-title`
1291: title of table of contents (works only with EPUB,
1292 opendocument, odt, docx)
1294`include-before`
1295: contents specified by `-B/--include-before-body` (may have
1296 multiple values)
1298`include-after`
1299: contents specified by `-A/--include-after-body` (may have
1300 multiple values)
1302`body`
1303: body of document
1305`meta-json`
1306: JSON representation of all of the document's metadata. Field
1307 values are transformed to the selected output format.
1309[^subtitle]: To make `subtitle` work with other LaTeX
1310 document classes, you can add the following to `header-includes`:
1312 \providecommand{\subtitle}[1]{%
1313 \usepackage{titling}
1314 \posttitle{%
1315 \par\large#1\end{center}}
1318Language variables
1319------------------
1321`lang`
1322: identifies the main language of the document,
1323 using a code according to [BCP 47] (e.g. `en` or `en-GB`).
1324 For some output formats, pandoc will convert it to an appropriate
1325 format stored in the additional variables `babel-lang`,
1326 `polyglossia-lang` (LaTeX) and `context-lang` (ConTeXt).
1328 Native pandoc `span`s and `div`s with the lang attribute
1329 (value in BCP 47) can be used to switch the language in
1330 that range.
1332`otherlangs`
1333: a list of other languages used in the document
1334 in the YAML metadata, according to [BCP 47]. For example:
1335 `otherlangs: [en-GB, fr]`.
1336 This is automatically generated from the `lang` attributes
1337 in all `span`s and `div`s but can be overridden.
1338 Currently only used by LaTeX through the generated
1339 `babel-otherlangs` and `polyglossia-otherlangs` variables.
1340 The LaTeX writer outputs polyglossia commands in the text but
1341 the `babel-newcommands` variable contains mappings for them
1342 to the corresponding babel.
1344`dir`
1345: the base direction of the document, either `rtl` (right-to-left)
1346 or `ltr` (left-to-right).
1348 For bidirectional documents, native pandoc `span`s and `div`s
1349 with the `dir` attribute (value `rtl` or `ltr`) can be used to
1350 override the base direction in some output formats.
1351 This may not always be necessary if the final renderer
1352 (e.g. the browser, when generating HTML) supports the
1353 [Unicode Bidirectional Algorithm].
1355 When using LaTeX for bidirectional documents, only the `xelatex` engine
1356 is fully supported (use `--pdf-engine=xelatex`).
1358[BCP 47]: https://tools.ietf.org/html/bcp47
1359[Unicode Bidirectional Algorithm]: http://www.w3.org/International/articles/inline-bidi-markup/uba-basics
1361Variables for slides
1362--------------------
1364Variables are available for [producing slide shows with pandoc],
1365including all [reveal.js configuration options].
1367`titlegraphic`
1368: title graphic for Beamer documents
1370`logo`
1371: logo for Beamer documents
1373`slidy-url`
1374: base URL for Slidy documents (defaults to
1375 `https://www.w3.org/Talks/Tools/Slidy2`)
1377`slideous-url`
1378: base URL for Slideous documents (defaults to `slideous`)
1380`s5-url`
1381: base URL for S5 documents (defaults to `s5/default`)
1383`revealjs-url`
1384: base URL for reveal.js documents (defaults to `reveal.js`)
1386`theme`, `colortheme`, `fonttheme`, `innertheme`, `outertheme`
1387: themes for LaTeX [`beamer`] documents
1389`themeoptions`
1390: options for LaTeX beamer themes (a list).
1392`navigation`
1393: controls navigation symbols in `beamer` documents
1394 (default is `empty` for no navigation symbols; other valid values
1395 are `frame`, `vertical`, and `horizontal`).
1397`section-titles`
1398: enables on "title pages" for new sections in `beamer`
1399 documents (default = true).
1401`beamerarticle`
1402: when true, the `beamerarticle` package is loaded (for
1403 producing an article from beamer slides).
1405`aspectratio`
1406: aspect ratio of slides (for beamer only, `1610` for 16:10, `169` for 16:9,
1407 `149` for 14:9, `141` for 1.41:1, `54` for 5:4, `43` for 4:3 which is the
1408 default, and `32` for 3:2).
1410[reveal.js configuration options]: https://github.com/hakimel/reveal.js#configuration
1412Variables for LaTeX
1413-------------------
1415LaTeX variables are used when [creating a PDF].
1417`papersize`
1418: paper size, e.g. `letter`, `a4`
1420`fontsize`
1421: font size for body text (e.g. `10pt`, `12pt`)
1423`documentclass`
1424: document class, e.g. [`article`], [`report`], [`book`], [`memoir`]
1426`classoption`
1427: option for document class, e.g. `oneside`; may be repeated
1428 for multiple options
1430`geometry`
1431: option for [`geometry`] package, e.g. `margin=1in`;
1432 may be repeated for multiple options
1434`margin-left`, `margin-right`, `margin-top`, `margin-bottom`
1435: sets margins, if `geometry` is not used (otherwise `geometry`
1436 overrides these)
1438`linestretch`
1439: adjusts line spacing using the [`setspace`]
1440 package, e.g. `1.25`, `1.5`
1442`fontfamily`
1443: font package for use with `pdflatex`:
1444 [TeX Live] includes many options, documented in the [LaTeX Font Catalogue].
1445 The default is [Latin Modern][`lm`].
1447`fontfamilyoptions`
1448: options for package used as `fontfamily`: e.g. `osf,sc` with
1449 `fontfamily` set to [`mathpazo`] provides Palatino with old-style
1450 figures and true small caps; may be repeated for multiple options
1452`mainfont`, `sansfont`, `monofont`, `mathfont`, `CJKmainfont`
1453: font families for use with `xelatex` or
1454 `lualatex`: take the name of any system font, using the
1455 [`fontspec`] package. Note that if `CJKmainfont` is used,
1456 the [`xecjk`] package must be available.
1458`mainfontoptions`, `sansfontoptions`, `monofontoptions`, `mathfontoptions`, `CJKoptions`
1459: options to use with `mainfont`, `sansfont`, `monofont`, `mathfont`,
1460 `CJKmainfont` in `xelatex` and `lualatex`. Allow for any choices
1461 available through [`fontspec`], such as the OpenType features
1462 `Numbers=OldStyle,Numbers=Proportional`. May be repeated for multiple options.
1464`fontenc`
1465: allows font encoding to be specified through `fontenc` package (with `pdflatex`);
1466 default is `T1` (see guide to [LaTeX font encodings])
1468`microtypeoptions`
1469: options to pass to the microtype package
1471`colorlinks`
1472: add color to link text; automatically enabled if any of `linkcolor`, `citecolor`,
1473 `urlcolor`, or `toccolor` are set
1475`linkcolor`, `citecolor`, `urlcolor`, `toccolor`
1476: color for internal links, citation links, external links, and links in table of contents:
1477 uses options allowed by [`xcolor`], including the `dvipsnames`, `svgnames`, and `x11names` lists
1479`links-as-notes`
1480: causes links to be printed as footnotes
1482`indent`
1483: uses document class settings for indentation (the default LaTeX template
1484 otherwise removes indentation and adds space between paragraphs)
1486`subparagraph`
1487: disables default behavior of LaTeX template that redefines (sub)paragraphs
1488 as sections, changing the appearance of nested headings in some classes
1490`thanks`
1491: specifies contents of acknowledgments footnote after document title.
1493`toc`
1494: include table of contents (can also be set using `--toc/--table-of-contents`)
1496`toc-depth`
1497: level of section to include in table of contents
1499`secnumdepth`
1500: numbering depth for sections, if sections are numbered
1502`lof`, `lot`
1503: include list of figures, list of tables
1505`bibliography`
1506: bibliography to use for resolving references
1508`biblio-style`
1509: bibliography style, when used with `--natbib` and `--biblatex`.
1511`biblio-title`
1512: bibliography title, when used with `--natbib` and `--biblatex`.
1514`biblatexoptions`
1515: list of options for biblatex.
1517`natbiboptions`
1518: list of options for natbib.
1520[`article`]: https://ctan.org/pkg/article
1521[`report`]: https://ctan.org/pkg/report
1522[`book`]: https://ctan.org/pkg/book
1523[KOMA-Script]: https://ctan.org/pkg/koma-script
1524[`memoir`]: https://ctan.org/pkg/memoir
1525[`xcolor`]: https://ctan.org/pkg/xcolor
1526[LaTeX Font Catalogue]: http://www.tug.dk/FontCatalogue/
1527[`mathpazo`]: https://ctan.org/pkg/mathpazo
1528[LaTeX font encodings]: https://ctan.org/pkg/encguide
1530Variables for ConTeXt
1531---------------------
1533`papersize`
1534: paper size, e.g. `letter`, `A4`, `landscape` (see [ConTeXt Paper Setup]);
1535 may be repeated for multiple options
1537`layout`
1538: options for page margins and text arrangement (see [ConTeXt Layout]);
1539 may be repeated for multiple options
1541`margin-left`, `margin-right`, `margin-top`, `margin-bottom`
1542: sets margins, if `layout` is not used (otherwise `layout`
1543 overrides these)
1545`fontsize`
1546: font size for body text (e.g. `10pt`, `12pt`)
1548`mainfont`, `sansfont`, `monofont`, `mathfont`
1549: font families: take the name of any system font (see [ConTeXt Font Switching])
1551`linkcolor`, `contrastcolor`
1552: color for links outside and inside a page, e.g. `red`, `blue` (see [ConTeXt Color])
1554`linkstyle`
1555: typeface style for links, e.g. `normal`, `bold`, `slanted`, `boldslanted`, `type`, `cap`, `small`
1557`indenting`
1558: controls indentation of paragraphs, e.g. `yes,small,next` (see [ConTeXt Indentation]);
1559 may be repeated for multiple options
1561`whitespace`
1562: spacing between paragraphs, e.g. `none`, `small` (using [`setupwhitespace`])
1564`interlinespace`
1565: adjusts line spacing, e.g. `4ex` (using [`setupinterlinespace`]);
1566 may be repeated for multiple options
1568`headertext`, `footertext`
1569: text to be placed in running header or footer (see [ConTeXt Headers and Footers]);
1570 may be repeated up to four times for different placement
1572`pagenumbering`
1573: page number style and location (using [`setuppagenumbering`]);
1574 may be repeated for multiple options
1576`toc`
1577: include table of contents (can also be set using `--toc/--table-of-contents`)
1579`lof`, `lot`
1580: include list of figures, list of tables
1582[ConTeXt Paper Setup]: http://wiki.contextgarden.net/PaperSetup
1583[ConTeXt Layout]: http://wiki.contextgarden.net/Layout
1584[ConTeXt Font Switching]: http://wiki.contextgarden.net/Font_Switching
1585[ConTeXt Color]: http://wiki.contextgarden.net/Color
1586[ConTeXt Headers and Footers]: http://wiki.contextgarden.net/Headers_and_Footers
1587[ConTeXt Indentation]: http://wiki.contextgarden.net/Indentation
1588[`setupwhitespace`]: http://wiki.contextgarden.net/Command/setupwhitespace
1589[`setupinterlinespace`]: http://wiki.contextgarden.net/Command/setupinterlinespace
1590[`setuppagenumbering`]: http://wiki.contextgarden.net/Command/setuppagenumbering
1592Variables for man pages
1593-----------------------
1595`section`
1596: section number in man pages
1598`header`
1599: header in man pages
1601`footer`
1602: footer in man pages
1604`adjusting`
1605: adjusts text to left (`l`), right (`r`), center (`c`),
1606 or both (`b`) margins
1608`hyphenate`
1609: if `true` (the default), hyphenation will be used
1611Variables for ms
1612----------------
1614`pointsize`
1615: point size (e.g. `10p`)
1617`lineheight`
1618: line height (e.g. `12p`)
1620`fontfamily`
1621: font family (e.g. `T` or `P`)
1623`indent`
1624: paragraph indent (e.g. `2m`)
1626Using variables in templates
1627----------------------------
1629Variable names are sequences of alphanumerics, `-`, and `_`,
1630starting with a letter. A variable name surrounded by `$` signs
1631will be replaced by its value. For example, the string `$title$` in
1633 <title>$title$</title>
1635will be replaced by the document title.
1637To write a literal `$` in a template, use `$$`.
1639Templates may contain conditionals. The syntax is as follows:
1641 $if(variable)$
1643 $else$
1645 $endif$
1647This will include `X` in the template if `variable` has a non-null
1648value; otherwise it will include `Y`. `X` and `Y` are placeholders for
1649any valid template text, and may include interpolated variables or other
1650conditionals. The `$else$` section may be omitted.
1652When variables can have multiple values (for example, `author` in
1653a multi-author document), you can use the `$for$` keyword:
1655 $for(author)$
1656 <meta name="author" content="$author$" />
1657 $endfor$
1659You can optionally specify a separator to be used between
1660consecutive items:
1662 $for(author)$$author$$sep$, $endfor$
1664A dot can be used to select a field of a variable that takes
1665an object as its value. So, for example:
1667 $author.name$ ($author.affiliation$)
1669If you use custom templates, you may need to revise them as pandoc
1670changes. We recommend tracking the changes in the default templates,
1671and modifying your custom templates accordingly. An easy way to do this
1672is to fork the [pandoc-templates] repository and merge in changes after each
1673pandoc release.
1675Templates may contain comments: anything on a line after `$--`
1676will be treated as a comment and ignored.
1678[pandoc-templates]: https://github.com/jgm/pandoc-templates
1680Pandoc's Markdown
1681=================
1683Pandoc understands an extended and slightly revised version of
1684John Gruber's [Markdown] syntax. This document explains the syntax,
1685noting differences from standard Markdown. Except where noted, these
1686differences can be suppressed by using the `markdown_strict` format instead
1687of `markdown`. An extensions can be enabled by adding `+EXTENSION`
1688to the format name and disabled by adding `-EXTENSION`. For example,
1689`markdown_strict+footnotes` is strict Markdown with footnotes
1690enabled, while `markdown-footnotes-pipe_tables` is pandoc's
1691Markdown without footnotes or pipe tables.
1693Philosophy
1694----------
1696Markdown is designed to be easy to write, and, even more importantly,
1697easy to read:
1699> A Markdown-formatted document should be publishable as-is, as plain
1700> text, without looking like it's been marked up with tags or formatting
1701> instructions.
1702> -- [John Gruber](http://daringfireball.net/projects/markdown/syntax#philosophy)
1704This principle has guided pandoc's decisions in finding syntax for
1705tables, footnotes, and other extensions.
1707There is, however, one respect in which pandoc's aims are different
1708from the original aims of Markdown. Whereas Markdown was originally
1709designed with HTML generation in mind, pandoc is designed for multiple
1710output formats. Thus, while pandoc allows the embedding of raw HTML,
1711it discourages it, and provides other, non-HTMLish ways of representing
1712important document elements like definition lists, tables, mathematics, and
1713footnotes.
1715Paragraphs
1716----------
1718A paragraph is one or more lines of text followed by one or more blank lines.
1719Newlines are treated as spaces, so you can reflow your paragraphs as you like.
1720If you need a hard line break, put two or more spaces at the end of a line.
1722#### Extension: `escaped_line_breaks` ####
1724A backslash followed by a newline is also a hard line break.
1725Note: in multiline and grid table cells, this is the only way
1726to create a hard line break, since trailing spaces in the cells
1727are ignored.
1729Headers
1730-------
1732There are two kinds of headers: Setext and ATX.
1734### Setext-style headers ###
1736A setext-style header is a line of text "underlined" with a row of `=` signs
1737(for a level one header) or `-` signs (for a level two header):
1739 A level-one header
1740 ==================
1742 A level-two header
1743 ------------------
1745The header text can contain inline formatting, such as emphasis (see
1746[Inline formatting], below).
1749### ATX-style headers ###
1751An ATX-style header consists of one to six `#` signs and a line of
1752text, optionally followed by any number of `#` signs. The number of
1753`#` signs at the beginning of the line is the header level:
1755 ## A level-two header
1757 ### A level-three header ###
1759As with setext-style headers, the header text can contain formatting:
1761 # A level-one header with a [link](/url) and *emphasis*
1763#### Extension: `blank_before_header` ####
1765Standard Markdown syntax does not require a blank line before a header.
1766Pandoc does require this (except, of course, at the beginning of the
1767document). The reason for the requirement is that it is all too easy for a
1768`#` to end up at the beginning of a line by accident (perhaps through line
1769wrapping). Consider, for example:
1771 I like several of their flavors of ice cream:
1772 #22, for example, and #5.
1774#### Extension: `space_in_atx_header` ####
1776Many Markdown implementations do not require a space between the
1777opening `#`s of an ATX header and the header text, so that
1778`#5 bolt` and `#hashtag` count as headers. With this extension,
1779pandoc does require the space.
1781### Header identifiers ###
1783#### Extension: `header_attributes` ####
1785Headers can be assigned attributes using this syntax at the end
1786of the line containing the header text:
1788 {#identifier .class .class key=value key=value}
1790Thus, for example, the following headers will all be assigned the identifier
1791`foo`:
1793 # My header {#foo}
1795 ## My header ## {#foo}
1797 My other header {#foo}
1798 ---------------
1800(This syntax is compatible with [PHP Markdown Extra].)
1802Note that although this syntax allows assignment of classes and key/value
1803attributes, writers generally don't use all of this information. Identifiers,
1804classes, and key/value attributes are used in HTML and HTML-based formats such
1805as EPUB and slidy. Identifiers are used for labels and link anchors in the
1806LaTeX, ConTeXt, Textile, and AsciiDoc writers.
1808Headers with the class `unnumbered` will not be numbered, even if
1809`--number-sections` is specified. A single hyphen (`-`) in an attribute
1810context is equivalent to `.unnumbered`, and preferable in non-English
1811documents. So,
1813 # My header {-}
1815is just the same as
1817 # My header {.unnumbered}
1819#### Extension: `auto_identifiers` ####
1821A header without an explicitly specified identifier will be
1822automatically assigned a unique identifier based on the header text.
1823To derive the identifier from the header text,
1825 - Remove all formatting, links, etc.
1826 - Remove all footnotes.
1827 - Remove all punctuation, except underscores, hyphens, and periods.
1828 - Replace all spaces and newlines with hyphens.
1829 - Convert all alphabetic characters to lowercase.
1830 - Remove everything up to the first letter (identifiers may
1831 not begin with a number or punctuation mark).
1832 - If nothing is left after this, use the identifier `section`.
1834Thus, for example,
1836 Header Identifier
1837 ------------------------------- ----------------------------
1838 `Header identifiers in HTML` `header-identifiers-in-html`
1839 `*Dogs*?--in *my* house?` `dogs--in-my-house`
1840 `[HTML], [S5], or [RTF]?` `html-s5-or-rtf`
1841 `3. Applications` `applications`
1842 `33` `section`
1844These rules should, in most cases, allow one to determine the identifier
1845from the header text. The exception is when several headers have the
1846same text; in this case, the first will get an identifier as described
1847above; the second will get the same identifier with `-1` appended; the
1848third with `-2`; and so on.
1850These identifiers are used to provide link targets in the table of
1851contents generated by the `--toc|--table-of-contents` option. They
1852also make it easy to provide links from one section of a document to
1853another. A link to this section, for example, might look like this:
1855 See the section on
1856 [header identifiers](#header-identifiers-in-html-latex-and-context).
1858Note, however, that this method of providing links to sections works
1859only in HTML, LaTeX, and ConTeXt formats.
1861If the `--section-divs` option is specified, then each section will
1862be wrapped in a `div` (or a `section`, if `html5` was specified),
1863and the identifier will be attached to the enclosing `<div>`
1864(or `<section>`) tag rather than the header itself. This allows entire
1865sections to be manipulated using JavaScript or treated differently in
1866CSS.
1868#### Extension: `implicit_header_references` ####
1870Pandoc behaves as if reference links have been defined for each header.
1871So, to link to a header
1873 # Header identifiers in HTML
1875you can simply write
1877 [Header identifiers in HTML]
1881 [Header identifiers in HTML][]
1885 [the section on header identifiers][header identifiers in
1886 HTML]
1888instead of giving the identifier explicitly:
1890 [Header identifiers in HTML](#header-identifiers-in-html)
1892If there are multiple headers with identical text, the corresponding
1893reference will link to the first one only, and you will need to use explicit
1894links to link to the others, as described above.
1896Like regular reference links, these references are case-insensitive.
1898Explicit link reference definitions always take priority over
1899implicit header references. So, in the following example, the
1900link will point to `bar`, not to `#foo`:
1902 # Foo
1904 [foo]: bar
1906 See [foo]
1908Block quotations
1909----------------
1911Markdown uses email conventions for quoting blocks of text.
1912A block quotation is one or more paragraphs or other block elements
1913(such as lists or headers), with each line preceded by a `>` character
1914and an optional space. (The `>` need not start at the left margin, but
1915it should not be indented more than three spaces.)
1917 > This is a block quote. This
1918 > paragraph has two lines.
1920 > 1. This is a list inside a block quote.
1921 > 2. Second item.
1923A "lazy" form, which requires the `>` character only on the first
1924line of each block, is also allowed:
1926 > This is a block quote. This
1927 paragraph has two lines.
1929 > 1. This is a list inside a block quote.
1930 2. Second item.
1932Among the block elements that can be contained in a block quote are
1933other block quotes. That is, block quotes can be nested:
1935 > This is a block quote.
1937 > > A block quote within a block quote.
1939If the `>` character is followed by an optional space, that space
1940will be considered part of the block quote marker and not part of
1941the indentation of the contents. Thus, to put an indented code
1942block in a block quote, you need five spaces after the `>`:
1944 > code
1946#### Extension: `blank_before_blockquote` ####
1948Standard Markdown syntax does not require a blank line before a block
1949quote. Pandoc does require this (except, of course, at the beginning of the
1950document). The reason for the requirement is that it is all too easy for a
1951`>` to end up at the beginning of a line by accident (perhaps through line
1952wrapping). So, unless the `markdown_strict` format is used, the following does
1953not produce a nested block quote in pandoc:
1955 > This is a block quote.
1956 >> Nested.
1959Verbatim (code) blocks
1960----------------------
1962### Indented code blocks ###
1964A block of text indented four spaces (or one tab) is treated as verbatim
1965text: that is, special characters do not trigger special formatting,
1966and all spaces and line breaks are preserved. For example,
1968 if (a > 3) {
1969 moveShip(5 * gravity, DOWN);
1972The initial (four space or one tab) indentation is not considered part
1973of the verbatim text, and is removed in the output.
1975Note: blank lines in the verbatim text need not begin with four spaces.
1978### Fenced code blocks ###
1980#### Extension: `fenced_code_blocks` ####
1982In addition to standard indented code blocks, pandoc supports
1983*fenced* code blocks. These begin with a row of three or more
1984tildes (`~`) and end with a row of tildes that must be at least as long as
1985the starting row. Everything between these lines is treated as code. No
1986indentation is necessary:
1988 ~~~~~~~
1989 if (a > 3) {
1990 moveShip(5 * gravity, DOWN);
1992 ~~~~~~~
1994Like regular code blocks, fenced code blocks must be separated
1995from surrounding text by blank lines.
1997If the code itself contains a row of tildes or backticks, just use a longer
1998row of tildes or backticks at the start and end:
2000 ~~~~~~~~~~~~~~~~
2001 ~~~~~~~~~~
2002 code including tildes
2003 ~~~~~~~~~~
2004 ~~~~~~~~~~~~~~~~
2006#### Extension: `backtick_code_blocks` ####
2008Same as `fenced_code_blocks`, but uses backticks (`` ` ``) instead of tildes
2009(`~`).
2011#### Extension: `fenced_code_attributes` ####
2013Optionally, you may attach attributes to fenced or backtick code block using
2014this syntax:
2016 ~~~~ {#mycode .haskell .numberLines startFrom="100"}
2017 qsort [] = []
2018 qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
2019 qsort (filter (>= x) xs)
2020 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2022Here `mycode` is an identifier, `haskell` and `numberLines` are classes, and
2023`startFrom` is an attribute with value `100`. Some output formats can use this
2024information to do syntax highlighting. Currently, the only output formats
2025that uses this information are HTML, LaTeX, Docx, and Ms. If highlighting
2026is supported for your output format and language, then the code block above
2027will appear highlighted, with numbered lines. (To see which languages are
2028supported, type `pandoc --list-highlight-languages`.) Otherwise, the code
2029block above will appear as follows:
2031 <pre id="mycode" class="haskell numberLines" startFrom="100">
2032 <code>
2033 ...
2034 </code>
2035 </pre>
2037The `numberLines` (or `number-lines`) class will cause the lines
2038of the code block to be numbered, starting with `1` or the value
2039of the `startFrom` attribute. The `lineAnchors` (or
2040`line-anchors`) class will cause the lines to be clickable
2041anchors in HTML output.
2043A shortcut form can also be used for specifying the language of
2044the code block:
2046 ```haskell
2047 qsort [] = []
2048 ```
2050This is equivalent to:
2052 ``` {.haskell}
2053 qsort [] = []
2054 ```
2056If the `fenced_code_attributes` extension is disabled, but
2057input contains class attribute(s) for the code block, the first
2058class attribute will be printed after the opening fence as a bare
2059word.
2061To prevent all highlighting, use the `--no-highlight` flag.
2062To set the highlighting style, use `--highlight-style`.
2063For more information on highlighting, see [Syntax highlighting],
2064below.
2066Line blocks
2067-----------
2069#### Extension: `line_blocks` ####
2071A line block is a sequence of lines beginning with a vertical bar (`|`)
2072followed by a space. The division into lines will be preserved in
2073the output, as will any leading spaces; otherwise, the lines will
2074be formatted as Markdown. This is useful for verse and addresses:
2076 | The limerick packs laughs anatomical
2077 | In space that is quite economical.
2078 | But the good ones I've seen
2079 | So seldom are clean
2080 | And the clean ones so seldom are comical
2082 | 200 Main St.
2083 | Berkeley, CA 94718
2085The lines can be hard-wrapped if needed, but the continuation
2086line must begin with a space.
2088 | The Right Honorable Most Venerable and Righteous Samuel L.
2089 Constable, Jr.
2090 | 200 Main St.
2091 | Berkeley, CA 94718
2093This syntax is borrowed from [reStructuredText].
2095Lists
2096-----
2098### Bullet lists ###
2100A bullet list is a list of bulleted list items. A bulleted list
2101item begins with a bullet (`*`, `+`, or `-`). Here is a simple
2102example:
2104 * one
2105 * two
2106 * three
2108This will produce a "compact" list. If you want a "loose" list, in which
2109each item is formatted as a paragraph, put spaces between the items:
2111 * one
2113 * two
2115 * three
2117The bullets need not be flush with the left margin; they may be
2118indented one, two, or three spaces. The bullet must be followed
2119by whitespace.
2121List items look best if subsequent lines are flush with the first
2122line (after the bullet):
2124 * here is my first
2125 list item.
2126 * and my second.
2128But Markdown also allows a "lazy" format:
2130 * here is my first
2131 list item.
2132 * and my second.
2134### Block content in list items ###
2136A list item may contain multiple paragraphs and other block-level
2137content. However, subsequent paragraphs must be preceded by a blank line
2138and indented to line up with the first non-space content after
2139the list marker.
2141 * First paragraph.
2143 Continued.
2145 * Second paragraph. With a code block, which must be indented
2146 eight spaces:
2148 { code }
2150Exception: if the list marker is followed by an indented code
2151block, which must begin 5 spaces after the list marker, then
2152subsequent paragraphs must begin two columns after the last
2153character of the list marker:
2155 * code
2157 continuation paragraph
2159List items may include other lists. In this case the preceding blank
2160line is optional. The nested list must be indented to line up with
2161the first non-space character after the list marker of the
2162containing list item.
2164 * fruits
2165 + apples
2166 - macintosh
2167 - red delicious
2168 + pears
2169 + peaches
2170 * vegetables
2171 + broccoli
2172 + chard
2174As noted above, Markdown allows you to write list items "lazily," instead of
2175indenting continuation lines. However, if there are multiple paragraphs or
2176other blocks in a list item, the first line of each must be indented.
2178 + A lazy, lazy, list
2179 item.
2181 + Another one; this looks
2182 bad but is legal.
2184 Second paragraph of second
2185 list item.
2187### Ordered lists ###
2189Ordered lists work just like bulleted lists, except that the items
2190begin with enumerators rather than bullets.
2192In standard Markdown, enumerators are decimal numbers followed
2193by a period and a space. The numbers themselves are ignored, so
2194there is no difference between this list:
2196 1. one
2197 2. two
2198 3. three
2200and this one:
2202 5. one
2203 7. two
2204 1. three
2206#### Extension: `fancy_lists` ####
2208Unlike standard Markdown, pandoc allows ordered list items to be marked
2209with uppercase and lowercase letters and roman numerals, in addition to
2210Arabic numerals. List markers may be enclosed in parentheses or followed by a
2211single right-parentheses or period. They must be separated from the
2212text that follows by at least one space, and, if the list marker is a
2213capital letter with a period, by at least two spaces.[^2]
2215[^2]: The point of this rule is to ensure that normal paragraphs
2216 starting with people's initials, like
2218 B. Russell was an English philosopher.
2220 do not get treated as list items.
2222 This rule will not prevent
2224 (C) 2007 Joe Smith
2226 from being interpreted as a list item. In this case, a backslash
2227 escape can be used:
2229 (C\) 2007 Joe Smith
2231The `fancy_lists` extension also allows '`#`' to be used as an
2232ordered list marker in place of a numeral:
2234 #. one
2235 #. two
2237#### Extension: `startnum` ####
2239Pandoc also pays attention to the type of list marker used, and to the
2240starting number, and both of these are preserved where possible in the
2241output format. Thus, the following yields a list with numbers followed
2242by a single parenthesis, starting with 9, and a sublist with lowercase
2243roman numerals:
2245 9) Ninth
2246 10) Tenth
2247 11) Eleventh
2248 i. subone
2249 ii. subtwo
2250 iii. subthree
2252Pandoc will start a new list each time a different type of list
2253marker is used. So, the following will create three lists:
2255 (2) Two
2256 (5) Three
2257 1. Four
2258 * Five
2260If default list markers are desired, use `#.`:
2262 #. one
2263 #. two
2264 #. three
2267### Definition lists ###
2269#### Extension: `definition_lists` ####
2271Pandoc supports definition lists, using the syntax of
2272[PHP Markdown Extra] with some extensions.[^3]
2274 Term 1
2276 : Definition 1
2278 Term 2 with *inline markup*
2280 : Definition 2
2282 { some code, part of Definition 2 }
2284 Third paragraph of definition 2.
2286Each term must fit on one line, which may optionally be followed by
2287a blank line, and must be followed by one or more definitions.
2288A definition begins with a colon or tilde, which may be indented one
2289or two spaces.
2291A term may have multiple definitions, and each definition may consist of one or
2292more block elements (paragraph, code block, list, etc.), each indented four
2293spaces or one tab stop. The body of the definition (including the first line,
2294aside from the colon or tilde) should be indented four spaces. However,
2295as with other Markdown lists, you can "lazily" omit indentation except
2296at the beginning of a paragraph or other block element:
2298 Term 1
2300 : Definition
2301 with lazy continuation.
2303 Second paragraph of the definition.
2305If you leave space before the definition (as in the example above),
2306the text of the definition will be treated as a paragraph. In some
2307output formats, this will mean greater spacing between term/definition
2308pairs. For a more compact definition list, omit the space before the
2309definition:
2311 Term 1
2312 ~ Definition 1
2314 Term 2
2315 ~ Definition 2a
2316 ~ Definition 2b
2318Note that space between items in a definition list is required.
2319(A variant that loosens this requirement, but disallows "lazy"
2320hard wrapping, can be activated with `compact_definition_lists`: see
2321[Non-pandoc extensions], below.)
2323[^3]: I have been influenced by the suggestions of [David Wheeler](http://www.justatheory.com/computers/markup/modest-markdown-proposal.html).
2325### Numbered example lists ###
2327#### Extension: `example_lists` ####
2329The special list marker `@` can be used for sequentially numbered
2330examples. The first list item with a `@` marker will be numbered '1',
2331the next '2', and so on, throughout the document. The numbered examples
2332need not occur in a single list; each new list using `@` will take up
2333where the last stopped. So, for example:
2335 (@) My first example will be numbered (1).
2336 (@) My second example will be numbered (2).
2338 Explanation of examples.
2340 (@) My third example will be numbered (3).
2342Numbered examples can be labeled and referred to elsewhere in the
2343document:
2345 (@good) This is a good example.
2347 As (@good) illustrates, ...
2349The label can be any string of alphanumeric characters, underscores,
2350or hyphens.
2353### Compact and loose lists ###
2355Pandoc behaves differently from `Markdown.pl` on some "edge
2356cases" involving lists. Consider this source:
2358 + First
2359 + Second:
2360 - Fee
2361 - Fie
2362 - Foe
2364 + Third
2366Pandoc transforms this into a "compact list" (with no `<p>` tags around
2367"First", "Second", or "Third"), while Markdown puts `<p>` tags around
2368"Second" and "Third" (but not "First"), because of the blank space
2369around "Third". Pandoc follows a simple rule: if the text is followed by
2370a blank line, it is treated as a paragraph. Since "Second" is followed
2371by a list, and not a blank line, it isn't treated as a paragraph. The
2372fact that the list is followed by a blank line is irrelevant. (Note:
2373Pandoc works this way even when the `markdown_strict` format is specified. This
2374behavior is consistent with the official Markdown syntax description,
2375even though it is different from that of `Markdown.pl`.)
2378### Ending a list ###
2380What if you want to put an indented code block after a list?
2382 - item one
2383 - item two
2385 { my code block }
2387Trouble! Here pandoc (like other Markdown implementations) will treat
2388`{ my code block }` as the second paragraph of item two, and not as
2389a code block.
2391To "cut off" the list after item two, you can insert some non-indented
2392content, like an HTML comment, which won't produce visible output in
2393any format:
2395 - item one
2396 - item two
2398 <!-- end of list -->
2400 { my code block }
2402You can use the same trick if you want two consecutive lists instead
2403of one big list:
2405 1. one
2406 2. two
2407 3. three
2409 <!-- -->
2411 1. uno
2412 2. dos
2413 3. tres
2415Horizontal rules
2416----------------
2418A line containing a row of three or more `*`, `-`, or `_` characters
2419(optionally separated by spaces) produces a horizontal rule:
2421 * * * *
2423 ---------------
2426Tables
2427------
2429Four kinds of tables may be used. The first three kinds presuppose the use of
2430a fixed-width font, such as Courier. The fourth kind can be used with
2431proportionally spaced fonts, as it does not require lining up columns.
2433#### Extension: `table_captions` ####
2435A caption may optionally be provided with all 4 kinds of tables (as
2436illustrated in the examples below). A caption is a paragraph beginning
2437with the string `Table:` (or just `:`), which will be stripped off.
2438It may appear either before or after the table.
2440#### Extension: `simple_tables` ####
2442Simple tables look like this:
2444 Right Left Center Default
2445 ------- ------ ---------- -------
2446 12 12 12 12
2447 123 123 123 123
2448 1 1 1 1
2450 Table: Demonstration of simple table syntax.
2452The headers and table rows must each fit on one line. Column
2453alignments are determined by the position of the header text relative
2454to the dashed line below it:[^4]
2456 - If the dashed line is flush with the header text on the right side
2457 but extends beyond it on the left, the column is right-aligned.
2458 - If the dashed line is flush with the header text on the left side
2459 but extends beyond it on the right, the column is left-aligned.
2460 - If the dashed line extends beyond the header text on both sides,
2461 the column is centered.
2462 - If the dashed line is flush with the header text on both sides,
2463 the default alignment is used (in most cases, this will be left).
2465[^4]: This scheme is due to Michel Fortin, who proposed it on the
2466 [Markdown discussion list](http://six.pairlist.net/pipermail/markdown-discuss/2005-March/001097.html).
2468The table must end with a blank line, or a line of dashes followed by
2469a blank line.
2471The column headers may be omitted, provided a dashed line is used
2472to end the table. For example:
2474 ------- ------ ---------- -------
2475 12 12 12 12
2476 123 123 123 123
2477 1 1 1 1
2478 ------- ------ ---------- -------
2480When headers are omitted, column alignments are determined on the basis
2481of the first line of the table body. So, in the tables above, the columns
2482would be right, left, center, and right aligned, respectively.
2484#### Extension: `multiline_tables` ####
2486Multiline tables allow headers and table rows to span multiple lines
2487of text (but cells that span multiple columns or rows of the table are
2488not supported). Here is an example:
2490 -------------------------------------------------------------
2491 Centered Default Right Left
2492 Header Aligned Aligned Aligned
2493 ----------- ------- --------------- -------------------------
2494 First row 12.0 Example of a row that
2495 spans multiple lines.
2497 Second row 5.0 Here's another one. Note
2498 the blank line between
2499 rows.
2500 -------------------------------------------------------------
2502 Table: Here's the caption. It, too, may span
2503 multiple lines.
2505These work like simple tables, but with the following differences:
2507 - They must begin with a row of dashes, before the header text
2508 (unless the headers are omitted).
2509 - They must end with a row of dashes, then a blank line.
2510 - The rows must be separated by blank lines.
2512In multiline tables, the table parser pays attention to the widths of
2513the columns, and the writers try to reproduce these relative widths in
2514the output. So, if you find that one of the columns is too narrow in the
2515output, try widening it in the Markdown source.
2517Headers may be omitted in multiline tables as well as simple tables:
2519 ----------- ------- --------------- -------------------------
2520 First row 12.0 Example of a row that
2521 spans multiple lines.
2523 Second row 5.0 Here's another one. Note
2524 the blank line between
2525 rows.
2526 ----------- ------- --------------- -------------------------
2528 : Here's a multiline table without headers.
2530It is possible for a multiline table to have just one row, but the row
2531should be followed by a blank line (and then the row of dashes that ends
2532the table), or the table may be interpreted as a simple table.
2534#### Extension: `grid_tables` ####
2536Grid tables look like this:
2538 : Sample grid table.
2540 +---------------+---------------+--------------------+
2541 | Fruit | Price | Advantages |
2542 +===============+===============+====================+
2543 | Bananas | $1.34 | - built-in wrapper |
2544 | | | - bright color |
2545 +---------------+---------------+--------------------+
2546 | Oranges | $2.10 | - cures scurvy |
2547 | | | - tasty |
2548 +---------------+---------------+--------------------+
2550The row of `=`s separates the header from the table body, and can be
2551omitted for a headerless table. The cells of grid tables may contain
2552arbitrary block elements (multiple paragraphs, code blocks, lists,
2553etc.). Cells that span multiple columns or rows are not
2554supported. Grid tables can be created easily using [Emacs table mode].
2556[Emacs table mode]: http://table.sourceforge.net/
2558Alignments can be specified as with pipe tables, by putting
2559colons at the boundaries of the separator line after the
2560header:
2562 +---------------+---------------+--------------------+
2563 | Right | Left | Centered |
2564 +==============:+:==============+:==================:+
2565 | Bananas | $1.34 | built-in wrapper |
2566 +---------------+---------------+--------------------+
2568For headerless tables, the colons go on the top line instead:
2570 +--------------:+:--------------+:------------------:+
2571 | Right | Left | Centered |
2572 +---------------+---------------+--------------------+
2574##### Grid Table Limitations #####
2576Pandoc does not support grid tables with row spans or column spans.
2577This means that neither variable numbers of columns across rows nor
2578variable numbers of rows across columns are supported by Pandoc.
2579All grid tables must have the same number of columns in each row,
2580and the same number of rows in each column. For example, the
2581Docutils [sample grid tables] will not render as expected with
2582Pandoc.
2584[sample grid tables]: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#grid-tables
2587#### Extension: `pipe_tables` ####
2589Pipe tables look like this:
2591 | Right | Left | Default | Center |
2592 |------:|:-----|---------|:------:|
2593 | 12 | 12 | 12 | 12 |
2594 | 123 | 123 | 123 | 123 |
2595 | 1 | 1 | 1 | 1 |
2597 : Demonstration of pipe table syntax.
2599The syntax is identical to [PHP Markdown Extra tables]. The beginning and
2600ending pipe characters are optional, but pipes are required between all
2601columns. The colons indicate column alignment as shown. The header
2602cannot be omitted. To simulate a headerless table, include a header
2603with blank cells.
2605Since the pipes indicate column boundaries, columns need not be vertically
2606aligned, as they are in the above example. So, this is a perfectly
2607legal (though ugly) pipe table:
2609 fruit| price
2610 -----|-----:
2611 apple|2.05
2612 pear|1.37
2613 orange|3.09
2615The cells of pipe tables cannot contain block elements like paragraphs
2616and lists, and cannot span multiple lines. If a pipe table contains a
2617row whose printable content is wider than the column width (see
2618`--columns`), then the cell contents will wrap, with the
2619relative cell widths determined by the widths of the separator
2620lines.
2622Note: pandoc also recognizes pipe tables of the following
2623form, as can be produced by Emacs' orgtbl-mode:
2625 | One | Two |
2626 |-----+-------|
2627 | my | table |
2628 | is | nice |
2630The difference is that `+` is used instead of `|`. Other orgtbl features
2631are not supported. In particular, to get non-default column alignment,
2632you'll need to add colons as above.
2634[PHP Markdown Extra tables]: https://michelf.ca/projects/php-markdown/extra/#table
2636Metadata blocks
2637---------------
2639#### Extension: `pandoc_title_block` ####
2641If the file begins with a title block
2643 % title
2644 % author(s) (separated by semicolons)
2645 % date
2647it will be parsed as bibliographic information, not regular text. (It
2648will be used, for example, in the title of standalone LaTeX or HTML
2649output.) The block may contain just a title, a title and an author,
2650or all three elements. If you want to include an author but no
2651title, or a title and a date but no author, you need a blank line:
2654 % Author
2656 % My title
2658 % June 15, 2006
2660The title may occupy multiple lines, but continuation lines must
2661begin with leading space, thus:
2663 % My title
2664 on multiple lines
2666If a document has multiple authors, the authors may be put on
2667separate lines with leading space, or separated by semicolons, or
2668both. So, all of the following are equivalent:
2670 % Author One
2671 Author Two
2673 % Author One; Author Two
2675 % Author One;
2676 Author Two
2678The date must fit on one line.
2680All three metadata fields may contain standard inline formatting
2681(italics, links, footnotes, etc.).
2683Title blocks will always be parsed, but they will affect the output only
2684when the `--standalone` (`-s`) option is chosen. In HTML output, titles
2685will appear twice: once in the document head -- this is the title that
2686will appear at the top of the window in a browser -- and once at the
2687beginning of the document body. The title in the document head can have
2688an optional prefix attached (`--title-prefix` or `-T` option). The title
2689in the body appears as an H1 element with class "title", so it can be
2690suppressed or reformatted with CSS. If a title prefix is specified with
2691`-T` and no title block appears in the document, the title prefix will
2692be used by itself as the HTML title.
2694The man page writer extracts a title, man page section number, and
2695other header and footer information from the title line. The title
2696is assumed to be the first word on the title line, which may optionally
2697end with a (single-digit) section number in parentheses. (There should
2698be no space between the title and the parentheses.) Anything after
2699this is assumed to be additional footer and header text. A single pipe
2700character (`|`) should be used to separate the footer text from the header
2701text. Thus,
2703 % PANDOC(1)
2705will yield a man page with the title `PANDOC` and section 1.
2707 % PANDOC(1) Pandoc User Manuals
2709will also have "Pandoc User Manuals" in the footer.
2711 % PANDOC(1) Pandoc User Manuals | Version 4.0
2713will also have "Version 4.0" in the header.
2715#### Extension: `yaml_metadata_block` ####
2717A YAML metadata block is a valid YAML object, delimited by a line of three
2718hyphens (`---`) at the top and a line of three hyphens (`---`) or three dots
2719(`...`) at the bottom. A YAML metadata block may occur anywhere in the
2720document, but if it is not at the beginning, it must be preceded by a blank
2721line. (Note that, because of the way pandoc concatenates input files when
2722several are provided, you may also keep the metadata in a separate YAML file
2723and pass it to pandoc as an argument, along with your Markdown files:
2725 pandoc chap1.md chap2.md chap3.md metadata.yaml -s -o book.html
2727Just be sure that the YAML file begins with `---` and ends with `---` or
2728`...`.)
2730Metadata will be taken from the fields of the YAML object and added to any
2731existing document metadata. Metadata can contain lists and objects (nested
2732arbitrarily), but all string scalars will be interpreted as Markdown. Fields
2733with names ending in an underscore will be ignored by pandoc. (They may be
2734given a role by external processors.)
2736A document may contain multiple metadata blocks. The metadata fields will
2737be combined through a *left-biased union*: if two metadata blocks attempt
2738to set the same field, the value from the first block will be taken.
2740When pandoc is used with `-t markdown` to create a Markdown document,
2741a YAML metadata block will be produced only if the `-s/--standalone`
2742option is used. All of the metadata will appear in a single block
2743at the beginning of the document.
2745Note that YAML escaping rules must be followed. Thus, for example,
2746if a title contains a colon, it must be quoted. The pipe character
2747(`|`) can be used to begin an indented block that will be interpreted
2748literally, without need for escaping. This form is necessary
2749when the field contains blank lines or block-level formatting:
2751 ---
2752 title: 'This is the title: it contains a colon'
2753 author:
2754 - Author One
2755 - Author Two
2756 tags: [nothing, nothingness]
2757 abstract: |
2758 This is the abstract.
2760 It consists of two paragraphs.
2761 ...
2763Template variables will be set automatically from the metadata. Thus, for
2764example, in writing HTML, the variable `abstract` will be set to the HTML
2765equivalent of the Markdown in the `abstract` field:
2767 <p>This is the abstract.</p>
2768 <p>It consists of two paragraphs.</p>
2770Variables can contain arbitrary YAML structures, but the template must match
2771this structure. The `author` variable in the default templates expects a
2772simple list or string, but can be changed to support more complicated
2773structures. The following combination, for example, would add an affiliation
2774to the author if one is given:
2776 ---
2777 title: The document title
2778 author:
2779 - name: Author One
2780 affiliation: University of Somewhere
2781 - name: Author Two
2782 affiliation: University of Nowhere
2783 ...
2785To use the structured authors in the example above, you would need a custom
2786template:
2788 $for(author)$
2789 $if(author.name)$
2790 $author.name$$if(author.affiliation)$ ($author.affiliation$)$endif$
2791 $else$
2792 $author$
2793 $endif$
2794 $endfor$
2797Backslash escapes
2798-----------------
2800#### Extension: `all_symbols_escapable` ####
2802Except inside a code block or inline code, any punctuation or space
2803character preceded by a backslash will be treated literally, even if it
2804would normally indicate formatting. Thus, for example, if one writes
2806 *\*hello\**
2808one will get
2810 <em>*hello*</em>
2812instead of
2814 <strong>hello</strong>
2816This rule is easier to remember than standard Markdown's rule,
2817which allows only the following characters to be backslash-escaped:
2819 \`*_{}[]()>#+-.!
2821(However, if the `markdown_strict` format is used, the standard Markdown rule
2822will be used.)
2824A backslash-escaped space is parsed as a nonbreaking space. It will
2825appear in TeX output as `~` and in HTML and XML as `\&#160;` or
2826`\&nbsp;`.
2828A backslash-escaped newline (i.e. a backslash occurring at the end of
2829a line) is parsed as a hard line break. It will appear in TeX output as
2830`\\` and in HTML as `<br />`. This is a nice alternative to
2831Markdown's "invisible" way of indicating hard line breaks using
2832two trailing spaces on a line.
2834Backslash escapes do not work in verbatim contexts.
2836Inline formatting
2837-----------------
2839### Emphasis ###
2841To *emphasize* some text, surround it with `*`s or `_`, like this:
2843 This text is _emphasized with underscores_, and this
2844 is *emphasized with asterisks*.
2846Double `*` or `_` produces **strong emphasis**:
2848 This is **strong emphasis** and __with underscores__.
2850A `*` or `_` character surrounded by spaces, or backslash-escaped,
2851will not trigger emphasis:
2853 This is * not emphasized *, and \*neither is this\*.
2855#### Extension: `intraword_underscores` ####
2857Because `_` is sometimes used inside words and identifiers,
2858pandoc does not interpret a `_` surrounded by alphanumeric
2859characters as an emphasis marker. If you want to emphasize
2860just part of a word, use `*`:
2862 feas*ible*, not feas*able*.
2865### Strikeout ###
2867#### Extension: `strikeout` ####
2869To strikeout a section of text with a horizontal line, begin and end it
2870with `~~`. Thus, for example,
2872 This ~~is deleted text.~~
2875### Superscripts and subscripts ###
2877#### Extension: `superscript`, `subscript` ####
2879Superscripts may be written by surrounding the superscripted text by `^`
2880characters; subscripts may be written by surrounding the subscripted
2881text by `~` characters. Thus, for example,
2883 H~2~O is a liquid. 2^10^ is 1024.
2885If the superscripted or subscripted text contains spaces, these spaces
2886must be escaped with backslashes. (This is to prevent accidental
2887superscripting and subscripting through the ordinary use of `~` and `^`.)
2888Thus, if you want the letter P with 'a cat' in subscripts, use
2889`P~a\ cat~`, not `P~a cat~`.
2892### Verbatim ###
2894To make a short span of text verbatim, put it inside backticks:
2896 What is the difference between `>>=` and `>>`?
2898If the verbatim text includes a backtick, use double backticks:
2900 Here is a literal backtick `` ` ``.
2902(The spaces after the opening backticks and before the closing
2903backticks will be ignored.)
2905The general rule is that a verbatim span starts with a string
2906of consecutive backticks (optionally followed by a space)
2907and ends with a string of the same number of backticks (optionally
2908preceded by a space).
2910Note that backslash-escapes (and other Markdown constructs) do not
2911work in verbatim contexts:
2913 This is a backslash followed by an asterisk: `\*`.
2915#### Extension: `inline_code_attributes` ####
2917Attributes can be attached to verbatim text, just as with
2918[fenced code blocks]:
2920 `<$>`{.haskell}
2922### Small caps ###
2924To write small caps, use the `smallcaps` class:
2926 [Small caps]{.smallcaps}
2928Or, without the `bracketed_spans` extension:
2930 <span class="smallcaps">Small caps</span>
2932For compatibility with other Markdown flavors, CSS is also supported:
2934 <span style="font-variant:small-caps;">Small caps</span>
2936This will work in all output formats that support small caps.
2939Math
2940----
2942#### Extension: `tex_math_dollars` ####
2944Anything between two `$` characters will be treated as TeX math. The
2945opening `$` must have a non-space character immediately to its right,
2946while the closing `$` must have a non-space character immediately to its
2947left, and must not be followed immediately by a digit. Thus,
2948`$20,000 and $30,000` won't parse as math. If for some reason
2949you need to enclose text in literal `$` characters, backslash-escape
2950them and they won't be treated as math delimiters.
2952TeX math will be printed in all output formats. How it is rendered
2953depends on the output format:
2955Markdown, LaTeX, Emacs Org mode, ConTeXt, ZimWiki
2956 ~ It will appear verbatim between `$` characters.
2958reStructuredText
2959 ~ It will be rendered using an [interpreted text role `:math:`].
2961AsciiDoc
2962 ~ It will be rendered as `latexmath:[...]`.
2964Texinfo
2965 ~ It will be rendered inside a `@math` command.
2967groff man
2968 ~ It will be rendered verbatim without `$`'s.
2970MediaWiki, DokuWiki
2971 ~ It will be rendered inside `<math>` tags.
2973Textile
2974 ~ It will be rendered inside `<span class="math">` tags.
2976RTF, OpenDocument
2977 ~ It will be rendered, if possible, using Unicode characters,
2978 and will otherwise appear verbatim.
2980ODT
2981 ~ It will be rendered, if possible, using MathML.
2983DocBook
2984 ~ If the `--mathml` flag is used, it will be rendered using MathML
2985 in an `inlineequation` or `informalequation` tag. Otherwise it
2986 will be rendered, if possible, using Unicode characters.
2988Docx
2989 ~ It will be rendered using OMML math markup.
2991FictionBook2
2992 ~ If the `--webtex` option is used, formulas are rendered as images
2993 using CodeCogs or other compatible web service, downloaded
2994 and embedded in the e-book. Otherwise, they will appear verbatim.
2996HTML, Slidy, DZSlides, S5, EPUB
2997 ~ The way math is rendered in HTML will depend on the
2998 command-line options selected. Therefore see [Math rendering in HTML]
2999 above.
3001[interpreted text role `:math:`]: http://docutils.sourceforge.net/docs/ref/rst/roles.html#math
3003Raw HTML
3004--------
3006#### Extension: `raw_html` ####
3008Markdown allows you to insert raw HTML (or DocBook) anywhere in a document
3009(except verbatim contexts, where `<`, `>`, and `&` are interpreted
3010literally). (Technically this is not an extension, since standard
3011Markdown allows it, but it has been made an extension so that it can
3012be disabled if desired.)
3014The raw HTML is passed through unchanged in HTML, S5, Slidy, Slideous,
3015DZSlides, EPUB, Markdown, Emacs Org mode, and Textile output, and suppressed
3016in other formats.
3018#### Extension: `markdown_in_html_blocks` ####
3020Standard Markdown allows you to include HTML "blocks": blocks
3021of HTML between balanced tags that are separated from the surrounding text
3022with blank lines, and start and end at the left margin. Within
3023these blocks, everything is interpreted as HTML, not Markdown;
3024so (for example), `*` does not signify emphasis.
3026Pandoc behaves this way when the `markdown_strict` format is used; but
3027by default, pandoc interprets material between HTML block tags as Markdown.
3028Thus, for example, pandoc will turn
3030 <table>
3031 <tr>
3032 <td>*one*</td>
3033 <td>[a link](http://google.com)</td>
3034 </tr>
3035 </table>
3037into
3039 <table>
3040 <tr>
3041 <td><em>one</em></td>
3042 <td><a href="http://google.com">a link</a></td>
3043 </tr>
3044 </table>
3046whereas `Markdown.pl` will preserve it as is.
3048There is one exception to this rule: text between `<script>` and
3049`<style>` tags is not interpreted as Markdown.
3051This departure from standard Markdown should make it easier to mix
3052Markdown with HTML block elements. For example, one can surround
3053a block of Markdown text with `<div>` tags without preventing it
3054from being interpreted as Markdown.
3056#### Extension: `native_divs` ####
3058Use native pandoc `Div` blocks for content inside `<div>` tags.
3059For the most part this should give the same output as
3060`markdown_in_html_blocks`, but it makes it easier to write pandoc
3061filters to manipulate groups of blocks.
3063#### Extension: `native_spans` ####
3065Use native pandoc `Span` blocks for content inside `<span>` tags.
3066For the most part this should give the same output as `raw_html`,
3067but it makes it easier to write pandoc filters to manipulate groups
3068of inlines.
3070#### Extension: `fenced_divs` ####
3072Allow special fenced syntax for native `Div` blocks. A Div
3073starts with a fence containing at least three consecutive
3074colons plus some attributes. The attributes may optionally
3075be followed by another string of consecutive colons.
3076The attribute syntax is exactly as in fenced code blocks (see
3077[Extension: `fenced_code_attributes`]). As with fenced
3078code blocks, one can use either attributes in curly braces
3079or a single unbraced word, which will be treated as a class
3080name. The Div ends with another line containing a string of at
3081least three consecutive colons. The fenced Div should be
3082separated by blank lines from preceding and following blocks.
3084Example:
3086 ::::: {#special .sidebar}
3087 Here is a paragraph.
3089 And another.
3090 :::::
3092Fenced divs can be nested. Opening fences are distinguished
3093because they *must* have attributes:
3095 ::: Warning ::::::
3096 This is a warning.
3098 ::: Danger
3099 This is a warning within a warning.
3100 :::
3101 ::::::::::::::::::
3103Fences without attributes are always closing fences. Unlike
3104with fenced code blocks, the number of colons in the closing
3105fence need not match the number in the opening fence. However,
3106it can be helpful for visual clarity to use fences of different
3107lengths to distinguish nested divs from their parents.
3109#### Extension: `raw_tex` ####
3111In addition to raw HTML, pandoc allows raw LaTeX, TeX, and ConTeXt to be
3112included in a document. Inline TeX commands will be preserved and passed
3113unchanged to the LaTeX and ConTeXt writers. Thus, for example, you can use
3114LaTeX to include BibTeX citations:
3116 This result was proved in \cite{jones.1967}.
3118Note that in LaTeX environments, like
3120 \begin{tabular}{|l|l|}\hline
3121 Age & Frequency \\ \hline
3122 18--25 & 15 \\
3123 26--35 & 33 \\
3124 36--45 & 22 \\ \hline
3125 \end{tabular}
3127the material between the begin and end tags will be interpreted as raw
3128LaTeX, not as Markdown.
3130Inline LaTeX is ignored in output formats other than Markdown, LaTeX,
3131Emacs Org mode, and ConTeXt.
3133### Generic raw attribute ###
3135#### Extension: `raw_attribute` ####
3137Inline spans and fenced code blocks with a special
3138kind of attribute will be parsed as raw content with the
3139designated format. For example, the following produces a raw
3140groff `ms` block:
3142 ```{=ms}
3143 .MYMACRO
3144 blah blah
3145 ```
3146And the following produces a raw `html` inline element:
3148 This is `<a>html</a>`{=html}
3150The format name should match the target format name (see
3151`-t/--to`, above, for a list, or use `pandoc
3152--list-output-formats`).
3154This extension presupposes that the relevant kind of
3155inline code or fenced code block is enabled. Thus, for
3156example, to use a raw attribute with a backtick code block,
3157`backtick_code_blocks` must be enabled.
3159The raw attribute cannot be combined with regular attributes.
3161LaTeX macros
3162------------
3164#### Extension: `latex_macros` ####
3166For output formats other than LaTeX, pandoc will parse LaTeX `\newcommand` and
3167`\renewcommand` definitions and apply the resulting macros to all LaTeX
3168math. So, for example, the following will work in all output formats,
3169not just LaTeX:
3171 \newcommand{\tuple}[1]{\langle #1 \rangle}
3173 $\tuple{a, b, c}$
3175In LaTeX output, the `\newcommand` definition will simply be passed
3176unchanged to the output.
3179Links
3180-----
3182Markdown allows links to be specified in several ways.
3184### Automatic links ###
3186If you enclose a URL or email address in pointy brackets, it
3187will become a link:
3189 <http://google.com>
3190 <sam@green.eggs.ham>
3192### Inline links ###
3194An inline link consists of the link text in square brackets,
3195followed by the URL in parentheses. (Optionally, the URL can
3196be followed by a link title, in quotes.)
3198 This is an [inline link](/url), and here's [one with
3199 a title](http://fsf.org "click here for a good time!").
3201There can be no space between the bracketed part and the parenthesized part.
3202The link text can contain formatting (such as emphasis), but the title cannot.
3204Email addresses in inline links are not autodetected, so they have to be
3205prefixed with `mailto`:
3207 [Write me!](mailto:sam@green.eggs.ham)
3209### Reference links ###
3211An *explicit* reference link has two parts, the link itself and the link
3212definition, which may occur elsewhere in the document (either
3213before or after the link).
3215The link consists of link text in square brackets, followed by a label in
3216square brackets. (There cannot be space between the two unless the
3217`spaced_reference_links` extension is enabled.) The link definition
3218consists of the bracketed label, followed by a colon and a space, followed by
3219the URL, and optionally (after a space) a link title either in quotes or in
3220parentheses. The label must not be parseable as a citation (assuming
3221the `citations` extension is enabled): citations take precedence over
3222link labels.
3224Here are some examples:
3226 [my label 1]: /foo/bar.html "My title, optional"
3227 [my label 2]: /foo
3228 [my label 3]: http://fsf.org (The free software foundation)
3229 [my label 4]: /bar#special 'A title in single quotes'
3231The URL may optionally be surrounded by angle brackets:
3233 [my label 5]: <http://foo.bar.baz>
3235The title may go on the next line:
3237 [my label 3]: http://fsf.org
3238 "The free software foundation"
3240Note that link labels are not case sensitive. So, this will work:
3242 Here is [my link][FOO]
3244 [Foo]: /bar/baz
3246In an *implicit* reference link, the second pair of brackets is
3247empty:
3249 See [my website][].
3251 [my website]: http://foo.bar.baz
3253Note: In `Markdown.pl` and most other Markdown implementations,
3254reference link definitions cannot occur in nested constructions
3255such as list items or block quotes. Pandoc lifts this arbitrary
3256seeming restriction. So the following is fine in pandoc, though
3257not in most other implementations:
3259 > My block [quote].
3261 > [quote]: /foo
3263#### Extension: `shortcut_reference_links` ####
3265In a *shortcut* reference link, the second pair of brackets may
3266be omitted entirely:
3268 See [my website].
3270 [my website]: http://foo.bar.baz
3272### Internal links ###
3274To link to another section of the same document, use the automatically
3275generated identifier (see [Header identifiers]). For example:
3277 See the [Introduction](#introduction).
3281 See the [Introduction].
3283 [Introduction]: #introduction
3285Internal links are currently supported for HTML formats (including
3286HTML slide shows and EPUB), LaTeX, and ConTeXt.
3288Images
3289------
3291A link immediately preceded by a `!` will be treated as an image.
3292The link text will be used as the image's alt text:
3294 ![la lune](lalune.jpg "Voyage to the moon")
3296 ![movie reel]
3298 [movie reel]: movie.gif
3300#### Extension: `implicit_figures` ####
3302An image with nonempty alt text, occurring by itself in a
3303paragraph, will be rendered as a figure with a caption. The
3304image's alt text will be used as the caption.
3306 ![This is the caption](/url/of/image.png)
3308How this is rendered depends on the output format. Some output
3309formats (e.g. RTF) do not yet support figures. In those
3310formats, you'll just get an image in a paragraph by itself, with
3311no caption.
3313If you just want a regular inline image, just make sure it is not
3314the only thing in the paragraph. One way to do this is to insert a
3315nonbreaking space after the image:
3317 ![This image won't be a figure](/url/of/image.png)\
3319Note that in reveal.js slide shows, an image in a paragraph
3320by itself that has the `stretch` class will fill the screen,
3321and the caption and figure tags will be omitted.
3323#### Extension: `link_attributes` ####
3325Attributes can be set on links and images:
3327 An inline ![image](foo.jpg){#id .class width=30 height=20px}
3328 and a reference ![image][ref] with attributes.
3330 [ref]: foo.jpg "optional title" {#id .class key=val key2="val 2"}
3332(This syntax is compatible with [PHP Markdown Extra] when only `#id`
3333and `.class` are used.)
3335For HTML and EPUB, all attributes except `width` and `height` (but
3336including `srcset` and `sizes`) are passed through as is. The other
3337writers ignore attributes that are not supported by their output
3338format.
3340The `width` and `height` attributes on images are treated specially. When
3341used without a unit, the unit is assumed to be pixels. However, any of
3342the following unit identifiers can be used: `px`, `cm`, `mm`, `in`, `inch`
3343and `%`. There must not be any spaces between the number and the unit.
3344For example:
3346```
3347![](file.jpg){ width=50% }
3348```
3350- Dimensions are converted to inches for output in page-based formats like
3351 LaTeX. Dimensions are converted to pixels for output in HTML-like
3352 formats. Use the `--dpi` option to specify the number of pixels per
3353 inch. The default is 96dpi.
3354- The `%` unit is generally relative to some available space.
3355 For example the above example will render to
3356 `<img href="file.jpg" style="width: 50%;" />` (HTML),
3357 `\includegraphics[width=0.5\textwidth]{file.jpg}` (LaTeX), or
3358 `\externalfigure[file.jpg][width=0.5\textwidth]` (ConTeXt).
3359- Some output formats have a notion of a class
3360 ([ConTeXt](http://wiki.contextgarden.net/Using_Graphics#Multiple_Image_Settings))
3361 or a unique identifier (LaTeX `\caption`), or both (HTML).
3362- When no `width` or `height` attributes are specified, the fallback
3363 is to look at the image resolution and the dpi metadata embedded in
3364 the image file.
3366Spans
3367-----
3369#### Extension: `bracketed_spans` ####
3371A bracketed sequence of inlines, as one would use to begin
3372a link, will be treated as a span with attributes if it is
3373followed immediately by attributes:
3375 [This is *some text*]{.class key="val"}
3377Footnotes
3378---------
3380#### Extension: `footnotes` ####
3382Pandoc's Markdown allows footnotes, using the following syntax:
3384 Here is a footnote reference,[^1] and another.[^longnote]
3386 [^1]: Here is the footnote.
3388 [^longnote]: Here's one with multiple blocks.
3390 Subsequent paragraphs are indented to show that they
3391 belong to the previous footnote.
3393 { some.code }
3395 The whole paragraph can be indented, or just the first
3396 line. In this way, multi-paragraph footnotes work like
3397 multi-paragraph list items.
3399 This paragraph won't be part of the note, because it
3400 isn't indented.
3402The identifiers in footnote references may not contain spaces, tabs,
3403or newlines. These identifiers are used only to correlate the
3404footnote reference with the note itself; in the output, footnotes
3405will be numbered sequentially.
3407The footnotes themselves need not be placed at the end of the
3408document. They may appear anywhere except inside other block elements
3409(lists, block quotes, tables, etc.). Each footnote should be
3410separated from surrounding content (including other footnotes)
3411by blank lines.
3413#### Extension: `inline_notes` ####
3415Inline footnotes are also allowed (though, unlike regular notes,
3416they cannot contain multiple paragraphs). The syntax is as follows:
3418 Here is an inline note.^[Inlines notes are easier to write, since
3419 you don't have to pick an identifier and move down to type the
3420 note.]
3422Inline and regular footnotes may be mixed freely.
3424Typography
3425----------
3427#### Extension: `smart` ####
3429Interpret straight quotes as curly quotes, `---` as em-dashes,
3430`--` as en-dashes, and `...` as ellipses. Nonbreaking spaces are
3431inserted after certain abbreviations, such as "Mr." This
3432option currently affects the input formats `markdown`,
3433`commonmark`, `latex`, `mediawiki`, `org`, `rst`, and `twiki`,
3434and the output formats `markdown`, `latex`, and `context`.
3436Note: If you are *writing* Markdown, then the `smart` extension
3437has the reverse effect: what would have been curly quotes comes
3438out straight.
3440In LaTeX, `smart` means to use the standard TeX ligatures
3441for quotation marks (` `` ` and ` '' ` for double quotes,
3442`` ` `` and `` ' `` for single quotes) and dashes (`--` for
3443en-dash and `---` for em-dash). If `smart` is disabled,
3444then in reading LaTeX pandoc will parse these characters
3445literally. In writing LaTeX, enabling `smart` tells pandoc
3446to use the ligatures when possible; if `smart` is disabled
3447pandoc will use unicode quotation mark and dash characters.
3449Citations
3450---------
3452#### Extension: `citations` ####
3454Using an external filter, `pandoc-citeproc`, pandoc can automatically generate
3455citations and a bibliography in a number of styles. Basic usage is
3457 pandoc --filter pandoc-citeproc myinput.txt
3459In order to use this feature, you will need to specify a bibliography file
3460using the `bibliography` metadata field in a YAML metadata section, or
3461`--bibliography` command line argument. You can supply multiple `--bibliography`
3462arguments or set `bibliography` metadata field to YAML array, if you want to
3463use multiple bibliography files. The bibliography may have any of these
3464formats:
3466 Format File extension
3467 ------------ --------------
3468 BibLaTeX .bib
3469 BibTeX .bibtex
3470 Copac .copac
3471 CSL JSON .json
3472 CSL YAML .yaml
3473 EndNote .enl
3474 EndNote XML .xml
3475 ISI .wos
3476 MEDLINE .medline
3477 MODS .mods
3478 RIS .ris
3480Note that `.bib` can be used with both BibTeX and BibLaTeX files;
3481use `.bibtex` to force BibTeX.
3483Note that `pandoc-citeproc --bib2json` and `pandoc-citeproc --bib2yaml`
3484can produce `.json` and `.yaml` files from any of the supported formats.
3486In-field markup: In BibTeX and BibLaTeX databases, pandoc-citeproc parses
3487a subset of LaTeX markup; in CSL YAML databases, pandoc Markdown; and in CSL JSON databases, an [HTML-like markup][CSL markup specs]:
3489`<i>...</i>`
3490: italics
3492`<b>...</b>`
3493: bold
3495`<span style="font-variant:small-caps;">...</span>` or `<sc>...</sc>`
3496: small capitals
3498`<sub>...</sub>`
3499: subscript
3501`<sup>...</sup>`
3502: superscript
3504`<span class="nocase">...</span>`
3505: prevent a phrase from being capitalized as title case
3507`pandoc-citeproc -j` and `-y` interconvert the CSL JSON
3508and CSL YAML formats as far as possible.
3510As an alternative to specifying a bibliography file using `--bibliography`
3511or the YAML metadata field `bibliography`, you can include
3512the citation data directly in the `references` field of the
3513document's YAML metadata. The field should contain an array of
3514YAML-encoded references, for example:
3516 ---
3517 references:
3518 - type: article-journal
3519 id: WatsonCrick1953
3520 author:
3521 - family: Watson
3522 given: J. D.
3523 - family: Crick
3524 given: F. H. C.
3525 issued:
3526 date-parts:
3527 - - 1953
3528 - 4
3529 - 25
3530 title: 'Molecular structure of nucleic acids: a structure for deoxyribose
3531 nucleic acid'
3532 title-short: Molecular structure of nucleic acids
3533 container-title: Nature
3534 volume: 171
3535 issue: 4356
3536 page: 737-738
3537 DOI: 10.1038/171737a0
3538 URL: http://www.nature.com/nature/journal/v171/n4356/abs/171737a0.html
3539 language: en-GB
3540 ...
3542(`pandoc-citeproc --bib2yaml` can produce these from a bibliography file in one
3543of the supported formats.)
3545Citations and references can be formatted using any style supported by the
3546[Citation Style Language], listed in the [Zotero Style Repository].
3547These files are specified using the `--csl` option or the `csl` metadata field.
3548By default, `pandoc-citeproc` will use the [Chicago Manual of Style] author-date
3549format. The CSL project provides further information on [finding and editing styles].
3551To make your citations hyperlinks to the corresponding bibliography
3552entries, add `link-citations: true` to your YAML metadata.
3554Citations go inside square brackets and are separated by semicolons.
3555Each citation must have a key, composed of '@' + the citation
3556identifier from the database, and may optionally have a prefix,
3557a locator, and a suffix. The citation key must begin with a letter, digit,
3558or `_`, and may contain alphanumerics, `_`, and internal punctuation
3559characters (`:.#$%&-+?<>~/`). Here are some examples:
3561 Blah blah [see @doe99, pp. 33-35; also @smith04, chap. 1].
3563 Blah blah [@doe99, pp. 33-35, 38-39 and *passim*].
3565 Blah blah [@smith04; @doe99].
3567`pandoc-citeproc` detects locator terms in the [CSL locale files].
3568Either abbreviated or unabbreviated forms are accepted. In the `en-US`
3569locale, locator terms can be written in either singular or plural forms,
3570as `book`, `bk.`/`bks.`; `chapter`, `chap.`/`chaps.`; `column`,
3571`col.`/`cols.`; `figure`, `fig.`/`figs.`; `folio`, `fol.`/`fols.`;
3572`number`, `no.`/`nos.`; `line`, `l.`/`ll.`; `note`, `n.`/`nn.`; `opus`,
3573`op.`/`opp.`; `page`, `p.`/`pp.`; `paragraph`, `para.`/`paras.`; `part`,
3574`pt.`/`pts.`; `section`, `sec.`/`secs.`; `sub verbo`, `s.v.`/`s.vv.`;
3575`verse`, `v.`/`vv.`; `volume`, `vol.`/`vols.`; `¶`/`¶¶`; `§`/`§§`. If no
3576locator term is used, "page" is assumed.
3578A minus sign (`-`) before the `@` will suppress mention of
3579the author in the citation. This can be useful when the
3580author is already mentioned in the text:
3582 Smith says blah [-@smith04].
3584You can also write an in-text citation, as follows:
3586 @smith04 says blah.
3588 @smith04 [p. 33] says blah.
3590If the style calls for a list of works cited, it will be placed
3591at the end of the document. Normally, you will want to end your
3592document with an appropriate header:
3594 last paragraph...
3596 # References
3598The bibliography will be inserted after this header. Note that
3599the `unnumbered` class will be added to this header, so that the
3600section will not be numbered.
3602If you want to include items in the bibliography without actually
3603citing them in the body text, you can define a dummy `nocite` metadata
3604field and put the citations there:
3606 ---
3607 nocite: |
3608 @item1, @item2
3609 ...
3611 @item3
3613In this example, the document will contain a citation for `item3`
3614only, but the bibliography will contain entries for `item1`, `item2`, and
3615`item3`.
3617It is possible to create a bibliography with all the citations,
3618whether or not they appear in the document, by using a wildcard:
3620 ---
3621 nocite: |
3622 @*
3623 ...
3625For LaTeX or PDF output, you can also use [`natbib`] or [`biblatex`]
3626to render bibliography. In order to do so, specify bibliography files as
3627outlined above, and add `--natbib` or `--biblatex` argument to `pandoc`
3628invocation. Bear in mind that bibliography files have to be in respective
3629format (either BibTeX or BibLaTeX).
3631For more information, see the [pandoc-citeproc man page].
3633[CSL markup specs]: http://docs.citationstyles.org/en/1.0/release-notes.html#rich-text-markup-within-fields
3634[Chicago Manual of Style]: http://chicagomanualofstyle.org
3635[Citation Style Language]: http://citationstyles.org
3636[Zotero Style Repository]: https://www.zotero.org/styles
3637[finding and editing styles]: http://citationstyles.org/styles/
3638[CSL locale files]: https://github.com/citation-style-language/locales
3639[pandoc-citeproc man page]: https://github.com/jgm/pandoc-citeproc/blob/master/man/pandoc-citeproc.1.md
3641Non-pandoc extensions
3642---------------------
3644The following Markdown syntax extensions are not enabled by default
3645in pandoc, but may be enabled by adding `+EXTENSION` to the format
3646name, where `EXTENSION` is the name of the extension. Thus, for
3647example, `markdown+hard_line_breaks` is Markdown with hard line breaks.
3649#### Extension: `old_dashes` ####
3651Selects the pandoc <= 1.8.2.1 behavior for parsing smart dashes:
3652`-` before a numeral is an en-dash, and `--` is an em-dash.
3653This option only has an effect if `smart` is enabled. It is
3654selected automatically for `textile` input.
3656#### Extension: `angle_brackets_escapable` ####
3658Allow `<` and `>` to be backslash-escaped, as they can be in
3659GitHub flavored Markdown but not original Markdown. This is
3660implied by pandoc's default `all_symbols_escapable`.
3662#### Extension: `lists_without_preceding_blankline` ####
3664Allow a list to occur right after a paragraph, with no intervening
3665blank space.
3667#### Extension: `four_space_rule` ####
3669Selects the pandoc <= 2.0 behavior for parsing lists, so that
3670four spaces indent are needed for list item continuation
3671paragraphs.
3673#### Extension: `spaced_reference_links` ####
3675Allow whitespace between the two components of a reference link,
3676for example,
3678 [foo] [bar].
3680#### Extension: `hard_line_breaks` ####
3682Causes all newlines within a paragraph to be interpreted as hard line
3683breaks instead of spaces.
3685#### Extension: `ignore_line_breaks` ####
3687Causes newlines within a paragraph to be ignored, rather than being
3688treated as spaces or as hard line breaks. This option is intended for
3689use with East Asian languages where spaces are not used between words,
3690but text is divided into lines for readability.
3692#### Extension: `east_asian_line_breaks` ####
3694Causes newlines within a paragraph to be ignored, rather than
3695being treated as spaces or as hard line breaks, when they occur
3696between two East Asian wide characters. This is a better choice
3697than `ignore_line_breaks` for texts that include a mix of East
3698Asian wide characters and other characters.
3700#### Extension: `emoji` ####
3702Parses textual emojis like `:smile:` as Unicode emoticons.
3704#### Extension: `tex_math_single_backslash` ####
3706Causes anything between `\(` and `\)` to be interpreted as inline
3707TeX math, and anything between `\[` and `\]` to be interpreted
3708as display TeX math. Note: a drawback of this extension is that
3709it precludes escaping `(` and `[`.
3711#### Extension: `tex_math_double_backslash` ####
3713Causes anything between `\\(` and `\\)` to be interpreted as inline
3714TeX math, and anything between `\\[` and `\\]` to be interpreted
3715as display TeX math.
3717#### Extension: `markdown_attribute` ####
3719By default, pandoc interprets material inside block-level tags as Markdown.
3720This extension changes the behavior so that Markdown is only parsed
3721inside block-level tags if the tags have the attribute `markdown=1`.
3723#### Extension: `mmd_title_block` ####
3725Enables a [MultiMarkdown] style title block at the top of
3726the document, for example:
3728 Title: My title
3729 Author: John Doe
3730 Date: September 1, 2008
3731 Comment: This is a sample mmd title block, with
3732 a field spanning multiple lines.
3734See the MultiMarkdown documentation for details. If `pandoc_title_block` or
3735`yaml_metadata_block` is enabled, it will take precedence over
3736`mmd_title_block`.
3738#### Extension: `abbreviations` ####
3740Parses PHP Markdown Extra abbreviation keys, like
3742 *[HTML]: Hypertext Markup Language
3744Note that the pandoc document model does not support
3745abbreviations, so if this extension is enabled, abbreviation keys are
3746simply skipped (as opposed to being parsed as paragraphs).
3748#### Extension: `autolink_bare_uris` ####
3750Makes all absolute URIs into links, even when not surrounded by
3751pointy braces `<...>`.
3753#### Extension: `ascii_identifiers` ####
3755Causes the identifiers produced by `auto_identifiers` to be pure ASCII.
3756Accents are stripped off of accented Latin letters, and non-Latin
3757letters are omitted.
3759#### Extension: `mmd_link_attributes` ####
3761Parses multimarkdown style key-value attributes on link
3762and image references. This extension should not be confused with the
3763[`link_attributes`](#extension-link_attributes) extension.
3765 This is a reference ![image][ref] with multimarkdown attributes.
3767 [ref]: http://path.to/image "Image title" width=20px height=30px
3768 id=myId class="myClass1 myClass2"
3770#### Extension: `mmd_header_identifiers` ####
3772Parses multimarkdown style header identifiers (in square brackets,
3773after the header but before any trailing `#`s in an ATX header).
3775#### Extension: `compact_definition_lists` ####
3777Activates the definition list syntax of pandoc 1.12.x and earlier.
3778This syntax differs from the one described above under [Definition lists]
3779in several respects:
3781 - No blank line is required between consecutive items of the
3782 definition list.
3783 - To get a "tight" or "compact" list, omit space between consecutive
3784 items; the space between a term and its definition does not affect
3785 anything.
3786 - Lazy wrapping of paragraphs is not allowed: the entire definition must
3787 be indented four spaces.[^6]
3789[^6]: To see why laziness is incompatible with relaxing the requirement
3790 of a blank line between items, consider the following example:
3792 bar
3793 : definition
3794 foo
3795 : definition
3797 Is this a single list item with two definitions of "bar," the first of
3798 which is lazily wrapped, or two list items? To remove the ambiguity
3799 we must either disallow lazy wrapping or require a blank line between
3800 list items.
3802Markdown variants
3803-----------------
3805In addition to pandoc's extended Markdown, the following Markdown
3806variants are supported:
3808`markdown_phpextra` (PHP Markdown Extra)
3809: `footnotes`, `pipe_tables`, `raw_html`, `markdown_attribute`,
3810 `fenced_code_blocks`, `definition_lists`, `intraword_underscores`,
3811 `header_attributes`, `link_attributes`, `abbreviations`,
3812 `shortcut_reference_links`, `spaced_reference_links`.
3814`markdown_github` (deprecated GitHub-Flavored Markdown)
3815: `pipe_tables`, `raw_html`, `fenced_code_blocks`, `gfm_auto_identifiers`,
3816 `ascii_identifiers`, `backtick_code_blocks`, `autolink_bare_uris`,
3817 `space_in_atx_header`, `intraword_underscores`, `strikeout`,
3818 `emoji`, `shortcut_reference_links`, `angle_brackets_escapable`,
3819 `lists_without_preceding_blankline`.
3821`markdown_mmd` (MultiMarkdown)
3822: `pipe_tables`, `raw_html`, `markdown_attribute`, `mmd_link_attributes`,
3823 `tex_math_double_backslash`, `intraword_underscores`,
3824 `mmd_title_block`, `footnotes`, `definition_lists`,
3825 `all_symbols_escapable`, `implicit_header_references`,
3826 `auto_identifiers`, `mmd_header_identifiers`,
3827 `shortcut_reference_links`, `implicit_figures`,
3828 `superscript`, `subscript`, `backtick_code_blocks`,
3829 `spaced_reference_links`, `raw_attribute`.
3831`markdown_strict` (Markdown.pl)
3832: `raw_html`, `shortcut_reference_links`,
3833 `spaced_reference_links`.
3835We also support `gfm` (GitHub-Flavored Markdown) as a set of
3836extensions on `commonmark`:
3838: `pipe_tables`, `raw_html`, `fenced_code_blocks`, `auto_identifiers`,
3839 `ascii_identifiers`, `backtick_code_blocks`, `autolink_bare_uris`,
3840 `intraword_underscores`, `strikeout`, `hard_line_breaks`, `emoji`,
3841 `shortcut_reference_links`, `angle_brackets_escapable`.
3843 These can all be individually disabled. Note, however, that
3844 `commonmark` and `gfm` have limited support for extensions:
3845 extensions other than those listed above (and `smart`) will have
3846 no effect on `commonmark` or `gfm`.
3848Extensions with formats other than Markdown
3849-------------------------------------------
3851Some of the extensions discussed above can be used with formats
3852other than Markdown:
3854* `auto_identifiers` can be used with `latex`, `rst`, `mediawiki`,
3855 and `textile` input (and is used by default).
3857* `tex_math_dollars`, `tex_math_single_backslash`, and
3858 `tex_math_double_backslash` can be used with `html` input.
3859 (This is handy for reading web pages formatted using MathJax,
3860 for example.)
3862Producing slide shows with pandoc
3863=================================
3865You can use pandoc to produce an HTML + JavaScript slide presentation
3866that can be viewed via a web browser. There are five ways to do this,
3867using [S5], [DZSlides], [Slidy], [Slideous], or [reveal.js].
3868You can also produce a PDF slide show using LaTeX [`beamer`].
3870Here's the Markdown source for a simple slide show, `habits.txt`:
3872 % Habits
3873 % John Doe
3874 % March 22, 2005
3876 # In the morning
3878 ## Getting up
3880 - Turn off alarm
3881 - Get out of bed
3883 ## Breakfast
3885 - Eat eggs
3886 - Drink coffee
3888 # In the evening
3890 ## Dinner
3892 - Eat spaghetti
3893 - Drink wine
3895 ------------------
3897 ![picture of spaghetti](images/spaghetti.jpg)
3899 ## Going to sleep
3901 - Get in bed
3902 - Count sheep
3904To produce an HTML/JavaScript slide show, simply type
3906 pandoc -t FORMAT -s habits.txt -o habits.html
3908where `FORMAT` is either `s5`, `slidy`, `slideous`, `dzslides`, or `revealjs`.
3910For Slidy, Slideous, reveal.js, and S5, the file produced by pandoc with the
3911`-s/--standalone` option embeds a link to JavaScript and CSS files, which are
3912assumed to be available at the relative path `s5/default` (for S5), `slideous`
3913(for Slideous), `reveal.js` (for reveal.js), or at the Slidy website at
3914`w3.org` (for Slidy). (These paths can be changed by setting the `slidy-url`,
3915`slideous-url`, `revealjs-url`, or `s5-url` variables; see [Variables for slides],
3916above.) For DZSlides, the (relatively short) JavaScript and CSS are included in
3917the file by default.
3919With all HTML slide formats, the `--self-contained` option can be used to
3920produce a single file that contains all of the data necessary to display the
3921slide show, including linked scripts, stylesheets, images, and videos.
3923To produce a PDF slide show using beamer, type
3925 pandoc -t beamer habits.txt -o habits.pdf
3927Note that a reveal.js slide show can also be converted to a PDF
3928by printing it to a file from the browser.
3930Structuring the slide show
3931--------------------------
3933By default, the *slide level* is the highest header level in
3934the hierarchy that is followed immediately by content, and not another
3935header, somewhere in the document. In the example above, level 1 headers
3936are always followed by level 2 headers, which are followed by content,
3937so 2 is the slide level. This default can be overridden using
3938the `--slide-level` option.
3940The document is carved up into slides according to the following
3941rules:
3943 * A horizontal rule always starts a new slide.
3945 * A header at the slide level always starts a new slide.
3947 * Headers *below* the slide level in the hierarchy create
3948 headers *within* a slide.
3950 * Headers *above* the slide level in the hierarchy create
3951 "title slides," which just contain the section title
3952 and help to break the slide show into sections.
3954 * Content *above* the slide level will not appear in the slide
3955 show.
3957 * A title page is constructed automatically from the document's title
3958 block, if present. (In the case of beamer, this can be disabled
3959 by commenting out some lines in the default template.)
3961These rules are designed to support many different styles of slide show. If
3962you don't care about structuring your slides into sections and subsections,
3963you can just use level 1 headers for all each slide. (In that case, level 1
3964will be the slide level.) But you can also structure the slide show into
3965sections, as in the example above.
3967Note: in reveal.js slide shows, if slide level is 2, a two-dimensional
3968layout will be produced, with level 1 headers building horizontally
3969and level 2 headers building vertically. It is not recommended that
3970you use deeper nesting of section levels with reveal.js.
3972Incremental lists
3973-----------------
3975By default, these writers produce lists that display "all at once."
3976If you want your lists to display incrementally (one item at a time),
3977use the `-i` option. If you want a particular list to depart from the
3978default (that is, to display incrementally without the `-i` option and
3979all at once with the `-i` option), put it in a block quote:
3981 > - Eat spaghetti
3982 > - Drink wine
3984In this way incremental and nonincremental lists can be mixed in
3985a single document.
3987Inserting pauses
3988----------------
3990You can add "pauses" within a slide by including a paragraph containing
3991three dots, separated by spaces:
3993 # Slide with a pause
3995 content before the pause
3997 . . .
3999 content after the pause
4001Styling the slides
4002------------------
4004You can change the style of HTML slides by putting customized CSS files
4005in `$DATADIR/s5/default` (for S5), `$DATADIR/slidy` (for Slidy),
4006or `$DATADIR/slideous` (for Slideous),
4007where `$DATADIR` is the user data directory (see `--data-dir`, above).
4008The originals may be found in pandoc's system data directory (generally
4009`$CABALDIR/pandoc-VERSION/s5/default`). Pandoc will look there for any
4010files it does not find in the user data directory.
4012For dzslides, the CSS is included in the HTML file itself, and may
4013be modified there.
4015All [reveal.js configuration options] can be set through variables.
4016For example, themes can be used by setting the `theme` variable:
4018 -V theme=moon
4020Or you can specify a custom stylesheet using the `--css` option.
4022To style beamer slides, you can specify a `theme`, `colortheme`,
4023`fonttheme`, `innertheme`, and `outertheme`, using the `-V` option:
4025 pandoc -t beamer habits.txt -V theme:Warsaw -o habits.pdf
4027Note that header attributes will turn into slide attributes
4028(on a `<div>` or `<section>`) in HTML slide formats, allowing you
4029to style individual slides. In beamer, the only header attribute
4030that affects slides is the `allowframebreaks` class, which sets the
4031`allowframebreaks` option, causing multiple slides to be created
4032if the content overfills the frame. This is recommended especially for
4033bibliographies:
4035 # References {.allowframebreaks}
4037Speaker notes
4038-------------
4040reveal.js has good support for speaker notes. You can add notes to your
4041Markdown document thus:
4043 ::: notes
4045 This is my note.
4047 - It can contain Markdown
4048 - like this list
4050 :::
4052To show the notes window, press `s` while viewing the presentation.
4053Notes are not yet supported for other slide formats, but the notes
4054will not appear on the slides themselves.
4056Columns
4057-------
4059To put material in side by side columns, you can use a native
4060div container with class `columns`, containing two or more div
4061containers with class `column` and a `width` attribute:
4063 :::::::::::::: {.columns}
4064 ::: {.column width="40%"}
4065 contents...
4066 :::
4067 ::: {.column width="60%"}
4068 contents...
4069 :::
4070 ::::::::::::::
4072Frame attributes in beamer
4073--------------------------
4075Sometimes it is necessary to add the LaTeX `[fragile]` option to
4076a frame in beamer (for example, when using the `minted` environment).
4077This can be forced by adding the `fragile` class to the header
4078introducing the slide:
4080 # Fragile slide {.fragile}
4082All of the other frame attributes described in Section 8.1 of
4083the [Beamer User's Guide] may also be used: `allowdisplaybreaks`,
4084`allowframebreaks`, `b`, `c`, `t`, `environment`, `label`, `plain`,
4085`shrink`.
4087Creating EPUBs with pandoc
4088==========================
4090EPUB Metadata
4091-------------
4093EPUB metadata may be specified using the `--epub-metadata` option, but
4094if the source document is Markdown, it is better to use a [YAML metadata
4095block][Extension: `yaml_metadata_block`]. Here is an example:
4097 ---
4098 title:
4099 - type: main
4100 text: My Book
4101 - type: subtitle
4102 text: An investigation of metadata
4103 creator:
4104 - role: author
4105 text: John Smith
4106 - role: editor
4107 text: Sarah Jones
4108 identifier:
4109 - scheme: DOI
4110 text: doi:10.234234.234/33
4111 publisher: My Press
4112 rights: © 2007 John Smith, CC BY-NC
4113 ibooks:
4114 version: 1.3.4
4115 ...
4117The following fields are recognized:
4119`identifier`
4120 ~ Either a string value or an object with fields `text` and
4121 `scheme`. Valid values for `scheme` are `ISBN-10`,
4122 `GTIN-13`, `UPC`, `ISMN-10`, `DOI`, `LCCN`, `GTIN-14`,
4123 `ISBN-13`, `Legal deposit number`, `URN`, `OCLC`,
4124 `ISMN-13`, `ISBN-A`, `JP`, `OLCC`.
4126`title`
4127 ~ Either a string value, or an object with fields `file-as` and
4128 `type`, or a list of such objects. Valid values for `type` are
4129 `main`, `subtitle`, `short`, `collection`, `edition`, `extended`.
4131`creator`
4132 ~ Either a string value, or an object with fields `role`, `file-as`,
4133 and `text`, or a list of such objects. Valid values for `role` are
4134 [MARC relators], but
4135 pandoc will attempt to translate the human-readable versions
4136 (like "author" and "editor") to the appropriate marc relators.
4138`contributor`
4139 ~ Same format as `creator`.
4141`date`
4142 ~ A string value in `YYYY-MM-DD` format. (Only the year is necessary.)
4143 Pandoc will attempt to convert other common date formats.
4145`lang` (or legacy: `language`)
4146 ~ A string value in [BCP 47] format. Pandoc will default to the local
4147 language if nothing is specified.
4149`subject`
4150 ~ A string value or a list of such values.
4152`description`
4153 ~ A string value.
4155`type`
4156 ~ A string value.
4158`format`
4159 ~ A string value.
4161`relation`
4162 ~ A string value.
4164`coverage`
4165 ~ A string value.
4167`rights`
4168 ~ A string value.
4170`cover-image`
4171 ~ A string value (path to cover image).
4173`stylesheet`
4174 ~ A string value (path to CSS stylesheet).
4176`page-progression-direction`
4177 ~ Either `ltr` or `rtl`. Specifies the `page-progression-direction`
4178 attribute for the [`spine` element].
4180`ibooks`
4181 ~ iBooks-specific metadata, with the following fields:
4183 - `version`: (string)
4184 - `specified-fonts`: `true`|`false` (default `false`)
4185 - `ipad-orientation-lock`: `portrait-only`|`landscape-only`
4186 - `iphone-orientation-lock`: `portrait-only`|`landscape-only`
4187 - `binding`: `true`|`false` (default `true`)
4188 - `scroll-axis`: `vertical`|`horizontal`|`default`
4190[MARC relators]: http://loc.gov/marc/relators/relaterm.html
4191[`spine` element]: http://idpf.org/epub/301/spec/epub-publications.html#sec-spine-elem
4193Linked media
4194------------
4196By default, pandoc will download linked media (including audio and
4197video) and include it in the EPUB container, yielding a completely
4198self-contained EPUB. If you want to link to external media resources
4199instead, use raw HTML in your source and add `data-external="1"` to the tag
4200with the `src` attribute. For example:
4202 <audio controls="1">
4203 <source src="http://example.com/music/toccata.mp3"
4204 data-external="1" type="audio/mpeg">
4205 </source>
4206 </audio>
4208Literate Haskell support
4209========================
4211If you append `+lhs` (or `+literate_haskell`) to an appropriate input or output
4212format (`markdown`, `markdown_strict`, `rst`, or `latex` for input or output;
4213`beamer`, `html4` or `html5` for output only), pandoc will treat the document as
4214literate Haskell source. This means that
4216 - In Markdown input, "bird track" sections will be parsed as Haskell
4217 code rather than block quotations. Text between `\begin{code}`
4218 and `\end{code}` will also be treated as Haskell code. For
4219 ATX-style headers the character '=' will be used instead of '#'.
4221 - In Markdown output, code blocks with classes `haskell` and `literate`
4222 will be rendered using bird tracks, and block quotations will be
4223 indented one space, so they will not be treated as Haskell code.
4224 In addition, headers will be rendered setext-style (with underlines)
4225 rather than ATX-style (with '#' characters). (This is because ghc
4226 treats '#' characters in column 1 as introducing line numbers.)
4228 - In restructured text input, "bird track" sections will be parsed
4229 as Haskell code.
4231 - In restructured text output, code blocks with class `haskell` will
4232 be rendered using bird tracks.
4234 - In LaTeX input, text in `code` environments will be parsed as
4235 Haskell code.
4237 - In LaTeX output, code blocks with class `haskell` will be rendered
4238 inside `code` environments.
4240 - In HTML output, code blocks with class `haskell` will be rendered
4241 with class `literatehaskell` and bird tracks.
4243Examples:
4245 pandoc -f markdown+lhs -t html
4247reads literate Haskell source formatted with Markdown conventions and writes
4248ordinary HTML (without bird tracks).
4250 pandoc -f markdown+lhs -t html+lhs
4252writes HTML with the Haskell code in bird tracks, so it can be copied
4253and pasted as literate Haskell source.
4255Note that GHC expects the bird tracks in the first column, so indentend literate
4256code blocks (e.g. inside an itemized environment) will not be picked up by the
4257Haskell compiler.
4259Syntax highlighting
4260===================
4262Pandoc will automatically highlight syntax in [fenced code blocks] that
4263are marked with a language name. The Haskell library [skylighting] is
4264used for highlighting, which works in HTML, Docx, Ms, and LaTeX/PDF output.
4265To see a list of language names that pandoc will recognize, type
4266`pandoc --list-highlight-languages`.
4268The color scheme can be selected using the `--highlight-style` option.
4269The default color scheme is `pygments`, which imitates the default color
4270scheme used by the Python library pygments (though pygments is not actually
4271used to do the highlighting). To see a list of highlight styles,
4272type `pandoc --list-highlight-styles`.
4274To disable highlighting, use the `--no-highlight` option.
4276[skylighting]: https://github.com/jgm/skylighting
4278Custom Styles in Docx Output
4279============================
4281By default, pandoc's docx output applies a predefined set of styles for
4282blocks such as paragraphs and block quotes, and uses largely default
4283formatting (italics, bold) for inlines. This will work for most
4284purposes, especially alongside a `reference.docx` file. However, if you
4285need to apply your own styles to blocks, or match a preexisting set of
4286styles, pandoc allows you to define custom styles for blocks and text
4287using `div`s and `span`s, respectively.
4289If you define a `div` or `span` with the attribute `custom-style`,
4290pandoc will apply your specified style to the contained elements. So,
4291for example,
4293 <span custom-style="Emphatically">Get out,</span> he said.
4295would produce a docx file with "Get out," styled with character
4296style `Emphatically`. Similarly,
4298 Dickinson starts the poem simply:
4300 <div custom-style="Poetry">
4301 | A Bird came down the Walk---
4302 | He did not know I saw---
4303 </div>
4305would style the two contained lines with the `Poetry` paragraph style.
4307If the styles are not yet in your reference.docx, they will be defined
4308in the output file as inheriting from normal text. If they are already
4309defined, pandoc will not alter the definition.
4311This feature allows for greatest customization in conjunction with
4312[pandoc filters]. If you want all paragraphs after block quotes to be
4313indented, you can write a filter to apply the styles necessary. If you
4314want all italics to be transformed to the `Emphasis` character style
4315(perhaps to change their color), you can write a filter which will
4316transform all italicized inlines to inlines within an `Emphasis`
4317custom-style `span`.
4319[pandoc filters]: http://pandoc.org/filters.html
4321Custom writers
4322==============
4324Pandoc can be extended with custom writers written in [lua]. (Pandoc
4325includes a lua interpreter, so lua need not be installed separately.)
4327To use a custom writer, simply specify the path to the lua script
4328in place of the output format. For example:
4330 pandoc -t data/sample.lua
4332Creating a custom writer requires writing a lua function for each
4333possible element in a pandoc document. To get a documented example
4334which you can modify according to your needs, do
4336 pandoc --print-default-data-file sample.lua
4338[lua]: http://www.lua.org
4340Authors
4341=======
4343Copyright 2006-2017 John MacFarlane (jgm@berkeley.edu). Released
4344under the [GPL], version 2 or greater. This software carries no
4345warranty of any kind. (See COPYRIGHT for full copyright and
4346warranty notices.) For a full list of contributors, see the file
4347AUTHORS.md in the pandoc source code.
4349[GPL]: http://www.gnu.org/copyleft/gpl.html "GNU General Public License"