git.iko.soy/typeable/pandoc
on 2.0.5 help sign in
typeable/pandoc/MANUAL.txt
4388 lines 155 kB history raw
1% Pandoc User's Guide
2% John MacFarlane
3% December 8, 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
18markup], [TikiWiki markup], [Creole 1.0], [Haddock markup], [OPML],
19[Emacs Org mode], [DocBook], [Muse], [txt2tags], [Vimwiki], [EPUB],
20[ODT], and [Word docx]; and it can write plain text, [Markdown],
21[CommonMark], [PHP Markdown Extra], [GitHub-Flavored Markdown],
22[MultiMarkdown], [reStructuredText], [XHTML], [HTML5], [LaTeX]
23\(including [`beamer`] slide shows\), [ConTeXt], [RTF], [OPML],
24[DocBook], [OpenDocument], [ODT], [Word docx], [GNU Texinfo],
25[MediaWiki markup], [DokuWiki markup], [ZimWiki markup], [Haddock
26markup], [EPUB] \(v2 or v3\), [FictionBook2], [Textile], [groff man],
27[groff ms], [Emacs Org mode], [AsciiDoc], [InDesign ICML], [TEI
28Simple], [Muse], [PowerPoint] slide shows and [Slidy], [Slideous],
29[DZSlides], [reveal.js] or [S5] HTML slide shows. It can also produce
30[PDF] output on systems where LaTeX, ConTeXt, `pdfroff`,
31`wkhtmltopdf`, `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[PowerPoint]: https://en.wikipedia.org/wiki/Microsoft_PowerPoint
106[Vimwiki]: https://vimwiki.github.io
108Using `pandoc`
109--------------
111If no *input-file* is specified, input is read from *stdin*.
112Otherwise, the *input-files* are concatenated (with a blank
113line between each) and used as input. Output goes to *stdout* by
114default (though output to the terminal is disabled for the
115`odt`, `docx`, `epub2`, and `epub3` output formats, unless it is
116forced using `-o -`). For output to a file, use the `-o`
117option:
119 pandoc -o output.html input.txt
121By default, pandoc produces a document fragment, not a standalone
122document with a proper header and footer. To produce a standalone
123document, use the `-s` or `--standalone` flag:
125 pandoc -s -o output.html input.txt
127For more information on how standalone documents are produced, see
128[Templates], below.
130Instead of a file, an absolute URI may be given. In this case
131pandoc will fetch the content using HTTP:
133 pandoc -f html -t markdown http://www.fsf.org
135It is possible to supply a custom User-Agent string or other
136header when requesting a document from a URL:
138 pandoc -f html -t markdown --request-header User-Agent:"Mozilla/5.0" \
139 http://www.fsf.org
141If multiple input files are given, `pandoc` will concatenate them all (with
142blank lines between them) before parsing. This feature is disabled for
143 binary input formats such as `EPUB`, `odt`, and `docx`.
145The format of the input and output can be specified explicitly using
146command-line options. The input format can be specified using the
147`-r/--read` or `-f/--from` options, the output format using the
148`-w/--write` or `-t/--to` options. Thus, to convert `hello.txt` from
149Markdown to LaTeX, you could type:
151 pandoc -f markdown -t latex hello.txt
153To convert `hello.html` from HTML to Markdown:
155 pandoc -f html -t markdown hello.html
157Supported output formats are listed below under the `-t/--to` option.
158Supported input formats are listed below under the `-f/--from` option. Note
159that the `rst`, `textile`, `latex`, and `html` readers are not complete;
160there are some constructs that they do not parse.
162If the input or output format is not specified explicitly, `pandoc`
163will attempt to guess it from the extensions of
164the input and output filenames. Thus, for example,
166 pandoc -o hello.tex hello.txt
168will convert `hello.txt` from Markdown to LaTeX. If no output file
169is specified (so that output goes to *stdout*), or if the output file's
170extension is unknown, the output format will default to HTML.
171If no input file is specified (so that input comes from *stdin*), or
172if the input files' extensions are unknown, the input format will
173be assumed to be Markdown unless explicitly specified.
175Pandoc uses the UTF-8 character encoding for both input and output.
176If your local character encoding is not UTF-8, you
177should pipe input and output through [`iconv`]:
179 iconv -t utf-8 input.txt | pandoc | iconv -f utf-8
181Note that in some output formats (such as HTML, LaTeX, ConTeXt,
182RTF, OPML, DocBook, and Texinfo), information about
183the character encoding is included in the document header, which
184will only be included if you use the `-s/--standalone` option.
186[`iconv`]: http://www.gnu.org/software/libiconv/
188Creating a PDF
189--------------
191To produce a PDF, specify an output file with a `.pdf` extension.
192By default, pandoc will use LaTeX to create the PDF:
194 pandoc test.txt -o test.pdf
196Production of a PDF requires that a LaTeX engine be installed (see
197`--pdf-engine`, below), and assumes that the following LaTeX packages
198are available: [`amsfonts`], [`amsmath`], [`lm`], [`unicode-math`],
199[`ifxetex`], [`ifluatex`], [`listings`] (if the
200`--listings` option is used), [`fancyvrb`], [`longtable`],
201[`booktabs`], [`graphicx`] and [`grffile`] (if the document
202contains images), [`hyperref`], [`xcolor`] (with `colorlinks`), [`ulem`], [`geometry`] (with the
203`geometry` variable set), [`setspace`] (with `linestretch`), and
204[`babel`] (with `lang`). The use of `xelatex` or `lualatex` as
205the LaTeX engine requires [`fontspec`]. `xelatex` uses
206[`polyglossia`] (with `lang`), [`xecjk`], and [`bidi`] (with the
207`dir` variable set). If the `mathspec` variable is set,
208`xelatex` will use [`mathspec`] instead of [`unicode-math`].
209The [`upquote`] and [`microtype`] packages are used if
210available, and [`csquotes`] will be used for [typography]
211if added to the template or included in any header file. The
212[`natbib`], [`biblatex`], [`bibtex`], and [`biber`] packages can
213optionally be used for [citation rendering]. These are included
214with all recent versions of [TeX Live].
216Alternatively, pandoc can use [ConTeXt], `pdfroff`, or any of the
217following HTML/CSS-to-PDF-engines, to create a PDF: [`wkhtmltopdf`],
218[`weasyprint`] or [`prince`].
219To do this, specify an output file with a `.pdf` extension, as before,
220but add the `--pdf-engine` option or `-t context`, `-t html`, or `-t ms`
221to the command line (`-t html` defaults to `--pdf-engine=wkhtmltopdf`).
223PDF output can be controlled using [variables for LaTeX] (if
224LaTeX is used) and [variables for ConTeXt] (if ConTeXt is used).
225When using an HTML/CSS-to-PDF-engine, `--css` affects the output.
226If `wkhtmltopdf` is used, then the variables `margin-left`,
227`margin-right`, `margin-top`, `margin-bottom`, and `papersize`
228will affect the output.
230[`amsfonts`]: https://ctan.org/pkg/amsfonts
231[`amsmath`]: https://ctan.org/pkg/amsmath
232[`lm`]: https://ctan.org/pkg/lm
233[`ifxetex`]: https://ctan.org/pkg/ifxetex
234[`ifluatex`]: https://ctan.org/pkg/ifluatex
235[`listings`]: https://ctan.org/pkg/listings
236[`fancyvrb`]: https://ctan.org/pkg/fancyvrb
237[`longtable`]: https://ctan.org/pkg/longtable
238[`booktabs`]: https://ctan.org/pkg/booktabs
239[`graphicx`]: https://ctan.org/pkg/graphicx
240[`grffile`]: https://ctan.org/pkg/grffile
241[`geometry`]: https://ctan.org/pkg/geometry
242[`setspace`]: https://ctan.org/pkg/setspace
243[`xecjk`]: https://ctan.org/pkg/xecjk
244[`hyperref`]: https://ctan.org/pkg/hyperref
245[`ulem`]: https://ctan.org/pkg/ulem
246[`babel`]: https://ctan.org/pkg/babel
247[`bidi`]: https://ctan.org/pkg/bidi
248[`mathspec`]: https://ctan.org/pkg/mathspec
249[`unicode-math`]: https://ctan.org/pkg/unicode-math
250[`polyglossia`]: https://ctan.org/pkg/polyglossia
251[`fontspec`]: https://ctan.org/pkg/fontspec
252[`upquote`]: https://ctan.org/pkg/upquote
253[`microtype`]: https://ctan.org/pkg/microtype
254[`csquotes`]: https://ctan.org/pkg/csquotes
255[`natbib`]: https://ctan.org/pkg/natbib
256[`biblatex`]: https://ctan.org/pkg/biblatex
257[`bibtex`]: https://ctan.org/pkg/bibtex
258[`biber`]: https://ctan.org/pkg/biber
259[TeX Live]: http://www.tug.org/texlive/
260[`wkhtmltopdf`]: https://wkhtmltopdf.org
261[`weasyprint`]: http://weasyprint.org
262[`prince`]: https://www.princexml.com/
264Options
265=======
267General options
268---------------
270`-f` *FORMAT*, `-r` *FORMAT*, `--from=`*FORMAT*, `--read=`*FORMAT*
272: Specify input format. *FORMAT* can be `native` (native Haskell),
273 `json` (JSON version of native AST), `markdown` (pandoc's
274 extended Markdown), `markdown_strict` (original unextended
275 Markdown), `markdown_phpextra` (PHP Markdown Extra),
276 `markdown_mmd` (MultiMarkdown), `gfm` (GitHub-Flavored Markdown),
277 `commonmark` (CommonMark Markdown), `textile` (Textile), `rst`
278 (reStructuredText), `html` (HTML), `docbook` (DocBook), `t2t`
279 (txt2tags), `docx` (docx), `odt` (ODT), `epub` (EPUB), `opml` (OPML),
280 `org` (Emacs Org mode), `mediawiki` (MediaWiki markup), `twiki` (TWiki
281 markup), `tikiwiki` (TikiWiki markup), `creole` (Creole 1.0),
282 `haddock` (Haddock markup), or `latex` (LaTeX).
283 (`markdown_github` provides deprecated and less accurate support
284 for Github-Flavored Markdown; please use `gfm` instead, unless you
285 need to use extensions other than `smart`.)
286 If `+lhs` is appended to `markdown`, `rst`, `latex`, or
287 `html`, the input will be treated as literate Haskell source: see
288 [Literate Haskell support], below. Markdown
289 syntax extensions can be individually enabled or disabled by
290 appending `+EXTENSION` or `-EXTENSION` to the format name. So, for
291 example, `markdown_strict+footnotes+definition_lists` is strict
292 Markdown with footnotes and definition lists enabled, and
293 `markdown-pipe_tables+hard_line_breaks` is pandoc's Markdown
294 without pipe tables and with hard line breaks. See [Pandoc's
295 Markdown], below, for a list of extensions and
296 their names. See `--list-input-formats` and `--list-extensions`,
297 below.
299`-t` *FORMAT*, `-w` *FORMAT*, `--to=`*FORMAT*, `--write=`*FORMAT*
301: Specify output format. *FORMAT* can be `native` (native Haskell),
302 `json` (JSON version of native AST), `plain` (plain text),
303 `markdown` (pandoc's extended Markdown), `markdown_strict`
304 (original unextended Markdown), `markdown_phpextra` (PHP Markdown
305 Extra), `markdown_mmd` (MultiMarkdown), `gfm` (GitHub-Flavored
306 Markdown), `commonmark` (CommonMark Markdown), `rst`
307 (reStructuredText), `html4` (XHTML 1.0 Transitional), `html` or
308 `html5` (HTML5/XHTML [polyglot markup]), `latex` (LaTeX), `beamer`
309 (LaTeX beamer slide show), `context` (ConTeXt), `man` (groff man),
310 `mediawiki` (MediaWiki markup), `dokuwiki` (DokuWiki markup),
311 `zimwiki` (ZimWiki markup), `textile` (Textile), `org` (Emacs Org
312 mode), `texinfo` (GNU Texinfo), `opml` (OPML), `docbook` or
313 `docbook4` (DocBook 4), `docbook5` (DocBook 5), `jats` (JATS XML),
314 `opendocument` (OpenDocument), `odt` (OpenOffice text document),
315 `docx` (Word docx), `haddock` (Haddock markup), `rtf` (rich text
316 format), `epub2` (EPUB v2 book), `epub` or `epub3` (EPUB v3),
317 `fb2` (FictionBook2 e-book), `asciidoc` (AsciiDoc), `icml`
318 (InDesign ICML), `tei` (TEI Simple), `slidy` (Slidy HTML and
319 JavaScript slide show), `slideous` (Slideous HTML and JavaScript
320 slide show), `dzslides` (DZSlides HTML5 + JavaScript slide show),
321 `revealjs` (reveal.js HTML5 + JavaScript slide show), `s5` (S5
322 HTML and JavaScript slide show), `pptx` (PowerPoint slide show) or
323 the path of a custom lua writer (see [Custom writers],
324 below). (`markdown_github` provides deprecated and less accurate
325 support for Github-Flavored Markdown; please use `gfm` instead,
326 unless you use extensions that do not work with `gfm`.) Note that
327 `odt`, `epub`, and `epub3` output will not be directed to
328 *stdout*; an output filename must be specified using the
329 `-o/--output` option. If `+lhs` is appended to `markdown`, `rst`,
330 `latex`, `beamer`, `html4`, or `html5`, the output will be
331 rendered as literate Haskell source: see [Literate Haskell
332 support], below. Markdown syntax extensions can be individually
333 enabled or disabled by appending `+EXTENSION` or `-EXTENSION` to
334 the format name, as described above under `-f`. See
335 `--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`--strip-empty-paragraphs`
432: *Deprecated. Use the `+empty_paragraphs` extension instead.*
433 Ignore paragraphs with no content. This option is useful
434 for converting word processing documents where users have
435 used empty paragraphs to create inter-paragraph space.
437`--indented-code-classes=`*CLASSES*
439: Specify classes to use for indented code blocks--for example,
440 `perl,numberLines` or `haskell`. Multiple classes may be separated
441 by spaces or commas.
443`--default-image-extension=`*EXTENSION*
445: Specify a default extension to use when image paths/URLs have no
446 extension. This allows you to use the same source for formats that
447 require different kinds of images. Currently this option only affects
448 the Markdown and LaTeX readers.
450`--file-scope`
452: Parse each file individually before combining for multifile
453 documents. This will allow footnotes in different files with the
454 same identifiers to work as expected. If this option is set,
455 footnotes and links will not work across files. Reading binary
456 files (docx, odt, epub) implies `--file-scope`.
458`--filter=`*PROGRAM*
460: Specify an executable to be used as a filter transforming the
461 pandoc AST after the input is parsed and before the output is
462 written. The executable should read JSON from stdin and write
463 JSON to stdout. The JSON must be formatted like pandoc's own
464 JSON input and output. The name of the output format will be
465 passed to the filter as the first argument. Hence,
467 pandoc --filter ./caps.py -t latex
469 is equivalent to
471 pandoc -t json | ./caps.py latex | pandoc -f json -t latex
473 The latter form may be useful for debugging filters.
475 Filters may be written in any language. `Text.Pandoc.JSON`
476 exports `toJSONFilter` to facilitate writing filters in Haskell.
477 Those who would prefer to write filters in python can use the
478 module [`pandocfilters`], installable from PyPI. There are also
479 pandoc filter libraries in [PHP], [perl], and
480 [JavaScript/node.js].
482 In order of preference, pandoc will look for filters in
484 1. a specified full or relative path (executable or
485 non-executable)
487 2. `$DATADIR/filters` (executable or non-executable)
488 where `$DATADIR` is the user data directory (see
489 `--data-dir`, above).
491 3. `$PATH` (executable only)
493`--lua-filter=`*SCRIPT*
495: Transform the document in a similar fashion as JSON filters (see
496 `--filter`), but use pandoc's build-in lua filtering system. The given
497 lua script is expected to return a list of lua filters which will be
498 applied in order. Each lua filter must contain element-transforming
499 functions indexed by the name of the AST element on which the filter
500 function should be applied.
502 The `pandoc` lua module provides helper functions for element
503 creation. It is always loaded into the script's lua environment.
505 The following is an example lua script for macro-expansion:
507 function expand_hello_world(inline)
508 if inline.c == '{{helloworld}}' then
509 return pandoc.Emph{ pandoc.Str "Hello, World" }
510 else
511 return inline
512 end
513 end
515 return {{Str = expand_hello_world}}
518`-M` *KEY*[`=`*VAL*], `--metadata=`*KEY*[`:`*VAL*]
520: Set the metadata field *KEY* to the value *VAL*. A value specified
521 on the command line overrides a value specified in the document.
522 Values will be parsed as YAML boolean or string values. If no value is
523 specified, the value will be treated as Boolean true. Like
524 `--variable`, `--metadata` causes template variables to be set.
525 But unlike `--variable`, `--metadata` affects the metadata of the
526 underlying document (which is accessible from filters and may be
527 printed in some output formats).
529`-p`, `--preserve-tabs`
531: Preserve tabs instead of converting them to spaces (the default).
532 Note that this will only affect tabs in literal code spans and code
533 blocks; tabs in regular text will be treated as spaces.
535`--tab-stop=`*NUMBER*
537: Specify the number of spaces per tab (default is 4).
539`--track-changes=accept`|`reject`|`all`
541: Specifies what to do with insertions, deletions, and comments
542 produced by the MS Word "Track Changes" feature. `accept` (the
543 default), inserts all insertions, and ignores all
544 deletions. `reject` inserts all deletions and ignores
545 insertions. Both `accept` and `reject` ignore comments. `all` puts
546 in insertions, deletions, and comments, wrapped in spans with
547 `insertion`, `deletion`, `comment-start`, and `comment-end`
548 classes, respectively. The author and time of change is
549 included. `all` is useful for scripting: only accepting changes
550 from a certain reviewer, say, or before a certain date. This
551 option only affects the docx reader.
553`--extract-media=`*DIR*
555: Extract images and other media contained in or linked from
556 the source document to the path *DIR*, creating it if
557 necessary, and adjust the images references in the document
558 so they point to the extracted files. If the source format is
559 a binary container (docx, epub, or odt), the media is
560 extracted from the container and the original
561 filenames are used. Otherwise the media is read from the
562 file system or downloaded, and new filenames are constructed
563 based on SHA1 hashes of the contents.
565`--abbreviations=`*FILE*
567: Specifies a custom abbreviations file, with abbreviations
568 one to a line. If this option is not specified, pandoc will
569 read the data file `abbreviations` from the user data
570 directory or fall back on a system default. To see the
571 system default, use
572 `pandoc --print-default-data-file=abbreviations`. The only
573 use pandoc makes of this list is in the Markdown reader.
574 Strings ending in a period that are found in this list will
575 be followed by a nonbreaking space, so that the period will
576 not produce sentence-ending space in formats like LaTeX.
578[`pandocfilters`]: https://github.com/jgm/pandocfilters
579[PHP]: https://github.com/vinai/pandocfilters-php
580[perl]: https://metacpan.org/pod/Pandoc::Filter
581[JavaScript/node.js]: https://github.com/mvhenderson/pandoc-filter-node
583General writer options
584----------------------
586`-s`, `--standalone`
588: Produce output with an appropriate header and footer (e.g. a
589 standalone HTML, LaTeX, TEI, or RTF file, not a fragment). This option
590 is set automatically for `pdf`, `epub`, `epub3`, `fb2`, `docx`, and `odt`
591 output.
593`--template=`*FILE*
595: Use *FILE* as a custom template for the generated document. Implies
596 `--standalone`. See [Templates], below, for a description
597 of template syntax. If no extension is specified, an extension
598 corresponding to the writer will be added, so that `--template=special`
599 looks for `special.html` for HTML output. If the template is not
600 found, pandoc will search for it in the `templates` subdirectory of
601 the user data directory (see `--data-dir`). If this option is not used,
602 a default template appropriate for the output format will be used (see
603 `-D/--print-default-template`).
605`-V` *KEY*[`=`*VAL*], `--variable=`*KEY*[`:`*VAL*]
607: Set the template variable *KEY* to the value *VAL* when rendering the
608 document in standalone mode. This is generally only useful when the
609 `--template` option is used to specify a custom template, since
610 pandoc automatically sets the variables used in the default
611 templates. If no *VAL* is specified, the key will be given the
612 value `true`.
614`-D` *FORMAT*, `--print-default-template=`*FORMAT*
616: Print the system default template for an output *FORMAT*. (See `-t`
617 for a list of possible *FORMAT*s.) Templates in the user data
618 directory are ignored.
620`--print-default-data-file=`*FILE*
622: Print a system default data file. Files in the user data directory
623 are ignored.
625`--eol=crlf`|`lf`|`native`
627: Manually specify line endings: `crlf` (Windows), `lf`
628 (macOS/Linux/UNIX), or `native` (line endings appropriate
629 to the OS on which pandoc is being run). The default is
630 `native`.
632`--dpi`=*NUMBER*
634: Specify the dpi (dots per inch) value for conversion from pixels
635 to inch/centimeters and vice versa. The default is 96dpi.
636 Technically, the correct term would be ppi (pixels per inch).
638`--wrap=auto`|`none`|`preserve`
640: Determine how text is wrapped in the output (the source
641 code, not the rendered version). With `auto` (the default),
642 pandoc will attempt to wrap lines to the column width specified by
643 `--columns` (default 72). With `none`, pandoc will not wrap
644 lines at all. With `preserve`, pandoc will attempt to
645 preserve the wrapping from the source document (that is,
646 where there are nonsemantic newlines in the source, there
647 will be nonsemantic newlines in the output as well).
648 Automatic wrapping does not currently work in HTML output.
650`--columns=`*NUMBER*
652: Specify length of lines in characters. This affects text wrapping
653 in the generated source code (see `--wrap`). It also affects
654 calculation of column widths for plain text tables (see [Tables] below).
656`--toc`, `--table-of-contents`
658: Include an automatically generated table of contents (or, in
659 the case of `latex`, `context`, `docx`, `odt`,
660 `opendocument`, `rst`, or `ms`, an instruction to create
661 one) in the output document. This option has no effect on
662 `man`, `docbook4`, `docbook5`, or `jats` output.
664`--toc-depth=`*NUMBER*
666: Specify the number of section levels to include in the table
667 of contents. The default is 3 (which means that level 1, 2, and 3
668 headers will be listed in the contents).
670`--strip-comments`
672: Strip out HTML comments in the Markdown or Textile source,
673 rather than passing them on to Markdown, Textile or HTML
674 output as raw HTML. This does not apply to HTML comments
675 inside raw HTML blocks when the `markdown_in_html_blocks`
676 extension is not set.
678`--no-highlight`
680: Disables syntax highlighting for code blocks and inlines, even when
681 a language attribute is given.
683`--highlight-style=`*STYLE*|*FILE*
685: Specifies the coloring style to be used in highlighted source code.
686 Options are `pygments` (the default), `kate`, `monochrome`,
687 `breezeDark`, `espresso`, `zenburn`, `haddock`, and `tango`.
688 For more information on syntax highlighting in pandoc, see
689 [Syntax highlighting], below. See also
690 `--list-highlight-styles`.
692 Instead of a *STYLE* name, a JSON file with extension
693 `.theme` may be supplied. This will be parsed as a KDE
694 syntax highlighting theme and (if valid) used as the
695 highlighting style.
697 To generate the JSON version of an existing style,
698 use `--print-highlight-style`.
700`--print-highlight-style=`*STYLE*|*FILE*
702: Prints a JSON version of a highlighting style, which can
703 be modified, saved with a `.theme` extension, and used
704 with `--highlight-style`.
706`--syntax-definition=`*FILE*
708: Instructs pandoc to load a KDE XML syntax definition file,
709 which will be used for syntax highlighting of appropriately
710 marked code blocks. This can be used to add support for
711 new languages or to use altered syntax definitions for
712 existing languages.
714`-H` *FILE*, `--include-in-header=`*FILE*
716: Include contents of *FILE*, verbatim, at the end of the header.
717 This can be used, for example, to include special
718 CSS or JavaScript in HTML documents. This option can be used
719 repeatedly to include multiple files in the header. They will be
720 included in the order specified. Implies `--standalone`.
722`-B` *FILE*, `--include-before-body=`*FILE*
724: Include contents of *FILE*, verbatim, at the beginning of the
725 document body (e.g. after the `<body>` tag in HTML, or the
726 `\begin{document}` command in LaTeX). This can be used to include
727 navigation bars or banners in HTML documents. This option can be
728 used repeatedly to include multiple files. They will be included in
729 the order specified. Implies `--standalone`.
731`-A` *FILE*, `--include-after-body=`*FILE*
733: Include contents of *FILE*, verbatim, at the end of the document
734 body (before the `</body>` tag in HTML, or the
735 `\end{document}` command in LaTeX). This option can be used
736 repeatedly to include multiple files. They will be included in the
737 order specified. Implies `--standalone`.
739`--resource-path=`*SEARCHPATH*
741: List of paths to search for images and other resources.
742 The paths should be separated by `:` on Linux, UNIX, and
743 macOS systems, and by `;` on Windows. If `--resource-path`
744 is not specified, the default resource path is the working
745 directory. Note that, if `--resource-path` is specified,
746 the working directory must be explicitly listed or it
747 will not be searched. For example:
748 `--resource-path=.:test` will search the working directory
749 and the `test` subdirectory, in that order.
751`--request-header=`*NAME*`:`*VAL*
753: Set the request header *NAME* to the value *VAL* when making
754 HTTP requests (for example, when a URL is given on the
755 command line, or when resources used in a document must be
756 downloaded).
758Options affecting specific writers
759----------------------------------
761`--self-contained`
763: Produce a standalone HTML file with no external dependencies, using
764 `data:` URIs to incorporate the contents of linked scripts, stylesheets,
765 images, and videos. The resulting file should be "self-contained,"
766 in the sense that it needs no external files and no net access to be
767 displayed properly by a browser. This option works only with HTML output
768 formats, including `html4`, `html5`, `html+lhs`, `html5+lhs`, `s5`,
769 `slidy`, `slideous`, `dzslides`, and `revealjs`. Scripts, images, and
770 stylesheets at absolute URLs will be downloaded; those at relative URLs
771 will be sought relative to the working directory (if the first source
772 file is local) or relative to the base URL (if the first source
773 file is remote). Elements with the attribute
774 `data-external="1"` will be left alone; the documents they
775 link to will not be incorporated in the document.
776 Limitation: resources that are loaded dynamically through
777 JavaScript cannot be incorporated; as a result,
778 `--self-contained` does not work with `--mathjax`, and some
779 advanced features (e.g. zoom or speaker notes) may not work
780 in an offline "self-contained" `reveal.js` slide show.
782`--html-q-tags`
784: Use `<q>` tags for quotes in HTML.
786`--ascii`
788: Use only ASCII characters in output. Currently supported only for
789 HTML and DocBook output (which uses numerical entities instead of
790 UTF-8 when this option is selected).
792`--reference-links`
794: Use reference-style links, rather than inline links, in writing Markdown
795 or reStructuredText. By default inline links are used. The
796 placement of link references is affected by the
797 `--reference-location` option.
799`--reference-location = block`|`section`|`document`
801: Specify whether footnotes (and references, if `reference-links` is
802 set) are placed at the end of the current (top-level) block, the
803 current section, or the document. The default is
804 `document`. Currently only affects the markdown writer.
806`--atx-headers`
808: Use ATX-style headers in Markdown and AsciiDoc output. The default is
809 to use setext-style headers for levels 1-2, and then ATX headers.
810 (Note: for `gfm` output, ATX headers are always used.)
812`--top-level-division=[default|section|chapter|part]`
814: Treat top-level headers as the given division type in LaTeX, ConTeXt,
815 DocBook, and TEI output. The hierarchy order is part, chapter, then section;
816 all headers are shifted such that the top-level header becomes the specified
817 type. The default behavior is to determine the best division type via
818 heuristics: unless other conditions apply, `section` is chosen. When the
819 LaTeX document class is set to `report`, `book`, or `memoir` (unless the
820 `article` option is specified), `chapter` is implied as the setting for this
821 option. If `beamer` is the output format, specifying either `chapter` or
822 `part` will cause top-level headers to become `\part{..}`, while
823 second-level headers remain as their default type.
825`-N`, `--number-sections`
827: Number section headings in LaTeX, ConTeXt, HTML, or EPUB output.
828 By default, sections are not numbered. Sections with class
829 `unnumbered` will never be numbered, even if `--number-sections`
830 is specified.
832`--number-offset=`*NUMBER*[`,`*NUMBER*`,`*...*]
834: Offset for section headings in HTML output (ignored in other
835 output formats). The first number is added to the section number for
836 top-level headers, the second for second-level headers, and so on.
837 So, for example, if you want the first top-level header in your
838 document to be numbered "6", specify `--number-offset=5`.
839 If your document starts with a level-2 header which you want to
840 be numbered "1.5", specify `--number-offset=1,4`.
841 Offsets are 0 by default. Implies `--number-sections`.
843`--listings`
845: Use the [`listings`] package for LaTeX code blocks
847`-i`, `--incremental`
849: Make list items in slide shows display incrementally (one by one).
850 The default is for lists to be displayed all at once.
852`--slide-level=`*NUMBER*
854: Specifies that headers with the specified level create
855 slides (for `beamer`, `s5`, `slidy`, `slideous`, `dzslides`). Headers
856 above this level in the hierarchy are used to divide the
857 slide show into sections; headers below this level create
858 subheads within a slide. Note that content that is
859 not contained under slide-level headers will not appear in
860 the slide show. The default is to set the slide level based
861 on the contents of the document; see [Structuring the slide
862 show].
864`--section-divs`
866: Wrap sections in `<div>` tags (or `<section>` tags in HTML5),
867 and attach identifiers to the enclosing `<div>` (or `<section>`)
868 rather than the header itself. See
869 [Header identifiers], below.
871`--email-obfuscation=none`|`javascript`|`references`
873: Specify a method for obfuscating `mailto:` links in HTML documents.
874 `none` leaves `mailto:` links as they are. `javascript` obfuscates
875 them using JavaScript. `references` obfuscates them by printing their
876 letters as decimal or hexadecimal character references. The default
877 is `none`.
879`--id-prefix=`*STRING*
881: Specify a prefix to be added to all identifiers and internal links
882 in HTML and DocBook output, and to footnote numbers in Markdown
883 and Haddock output. This is useful for preventing duplicate
884 identifiers when generating fragments to be included in other pages.
886`-T` *STRING*, `--title-prefix=`*STRING*
888: Specify *STRING* as a prefix at the beginning of the title
889 that appears in the HTML header (but not in the title as it
890 appears at the beginning of the HTML body). Implies
891 `--standalone`.
893`-c` *URL*, `--css=`*URL*
895: Link to a CSS style sheet. This option can be used repeatedly to
896 include multiple files. They will be included in the order specified.
898 A stylesheet is required for generating EPUB. If none is
899 provided using this option (or the `stylesheet` metadata
900 field), pandoc will look for a file `epub.css` in the
901 user data directory (see `--data-dir`). If it is not
902 found there, sensible defaults will be used.
904`--reference-doc=`*FILE*
906: Use the specified file as a style reference in producing a
907 docx or ODT file.
909 Docx
911 : For best results, the reference docx should be a modified
912 version of a docx file produced using pandoc. The contents
913 of the reference docx are ignored, but its stylesheets and
914 document properties (including margins, page size, header,
915 and footer) are used in the new docx. If no reference docx
916 is specified on the command line, pandoc will look for a
917 file `reference.docx` in the user data directory (see
918 `--data-dir`). If this is not found either, sensible
919 defaults will be used.
921 To produce a custom `reference.docx`, first get a copy of
922 the default `reference.docx`: `pandoc
923 --print-default-data-file reference.docx >
924 custom-reference.docx`. Then open `custom-reference.docx`
925 in Word, modify the styles as you wish, and save the file.
926 For best results, do not make changes to this file other
927 than modifying the styles used by pandoc: [paragraph]
928 Normal, Body Text, First Paragraph, Compact, Title,
929 Subtitle, Author, Date, Abstract, Bibliography, Heading 1,
930 Heading 2, Heading 3, Heading 4, Heading 5, Heading 6,
931 Heading 7, Heading 8, Heading 9, Block Text, Footnote Text,
932 Definition Term, Definition, Caption, Table Caption,
933 Image Caption, Figure, Captioned Figure, TOC Heading;
934 [character] Default Paragraph Font, Body Text Char,
935 Verbatim Char, Footnote Reference, Hyperlink; [table]
936 Table.
938 ODT
940 : For best results, the reference ODT should be a modified
941 version of an ODT produced using pandoc. The contents of
942 the reference ODT are ignored, but its stylesheets are used
943 in the new ODT. If no reference ODT is specified on the
944 command line, pandoc will look for a file `reference.odt` in
945 the user data directory (see `--data-dir`). If this is not
946 found either, sensible defaults will be used.
948 To produce a custom `reference.odt`, first get a copy of
949 the default `reference.odt`: `pandoc
950 --print-default-data-file reference.odt >
951 custom-reference.odt`. Then open `custom-reference.odt` in
952 LibreOffice, modify the styles as you wish, and save the
953 file.
955`--epub-cover-image=`*FILE*
957: Use the specified image as the EPUB cover. It is recommended
958 that the image be less than 1000px in width and height. Note that
959 in a Markdown source document you can also specify `cover-image`
960 in a YAML metadata block (see [EPUB Metadata], below).
962`--epub-metadata=`*FILE*
964: Look in the specified XML file for metadata for the EPUB.
965 The file should contain a series of [Dublin Core elements].
966 For example:
968 <dc:rights>Creative Commons</dc:rights>
969 <dc:language>es-AR</dc:language>
971 By default, pandoc will include the following metadata elements:
972 `<dc:title>` (from the document title), `<dc:creator>` (from the
973 document authors), `<dc:date>` (from the document date, which should
974 be in [ISO 8601 format]), `<dc:language>` (from the `lang`
975 variable, or, if is not set, the locale), and `<dc:identifier
976 id="BookId">` (a randomly generated UUID). Any of these may be
977 overridden by elements in the metadata file.
979 Note: if the source document is Markdown, a YAML metadata block
980 in the document can be used instead. See below under
981 [EPUB Metadata].
983`--epub-embed-font=`*FILE*
985: Embed the specified font in the EPUB. This option can be repeated
986 to embed multiple fonts. Wildcards can also be used: for example,
987 `DejaVuSans-*.ttf`. However, if you use wildcards on the command
988 line, be sure to escape them or put the whole filename in single quotes,
989 to prevent them from being interpreted by the shell. To use the
990 embedded fonts, you will need to add declarations like the following
991 to your CSS (see `--css`):
993 @font-face {
994 font-family: DejaVuSans;
995 font-style: normal;
996 font-weight: normal;
997 src:url("DejaVuSans-Regular.ttf");
998 }
999 @font-face {
1000 font-family: DejaVuSans;
1001 font-style: normal;
1002 font-weight: bold;
1003 src:url("DejaVuSans-Bold.ttf");
1005 @font-face {
1006 font-family: DejaVuSans;
1007 font-style: italic;
1008 font-weight: normal;
1009 src:url("DejaVuSans-Oblique.ttf");
1011 @font-face {
1012 font-family: DejaVuSans;
1013 font-style: italic;
1014 font-weight: bold;
1015 src:url("DejaVuSans-BoldOblique.ttf");
1017 body { font-family: "DejaVuSans"; }
1019`--epub-chapter-level=`*NUMBER*
1021: Specify the header level at which to split the EPUB into separate
1022 "chapter" files. The default is to split into chapters at level 1
1023 headers. This option only affects the internal composition of the
1024 EPUB, not the way chapters and sections are displayed to users. Some
1025 readers may be slow if the chapter files are too large, so for large
1026 documents with few level 1 headers, one might want to use a chapter
1027 level of 2 or 3.
1029`--epub-subdirectory=`*DIRNAME*
1031: Specify the subdirectory in the OCF container that is to hold
1032 the EPUB-specific contents. The default is `EPUB`. To put
1033 the EPUB contents in the top level, use an empty string.
1035`--pdf-engine=pdflatex`|`lualatex`|`xelatex`|`wkhtmltopdf`|`weasyprint`|`prince`|`context`|`pdfroff`
1037: Use the specified engine when producing PDF output.
1038 The default is `pdflatex`. If the engine is not in your PATH,
1039 the full path of the engine may be specified here.
1041`--pdf-engine-opt=`*STRING*
1043: Use the given string as a command-line argument to the `pdf-engine`.
1044 If used multiple times, the arguments are provided with spaces between
1045 them. Note that no check for duplicate options is done.
1047[Dublin Core elements]: http://dublincore.org/documents/dces/
1048[ISO 8601 format]: http://www.w3.org/TR/NOTE-datetime
1050Citation rendering
1051------------------
1053`--bibliography=`*FILE*
1055: Set the `bibliography` field in the document's metadata to *FILE*,
1056 overriding any value set in the metadata, and process citations
1057 using `pandoc-citeproc`. (This is equivalent to
1058 `--metadata bibliography=FILE --filter pandoc-citeproc`.)
1059 If `--natbib` or `--biblatex` is also supplied, `pandoc-citeproc` is not
1060 used, making this equivalent to `--metadata bibliography=FILE`.
1061 If you supply this argument multiple times, each *FILE* will be added
1062 to bibliography.
1064`--csl=`*FILE*
1066: Set the `csl` field in the document's metadata to *FILE*,
1067 overriding any value set in the metadata. (This is equivalent to
1068 `--metadata csl=FILE`.)
1069 This option is only relevant with `pandoc-citeproc`.
1071`--citation-abbreviations=`*FILE*
1073: Set the `citation-abbreviations` field in the document's metadata to
1074 *FILE*, overriding any value set in the metadata. (This is equivalent to
1075 `--metadata citation-abbreviations=FILE`.)
1076 This option is only relevant with `pandoc-citeproc`.
1078`--natbib`
1080: Use [`natbib`] for citations in LaTeX output. This option is not for use
1081 with the `pandoc-citeproc` filter or with PDF output. It is intended for
1082 use in producing a LaTeX file that can be processed with [`bibtex`].
1084`--biblatex`
1086: Use [`biblatex`] for citations in LaTeX output. This option is not for use
1087 with the `pandoc-citeproc` filter or with PDF output. It is intended for
1088 use in producing a LaTeX file that can be processed with [`bibtex`] or [`biber`].
1090Math rendering in HTML
1091----------------------
1093The default is to render TeX math as far as possible using Unicode characters.
1094Formulas are put inside a `span` with `class="math"`, so that they may be styled
1095differently from the surrounding text if needed. However, this gives acceptable
1096results only for basic math, usually you will want to use `--mathjax` or another
1097of the following options.
1099`--mathjax`[`=`*URL*]
1101: Use [MathJax] to display embedded TeX math in HTML output.
1102 TeX math will be put between `\(...\)` (for inline math)
1103 or `\[...\]` (for display math) and wrapped in `<span>` tags
1104 with class `math`. Then the MathJax JavaScript will render it.
1105 The *URL* should point to the `MathJax.js` load script.
1106 If a *URL* is not provided, a link to the Cloudflare CDN will
1107 be inserted.
1109`--mathml`
1111: Convert TeX math to [MathML] (in `epub3`, `docbook4`, `docbook5`, `jats`,
1112 `html4` and `html5`). This is the default in `odt` output. Note that
1113 currently only Firefox and Safari (and select e-book readers) natively
1114 support MathML.
1116`--webtex`[`=`*URL*]
1118: Convert TeX formulas to `<img>` tags that link to an external script
1119 that converts formulas to images. The formula will be URL-encoded
1120 and concatenated with the URL provided. For SVG images you can for
1121 example use `--webtex https://latex.codecogs.com/svg.latex?`.
1122 If no URL is specified, the CodeCogs URL generating PNGs
1123 will be used (`https://latex.codecogs.com/png.latex?`).
1124 Note: the `--webtex` option will affect Markdown output
1125 as well as HTML, which is useful if you're targeting a
1126 version of Markdown without native math support.
1128`--katex`[`=`*URL*]
1130: Use [KaTeX] to display embedded TeX math in HTML output.
1131 The *URL* is the base URL for the KaTeX library. If a *URL* is
1132 not provided, a link to the KaTeX CDN will be inserted.
1134`--katex-stylesheet=`*URL*
1136: The *URL* should point to the `katex.css` stylesheet. If this option is
1137 not specified, a link to the KaTeX CDN will be inserted. Note that this
1138 option does not imply `--katex`.
1140`-m` [*URL*], `--latexmathml`[`=`*URL*]
1142: *Deprecated.*
1143 Use the [LaTeXMathML] script to display embedded TeX math in HTML output.
1144 TeX math will be displayed between `$` or `$$` characters and put in
1145 `<span>` tags with class `LaTeX`. The LaTeXMathML JavaScript will then
1146 change it to MathML. Note that currently only Firefox and Safari
1147 (and select e-book readers) natively support MathML.
1148 To insert a link the `LaTeXMathML.js` script, provide a *URL*.
1150`--jsmath`[`=`*URL*]
1152: *Deprecated.*
1153 Use [jsMath] (the predecessor of MathJax) to display embedded TeX
1154 math in HTML output. TeX math will be put inside `<span>` tags
1155 (for inline math) or `<div>` tags (for display math) with class
1156 `math` and rendered by the jsMath script. The *URL* should point to
1157 the script (e.g. `jsMath/easy/load.js`); if provided, it will be linked
1158 to in the header of standalone HTML documents. If a *URL* is not provided,
1159 no link to the jsMath load script will be inserted; it is then
1160 up to the author to provide such a link in the HTML template.
1162`--gladtex`
1164: *Deprecated.*
1165 Enclose TeX math in `<eq>` tags in HTML output. The resulting HTML
1166 can then be processed by [gladTeX] to produce images of the typeset
1167 formulas and an HTML file with links to these images.
1168 So, the procedure is:
1170 pandoc -s --gladtex input.md -o myfile.htex
1171 gladtex -d myfile-images myfile.htex
1172 # produces myfile.html and images in myfile-images
1174`--mimetex`[`=`*URL*]
1176: *Deprecated.*
1177 Render TeX math using the [mimeTeX] CGI script, which generates an
1178 image for each TeX formula. This should work in all browsers. If
1179 *URL* is not specified, it is assumed that the script is at
1180 `/cgi-bin/mimetex.cgi`.
1182[MathML]: http://www.w3.org/Math/
1183[LaTeXMathML]: http://math.etsu.edu/LaTeXMathML/
1184[jsMath]: http://www.math.union.edu/~dpvc/jsmath/
1185[MathJax]: https://www.mathjax.org
1186[gladTeX]: http://ans.hsh.no/home/mgg/gladtex/
1187[mimeTeX]: http://www.forkosh.com/mimetex.html
1188[KaTeX]: https://github.com/Khan/KaTeX
1190Options for wrapper scripts
1191---------------------------
1193`--dump-args`
1195: Print information about command-line arguments to *stdout*, then exit.
1196 This option is intended primarily for use in wrapper scripts.
1197 The first line of output contains the name of the output file specified
1198 with the `-o` option, or `-` (for *stdout*) if no output file was
1199 specified. The remaining lines contain the command-line arguments,
1200 one per line, in the order they appear. These do not include regular
1201 pandoc options and their arguments, but do include any options appearing
1202 after a `--` separator at the end of the line.
1204`--ignore-args`
1206: Ignore command-line arguments (for use in wrapper scripts).
1207 Regular pandoc options are not ignored. Thus, for example,
1209 pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1
1211 is equivalent to
1213 pandoc -o foo.html -s
1215Templates
1216=========
1218When the `-s/--standalone` option is used, pandoc uses a template to
1219add header and footer material that is needed for a self-standing
1220document. To see the default template that is used, just type
1222 pandoc -D *FORMAT*
1224where *FORMAT* is the name of the output format. A custom template
1225can be specified using the `--template` option. You can also override
1226the system default templates for a given output format *FORMAT*
1227by putting a file `templates/default.*FORMAT*` in the user data
1228directory (see `--data-dir`, above). *Exceptions:*
1230- For `odt` output, customize the `default.opendocument`
1231 template.
1232- For `pdf` output, customize the `default.latex` template
1233 (or the `default.context` template, if you use `-t context`,
1234 or the `default.ms` template, if you use `-t ms`, or the
1235 `default.html5` template, if you use `-t html5`).
1236- `docx` has no template (however, you can use
1237 `--reference-doc` to customize the output).
1239Templates contain *variables*, which allow for the inclusion of
1240arbitrary information at any point in the file. Variables may be set
1241within the document using [YAML metadata blocks][Extension:
1242`yaml_metadata_block`]. They may also be set at the
1243command line using the `-V/--variable` option: variables set in this
1244way override metadata fields with the same name.
1246Variables set by pandoc
1247-----------------------
1249Some variables are set automatically by pandoc. These vary somewhat
1250depending on the output format, but include metadata fields as well
1251as the following:
1253`sourcefile`, `outputfile`
1254: source and destination filenames, as given on the command line.
1255 `sourcefile` can also be a list if input comes from multiple files, or empty
1256 if input is from stdin. You can use the following snippet in your template
1257 to distinguish them:
1259 $if(sourcefile)$
1260 $for(sourcefile)$
1261 $sourcefile$
1262 $endfor$
1263 $else$
1264 (stdin)
1265 $endif$
1267 Similarly, `outputfile` can be `-` if output goes to the terminal.
1269`title`, `author`, `date`
1270: allow identification of basic aspects of the document. Included
1271 in PDF metadata through LaTeX and ConTeXt. These can be set
1272 through a [pandoc title block][Extension: `pandoc_title_block`],
1273 which allows for multiple authors, or through a YAML metadata block:
1275 ---
1276 author:
1277 - Aristotle
1278 - Peter Abelard
1279 ...
1281`subtitle`
1282: document subtitle, included in HTML, EPUB, LaTeX, ConTeXt, and Word docx;
1283 renders in LaTeX only when using a document class that supports
1284 `\subtitle`, such as `beamer` or the [KOMA-Script] series (`scrartcl`,
1285 `scrreprt`, `scrbook`).[^subtitle]
1287`institute`
1288: author affiliations (in LaTeX and Beamer only). Can be a
1289 list, when there are multiple authors.
1291`abstract`
1292: document summary, included in LaTeX, ConTeXt, AsciiDoc, and Word docx
1294`keywords`
1295: list of keywords to be included in HTML, PDF, and AsciiDoc metadata;
1296 may be repeated as for `author`, above
1298`header-includes`
1299: contents specified by `-H/--include-in-header` (may have multiple
1300 values)
1302`toc`
1303: non-null value if `--toc/--table-of-contents` was specified
1305`toc-title`
1306: title of table of contents (works only with EPUB,
1307 opendocument, odt, docx)
1309`include-before`
1310: contents specified by `-B/--include-before-body` (may have
1311 multiple values)
1313`include-after`
1314: contents specified by `-A/--include-after-body` (may have
1315 multiple values)
1317`body`
1318: body of document
1320`meta-json`
1321: JSON representation of all of the document's metadata. Field
1322 values are transformed to the selected output format.
1324[^subtitle]: To make `subtitle` work with other LaTeX
1325 document classes, you can add the following to `header-includes`:
1327 \providecommand{\subtitle}[1]{%
1328 \usepackage{titling}
1329 \posttitle{%
1330 \par\large#1\end{center}}
1333Language variables
1334------------------
1336`lang`
1337: identifies the main language of the document,
1338 using a code according to [BCP 47] (e.g. `en` or `en-GB`).
1339 For some output formats, pandoc will convert it to an appropriate
1340 format stored in the additional variables `babel-lang`,
1341 `polyglossia-lang` (LaTeX) and `context-lang` (ConTeXt).
1343 Native pandoc `span`s and `div`s with the lang attribute
1344 (value in BCP 47) can be used to switch the language in
1345 that range.
1347`otherlangs`
1348: a list of other languages used in the document
1349 in the YAML metadata, according to [BCP 47]. For example:
1350 `otherlangs: [en-GB, fr]`.
1351 This is automatically generated from the `lang` attributes
1352 in all `span`s and `div`s but can be overridden.
1353 Currently only used by LaTeX through the generated
1354 `babel-otherlangs` and `polyglossia-otherlangs` variables.
1355 The LaTeX writer outputs polyglossia commands in the text but
1356 the `babel-newcommands` variable contains mappings for them
1357 to the corresponding babel.
1359`dir`
1360: the base direction of the document, either `rtl` (right-to-left)
1361 or `ltr` (left-to-right).
1363 For bidirectional documents, native pandoc `span`s and `div`s
1364 with the `dir` attribute (value `rtl` or `ltr`) can be used to
1365 override the base direction in some output formats.
1366 This may not always be necessary if the final renderer
1367 (e.g. the browser, when generating HTML) supports the
1368 [Unicode Bidirectional Algorithm].
1370 When using LaTeX for bidirectional documents, only the `xelatex` engine
1371 is fully supported (use `--pdf-engine=xelatex`).
1373[BCP 47]: https://tools.ietf.org/html/bcp47
1374[Unicode Bidirectional Algorithm]: http://www.w3.org/International/articles/inline-bidi-markup/uba-basics
1376Variables for slides
1377--------------------
1379Variables are available for [producing slide shows with pandoc],
1380including all [reveal.js configuration options].
1382`titlegraphic`
1383: title graphic for Beamer documents
1385`logo`
1386: logo for Beamer documents
1388`slidy-url`
1389: base URL for Slidy documents (defaults to
1390 `https://www.w3.org/Talks/Tools/Slidy2`)
1392`slideous-url`
1393: base URL for Slideous documents (defaults to `slideous`)
1395`s5-url`
1396: base URL for S5 documents (defaults to `s5/default`)
1398`revealjs-url`
1399: base URL for reveal.js documents (defaults to `reveal.js`)
1401`theme`, `colortheme`, `fonttheme`, `innertheme`, `outertheme`
1402: themes for LaTeX [`beamer`] documents
1404`themeoptions`
1405: options for LaTeX beamer themes (a list).
1407`navigation`
1408: controls navigation symbols in `beamer` documents
1409 (default is `empty` for no navigation symbols; other valid values
1410 are `frame`, `vertical`, and `horizontal`).
1412`section-titles`
1413: enables on "title pages" for new sections in `beamer`
1414 documents (default = true).
1416`beamerarticle`
1417: when true, the `beamerarticle` package is loaded (for
1418 producing an article from beamer slides).
1420`aspectratio`
1421: aspect ratio of slides (for beamer only, `1610` for 16:10, `169` for 16:9,
1422 `149` for 14:9, `141` for 1.41:1, `54` for 5:4, `43` for 4:3 which is the
1423 default, and `32` for 3:2).
1425[reveal.js configuration options]: https://github.com/hakimel/reveal.js#configuration
1427Variables for LaTeX
1428-------------------
1430LaTeX variables are used when [creating a PDF].
1432`papersize`
1433: paper size, e.g. `letter`, `a4`
1435`fontsize`
1436: font size for body text (e.g. `10pt`, `12pt`)
1438`documentclass`
1439: document class, e.g. [`article`], [`report`], [`book`], [`memoir`]
1441`classoption`
1442: option for document class, e.g. `oneside`; may be repeated
1443 for multiple options
1445`geometry`
1446: option for [`geometry`] package, e.g. `margin=1in`;
1447 may be repeated for multiple options
1449`margin-left`, `margin-right`, `margin-top`, `margin-bottom`
1450: sets margins, if `geometry` is not used (otherwise `geometry`
1451 overrides these)
1453`linestretch`
1454: adjusts line spacing using the [`setspace`]
1455 package, e.g. `1.25`, `1.5`
1457`fontfamily`
1458: font package for use with `pdflatex`:
1459 [TeX Live] includes many options, documented in the [LaTeX Font Catalogue].
1460 The default is [Latin Modern][`lm`].
1462`fontfamilyoptions`
1463: options for package used as `fontfamily`: e.g. `osf,sc` with
1464 `fontfamily` set to [`mathpazo`] provides Palatino with old-style
1465 figures and true small caps; may be repeated for multiple options
1467`mainfont`, `sansfont`, `monofont`, `mathfont`, `CJKmainfont`
1468: font families for use with `xelatex` or
1469 `lualatex`: take the name of any system font, using the
1470 [`fontspec`] package. Note that if `CJKmainfont` is used,
1471 the [`xecjk`] package must be available.
1473`mainfontoptions`, `sansfontoptions`, `monofontoptions`, `mathfontoptions`, `CJKoptions`
1474: options to use with `mainfont`, `sansfont`, `monofont`, `mathfont`,
1475 `CJKmainfont` in `xelatex` and `lualatex`. Allow for any choices
1476 available through [`fontspec`], such as the OpenType features
1477 `Numbers=OldStyle,Numbers=Proportional`. May be repeated for multiple options.
1479`fontenc`
1480: allows font encoding to be specified through `fontenc` package (with `pdflatex`);
1481 default is `T1` (see guide to [LaTeX font encodings])
1483`microtypeoptions`
1484: options to pass to the microtype package
1486`colorlinks`
1487: add color to link text; automatically enabled if any of `linkcolor`, `citecolor`,
1488 `urlcolor`, or `toccolor` are set
1490`linkcolor`, `citecolor`, `urlcolor`, `toccolor`
1491: color for internal links, citation links, external links, and links in table of contents:
1492 uses options allowed by [`xcolor`], including the `dvipsnames`, `svgnames`, and `x11names` lists
1494`links-as-notes`
1495: causes links to be printed as footnotes
1497`indent`
1498: uses document class settings for indentation (the default LaTeX template
1499 otherwise removes indentation and adds space between paragraphs)
1501`subparagraph`
1502: disables default behavior of LaTeX template that redefines (sub)paragraphs
1503 as sections, changing the appearance of nested headings in some classes
1505`thanks`
1506: specifies contents of acknowledgments footnote after document title.
1508`toc`
1509: include table of contents (can also be set using `--toc/--table-of-contents`)
1511`toc-depth`
1512: level of section to include in table of contents
1514`secnumdepth`
1515: numbering depth for sections, if sections are numbered
1517`lof`, `lot`
1518: include list of figures, list of tables
1520`bibliography`
1521: bibliography to use for resolving references
1523`biblio-style`
1524: bibliography style, when used with `--natbib` and `--biblatex`.
1526`biblio-title`
1527: bibliography title, when used with `--natbib` and `--biblatex`.
1529`biblatexoptions`
1530: list of options for biblatex.
1532`natbiboptions`
1533: list of options for natbib.
1535`pagestyle`
1536: An option for LaTeX's `\pagestyle{}`. The default article class
1537 supports 'plain' (default), 'empty', and 'headings'; headings puts
1538 section titles in the header.
1540[`article`]: https://ctan.org/pkg/article
1541[`report`]: https://ctan.org/pkg/report
1542[`book`]: https://ctan.org/pkg/book
1543[KOMA-Script]: https://ctan.org/pkg/koma-script
1544[`memoir`]: https://ctan.org/pkg/memoir
1545[`xcolor`]: https://ctan.org/pkg/xcolor
1546[LaTeX Font Catalogue]: http://www.tug.dk/FontCatalogue/
1547[`mathpazo`]: https://ctan.org/pkg/mathpazo
1548[LaTeX font encodings]: https://ctan.org/pkg/encguide
1550Variables for ConTeXt
1551---------------------
1553`papersize`
1554: paper size, e.g. `letter`, `A4`, `landscape` (see [ConTeXt Paper Setup]);
1555 may be repeated for multiple options
1557`layout`
1558: options for page margins and text arrangement (see [ConTeXt Layout]);
1559 may be repeated for multiple options
1561`margin-left`, `margin-right`, `margin-top`, `margin-bottom`
1562: sets margins, if `layout` is not used (otherwise `layout`
1563 overrides these)
1565`fontsize`
1566: font size for body text (e.g. `10pt`, `12pt`)
1568`mainfont`, `sansfont`, `monofont`, `mathfont`
1569: font families: take the name of any system font (see [ConTeXt Font Switching])
1571`linkcolor`, `contrastcolor`
1572: color for links outside and inside a page, e.g. `red`, `blue` (see [ConTeXt Color])
1574`linkstyle`
1575: typeface style for links, e.g. `normal`, `bold`, `slanted`, `boldslanted`, `type`, `cap`, `small`
1577`indenting`
1578: controls indentation of paragraphs, e.g. `yes,small,next` (see [ConTeXt Indentation]);
1579 may be repeated for multiple options
1581`whitespace`
1582: spacing between paragraphs, e.g. `none`, `small` (using [`setupwhitespace`])
1584`interlinespace`
1585: adjusts line spacing, e.g. `4ex` (using [`setupinterlinespace`]);
1586 may be repeated for multiple options
1588`headertext`, `footertext`
1589: text to be placed in running header or footer (see [ConTeXt Headers and Footers]);
1590 may be repeated up to four times for different placement
1592`pagenumbering`
1593: page number style and location (using [`setuppagenumbering`]);
1594 may be repeated for multiple options
1596`toc`
1597: include table of contents (can also be set using `--toc/--table-of-contents`)
1599`lof`, `lot`
1600: include list of figures, list of tables
1602[ConTeXt Paper Setup]: http://wiki.contextgarden.net/PaperSetup
1603[ConTeXt Layout]: http://wiki.contextgarden.net/Layout
1604[ConTeXt Font Switching]: http://wiki.contextgarden.net/Font_Switching
1605[ConTeXt Color]: http://wiki.contextgarden.net/Color
1606[ConTeXt Headers and Footers]: http://wiki.contextgarden.net/Headers_and_Footers
1607[ConTeXt Indentation]: http://wiki.contextgarden.net/Indentation
1608[`setupwhitespace`]: http://wiki.contextgarden.net/Command/setupwhitespace
1609[`setupinterlinespace`]: http://wiki.contextgarden.net/Command/setupinterlinespace
1610[`setuppagenumbering`]: http://wiki.contextgarden.net/Command/setuppagenumbering
1612Variables for man pages
1613-----------------------
1615`section`
1616: section number in man pages
1618`header`
1619: header in man pages
1621`footer`
1622: footer in man pages
1624`adjusting`
1625: adjusts text to left (`l`), right (`r`), center (`c`),
1626 or both (`b`) margins
1628`hyphenate`
1629: if `true` (the default), hyphenation will be used
1631Variables for ms
1632----------------
1634`pointsize`
1635: point size (e.g. `10p`)
1637`lineheight`
1638: line height (e.g. `12p`)
1640`fontfamily`
1641: font family (e.g. `T` or `P`)
1643`indent`
1644: paragraph indent (e.g. `2m`)
1646Using variables in templates
1647----------------------------
1649Variable names are sequences of alphanumerics, `-`, and `_`,
1650starting with a letter. A variable name surrounded by `$` signs
1651will be replaced by its value. For example, the string `$title$` in
1653 <title>$title$</title>
1655will be replaced by the document title.
1657To write a literal `$` in a template, use `$$`.
1659Templates may contain conditionals. The syntax is as follows:
1661 $if(variable)$
1663 $else$
1665 $endif$
1667This will include `X` in the template if `variable` has a non-null
1668value; otherwise it will include `Y`. `X` and `Y` are placeholders for
1669any valid template text, and may include interpolated variables or other
1670conditionals. The `$else$` section may be omitted.
1672When variables can have multiple values (for example, `author` in
1673a multi-author document), you can use the `$for$` keyword:
1675 $for(author)$
1676 <meta name="author" content="$author$" />
1677 $endfor$
1679You can optionally specify a separator to be used between
1680consecutive items:
1682 $for(author)$$author$$sep$, $endfor$
1684A dot can be used to select a field of a variable that takes
1685an object as its value. So, for example:
1687 $author.name$ ($author.affiliation$)
1689If you use custom templates, you may need to revise them as pandoc
1690changes. We recommend tracking the changes in the default templates,
1691and modifying your custom templates accordingly. An easy way to do this
1692is to fork the [pandoc-templates] repository and merge in changes after each
1693pandoc release.
1695Templates may contain comments: anything on a line after `$--`
1696will be treated as a comment and ignored.
1698[pandoc-templates]: https://github.com/jgm/pandoc-templates
1700Pandoc's Markdown
1701=================
1703Pandoc understands an extended and slightly revised version of
1704John Gruber's [Markdown] syntax. This document explains the syntax,
1705noting differences from standard Markdown. Except where noted, these
1706differences can be suppressed by using the `markdown_strict` format instead
1707of `markdown`. An extensions can be enabled by adding `+EXTENSION`
1708to the format name and disabled by adding `-EXTENSION`. For example,
1709`markdown_strict+footnotes` is strict Markdown with footnotes
1710enabled, while `markdown-footnotes-pipe_tables` is pandoc's
1711Markdown without footnotes or pipe tables.
1713Philosophy
1714----------
1716Markdown is designed to be easy to write, and, even more importantly,
1717easy to read:
1719> A Markdown-formatted document should be publishable as-is, as plain
1720> text, without looking like it's been marked up with tags or formatting
1721> instructions.
1722> -- [John Gruber](http://daringfireball.net/projects/markdown/syntax#philosophy)
1724This principle has guided pandoc's decisions in finding syntax for
1725tables, footnotes, and other extensions.
1727There is, however, one respect in which pandoc's aims are different
1728from the original aims of Markdown. Whereas Markdown was originally
1729designed with HTML generation in mind, pandoc is designed for multiple
1730output formats. Thus, while pandoc allows the embedding of raw HTML,
1731it discourages it, and provides other, non-HTMLish ways of representing
1732important document elements like definition lists, tables, mathematics, and
1733footnotes.
1735Paragraphs
1736----------
1738A paragraph is one or more lines of text followed by one or more blank lines.
1739Newlines are treated as spaces, so you can reflow your paragraphs as you like.
1740If you need a hard line break, put two or more spaces at the end of a line.
1742#### Extension: `escaped_line_breaks` ####
1744A backslash followed by a newline is also a hard line break.
1745Note: in multiline and grid table cells, this is the only way
1746to create a hard line break, since trailing spaces in the cells
1747are ignored.
1749Headers
1750-------
1752There are two kinds of headers: Setext and ATX.
1754### Setext-style headers ###
1756A setext-style header is a line of text "underlined" with a row of `=` signs
1757(for a level one header) or `-` signs (for a level two header):
1759 A level-one header
1760 ==================
1762 A level-two header
1763 ------------------
1765The header text can contain inline formatting, such as emphasis (see
1766[Inline formatting], below).
1769### ATX-style headers ###
1771An ATX-style header consists of one to six `#` signs and a line of
1772text, optionally followed by any number of `#` signs. The number of
1773`#` signs at the beginning of the line is the header level:
1775 ## A level-two header
1777 ### A level-three header ###
1779As with setext-style headers, the header text can contain formatting:
1781 # A level-one header with a [link](/url) and *emphasis*
1783#### Extension: `blank_before_header` ####
1785Standard Markdown syntax does not require a blank line before a header.
1786Pandoc does require this (except, of course, at the beginning of the
1787document). The reason for the requirement is that it is all too easy for a
1788`#` to end up at the beginning of a line by accident (perhaps through line
1789wrapping). Consider, for example:
1791 I like several of their flavors of ice cream:
1792 #22, for example, and #5.
1794#### Extension: `space_in_atx_header` ####
1796Many Markdown implementations do not require a space between the
1797opening `#`s of an ATX header and the header text, so that
1798`#5 bolt` and `#hashtag` count as headers. With this extension,
1799pandoc does require the space.
1801### Header identifiers ###
1803#### Extension: `header_attributes` ####
1805Headers can be assigned attributes using this syntax at the end
1806of the line containing the header text:
1808 {#identifier .class .class key=value key=value}
1810Thus, for example, the following headers will all be assigned the identifier
1811`foo`:
1813 # My header {#foo}
1815 ## My header ## {#foo}
1817 My other header {#foo}
1818 ---------------
1820(This syntax is compatible with [PHP Markdown Extra].)
1822Note that although this syntax allows assignment of classes and key/value
1823attributes, writers generally don't use all of this information. Identifiers,
1824classes, and key/value attributes are used in HTML and HTML-based formats such
1825as EPUB and slidy. Identifiers are used for labels and link anchors in the
1826LaTeX, ConTeXt, Textile, and AsciiDoc writers.
1828Headers with the class `unnumbered` will not be numbered, even if
1829`--number-sections` is specified. A single hyphen (`-`) in an attribute
1830context is equivalent to `.unnumbered`, and preferable in non-English
1831documents. So,
1833 # My header {-}
1835is just the same as
1837 # My header {.unnumbered}
1839#### Extension: `auto_identifiers` ####
1841A header without an explicitly specified identifier will be
1842automatically assigned a unique identifier based on the header text.
1843To derive the identifier from the header text,
1845 - Remove all formatting, links, etc.
1846 - Remove all footnotes.
1847 - Remove all punctuation, except underscores, hyphens, and periods.
1848 - Replace all spaces and newlines with hyphens.
1849 - Convert all alphabetic characters to lowercase.
1850 - Remove everything up to the first letter (identifiers may
1851 not begin with a number or punctuation mark).
1852 - If nothing is left after this, use the identifier `section`.
1854Thus, for example,
1856 Header Identifier
1857 ------------------------------- ----------------------------
1858 `Header identifiers in HTML` `header-identifiers-in-html`
1859 `*Dogs*?--in *my* house?` `dogs--in-my-house`
1860 `[HTML], [S5], or [RTF]?` `html-s5-or-rtf`
1861 `3. Applications` `applications`
1862 `33` `section`
1864These rules should, in most cases, allow one to determine the identifier
1865from the header text. The exception is when several headers have the
1866same text; in this case, the first will get an identifier as described
1867above; the second will get the same identifier with `-1` appended; the
1868third with `-2`; and so on.
1870These identifiers are used to provide link targets in the table of
1871contents generated by the `--toc|--table-of-contents` option. They
1872also make it easy to provide links from one section of a document to
1873another. A link to this section, for example, might look like this:
1875 See the section on
1876 [header identifiers](#header-identifiers-in-html-latex-and-context).
1878Note, however, that this method of providing links to sections works
1879only in HTML, LaTeX, and ConTeXt formats.
1881If the `--section-divs` option is specified, then each section will
1882be wrapped in a `div` (or a `section`, if `html5` was specified),
1883and the identifier will be attached to the enclosing `<div>`
1884(or `<section>`) tag rather than the header itself. This allows entire
1885sections to be manipulated using JavaScript or treated differently in
1886CSS.
1888#### Extension: `implicit_header_references` ####
1890Pandoc behaves as if reference links have been defined for each header.
1891So, to link to a header
1893 # Header identifiers in HTML
1895you can simply write
1897 [Header identifiers in HTML]
1901 [Header identifiers in HTML][]
1905 [the section on header identifiers][header identifiers in
1906 HTML]
1908instead of giving the identifier explicitly:
1910 [Header identifiers in HTML](#header-identifiers-in-html)
1912If there are multiple headers with identical text, the corresponding
1913reference will link to the first one only, and you will need to use explicit
1914links to link to the others, as described above.
1916Like regular reference links, these references are case-insensitive.
1918Explicit link reference definitions always take priority over
1919implicit header references. So, in the following example, the
1920link will point to `bar`, not to `#foo`:
1922 # Foo
1924 [foo]: bar
1926 See [foo]
1928Block quotations
1929----------------
1931Markdown uses email conventions for quoting blocks of text.
1932A block quotation is one or more paragraphs or other block elements
1933(such as lists or headers), with each line preceded by a `>` character
1934and an optional space. (The `>` need not start at the left margin, but
1935it should not be indented more than three spaces.)
1937 > This is a block quote. This
1938 > paragraph has two lines.
1940 > 1. This is a list inside a block quote.
1941 > 2. Second item.
1943A "lazy" form, which requires the `>` character only on the first
1944line of each block, is also allowed:
1946 > This is a block quote. This
1947 paragraph has two lines.
1949 > 1. This is a list inside a block quote.
1950 2. Second item.
1952Among the block elements that can be contained in a block quote are
1953other block quotes. That is, block quotes can be nested:
1955 > This is a block quote.
1957 > > A block quote within a block quote.
1959If the `>` character is followed by an optional space, that space
1960will be considered part of the block quote marker and not part of
1961the indentation of the contents. Thus, to put an indented code
1962block in a block quote, you need five spaces after the `>`:
1964 > code
1966#### Extension: `blank_before_blockquote` ####
1968Standard Markdown syntax does not require a blank line before a block
1969quote. Pandoc does require this (except, of course, at the beginning of the
1970document). The reason for the requirement is that it is all too easy for a
1971`>` to end up at the beginning of a line by accident (perhaps through line
1972wrapping). So, unless the `markdown_strict` format is used, the following does
1973not produce a nested block quote in pandoc:
1975 > This is a block quote.
1976 >> Nested.
1979Verbatim (code) blocks
1980----------------------
1982### Indented code blocks ###
1984A block of text indented four spaces (or one tab) is treated as verbatim
1985text: that is, special characters do not trigger special formatting,
1986and all spaces and line breaks are preserved. For example,
1988 if (a > 3) {
1989 moveShip(5 * gravity, DOWN);
1992The initial (four space or one tab) indentation is not considered part
1993of the verbatim text, and is removed in the output.
1995Note: blank lines in the verbatim text need not begin with four spaces.
1998### Fenced code blocks ###
2000#### Extension: `fenced_code_blocks` ####
2002In addition to standard indented code blocks, pandoc supports
2003*fenced* code blocks. These begin with a row of three or more
2004tildes (`~`) and end with a row of tildes that must be at least as long as
2005the starting row. Everything between these lines is treated as code. No
2006indentation is necessary:
2008 ~~~~~~~
2009 if (a > 3) {
2010 moveShip(5 * gravity, DOWN);
2012 ~~~~~~~
2014Like regular code blocks, fenced code blocks must be separated
2015from surrounding text by blank lines.
2017If the code itself contains a row of tildes or backticks, just use a longer
2018row of tildes or backticks at the start and end:
2020 ~~~~~~~~~~~~~~~~
2021 ~~~~~~~~~~
2022 code including tildes
2023 ~~~~~~~~~~
2024 ~~~~~~~~~~~~~~~~
2026#### Extension: `backtick_code_blocks` ####
2028Same as `fenced_code_blocks`, but uses backticks (`` ` ``) instead of tildes
2029(`~`).
2031#### Extension: `fenced_code_attributes` ####
2033Optionally, you may attach attributes to fenced or backtick code block using
2034this syntax:
2036 ~~~~ {#mycode .haskell .numberLines startFrom="100"}
2037 qsort [] = []
2038 qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
2039 qsort (filter (>= x) xs)
2040 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2042Here `mycode` is an identifier, `haskell` and `numberLines` are classes, and
2043`startFrom` is an attribute with value `100`. Some output formats can use this
2044information to do syntax highlighting. Currently, the only output formats
2045that uses this information are HTML, LaTeX, Docx, and Ms. If highlighting
2046is supported for your output format and language, then the code block above
2047will appear highlighted, with numbered lines. (To see which languages are
2048supported, type `pandoc --list-highlight-languages`.) Otherwise, the code
2049block above will appear as follows:
2051 <pre id="mycode" class="haskell numberLines" startFrom="100">
2052 <code>
2053 ...
2054 </code>
2055 </pre>
2057The `numberLines` (or `number-lines`) class will cause the lines
2058of the code block to be numbered, starting with `1` or the value
2059of the `startFrom` attribute. The `lineAnchors` (or
2060`line-anchors`) class will cause the lines to be clickable
2061anchors in HTML output.
2063A shortcut form can also be used for specifying the language of
2064the code block:
2066 ```haskell
2067 qsort [] = []
2068 ```
2070This is equivalent to:
2072 ``` {.haskell}
2073 qsort [] = []
2074 ```
2076If the `fenced_code_attributes` extension is disabled, but
2077input contains class attribute(s) for the code block, the first
2078class attribute will be printed after the opening fence as a bare
2079word.
2081To prevent all highlighting, use the `--no-highlight` flag.
2082To set the highlighting style, use `--highlight-style`.
2083For more information on highlighting, see [Syntax highlighting],
2084below.
2086Line blocks
2087-----------
2089#### Extension: `line_blocks` ####
2091A line block is a sequence of lines beginning with a vertical bar (`|`)
2092followed by a space. The division into lines will be preserved in
2093the output, as will any leading spaces; otherwise, the lines will
2094be formatted as Markdown. This is useful for verse and addresses:
2096 | The limerick packs laughs anatomical
2097 | In space that is quite economical.
2098 | But the good ones I've seen
2099 | So seldom are clean
2100 | And the clean ones so seldom are comical
2102 | 200 Main St.
2103 | Berkeley, CA 94718
2105The lines can be hard-wrapped if needed, but the continuation
2106line must begin with a space.
2108 | The Right Honorable Most Venerable and Righteous Samuel L.
2109 Constable, Jr.
2110 | 200 Main St.
2111 | Berkeley, CA 94718
2113This syntax is borrowed from [reStructuredText].
2115Lists
2116-----
2118### Bullet lists ###
2120A bullet list is a list of bulleted list items. A bulleted list
2121item begins with a bullet (`*`, `+`, or `-`). Here is a simple
2122example:
2124 * one
2125 * two
2126 * three
2128This will produce a "compact" list. If you want a "loose" list, in which
2129each item is formatted as a paragraph, put spaces between the items:
2131 * one
2133 * two
2135 * three
2137The bullets need not be flush with the left margin; they may be
2138indented one, two, or three spaces. The bullet must be followed
2139by whitespace.
2141List items look best if subsequent lines are flush with the first
2142line (after the bullet):
2144 * here is my first
2145 list item.
2146 * and my second.
2148But Markdown also allows a "lazy" format:
2150 * here is my first
2151 list item.
2152 * and my second.
2154### Block content in list items ###
2156A list item may contain multiple paragraphs and other block-level
2157content. However, subsequent paragraphs must be preceded by a blank line
2158and indented to line up with the first non-space content after
2159the list marker.
2161 * First paragraph.
2163 Continued.
2165 * Second paragraph. With a code block, which must be indented
2166 eight spaces:
2168 { code }
2170Exception: if the list marker is followed by an indented code
2171block, which must begin 5 spaces after the list marker, then
2172subsequent paragraphs must begin two columns after the last
2173character of the list marker:
2175 * code
2177 continuation paragraph
2179List items may include other lists. In this case the preceding blank
2180line is optional. The nested list must be indented to line up with
2181the first non-space character after the list marker of the
2182containing list item.
2184 * fruits
2185 + apples
2186 - macintosh
2187 - red delicious
2188 + pears
2189 + peaches
2190 * vegetables
2191 + broccoli
2192 + chard
2194As noted above, Markdown allows you to write list items "lazily," instead of
2195indenting continuation lines. However, if there are multiple paragraphs or
2196other blocks in a list item, the first line of each must be indented.
2198 + A lazy, lazy, list
2199 item.
2201 + Another one; this looks
2202 bad but is legal.
2204 Second paragraph of second
2205 list item.
2207### Ordered lists ###
2209Ordered lists work just like bulleted lists, except that the items
2210begin with enumerators rather than bullets.
2212In standard Markdown, enumerators are decimal numbers followed
2213by a period and a space. The numbers themselves are ignored, so
2214there is no difference between this list:
2216 1. one
2217 2. two
2218 3. three
2220and this one:
2222 5. one
2223 7. two
2224 1. three
2226#### Extension: `fancy_lists` ####
2228Unlike standard Markdown, pandoc allows ordered list items to be marked
2229with uppercase and lowercase letters and roman numerals, in addition to
2230Arabic numerals. List markers may be enclosed in parentheses or followed by a
2231single right-parentheses or period. They must be separated from the
2232text that follows by at least one space, and, if the list marker is a
2233capital letter with a period, by at least two spaces.[^2]
2235[^2]: The point of this rule is to ensure that normal paragraphs
2236 starting with people's initials, like
2238 B. Russell was an English philosopher.
2240 do not get treated as list items.
2242 This rule will not prevent
2244 (C) 2007 Joe Smith
2246 from being interpreted as a list item. In this case, a backslash
2247 escape can be used:
2249 (C\) 2007 Joe Smith
2251The `fancy_lists` extension also allows '`#`' to be used as an
2252ordered list marker in place of a numeral:
2254 #. one
2255 #. two
2257#### Extension: `startnum` ####
2259Pandoc also pays attention to the type of list marker used, and to the
2260starting number, and both of these are preserved where possible in the
2261output format. Thus, the following yields a list with numbers followed
2262by a single parenthesis, starting with 9, and a sublist with lowercase
2263roman numerals:
2265 9) Ninth
2266 10) Tenth
2267 11) Eleventh
2268 i. subone
2269 ii. subtwo
2270 iii. subthree
2272Pandoc will start a new list each time a different type of list
2273marker is used. So, the following will create three lists:
2275 (2) Two
2276 (5) Three
2277 1. Four
2278 * Five
2280If default list markers are desired, use `#.`:
2282 #. one
2283 #. two
2284 #. three
2287### Definition lists ###
2289#### Extension: `definition_lists` ####
2291Pandoc supports definition lists, using the syntax of
2292[PHP Markdown Extra] with some extensions.[^3]
2294 Term 1
2296 : Definition 1
2298 Term 2 with *inline markup*
2300 : Definition 2
2302 { some code, part of Definition 2 }
2304 Third paragraph of definition 2.
2306Each term must fit on one line, which may optionally be followed by
2307a blank line, and must be followed by one or more definitions.
2308A definition begins with a colon or tilde, which may be indented one
2309or two spaces.
2311A term may have multiple definitions, and each definition may consist of one or
2312more block elements (paragraph, code block, list, etc.), each indented four
2313spaces or one tab stop. The body of the definition (including the first line,
2314aside from the colon or tilde) should be indented four spaces. However,
2315as with other Markdown lists, you can "lazily" omit indentation except
2316at the beginning of a paragraph or other block element:
2318 Term 1
2320 : Definition
2321 with lazy continuation.
2323 Second paragraph of the definition.
2325If you leave space before the definition (as in the example above),
2326the text of the definition will be treated as a paragraph. In some
2327output formats, this will mean greater spacing between term/definition
2328pairs. For a more compact definition list, omit the space before the
2329definition:
2331 Term 1
2332 ~ Definition 1
2334 Term 2
2335 ~ Definition 2a
2336 ~ Definition 2b
2338Note that space between items in a definition list is required.
2339(A variant that loosens this requirement, but disallows "lazy"
2340hard wrapping, can be activated with `compact_definition_lists`: see
2341[Non-pandoc extensions], below.)
2343[^3]: I have been influenced by the suggestions of [David Wheeler](http://www.justatheory.com/computers/markup/modest-markdown-proposal.html).
2345### Numbered example lists ###
2347#### Extension: `example_lists` ####
2349The special list marker `@` can be used for sequentially numbered
2350examples. The first list item with a `@` marker will be numbered '1',
2351the next '2', and so on, throughout the document. The numbered examples
2352need not occur in a single list; each new list using `@` will take up
2353where the last stopped. So, for example:
2355 (@) My first example will be numbered (1).
2356 (@) My second example will be numbered (2).
2358 Explanation of examples.
2360 (@) My third example will be numbered (3).
2362Numbered examples can be labeled and referred to elsewhere in the
2363document:
2365 (@good) This is a good example.
2367 As (@good) illustrates, ...
2369The label can be any string of alphanumeric characters, underscores,
2370or hyphens.
2373### Compact and loose lists ###
2375Pandoc behaves differently from `Markdown.pl` on some "edge
2376cases" involving lists. Consider this source:
2378 + First
2379 + Second:
2380 - Fee
2381 - Fie
2382 - Foe
2384 + Third
2386Pandoc transforms this into a "compact list" (with no `<p>` tags around
2387"First", "Second", or "Third"), while Markdown puts `<p>` tags around
2388"Second" and "Third" (but not "First"), because of the blank space
2389around "Third". Pandoc follows a simple rule: if the text is followed by
2390a blank line, it is treated as a paragraph. Since "Second" is followed
2391by a list, and not a blank line, it isn't treated as a paragraph. The
2392fact that the list is followed by a blank line is irrelevant. (Note:
2393Pandoc works this way even when the `markdown_strict` format is specified. This
2394behavior is consistent with the official Markdown syntax description,
2395even though it is different from that of `Markdown.pl`.)
2398### Ending a list ###
2400What if you want to put an indented code block after a list?
2402 - item one
2403 - item two
2405 { my code block }
2407Trouble! Here pandoc (like other Markdown implementations) will treat
2408`{ my code block }` as the second paragraph of item two, and not as
2409a code block.
2411To "cut off" the list after item two, you can insert some non-indented
2412content, like an HTML comment, which won't produce visible output in
2413any format:
2415 - item one
2416 - item two
2418 <!-- end of list -->
2420 { my code block }
2422You can use the same trick if you want two consecutive lists instead
2423of one big list:
2425 1. one
2426 2. two
2427 3. three
2429 <!-- -->
2431 1. uno
2432 2. dos
2433 3. tres
2435Horizontal rules
2436----------------
2438A line containing a row of three or more `*`, `-`, or `_` characters
2439(optionally separated by spaces) produces a horizontal rule:
2441 * * * *
2443 ---------------
2446Tables
2447------
2449Four kinds of tables may be used. The first three kinds presuppose the use of
2450a fixed-width font, such as Courier. The fourth kind can be used with
2451proportionally spaced fonts, as it does not require lining up columns.
2453#### Extension: `table_captions` ####
2455A caption may optionally be provided with all 4 kinds of tables (as
2456illustrated in the examples below). A caption is a paragraph beginning
2457with the string `Table:` (or just `:`), which will be stripped off.
2458It may appear either before or after the table.
2460#### Extension: `simple_tables` ####
2462Simple tables look like this:
2464 Right Left Center Default
2465 ------- ------ ---------- -------
2466 12 12 12 12
2467 123 123 123 123
2468 1 1 1 1
2470 Table: Demonstration of simple table syntax.
2472The headers and table rows must each fit on one line. Column
2473alignments are determined by the position of the header text relative
2474to the dashed line below it:[^4]
2476 - If the dashed line is flush with the header text on the right side
2477 but extends beyond it on the left, the column is right-aligned.
2478 - If the dashed line is flush with the header text on the left side
2479 but extends beyond it on the right, the column is left-aligned.
2480 - If the dashed line extends beyond the header text on both sides,
2481 the column is centered.
2482 - If the dashed line is flush with the header text on both sides,
2483 the default alignment is used (in most cases, this will be left).
2485[^4]: This scheme is due to Michel Fortin, who proposed it on the
2486 [Markdown discussion list](http://six.pairlist.net/pipermail/markdown-discuss/2005-March/001097.html).
2488The table must end with a blank line, or a line of dashes followed by
2489a blank line.
2491The column headers may be omitted, provided a dashed line is used
2492to end the table. For example:
2494 ------- ------ ---------- -------
2495 12 12 12 12
2496 123 123 123 123
2497 1 1 1 1
2498 ------- ------ ---------- -------
2500When headers are omitted, column alignments are determined on the basis
2501of the first line of the table body. So, in the tables above, the columns
2502would be right, left, center, and right aligned, respectively.
2504#### Extension: `multiline_tables` ####
2506Multiline tables allow headers and table rows to span multiple lines
2507of text (but cells that span multiple columns or rows of the table are
2508not supported). Here is an example:
2510 -------------------------------------------------------------
2511 Centered Default Right Left
2512 Header Aligned Aligned Aligned
2513 ----------- ------- --------------- -------------------------
2514 First row 12.0 Example of a row that
2515 spans multiple lines.
2517 Second row 5.0 Here's another one. Note
2518 the blank line between
2519 rows.
2520 -------------------------------------------------------------
2522 Table: Here's the caption. It, too, may span
2523 multiple lines.
2525These work like simple tables, but with the following differences:
2527 - They must begin with a row of dashes, before the header text
2528 (unless the headers are omitted).
2529 - They must end with a row of dashes, then a blank line.
2530 - The rows must be separated by blank lines.
2532In multiline tables, the table parser pays attention to the widths of
2533the columns, and the writers try to reproduce these relative widths in
2534the output. So, if you find that one of the columns is too narrow in the
2535output, try widening it in the Markdown source.
2537Headers may be omitted in multiline tables as well as simple tables:
2539 ----------- ------- --------------- -------------------------
2540 First row 12.0 Example of a row that
2541 spans multiple lines.
2543 Second row 5.0 Here's another one. Note
2544 the blank line between
2545 rows.
2546 ----------- ------- --------------- -------------------------
2548 : Here's a multiline table without headers.
2550It is possible for a multiline table to have just one row, but the row
2551should be followed by a blank line (and then the row of dashes that ends
2552the table), or the table may be interpreted as a simple table.
2554#### Extension: `grid_tables` ####
2556Grid tables look like this:
2558 : Sample grid table.
2560 +---------------+---------------+--------------------+
2561 | Fruit | Price | Advantages |
2562 +===============+===============+====================+
2563 | Bananas | $1.34 | - built-in wrapper |
2564 | | | - bright color |
2565 +---------------+---------------+--------------------+
2566 | Oranges | $2.10 | - cures scurvy |
2567 | | | - tasty |
2568 +---------------+---------------+--------------------+
2570The row of `=`s separates the header from the table body, and can be
2571omitted for a headerless table. The cells of grid tables may contain
2572arbitrary block elements (multiple paragraphs, code blocks, lists,
2573etc.). Cells that span multiple columns or rows are not
2574supported. Grid tables can be created easily using [Emacs table mode].
2576[Emacs table mode]: http://table.sourceforge.net/
2578Alignments can be specified as with pipe tables, by putting
2579colons at the boundaries of the separator line after the
2580header:
2582 +---------------+---------------+--------------------+
2583 | Right | Left | Centered |
2584 +==============:+:==============+:==================:+
2585 | Bananas | $1.34 | built-in wrapper |
2586 +---------------+---------------+--------------------+
2588For headerless tables, the colons go on the top line instead:
2590 +--------------:+:--------------+:------------------:+
2591 | Right | Left | Centered |
2592 +---------------+---------------+--------------------+
2594##### Grid Table Limitations #####
2596Pandoc does not support grid tables with row spans or column spans.
2597This means that neither variable numbers of columns across rows nor
2598variable numbers of rows across columns are supported by Pandoc.
2599All grid tables must have the same number of columns in each row,
2600and the same number of rows in each column. For example, the
2601Docutils [sample grid tables] will not render as expected with
2602Pandoc.
2604[sample grid tables]: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#grid-tables
2607#### Extension: `pipe_tables` ####
2609Pipe tables look like this:
2611 | Right | Left | Default | Center |
2612 |------:|:-----|---------|:------:|
2613 | 12 | 12 | 12 | 12 |
2614 | 123 | 123 | 123 | 123 |
2615 | 1 | 1 | 1 | 1 |
2617 : Demonstration of pipe table syntax.
2619The syntax is identical to [PHP Markdown Extra tables]. The beginning and
2620ending pipe characters are optional, but pipes are required between all
2621columns. The colons indicate column alignment as shown. The header
2622cannot be omitted. To simulate a headerless table, include a header
2623with blank cells.
2625Since the pipes indicate column boundaries, columns need not be vertically
2626aligned, as they are in the above example. So, this is a perfectly
2627legal (though ugly) pipe table:
2629 fruit| price
2630 -----|-----:
2631 apple|2.05
2632 pear|1.37
2633 orange|3.09
2635The cells of pipe tables cannot contain block elements like paragraphs
2636and lists, and cannot span multiple lines. If a pipe table contains a
2637row whose printable content is wider than the column width (see
2638`--columns`), then the cell contents will wrap, with the
2639relative cell widths determined by the widths of the separator
2640lines. (In this case, the table will take up the full text
2641width.) If no lines are wider than column width, then
2642cell contents will not be wrapped, and the cells will be sized
2643to their contents.
2645Note: pandoc also recognizes pipe tables of the following
2646form, as can be produced by Emacs' orgtbl-mode:
2648 | One | Two |
2649 |-----+-------|
2650 | my | table |
2651 | is | nice |
2653The difference is that `+` is used instead of `|`. Other orgtbl features
2654are not supported. In particular, to get non-default column alignment,
2655you'll need to add colons as above.
2657[PHP Markdown Extra tables]: https://michelf.ca/projects/php-markdown/extra/#table
2659Metadata blocks
2660---------------
2662#### Extension: `pandoc_title_block` ####
2664If the file begins with a title block
2666 % title
2667 % author(s) (separated by semicolons)
2668 % date
2670it will be parsed as bibliographic information, not regular text. (It
2671will be used, for example, in the title of standalone LaTeX or HTML
2672output.) The block may contain just a title, a title and an author,
2673or all three elements. If you want to include an author but no
2674title, or a title and a date but no author, you need a blank line:
2677 % Author
2679 % My title
2681 % June 15, 2006
2683The title may occupy multiple lines, but continuation lines must
2684begin with leading space, thus:
2686 % My title
2687 on multiple lines
2689If a document has multiple authors, the authors may be put on
2690separate lines with leading space, or separated by semicolons, or
2691both. So, all of the following are equivalent:
2693 % Author One
2694 Author Two
2696 % Author One; Author Two
2698 % Author One;
2699 Author Two
2701The date must fit on one line.
2703All three metadata fields may contain standard inline formatting
2704(italics, links, footnotes, etc.).
2706Title blocks will always be parsed, but they will affect the output only
2707when the `--standalone` (`-s`) option is chosen. In HTML output, titles
2708will appear twice: once in the document head -- this is the title that
2709will appear at the top of the window in a browser -- and once at the
2710beginning of the document body. The title in the document head can have
2711an optional prefix attached (`--title-prefix` or `-T` option). The title
2712in the body appears as an H1 element with class "title", so it can be
2713suppressed or reformatted with CSS. If a title prefix is specified with
2714`-T` and no title block appears in the document, the title prefix will
2715be used by itself as the HTML title.
2717The man page writer extracts a title, man page section number, and
2718other header and footer information from the title line. The title
2719is assumed to be the first word on the title line, which may optionally
2720end with a (single-digit) section number in parentheses. (There should
2721be no space between the title and the parentheses.) Anything after
2722this is assumed to be additional footer and header text. A single pipe
2723character (`|`) should be used to separate the footer text from the header
2724text. Thus,
2726 % PANDOC(1)
2728will yield a man page with the title `PANDOC` and section 1.
2730 % PANDOC(1) Pandoc User Manuals
2732will also have "Pandoc User Manuals" in the footer.
2734 % PANDOC(1) Pandoc User Manuals | Version 4.0
2736will also have "Version 4.0" in the header.
2738#### Extension: `yaml_metadata_block` ####
2740A YAML metadata block is a valid YAML object, delimited by a line of three
2741hyphens (`---`) at the top and a line of three hyphens (`---`) or three dots
2742(`...`) at the bottom. A YAML metadata block may occur anywhere in the
2743document, but if it is not at the beginning, it must be preceded by a blank
2744line. (Note that, because of the way pandoc concatenates input files when
2745several are provided, you may also keep the metadata in a separate YAML file
2746and pass it to pandoc as an argument, along with your Markdown files:
2748 pandoc chap1.md chap2.md chap3.md metadata.yaml -s -o book.html
2750Just be sure that the YAML file begins with `---` and ends with `---` or
2751`...`.)
2753Metadata will be taken from the fields of the YAML object and added to any
2754existing document metadata. Metadata can contain lists and objects (nested
2755arbitrarily), but all string scalars will be interpreted as Markdown. Fields
2756with names ending in an underscore will be ignored by pandoc. (They may be
2757given a role by external processors.)
2759A document may contain multiple metadata blocks. The metadata fields will
2760be combined through a *left-biased union*: if two metadata blocks attempt
2761to set the same field, the value from the first block will be taken.
2763When pandoc is used with `-t markdown` to create a Markdown document,
2764a YAML metadata block will be produced only if the `-s/--standalone`
2765option is used. All of the metadata will appear in a single block
2766at the beginning of the document.
2768Note that YAML escaping rules must be followed. Thus, for example,
2769if a title contains a colon, it must be quoted. The pipe character
2770(`|`) can be used to begin an indented block that will be interpreted
2771literally, without need for escaping. This form is necessary
2772when the field contains blank lines or block-level formatting:
2774 ---
2775 title: 'This is the title: it contains a colon'
2776 author:
2777 - Author One
2778 - Author Two
2779 tags: [nothing, nothingness]
2780 abstract: |
2781 This is the abstract.
2783 It consists of two paragraphs.
2784 ...
2786Template variables will be set automatically from the metadata. Thus, for
2787example, in writing HTML, the variable `abstract` will be set to the HTML
2788equivalent of the Markdown in the `abstract` field:
2790 <p>This is the abstract.</p>
2791 <p>It consists of two paragraphs.</p>
2793Variables can contain arbitrary YAML structures, but the template must match
2794this structure. The `author` variable in the default templates expects a
2795simple list or string, but can be changed to support more complicated
2796structures. The following combination, for example, would add an affiliation
2797to the author if one is given:
2799 ---
2800 title: The document title
2801 author:
2802 - name: Author One
2803 affiliation: University of Somewhere
2804 - name: Author Two
2805 affiliation: University of Nowhere
2806 ...
2808To use the structured authors in the example above, you would need a custom
2809template:
2811 $for(author)$
2812 $if(author.name)$
2813 $author.name$$if(author.affiliation)$ ($author.affiliation$)$endif$
2814 $else$
2815 $author$
2816 $endif$
2817 $endfor$
2820Backslash escapes
2821-----------------
2823#### Extension: `all_symbols_escapable` ####
2825Except inside a code block or inline code, any punctuation or space
2826character preceded by a backslash will be treated literally, even if it
2827would normally indicate formatting. Thus, for example, if one writes
2829 *\*hello\**
2831one will get
2833 <em>*hello*</em>
2835instead of
2837 <strong>hello</strong>
2839This rule is easier to remember than standard Markdown's rule,
2840which allows only the following characters to be backslash-escaped:
2842 \`*_{}[]()>#+-.!
2844(However, if the `markdown_strict` format is used, the standard Markdown rule
2845will be used.)
2847A backslash-escaped space is parsed as a nonbreaking space. It will
2848appear in TeX output as `~` and in HTML and XML as `\&#160;` or
2849`\&nbsp;`.
2851A backslash-escaped newline (i.e. a backslash occurring at the end of
2852a line) is parsed as a hard line break. It will appear in TeX output as
2853`\\` and in HTML as `<br />`. This is a nice alternative to
2854Markdown's "invisible" way of indicating hard line breaks using
2855two trailing spaces on a line.
2857Backslash escapes do not work in verbatim contexts.
2859Inline formatting
2860-----------------
2862### Emphasis ###
2864To *emphasize* some text, surround it with `*`s or `_`, like this:
2866 This text is _emphasized with underscores_, and this
2867 is *emphasized with asterisks*.
2869Double `*` or `_` produces **strong emphasis**:
2871 This is **strong emphasis** and __with underscores__.
2873A `*` or `_` character surrounded by spaces, or backslash-escaped,
2874will not trigger emphasis:
2876 This is * not emphasized *, and \*neither is this\*.
2878#### Extension: `intraword_underscores` ####
2880Because `_` is sometimes used inside words and identifiers,
2881pandoc does not interpret a `_` surrounded by alphanumeric
2882characters as an emphasis marker. If you want to emphasize
2883just part of a word, use `*`:
2885 feas*ible*, not feas*able*.
2888### Strikeout ###
2890#### Extension: `strikeout` ####
2892To strikeout a section of text with a horizontal line, begin and end it
2893with `~~`. Thus, for example,
2895 This ~~is deleted text.~~
2898### Superscripts and subscripts ###
2900#### Extension: `superscript`, `subscript` ####
2902Superscripts may be written by surrounding the superscripted text by `^`
2903characters; subscripts may be written by surrounding the subscripted
2904text by `~` characters. Thus, for example,
2906 H~2~O is a liquid. 2^10^ is 1024.
2908If the superscripted or subscripted text contains spaces, these spaces
2909must be escaped with backslashes. (This is to prevent accidental
2910superscripting and subscripting through the ordinary use of `~` and `^`.)
2911Thus, if you want the letter P with 'a cat' in subscripts, use
2912`P~a\ cat~`, not `P~a cat~`.
2915### Verbatim ###
2917To make a short span of text verbatim, put it inside backticks:
2919 What is the difference between `>>=` and `>>`?
2921If the verbatim text includes a backtick, use double backticks:
2923 Here is a literal backtick `` ` ``.
2925(The spaces after the opening backticks and before the closing
2926backticks will be ignored.)
2928The general rule is that a verbatim span starts with a string
2929of consecutive backticks (optionally followed by a space)
2930and ends with a string of the same number of backticks (optionally
2931preceded by a space).
2933Note that backslash-escapes (and other Markdown constructs) do not
2934work in verbatim contexts:
2936 This is a backslash followed by an asterisk: `\*`.
2938#### Extension: `inline_code_attributes` ####
2940Attributes can be attached to verbatim text, just as with
2941[fenced code blocks]:
2943 `<$>`{.haskell}
2945### Small caps ###
2947To write small caps, use the `smallcaps` class:
2949 [Small caps]{.smallcaps}
2951Or, without the `bracketed_spans` extension:
2953 <span class="smallcaps">Small caps</span>
2955For compatibility with other Markdown flavors, CSS is also supported:
2957 <span style="font-variant:small-caps;">Small caps</span>
2959This will work in all output formats that support small caps.
2962Math
2963----
2965#### Extension: `tex_math_dollars` ####
2967Anything between two `$` characters will be treated as TeX math. The
2968opening `$` must have a non-space character immediately to its right,
2969while the closing `$` must have a non-space character immediately to its
2970left, and must not be followed immediately by a digit. Thus,
2971`$20,000 and $30,000` won't parse as math. If for some reason
2972you need to enclose text in literal `$` characters, backslash-escape
2973them and they won't be treated as math delimiters.
2975TeX math will be printed in all output formats. How it is rendered
2976depends on the output format:
2978Markdown, LaTeX, Emacs Org mode, ConTeXt, ZimWiki
2979 ~ It will appear verbatim between `$` characters.
2981reStructuredText
2982 ~ It will be rendered using an [interpreted text role `:math:`].
2984AsciiDoc
2985 ~ It will be rendered as `latexmath:[...]`.
2987Texinfo
2988 ~ It will be rendered inside a `@math` command.
2990groff man
2991 ~ It will be rendered verbatim without `$`'s.
2993MediaWiki, DokuWiki
2994 ~ It will be rendered inside `<math>` tags.
2996Textile
2997 ~ It will be rendered inside `<span class="math">` tags.
2999RTF, OpenDocument
3000 ~ It will be rendered, if possible, using Unicode characters,
3001 and will otherwise appear verbatim.
3003ODT
3004 ~ It will be rendered, if possible, using MathML.
3006DocBook
3007 ~ If the `--mathml` flag is used, it will be rendered using MathML
3008 in an `inlineequation` or `informalequation` tag. Otherwise it
3009 will be rendered, if possible, using Unicode characters.
3011Docx
3012 ~ It will be rendered using OMML math markup.
3014FictionBook2
3015 ~ If the `--webtex` option is used, formulas are rendered as images
3016 using CodeCogs or other compatible web service, downloaded
3017 and embedded in the e-book. Otherwise, they will appear verbatim.
3019HTML, Slidy, DZSlides, S5, EPUB
3020 ~ The way math is rendered in HTML will depend on the
3021 command-line options selected. Therefore see [Math rendering in HTML]
3022 above.
3024This extension can be used with both `markdown` and `html` input.
3026[interpreted text role `:math:`]: http://docutils.sourceforge.net/docs/ref/rst/roles.html#math
3028Raw HTML
3029--------
3031#### Extension: `raw_html` ####
3033Markdown allows you to insert raw HTML (or DocBook) anywhere in a document
3034(except verbatim contexts, where `<`, `>`, and `&` are interpreted
3035literally). (Technically this is not an extension, since standard
3036Markdown allows it, but it has been made an extension so that it can
3037be disabled if desired.)
3039The raw HTML is passed through unchanged in HTML, S5, Slidy, Slideous,
3040DZSlides, EPUB, Markdown, Emacs Org mode, and Textile output, and suppressed
3041in other formats.
3043#### Extension: `markdown_in_html_blocks` ####
3045Standard Markdown allows you to include HTML "blocks": blocks
3046of HTML between balanced tags that are separated from the surrounding text
3047with blank lines, and start and end at the left margin. Within
3048these blocks, everything is interpreted as HTML, not Markdown;
3049so (for example), `*` does not signify emphasis.
3051Pandoc behaves this way when the `markdown_strict` format is used; but
3052by default, pandoc interprets material between HTML block tags as Markdown.
3053Thus, for example, pandoc will turn
3055 <table>
3056 <tr>
3057 <td>*one*</td>
3058 <td>[a link](http://google.com)</td>
3059 </tr>
3060 </table>
3062into
3064 <table>
3065 <tr>
3066 <td><em>one</em></td>
3067 <td><a href="http://google.com">a link</a></td>
3068 </tr>
3069 </table>
3071whereas `Markdown.pl` will preserve it as is.
3073There is one exception to this rule: text between `<script>` and
3074`<style>` tags is not interpreted as Markdown.
3076This departure from standard Markdown should make it easier to mix
3077Markdown with HTML block elements. For example, one can surround
3078a block of Markdown text with `<div>` tags without preventing it
3079from being interpreted as Markdown.
3081#### Extension: `native_divs` ####
3083Use native pandoc `Div` blocks for content inside `<div>` tags.
3084For the most part this should give the same output as
3085`markdown_in_html_blocks`, but it makes it easier to write pandoc
3086filters to manipulate groups of blocks.
3088#### Extension: `native_spans` ####
3090Use native pandoc `Span` blocks for content inside `<span>` tags.
3091For the most part this should give the same output as `raw_html`,
3092but it makes it easier to write pandoc filters to manipulate groups
3093of inlines.
3095#### Extension: `fenced_divs` ####
3097Allow special fenced syntax for native `Div` blocks. A Div
3098starts with a fence containing at least three consecutive
3099colons plus some attributes. The attributes may optionally
3100be followed by another string of consecutive colons.
3101The attribute syntax is exactly as in fenced code blocks (see
3102[Extension: `fenced_code_attributes`]). As with fenced
3103code blocks, one can use either attributes in curly braces
3104or a single unbraced word, which will be treated as a class
3105name. The Div ends with another line containing a string of at
3106least three consecutive colons. The fenced Div should be
3107separated by blank lines from preceding and following blocks.
3109Example:
3111 ::::: {#special .sidebar}
3112 Here is a paragraph.
3114 And another.
3115 :::::
3117Fenced divs can be nested. Opening fences are distinguished
3118because they *must* have attributes:
3120 ::: Warning ::::::
3121 This is a warning.
3123 ::: Danger
3124 This is a warning within a warning.
3125 :::
3126 ::::::::::::::::::
3128Fences without attributes are always closing fences. Unlike
3129with fenced code blocks, the number of colons in the closing
3130fence need not match the number in the opening fence. However,
3131it can be helpful for visual clarity to use fences of different
3132lengths to distinguish nested divs from their parents.
3134#### Extension: `raw_tex` ####
3136In addition to raw HTML, pandoc allows raw LaTeX, TeX, and ConTeXt to be
3137included in a document. Inline TeX commands will be preserved and passed
3138unchanged to the LaTeX and ConTeXt writers. Thus, for example, you can use
3139LaTeX to include BibTeX citations:
3141 This result was proved in \cite{jones.1967}.
3143Note that in LaTeX environments, like
3145 \begin{tabular}{|l|l|}\hline
3146 Age & Frequency \\ \hline
3147 18--25 & 15 \\
3148 26--35 & 33 \\
3149 36--45 & 22 \\ \hline
3150 \end{tabular}
3152the material between the begin and end tags will be interpreted as raw
3153LaTeX, not as Markdown.
3155Inline LaTeX is ignored in output formats other than Markdown, LaTeX,
3156Emacs Org mode, and ConTeXt.
3158### Generic raw attribute ###
3160#### Extension: `raw_attribute` ####
3162Inline spans and fenced code blocks with a special
3163kind of attribute will be parsed as raw content with the
3164designated format. For example, the following produces a raw
3165groff `ms` block:
3167 ```{=ms}
3168 .MYMACRO
3169 blah blah
3170 ```
3171And the following produces a raw `html` inline element:
3173 This is `<a>html</a>`{=html}
3175The format name should match the target format name (see
3176`-t/--to`, above, for a list, or use `pandoc
3177--list-output-formats`).
3179This extension presupposes that the relevant kind of
3180inline code or fenced code block is enabled. Thus, for
3181example, to use a raw attribute with a backtick code block,
3182`backtick_code_blocks` must be enabled.
3184The raw attribute cannot be combined with regular attributes.
3186LaTeX macros
3187------------
3189#### Extension: `latex_macros` ####
3191For output formats other than LaTeX, pandoc will parse LaTeX `\newcommand` and
3192`\renewcommand` definitions and apply the resulting macros to all LaTeX
3193math. So, for example, the following will work in all output formats,
3194not just LaTeX:
3196 \newcommand{\tuple}[1]{\langle #1 \rangle}
3198 $\tuple{a, b, c}$
3200In LaTeX output, the `\newcommand` definition will simply be passed
3201unchanged to the output.
3204Links
3205-----
3207Markdown allows links to be specified in several ways.
3209### Automatic links ###
3211If you enclose a URL or email address in pointy brackets, it
3212will become a link:
3214 <http://google.com>
3215 <sam@green.eggs.ham>
3217### Inline links ###
3219An inline link consists of the link text in square brackets,
3220followed by the URL in parentheses. (Optionally, the URL can
3221be followed by a link title, in quotes.)
3223 This is an [inline link](/url), and here's [one with
3224 a title](http://fsf.org "click here for a good time!").
3226There can be no space between the bracketed part and the parenthesized part.
3227The link text can contain formatting (such as emphasis), but the title cannot.
3229Email addresses in inline links are not autodetected, so they have to be
3230prefixed with `mailto`:
3232 [Write me!](mailto:sam@green.eggs.ham)
3234### Reference links ###
3236An *explicit* reference link has two parts, the link itself and the link
3237definition, which may occur elsewhere in the document (either
3238before or after the link).
3240The link consists of link text in square brackets, followed by a label in
3241square brackets. (There cannot be space between the two unless the
3242`spaced_reference_links` extension is enabled.) The link definition
3243consists of the bracketed label, followed by a colon and a space, followed by
3244the URL, and optionally (after a space) a link title either in quotes or in
3245parentheses. The label must not be parseable as a citation (assuming
3246the `citations` extension is enabled): citations take precedence over
3247link labels.
3249Here are some examples:
3251 [my label 1]: /foo/bar.html "My title, optional"
3252 [my label 2]: /foo
3253 [my label 3]: http://fsf.org (The free software foundation)
3254 [my label 4]: /bar#special 'A title in single quotes'
3256The URL may optionally be surrounded by angle brackets:
3258 [my label 5]: <http://foo.bar.baz>
3260The title may go on the next line:
3262 [my label 3]: http://fsf.org
3263 "The free software foundation"
3265Note that link labels are not case sensitive. So, this will work:
3267 Here is [my link][FOO]
3269 [Foo]: /bar/baz
3271In an *implicit* reference link, the second pair of brackets is
3272empty:
3274 See [my website][].
3276 [my website]: http://foo.bar.baz
3278Note: In `Markdown.pl` and most other Markdown implementations,
3279reference link definitions cannot occur in nested constructions
3280such as list items or block quotes. Pandoc lifts this arbitrary
3281seeming restriction. So the following is fine in pandoc, though
3282not in most other implementations:
3284 > My block [quote].
3286 > [quote]: /foo
3288#### Extension: `shortcut_reference_links` ####
3290In a *shortcut* reference link, the second pair of brackets may
3291be omitted entirely:
3293 See [my website].
3295 [my website]: http://foo.bar.baz
3297### Internal links ###
3299To link to another section of the same document, use the automatically
3300generated identifier (see [Header identifiers]). For example:
3302 See the [Introduction](#introduction).
3306 See the [Introduction].
3308 [Introduction]: #introduction
3310Internal links are currently supported for HTML formats (including
3311HTML slide shows and EPUB), LaTeX, and ConTeXt.
3313Images
3314------
3316A link immediately preceded by a `!` will be treated as an image.
3317The link text will be used as the image's alt text:
3319 ![la lune](lalune.jpg "Voyage to the moon")
3321 ![movie reel]
3323 [movie reel]: movie.gif
3325#### Extension: `implicit_figures` ####
3327An image with nonempty alt text, occurring by itself in a
3328paragraph, will be rendered as a figure with a caption. The
3329image's alt text will be used as the caption.
3331 ![This is the caption](/url/of/image.png)
3333How this is rendered depends on the output format. Some output
3334formats (e.g. RTF) do not yet support figures. In those
3335formats, you'll just get an image in a paragraph by itself, with
3336no caption.
3338If you just want a regular inline image, just make sure it is not
3339the only thing in the paragraph. One way to do this is to insert a
3340nonbreaking space after the image:
3342 ![This image won't be a figure](/url/of/image.png)\
3344Note that in reveal.js slide shows, an image in a paragraph
3345by itself that has the `stretch` class will fill the screen,
3346and the caption and figure tags will be omitted.
3348#### Extension: `link_attributes` ####
3350Attributes can be set on links and images:
3352 An inline ![image](foo.jpg){#id .class width=30 height=20px}
3353 and a reference ![image][ref] with attributes.
3355 [ref]: foo.jpg "optional title" {#id .class key=val key2="val 2"}
3357(This syntax is compatible with [PHP Markdown Extra] when only `#id`
3358and `.class` are used.)
3360For HTML and EPUB, all attributes except `width` and `height` (but
3361including `srcset` and `sizes`) are passed through as is. The other
3362writers ignore attributes that are not supported by their output
3363format.
3365The `width` and `height` attributes on images are treated specially. When
3366used without a unit, the unit is assumed to be pixels. However, any of
3367the following unit identifiers can be used: `px`, `cm`, `mm`, `in`, `inch`
3368and `%`. There must not be any spaces between the number and the unit.
3369For example:
3371```
3372![](file.jpg){ width=50% }
3373```
3375- Dimensions are converted to inches for output in page-based formats like
3376 LaTeX. Dimensions are converted to pixels for output in HTML-like
3377 formats. Use the `--dpi` option to specify the number of pixels per
3378 inch. The default is 96dpi.
3379- The `%` unit is generally relative to some available space.
3380 For example the above example will render to
3381 `<img href="file.jpg" style="width: 50%;" />` (HTML),
3382 `\includegraphics[width=0.5\textwidth]{file.jpg}` (LaTeX), or
3383 `\externalfigure[file.jpg][width=0.5\textwidth]` (ConTeXt).
3384- Some output formats have a notion of a class
3385 ([ConTeXt](http://wiki.contextgarden.net/Using_Graphics#Multiple_Image_Settings))
3386 or a unique identifier (LaTeX `\caption`), or both (HTML).
3387- When no `width` or `height` attributes are specified, the fallback
3388 is to look at the image resolution and the dpi metadata embedded in
3389 the image file.
3391Spans
3392-----
3394#### Extension: `bracketed_spans` ####
3396A bracketed sequence of inlines, as one would use to begin
3397a link, will be treated as a span with attributes if it is
3398followed immediately by attributes:
3400 [This is *some text*]{.class key="val"}
3402Footnotes
3403---------
3405#### Extension: `footnotes` ####
3407Pandoc's Markdown allows footnotes, using the following syntax:
3409 Here is a footnote reference,[^1] and another.[^longnote]
3411 [^1]: Here is the footnote.
3413 [^longnote]: Here's one with multiple blocks.
3415 Subsequent paragraphs are indented to show that they
3416 belong to the previous footnote.
3418 { some.code }
3420 The whole paragraph can be indented, or just the first
3421 line. In this way, multi-paragraph footnotes work like
3422 multi-paragraph list items.
3424 This paragraph won't be part of the note, because it
3425 isn't indented.
3427The identifiers in footnote references may not contain spaces, tabs,
3428or newlines. These identifiers are used only to correlate the
3429footnote reference with the note itself; in the output, footnotes
3430will be numbered sequentially.
3432The footnotes themselves need not be placed at the end of the
3433document. They may appear anywhere except inside other block elements
3434(lists, block quotes, tables, etc.). Each footnote should be
3435separated from surrounding content (including other footnotes)
3436by blank lines.
3438#### Extension: `inline_notes` ####
3440Inline footnotes are also allowed (though, unlike regular notes,
3441they cannot contain multiple paragraphs). The syntax is as follows:
3443 Here is an inline note.^[Inlines notes are easier to write, since
3444 you don't have to pick an identifier and move down to type the
3445 note.]
3447Inline and regular footnotes may be mixed freely.
3449Typography
3450----------
3452#### Extension: `smart` ####
3454Interpret straight quotes as curly quotes, `---` as em-dashes,
3455`--` as en-dashes, and `...` as ellipses. Nonbreaking spaces are
3456inserted after certain abbreviations, such as "Mr." This
3457option currently affects the input formats `markdown`,
3458`commonmark`, `latex`, `mediawiki`, `org`, `rst`, and `twiki`,
3459and the output formats `markdown`, `latex`, and `context`.
3461Note: If you are *writing* Markdown, then the `smart` extension
3462has the reverse effect: what would have been curly quotes comes
3463out straight.
3465In LaTeX, `smart` means to use the standard TeX ligatures
3466for quotation marks (` `` ` and ` '' ` for double quotes,
3467`` ` `` and `` ' `` for single quotes) and dashes (`--` for
3468en-dash and `---` for em-dash). If `smart` is disabled,
3469then in reading LaTeX pandoc will parse these characters
3470literally. In writing LaTeX, enabling `smart` tells pandoc
3471to use the ligatures when possible; if `smart` is disabled
3472pandoc will use unicode quotation mark and dash characters.
3474Citations
3475---------
3477#### Extension: `citations` ####
3479Using an external filter, `pandoc-citeproc`, pandoc can automatically generate
3480citations and a bibliography in a number of styles. Basic usage is
3482 pandoc --filter pandoc-citeproc myinput.txt
3484In order to use this feature, you will need to specify a bibliography file
3485using the `bibliography` metadata field in a YAML metadata section, or
3486`--bibliography` command line argument. You can supply multiple `--bibliography`
3487arguments or set `bibliography` metadata field to YAML array, if you want to
3488use multiple bibliography files. The bibliography may have any of these
3489formats:
3491 Format File extension
3492 ------------ --------------
3493 BibLaTeX .bib
3494 BibTeX .bibtex
3495 Copac .copac
3496 CSL JSON .json
3497 CSL YAML .yaml
3498 EndNote .enl
3499 EndNote XML .xml
3500 ISI .wos
3501 MEDLINE .medline
3502 MODS .mods
3503 RIS .ris
3505Note that `.bib` can be used with both BibTeX and BibLaTeX files;
3506use `.bibtex` to force BibTeX.
3508Note that `pandoc-citeproc --bib2json` and `pandoc-citeproc --bib2yaml`
3509can produce `.json` and `.yaml` files from any of the supported formats.
3511In-field markup: In BibTeX and BibLaTeX databases, pandoc-citeproc parses
3512a subset of LaTeX markup; in CSL YAML databases, pandoc Markdown; and in CSL JSON databases, an [HTML-like markup][CSL markup specs]:
3514`<i>...</i>`
3515: italics
3517`<b>...</b>`
3518: bold
3520`<span style="font-variant:small-caps;">...</span>` or `<sc>...</sc>`
3521: small capitals
3523`<sub>...</sub>`
3524: subscript
3526`<sup>...</sup>`
3527: superscript
3529`<span class="nocase">...</span>`
3530: prevent a phrase from being capitalized as title case
3532`pandoc-citeproc -j` and `-y` interconvert the CSL JSON
3533and CSL YAML formats as far as possible.
3535As an alternative to specifying a bibliography file using `--bibliography`
3536or the YAML metadata field `bibliography`, you can include
3537the citation data directly in the `references` field of the
3538document's YAML metadata. The field should contain an array of
3539YAML-encoded references, for example:
3541 ---
3542 references:
3543 - type: article-journal
3544 id: WatsonCrick1953
3545 author:
3546 - family: Watson
3547 given: J. D.
3548 - family: Crick
3549 given: F. H. C.
3550 issued:
3551 date-parts:
3552 - - 1953
3553 - 4
3554 - 25
3555 title: 'Molecular structure of nucleic acids: a structure for deoxyribose
3556 nucleic acid'
3557 title-short: Molecular structure of nucleic acids
3558 container-title: Nature
3559 volume: 171
3560 issue: 4356
3561 page: 737-738
3562 DOI: 10.1038/171737a0
3563 URL: http://www.nature.com/nature/journal/v171/n4356/abs/171737a0.html
3564 language: en-GB
3565 ...
3567(`pandoc-citeproc --bib2yaml` can produce these from a bibliography file in one
3568of the supported formats.)
3570Citations and references can be formatted using any style supported by the
3571[Citation Style Language], listed in the [Zotero Style Repository].
3572These files are specified using the `--csl` option or the `csl` metadata field.
3573By default, `pandoc-citeproc` will use the [Chicago Manual of Style] author-date
3574format. The CSL project provides further information on [finding and editing styles].
3576To make your citations hyperlinks to the corresponding bibliography
3577entries, add `link-citations: true` to your YAML metadata.
3579Citations go inside square brackets and are separated by semicolons.
3580Each citation must have a key, composed of '@' + the citation
3581identifier from the database, and may optionally have a prefix,
3582a locator, and a suffix. The citation key must begin with a letter, digit,
3583or `_`, and may contain alphanumerics, `_`, and internal punctuation
3584characters (`:.#$%&-+?<>~/`). Here are some examples:
3586 Blah blah [see @doe99, pp. 33-35; also @smith04, chap. 1].
3588 Blah blah [@doe99, pp. 33-35, 38-39 and *passim*].
3590 Blah blah [@smith04; @doe99].
3592`pandoc-citeproc` detects locator terms in the [CSL locale files].
3593Either abbreviated or unabbreviated forms are accepted. In the `en-US`
3594locale, locator terms can be written in either singular or plural forms,
3595as `book`, `bk.`/`bks.`; `chapter`, `chap.`/`chaps.`; `column`,
3596`col.`/`cols.`; `figure`, `fig.`/`figs.`; `folio`, `fol.`/`fols.`;
3597`number`, `no.`/`nos.`; `line`, `l.`/`ll.`; `note`, `n.`/`nn.`; `opus`,
3598`op.`/`opp.`; `page`, `p.`/`pp.`; `paragraph`, `para.`/`paras.`; `part`,
3599`pt.`/`pts.`; `section`, `sec.`/`secs.`; `sub verbo`, `s.v.`/`s.vv.`;
3600`verse`, `v.`/`vv.`; `volume`, `vol.`/`vols.`; `¶`/`¶¶`; `§`/`§§`. If no
3601locator term is used, "page" is assumed.
3603A minus sign (`-`) before the `@` will suppress mention of
3604the author in the citation. This can be useful when the
3605author is already mentioned in the text:
3607 Smith says blah [-@smith04].
3609You can also write an in-text citation, as follows:
3611 @smith04 says blah.
3613 @smith04 [p. 33] says blah.
3615If the style calls for a list of works cited, it will be placed
3616at the end of the document. Normally, you will want to end your
3617document with an appropriate header:
3619 last paragraph...
3621 # References
3623The bibliography will be inserted after this header. Note that
3624the `unnumbered` class will be added to this header, so that the
3625section will not be numbered.
3627If you want to include items in the bibliography without actually
3628citing them in the body text, you can define a dummy `nocite` metadata
3629field and put the citations there:
3631 ---
3632 nocite: |
3633 @item1, @item2
3634 ...
3636 @item3
3638In this example, the document will contain a citation for `item3`
3639only, but the bibliography will contain entries for `item1`, `item2`, and
3640`item3`.
3642It is possible to create a bibliography with all the citations,
3643whether or not they appear in the document, by using a wildcard:
3645 ---
3646 nocite: |
3647 @*
3648 ...
3650For LaTeX or PDF output, you can also use [`natbib`] or [`biblatex`]
3651to render bibliography. In order to do so, specify bibliography files as
3652outlined above, and add `--natbib` or `--biblatex` argument to `pandoc`
3653invocation. Bear in mind that bibliography files have to be in respective
3654format (either BibTeX or BibLaTeX).
3656For more information, see the [pandoc-citeproc man page].
3658[CSL markup specs]: http://docs.citationstyles.org/en/1.0/release-notes.html#rich-text-markup-within-fields
3659[Chicago Manual of Style]: http://chicagomanualofstyle.org
3660[Citation Style Language]: http://citationstyles.org
3661[Zotero Style Repository]: https://www.zotero.org/styles
3662[finding and editing styles]: http://citationstyles.org/styles/
3663[CSL locale files]: https://github.com/citation-style-language/locales
3664[pandoc-citeproc man page]: https://github.com/jgm/pandoc-citeproc/blob/master/man/pandoc-citeproc.1.md
3666Non-pandoc extensions
3667---------------------
3669The following Markdown syntax extensions are not enabled by default
3670in pandoc, but may be enabled by adding `+EXTENSION` to the format
3671name, where `EXTENSION` is the name of the extension. Thus, for
3672example, `markdown+hard_line_breaks` is Markdown with hard line breaks.
3674#### Extension: `old_dashes` ####
3676Selects the pandoc <= 1.8.2.1 behavior for parsing smart dashes:
3677`-` before a numeral is an en-dash, and `--` is an em-dash.
3678This option only has an effect if `smart` is enabled. It is
3679selected automatically for `textile` input.
3681#### Extension: `angle_brackets_escapable` ####
3683Allow `<` and `>` to be backslash-escaped, as they can be in
3684GitHub flavored Markdown but not original Markdown. This is
3685implied by pandoc's default `all_symbols_escapable`.
3687#### Extension: `lists_without_preceding_blankline` ####
3689Allow a list to occur right after a paragraph, with no intervening
3690blank space.
3692#### Extension: `four_space_rule` ####
3694Selects the pandoc <= 2.0 behavior for parsing lists, so that
3695four spaces indent are needed for list item continuation
3696paragraphs.
3698#### Extension: `spaced_reference_links` ####
3700Allow whitespace between the two components of a reference link,
3701for example,
3703 [foo] [bar].
3705#### Extension: `hard_line_breaks` ####
3707Causes all newlines within a paragraph to be interpreted as hard line
3708breaks instead of spaces.
3710#### Extension: `ignore_line_breaks` ####
3712Causes newlines within a paragraph to be ignored, rather than being
3713treated as spaces or as hard line breaks. This option is intended for
3714use with East Asian languages where spaces are not used between words,
3715but text is divided into lines for readability.
3717#### Extension: `east_asian_line_breaks` ####
3719Causes newlines within a paragraph to be ignored, rather than
3720being treated as spaces or as hard line breaks, when they occur
3721between two East Asian wide characters. This is a better choice
3722than `ignore_line_breaks` for texts that include a mix of East
3723Asian wide characters and other characters.
3725#### Extension: `emoji` ####
3727Parses textual emojis like `:smile:` as Unicode emoticons.
3729#### Extension: `tex_math_single_backslash` ####
3731Causes anything between `\(` and `\)` to be interpreted as inline
3732TeX math, and anything between `\[` and `\]` to be interpreted
3733as display TeX math. Note: a drawback of this extension is that
3734it precludes escaping `(` and `[`.
3736This extension can be used with both `markdown` and `html` input.
3738#### Extension: `tex_math_double_backslash` ####
3740Causes anything between `\\(` and `\\)` to be interpreted as inline
3741TeX math, and anything between `\\[` and `\\]` to be interpreted
3742as display TeX math.
3744#### Extension: `markdown_attribute` ####
3746By default, pandoc interprets material inside block-level tags as Markdown.
3747This extension changes the behavior so that Markdown is only parsed
3748inside block-level tags if the tags have the attribute `markdown=1`.
3750#### Extension: `mmd_title_block` ####
3752Enables a [MultiMarkdown] style title block at the top of
3753the document, for example:
3755 Title: My title
3756 Author: John Doe
3757 Date: September 1, 2008
3758 Comment: This is a sample mmd title block, with
3759 a field spanning multiple lines.
3761See the MultiMarkdown documentation for details. If `pandoc_title_block` or
3762`yaml_metadata_block` is enabled, it will take precedence over
3763`mmd_title_block`.
3765#### Extension: `abbreviations` ####
3767Parses PHP Markdown Extra abbreviation keys, like
3769 *[HTML]: Hypertext Markup Language
3771Note that the pandoc document model does not support
3772abbreviations, so if this extension is enabled, abbreviation keys are
3773simply skipped (as opposed to being parsed as paragraphs).
3775#### Extension: `autolink_bare_uris` ####
3777Makes all absolute URIs into links, even when not surrounded by
3778pointy braces `<...>`.
3780#### Extension: `ascii_identifiers` ####
3782Causes the identifiers produced by `auto_identifiers` to be pure ASCII.
3783Accents are stripped off of accented Latin letters, and non-Latin
3784letters are omitted.
3786#### Extension: `mmd_link_attributes` ####
3788Parses multimarkdown style key-value attributes on link
3789and image references. This extension should not be confused with the
3790[`link_attributes`](#extension-link_attributes) extension.
3792 This is a reference ![image][ref] with multimarkdown attributes.
3794 [ref]: http://path.to/image "Image title" width=20px height=30px
3795 id=myId class="myClass1 myClass2"
3797#### Extension: `mmd_header_identifiers` ####
3799Parses multimarkdown style header identifiers (in square brackets,
3800after the header but before any trailing `#`s in an ATX header).
3802#### Extension: `compact_definition_lists` ####
3804Activates the definition list syntax of pandoc 1.12.x and earlier.
3805This syntax differs from the one described above under [Definition lists]
3806in several respects:
3808 - No blank line is required between consecutive items of the
3809 definition list.
3810 - To get a "tight" or "compact" list, omit space between consecutive
3811 items; the space between a term and its definition does not affect
3812 anything.
3813 - Lazy wrapping of paragraphs is not allowed: the entire definition must
3814 be indented four spaces.[^6]
3816[^6]: To see why laziness is incompatible with relaxing the requirement
3817 of a blank line between items, consider the following example:
3819 bar
3820 : definition
3821 foo
3822 : definition
3824 Is this a single list item with two definitions of "bar," the first of
3825 which is lazily wrapped, or two list items? To remove the ambiguity
3826 we must either disallow lazy wrapping or require a blank line between
3827 list items.
3829#### Extension: `empty_paragraphs` ####
3831Allows empty paragraphs. By default empty paragraphs are
3832omitted. This affects the `docx` reader and writer, the
3833`opendocument` and `odt` writer, and all HTML-based readers and writers.
3835Markdown variants
3836-----------------
3838In addition to pandoc's extended Markdown, the following Markdown
3839variants are supported:
3841`markdown_phpextra` (PHP Markdown Extra)
3842: `footnotes`, `pipe_tables`, `raw_html`, `markdown_attribute`,
3843 `fenced_code_blocks`, `definition_lists`, `intraword_underscores`,
3844 `header_attributes`, `link_attributes`, `abbreviations`,
3845 `shortcut_reference_links`, `spaced_reference_links`.
3847`markdown_github` (deprecated GitHub-Flavored Markdown)
3848: `pipe_tables`, `raw_html`, `fenced_code_blocks`, `gfm_auto_identifiers`,
3849 `ascii_identifiers`, `backtick_code_blocks`, `autolink_bare_uris`,
3850 `space_in_atx_header`, `intraword_underscores`, `strikeout`,
3851 `emoji`, `shortcut_reference_links`, `angle_brackets_escapable`,
3852 `lists_without_preceding_blankline`.
3854`markdown_mmd` (MultiMarkdown)
3855: `pipe_tables`, `raw_html`, `markdown_attribute`, `mmd_link_attributes`,
3856 `tex_math_double_backslash`, `intraword_underscores`,
3857 `mmd_title_block`, `footnotes`, `definition_lists`,
3858 `all_symbols_escapable`, `implicit_header_references`,
3859 `auto_identifiers`, `mmd_header_identifiers`,
3860 `shortcut_reference_links`, `implicit_figures`,
3861 `superscript`, `subscript`, `backtick_code_blocks`,
3862 `spaced_reference_links`, `raw_attribute`.
3864`markdown_strict` (Markdown.pl)
3865: `raw_html`, `shortcut_reference_links`,
3866 `spaced_reference_links`.
3868We also support `gfm` (GitHub-Flavored Markdown) as a set of
3869extensions on `commonmark`:
3871: `pipe_tables`, `raw_html`, `fenced_code_blocks`, `auto_identifiers`,
3872 `ascii_identifiers`, `backtick_code_blocks`, `autolink_bare_uris`,
3873 `intraword_underscores`, `strikeout`, `hard_line_breaks`, `emoji`,
3874 `shortcut_reference_links`, `angle_brackets_escapable`.
3876 These can all be individually disabled. Note, however, that
3877 `commonmark` and `gfm` have limited support for extensions:
3878 extensions other than those listed above (and `smart` and
3879 `raw_tex`) will have no effect on `commonmark` or `gfm`.
3880 And `raw_tex` only affects `gfm` output, not input.
3882Extensions with formats other than Markdown
3883-------------------------------------------
3885Some of the extensions discussed above can be used with formats
3886other than Markdown:
3888* `auto_identifiers` can be used with `latex`, `rst`, `mediawiki`,
3889 and `textile` input (and is used by default).
3891* `tex_math_dollars`, `tex_math_single_backslash`, and
3892 `tex_math_double_backslash` can be used with `html` input.
3893 (This is handy for reading web pages formatted using MathJax,
3894 for example.)
3896Producing slide shows with pandoc
3897=================================
3899You can use pandoc to produce an HTML + JavaScript slide presentation
3900that can be viewed via a web browser. There are five ways to do this,
3901using [S5], [DZSlides], [Slidy], [Slideous], or [reveal.js].
3902You can also produce a PDF slide show using LaTeX [`beamer`], or
3903slides shows in Microsoft [PowerPoint] format.
3905Here's the Markdown source for a simple slide show, `habits.txt`:
3907 % Habits
3908 % John Doe
3909 % March 22, 2005
3911 # In the morning
3913 ## Getting up
3915 - Turn off alarm
3916 - Get out of bed
3918 ## Breakfast
3920 - Eat eggs
3921 - Drink coffee
3923 # In the evening
3925 ## Dinner
3927 - Eat spaghetti
3928 - Drink wine
3930 ------------------
3932 ![picture of spaghetti](images/spaghetti.jpg)
3934 ## Going to sleep
3936 - Get in bed
3937 - Count sheep
3939To produce an HTML/JavaScript slide show, simply type
3941 pandoc -t FORMAT -s habits.txt -o habits.html
3943where `FORMAT` is either `s5`, `slidy`, `slideous`, `dzslides`, or `revealjs`.
3945For Slidy, Slideous, reveal.js, and S5, the file produced by pandoc with the
3946`-s/--standalone` option embeds a link to JavaScript and CSS files, which are
3947assumed to be available at the relative path `s5/default` (for S5), `slideous`
3948(for Slideous), `reveal.js` (for reveal.js), or at the Slidy website at
3949`w3.org` (for Slidy). (These paths can be changed by setting the `slidy-url`,
3950`slideous-url`, `revealjs-url`, or `s5-url` variables; see [Variables for slides],
3951above.) For DZSlides, the (relatively short) JavaScript and CSS are included in
3952the file by default.
3954With all HTML slide formats, the `--self-contained` option can be used to
3955produce a single file that contains all of the data necessary to display the
3956slide show, including linked scripts, stylesheets, images, and videos.
3958To produce a PDF slide show using beamer, type
3960 pandoc -t beamer habits.txt -o habits.pdf
3962Note that a reveal.js slide show can also be converted to a PDF
3963by printing it to a file from the browser.
3965To produce a Powerpoint slide show, type
3967 pandoc habits.txt -o habits.pptx
3969Structuring the slide show
3970--------------------------
3972By default, the *slide level* is the highest header level in
3973the hierarchy that is followed immediately by content, and not another
3974header, somewhere in the document. In the example above, level 1 headers
3975are always followed by level 2 headers, which are followed by content,
3976so 2 is the slide level. This default can be overridden using
3977the `--slide-level` option.
3979The document is carved up into slides according to the following
3980rules:
3982 * A horizontal rule always starts a new slide.
3984 * A header at the slide level always starts a new slide.
3986 * Headers *below* the slide level in the hierarchy create
3987 headers *within* a slide.
3989 * Headers *above* the slide level in the hierarchy create
3990 "title slides," which just contain the section title
3991 and help to break the slide show into sections.
3993 * Content *above* the slide level will not appear in the slide
3994 show.
3996 * A title page is constructed automatically from the document's title
3997 block, if present. (In the case of beamer, this can be disabled
3998 by commenting out some lines in the default template.)
4000These rules are designed to support many different styles of slide show. If
4001you don't care about structuring your slides into sections and subsections,
4002you can just use level 1 headers for all each slide. (In that case, level 1
4003will be the slide level.) But you can also structure the slide show into
4004sections, as in the example above.
4006Note: in reveal.js slide shows, if slide level is 2, a two-dimensional
4007layout will be produced, with level 1 headers building horizontally
4008and level 2 headers building vertically. It is not recommended that
4009you use deeper nesting of section levels with reveal.js.
4011Incremental lists
4012-----------------
4014By default, these writers produce lists that display "all at once."
4015If you want your lists to display incrementally (one item at a time),
4016use the `-i` option. If you want a particular list to depart from the
4017default (that is, to display incrementally without the `-i` option and
4018all at once with the `-i` option), put it in a block quote:
4020 > - Eat spaghetti
4021 > - Drink wine
4023In this way incremental and nonincremental lists can be mixed in
4024a single document.
4026Inserting pauses
4027----------------
4029You can add "pauses" within a slide by including a paragraph containing
4030three dots, separated by spaces:
4032 # Slide with a pause
4034 content before the pause
4036 . . .
4038 content after the pause
4040Styling the slides
4041------------------
4043You can change the style of HTML slides by putting customized CSS files
4044in `$DATADIR/s5/default` (for S5), `$DATADIR/slidy` (for Slidy),
4045or `$DATADIR/slideous` (for Slideous),
4046where `$DATADIR` is the user data directory (see `--data-dir`, above).
4047The originals may be found in pandoc's system data directory (generally
4048`$CABALDIR/pandoc-VERSION/s5/default`). Pandoc will look there for any
4049files it does not find in the user data directory.
4051For dzslides, the CSS is included in the HTML file itself, and may
4052be modified there.
4054All [reveal.js configuration options] can be set through variables.
4055For example, themes can be used by setting the `theme` variable:
4057 -V theme=moon
4059Or you can specify a custom stylesheet using the `--css` option.
4061To style beamer slides, you can specify a `theme`, `colortheme`,
4062`fonttheme`, `innertheme`, and `outertheme`, using the `-V` option:
4064 pandoc -t beamer habits.txt -V theme:Warsaw -o habits.pdf
4066Note that header attributes will turn into slide attributes
4067(on a `<div>` or `<section>`) in HTML slide formats, allowing you
4068to style individual slides. In beamer, the only header attribute
4069that affects slides is the `allowframebreaks` class, which sets the
4070`allowframebreaks` option, causing multiple slides to be created
4071if the content overfills the frame. This is recommended especially for
4072bibliographies:
4074 # References {.allowframebreaks}
4076Speaker notes
4077-------------
4079reveal.js has good support for speaker notes. You can add notes to your
4080Markdown document thus:
4082 ::: notes
4084 This is my note.
4086 - It can contain Markdown
4087 - like this list
4089 :::
4091To show the notes window, press `s` while viewing the presentation.
4092Notes are not yet supported for other slide formats, but the notes
4093will not appear on the slides themselves.
4095Columns
4096-------
4098To put material in side by side columns, you can use a native
4099div container with class `columns`, containing two or more div
4100containers with class `column` and a `width` attribute:
4102 :::::::::::::: {.columns}
4103 ::: {.column width="40%"}
4104 contents...
4105 :::
4106 ::: {.column width="60%"}
4107 contents...
4108 :::
4109 ::::::::::::::
4111Frame attributes in beamer
4112--------------------------
4114Sometimes it is necessary to add the LaTeX `[fragile]` option to
4115a frame in beamer (for example, when using the `minted` environment).
4116This can be forced by adding the `fragile` class to the header
4117introducing the slide:
4119 # Fragile slide {.fragile}
4121All of the other frame attributes described in Section 8.1 of
4122the [Beamer User's Guide] may also be used: `allowdisplaybreaks`,
4123`allowframebreaks`, `b`, `c`, `t`, `environment`, `label`, `plain`,
4124`shrink`.
4126Creating EPUBs with pandoc
4127==========================
4129EPUB Metadata
4130-------------
4132EPUB metadata may be specified using the `--epub-metadata` option, but
4133if the source document is Markdown, it is better to use a [YAML metadata
4134block][Extension: `yaml_metadata_block`]. Here is an example:
4136 ---
4137 title:
4138 - type: main
4139 text: My Book
4140 - type: subtitle
4141 text: An investigation of metadata
4142 creator:
4143 - role: author
4144 text: John Smith
4145 - role: editor
4146 text: Sarah Jones
4147 identifier:
4148 - scheme: DOI
4149 text: doi:10.234234.234/33
4150 publisher: My Press
4151 rights: © 2007 John Smith, CC BY-NC
4152 ibooks:
4153 version: 1.3.4
4154 ...
4156The following fields are recognized:
4158`identifier`
4159 ~ Either a string value or an object with fields `text` and
4160 `scheme`. Valid values for `scheme` are `ISBN-10`,
4161 `GTIN-13`, `UPC`, `ISMN-10`, `DOI`, `LCCN`, `GTIN-14`,
4162 `ISBN-13`, `Legal deposit number`, `URN`, `OCLC`,
4163 `ISMN-13`, `ISBN-A`, `JP`, `OLCC`.
4165`title`
4166 ~ Either a string value, or an object with fields `file-as` and
4167 `type`, or a list of such objects. Valid values for `type` are
4168 `main`, `subtitle`, `short`, `collection`, `edition`, `extended`.
4170`creator`
4171 ~ Either a string value, or an object with fields `role`, `file-as`,
4172 and `text`, or a list of such objects. Valid values for `role` are
4173 [MARC relators], but
4174 pandoc will attempt to translate the human-readable versions
4175 (like "author" and "editor") to the appropriate marc relators.
4177`contributor`
4178 ~ Same format as `creator`.
4180`date`
4181 ~ A string value in `YYYY-MM-DD` format. (Only the year is necessary.)
4182 Pandoc will attempt to convert other common date formats.
4184`lang` (or legacy: `language`)
4185 ~ A string value in [BCP 47] format. Pandoc will default to the local
4186 language if nothing is specified.
4188`subject`
4189 ~ A string value or a list of such values.
4191`description`
4192 ~ A string value.
4194`type`
4195 ~ A string value.
4197`format`
4198 ~ A string value.
4200`relation`
4201 ~ A string value.
4203`coverage`
4204 ~ A string value.
4206`rights`
4207 ~ A string value.
4209`cover-image`
4210 ~ A string value (path to cover image).
4212`stylesheet`
4213 ~ A string value (path to CSS stylesheet).
4215`page-progression-direction`
4216 ~ Either `ltr` or `rtl`. Specifies the `page-progression-direction`
4217 attribute for the [`spine` element].
4219`ibooks`
4220 ~ iBooks-specific metadata, with the following fields:
4222 - `version`: (string)
4223 - `specified-fonts`: `true`|`false` (default `false`)
4224 - `ipad-orientation-lock`: `portrait-only`|`landscape-only`
4225 - `iphone-orientation-lock`: `portrait-only`|`landscape-only`
4226 - `binding`: `true`|`false` (default `true`)
4227 - `scroll-axis`: `vertical`|`horizontal`|`default`
4229[MARC relators]: http://loc.gov/marc/relators/relaterm.html
4230[`spine` element]: http://idpf.org/epub/301/spec/epub-publications.html#sec-spine-elem
4232Linked media
4233------------
4235By default, pandoc will download linked media (including audio and
4236video) and include it in the EPUB container, yielding a completely
4237self-contained EPUB. If you want to link to external media resources
4238instead, use raw HTML in your source and add `data-external="1"` to the tag
4239with the `src` attribute. For example:
4241 <audio controls="1">
4242 <source src="http://example.com/music/toccata.mp3"
4243 data-external="1" type="audio/mpeg">
4244 </source>
4245 </audio>
4247Literate Haskell support
4248========================
4250If you append `+lhs` (or `+literate_haskell`) to an appropriate input or output
4251format (`markdown`, `markdown_strict`, `rst`, or `latex` for input or output;
4252`beamer`, `html4` or `html5` for output only), pandoc will treat the document as
4253literate Haskell source. This means that
4255 - In Markdown input, "bird track" sections will be parsed as Haskell
4256 code rather than block quotations. Text between `\begin{code}`
4257 and `\end{code}` will also be treated as Haskell code. For
4258 ATX-style headers the character '=' will be used instead of '#'.
4260 - In Markdown output, code blocks with classes `haskell` and `literate`
4261 will be rendered using bird tracks, and block quotations will be
4262 indented one space, so they will not be treated as Haskell code.
4263 In addition, headers will be rendered setext-style (with underlines)
4264 rather than ATX-style (with '#' characters). (This is because ghc
4265 treats '#' characters in column 1 as introducing line numbers.)
4267 - In restructured text input, "bird track" sections will be parsed
4268 as Haskell code.
4270 - In restructured text output, code blocks with class `haskell` will
4271 be rendered using bird tracks.
4273 - In LaTeX input, text in `code` environments will be parsed as
4274 Haskell code.
4276 - In LaTeX output, code blocks with class `haskell` will be rendered
4277 inside `code` environments.
4279 - In HTML output, code blocks with class `haskell` will be rendered
4280 with class `literatehaskell` and bird tracks.
4282Examples:
4284 pandoc -f markdown+lhs -t html
4286reads literate Haskell source formatted with Markdown conventions and writes
4287ordinary HTML (without bird tracks).
4289 pandoc -f markdown+lhs -t html+lhs
4291writes HTML with the Haskell code in bird tracks, so it can be copied
4292and pasted as literate Haskell source.
4294Note that GHC expects the bird tracks in the first column, so indentend literate
4295code blocks (e.g. inside an itemized environment) will not be picked up by the
4296Haskell compiler.
4298Syntax highlighting
4299===================
4301Pandoc will automatically highlight syntax in [fenced code blocks] that
4302are marked with a language name. The Haskell library [skylighting] is
4303used for highlighting, which works in HTML, Docx, Ms, and LaTeX/PDF output.
4304To see a list of language names that pandoc will recognize, type
4305`pandoc --list-highlight-languages`.
4307The color scheme can be selected using the `--highlight-style` option.
4308The default color scheme is `pygments`, which imitates the default color
4309scheme used by the Python library pygments (though pygments is not actually
4310used to do the highlighting). To see a list of highlight styles,
4311type `pandoc --list-highlight-styles`.
4313To disable highlighting, use the `--no-highlight` option.
4315[skylighting]: https://github.com/jgm/skylighting
4317Custom Styles in Docx Output
4318============================
4320By default, pandoc's docx output applies a predefined set of styles for
4321blocks such as paragraphs and block quotes, and uses largely default
4322formatting (italics, bold) for inlines. This will work for most
4323purposes, especially alongside a `reference.docx` file. However, if you
4324need to apply your own styles to blocks, or match a preexisting set of
4325styles, pandoc allows you to define custom styles for blocks and text
4326using `div`s and `span`s, respectively.
4328If you define a `div` or `span` with the attribute `custom-style`,
4329pandoc will apply your specified style to the contained elements. So,
4330for example,
4332 <span custom-style="Emphatically">Get out,</span> he said.
4334would produce a docx file with "Get out," styled with character
4335style `Emphatically`. Similarly,
4337 Dickinson starts the poem simply:
4339 <div custom-style="Poetry">
4340 | A Bird came down the Walk---
4341 | He did not know I saw---
4342 </div>
4344would style the two contained lines with the `Poetry` paragraph style.
4346If the styles are not yet in your reference.docx, they will be defined
4347in the output file as inheriting from normal text. If they are already
4348defined, pandoc will not alter the definition.
4350This feature allows for greatest customization in conjunction with
4351[pandoc filters]. If you want all paragraphs after block quotes to be
4352indented, you can write a filter to apply the styles necessary. If you
4353want all italics to be transformed to the `Emphasis` character style
4354(perhaps to change their color), you can write a filter which will
4355transform all italicized inlines to inlines within an `Emphasis`
4356custom-style `span`.
4358[pandoc filters]: http://pandoc.org/filters.html
4360Custom writers
4361==============
4363Pandoc can be extended with custom writers written in [lua]. (Pandoc
4364includes a lua interpreter, so lua need not be installed separately.)
4366To use a custom writer, simply specify the path to the lua script
4367in place of the output format. For example:
4369 pandoc -t data/sample.lua
4371Creating a custom writer requires writing a lua function for each
4372possible element in a pandoc document. To get a documented example
4373which you can modify according to your needs, do
4375 pandoc --print-default-data-file sample.lua
4377[lua]: http://www.lua.org
4379Authors
4380=======
4382Copyright 2006-2017 John MacFarlane (jgm@berkeley.edu). Released
4383under the [GPL], version 2 or greater. This software carries no
4384warranty of any kind. (See COPYRIGHT for full copyright and
4385warranty notices.) For a full list of contributors, see the file
4386AUTHORS.md in the pandoc source code.
4388[GPL]: http://www.gnu.org/copyleft/gpl.html "GNU General Public License"