git.iko.soy/typeable/pandoc
on 10e28ef help sign in
3344 lines 116 kB history raw
1% Pandoc User's Guide
2% John MacFarlane
3% August 30, 2014
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], and (subsets of) [Textile],
16[reStructuredText], [HTML], [LaTeX], [MediaWiki markup], [TWiki
17markup], [Haddock markup], [OPML], [Emacs Org-mode], [DocBook],
18[txt2tags], [EPUB] and [Word docx]; and it can write plain text,
19[Markdown], [reStructuredText], [XHTML], [HTML 5], [LaTeX] (including
20[beamer] slide shows), [ConTeXt], [RTF], [OPML], [DocBook],
21[OpenDocument], [ODT], [Word docx], [GNU Texinfo], [MediaWiki markup],
22[DokuWiki markup], [Haddock markup], [EPUB] (v2 or v3),
23[FictionBook2], [Textile], [groff man] pages, [Emacs Org-Mode],
24[AsciiDoc], [InDesign ICML], and [Slidy], [Slideous], [DZSlides],
25[reveal.js] or [S5] HTML slide shows. It can also produce [PDF] output
26on systems where LaTeX is installed.
28Pandoc's enhanced version of markdown includes syntax for footnotes,
29tables, flexible ordered lists, definition lists, fenced code blocks,
30superscript, subscript, strikeout, title blocks, automatic tables of
31contents, embedded LaTeX math, citations, and markdown inside HTML block
32elements. (These enhancements, described below under
33[Pandoc's markdown](#pandocs-markdown), can be disabled using the
34`markdown_strict` input or output format.)
36In contrast to most existing tools for converting markdown to HTML, which
37use regex substitutions, Pandoc has a modular design: it consists of a
38set of readers, which parse text in a given format and produce a native
39representation of the document, and a set of writers, which convert
40this native representation into a target format. Thus, adding an input
41or output format requires only adding a reader or writer.
43Using `pandoc`
44--------------
46If no *input-file* is specified, input is read from *stdin*.
47Otherwise, the *input-files* are concatenated (with a blank
48line between each) and used as input. Output goes to *stdout* by
49default (though output to *stdout* is disabled for the `odt`, `docx`,
50`epub`, and `epub3` output formats). For output to a file, use the
51`-o` option:
53 pandoc -o output.html input.txt
55By default, pandoc produces a document fragment, not a standalone
56document with a proper header and footer. To produce a standalone
57document, use the `-s` or `--standalone` flag:
59 pandoc -s -o output.html input.txt
61For more information on how standalone documents are produced, see
62[Templates](#templates), below.
64Instead of a file, an absolute URI may be given. In this case
65pandoc will fetch the content using HTTP:
67 pandoc -f html -t markdown http://www.fsf.org
69If multiple input files are given, `pandoc` will concatenate them all (with
70blank lines between them) before parsing. This feature is disabled for
71 binary input formats such as `EPUB` and `docx`.
73The format of the input and output can be specified explicitly using
74command-line options. The input format can be specified using the
75`-r/--read` or `-f/--from` options, the output format using the
76`-w/--write` or `-t/--to` options. Thus, to convert `hello.txt` from
77markdown to LaTeX, you could type:
79 pandoc -f markdown -t latex hello.txt
81To convert `hello.html` from html to markdown:
83 pandoc -f html -t markdown hello.html
85Supported output formats are listed below under the `-t/--to` option.
86Supported input formats are listed below under the `-f/--from` option. Note
87that the `rst`, `textile`, `latex`, and `html` readers are not complete;
88there are some constructs that they do not parse.
90If the input or output format is not specified explicitly, `pandoc`
91will attempt to guess it from the extensions of
92the input and output filenames. Thus, for example,
94 pandoc -o hello.tex hello.txt
96will convert `hello.txt` from markdown to LaTeX. If no output file
97is specified (so that output goes to *stdout*), or if the output file's
98extension is unknown, the output format will default to HTML.
99If no input file is specified (so that input comes from *stdin*), or
100if the input files' extensions are unknown, the input format will
101be assumed to be markdown unless explicitly specified.
103Pandoc uses the UTF-8 character encoding for both input and output.
104If your local character encoding is not UTF-8, you
105should pipe input and output through `iconv`:
107 iconv -t utf-8 input.txt | pandoc | iconv -f utf-8
109Note that in some output formats (such as HTML, LaTeX, ConTeXt,
110RTF, OPML, DocBook, and Texinfo), information about
111the character encoding is included in the document header, which
112will only be included if you use the `-s/--standalone` option.
114Creating a PDF
115--------------
117Earlier versions of pandoc came with a program, `markdown2pdf`, that
118used pandoc and pdflatex to produce a PDF. This is no longer needed,
119since `pandoc` can now produce `pdf` output itself. To produce a PDF, simply
120specify an output file with a `.pdf` extension. Pandoc will create a latex
121file and use pdflatex (or another engine, see `--latex-engine`) to convert it
122to PDF:
124 pandoc test.txt -o test.pdf
126Production of a PDF requires that a LaTeX engine be installed (see
127`--latex-engine`, below), and assumes that the following LaTeX packages are
128available: `amssymb`, `amsmath`, `ifxetex`, `ifluatex`, `listings` (if the
129`--listings` option is used), `fancyvrb`, `longtable`, `booktabs`, `url`,
130`graphicx` and `grffile` (if the document contains images),
131 `hyperref`, `ulem`, `babel` (if the `lang` variable is set),
132`fontspec` (if `xelatex` or `lualatex` is used as the LaTeX engine), `xltxtra`
133and `xunicode` (if `xelatex` is used).
135`hsmarkdown`
136------------
138A user who wants a drop-in replacement for `Markdown.pl` may create
139a symbolic link to the `pandoc` executable called `hsmarkdown`. When
140invoked under the name `hsmarkdown`, `pandoc` will behave as if
141invoked with `-f markdown_strict --email-obfuscation=references`,
142and all command-line options will be treated as regular arguments.
143However, this approach does not work under Cygwin, due to problems with
144its simulation of symbolic links.
146[Cygwin]: http://www.cygwin.com/
147[`iconv`]: http://www.gnu.org/software/libiconv/
148[CTAN]: http://www.ctan.org "Comprehensive TeX Archive Network"
149[TeX Live]: http://www.tug.org/texlive/
150[MacTeX]: http://www.tug.org/mactex/
152Options
153=======
155General options
156---------------
158`-f` *FORMAT*, `-r` *FORMAT*, `--from=`*FORMAT*, `--read=`*FORMAT*
160: Specify input format. *FORMAT* can be `native` (native Haskell),
161 `json` (JSON version of native AST), `markdown` (pandoc's
162 extended markdown), `markdown_strict` (original unextended
163 markdown), `markdown_phpextra` (PHP Markdown Extra extended
164 markdown), `markdown_github` (github extended markdown),
165 `commonmark` (CommonMark markdown), `textile` (Textile), `rst`
166 (reStructuredText), `html` (HTML), `docbook` (DocBook), `t2t`
167 (txt2tags), `docx` (docx), `epub` (EPUB), `opml` (OPML), `org`
168 (Emacs Org-mode), `mediawiki` (MediaWiki markup), `twiki` (TWiki
169 markup), `haddock` (Haddock markup), or `latex` (LaTeX). If
170 `+lhs` is appended to `markdown`, `rst`, `latex`, or `html`, the
171 input will be treated as literate Haskell source: see [Literate
172 Haskell support](#literate-haskell-support), below. Markdown
173 syntax extensions can be individually enabled or disabled by
174 appending `+EXTENSION` or `-EXTENSION` to the format name. So, for
175 example, `markdown_strict+footnotes+definition_lists` is strict
176 markdown with footnotes and definition lists enabled, and
177 `markdown-pipe_tables+hard_line_breaks` is pandoc's markdown
178 without pipe tables and with hard line breaks. See [Pandoc's
179 markdown](#pandocs-markdown), below, for a list of extensions and
180 their names.
182`-t` *FORMAT*, `-w` *FORMAT*, `--to=`*FORMAT*, `--write=`*FORMAT*
184: Specify output format. *FORMAT* can be `native` (native Haskell),
185 `json` (JSON version of native AST), `plain` (plain text),
186 `markdown` (pandoc's extended markdown), `markdown_strict`
187 (original unextended markdown), `markdown_phpextra` (PHP Markdown
188 extra extended markdown), `markdown_github` (github extended
189 markdown), `commonmark` (CommonMark markdown), `rst`
190 (reStructuredText), `html` (XHTML 1), `html5` (HTML 5), `latex`
191 (LaTeX), `beamer` (LaTeX beamer slide show), `context` (ConTeXt),
192 `man` (groff man), `mediawiki` (MediaWiki markup), `dokuwiki`
193 (DokuWiki markup), `textile` (Textile), `org` (Emacs Org-Mode),
194 `texinfo` (GNU Texinfo), `opml` (OPML), `docbook` (DocBook),
195 `opendocument` (OpenDocument), `odt` (OpenOffice text document),
196 `docx` (Word docx), `haddock` (Haddock markup), `rtf` (rich text
197 format), `epub` (EPUB v2 book), `epub3` (EPUB v3), `fb2`
198 (FictionBook2 e-book), `asciidoc` (AsciiDoc), `icml` (InDesign
199 ICML), `slidy` (Slidy HTML and javascript slide show), `slideous`
200 (Slideous HTML and javascript slide show), `dzslides` (DZSlides
201 HTML5 + javascript slide show), `revealjs` (reveal.js HTML5 +
202 javascript slide show), `s5` (S5 HTML and javascript slide show),
203 or the path of a custom lua writer (see [Custom
204 writers](#custom-writers), below). Note that `odt`, `epub`, and
205 `epub3` output will not be directed to *stdout*; an output
206 filename must be specified using the `-o/--output` option. If
207 `+lhs` is appended to `markdown`, `rst`, `latex`, `beamer`,
208 `html`, or `html5`, the output will be rendered as literate
209 Haskell source: see [Literate Haskell
210 support](#literate-haskell-support), below. Markdown syntax
211 extensions can be individually enabled or disabled by appending
212 `+EXTENSION` or `-EXTENSION` to the format name, as described
213 above under `-f`.
215`-o` *FILE*, `--output=`*FILE*
217: Write output to *FILE* instead of *stdout*. If *FILE* is
218 `-`, output will go to *stdout*. (Exception: if the output
219 format is `odt`, `docx`, `epub`, or `epub3`, output to stdout is disabled.)
221`--data-dir=`*DIRECTORY*
223: Specify the user data directory to search for pandoc data files.
224 If this option is not specified, the default user data directory
225 will be used. This is
227 $HOME/.pandoc
229 in unix,
231 C:\Documents And Settings\USERNAME\Application Data\pandoc
233 in Windows XP, and
235 C:\Users\USERNAME\AppData\Roaming\pandoc
237 in Windows 7. (You can find the default user data directory
238 on your system by looking at the output of `pandoc --version`.)
239 A `reference.odt`, `reference.docx`, `default.csl`,
240 `epub.css`, `templates`, `slidy`, `slideous`, or `s5` directory
241 placed in this directory will override pandoc's normal defaults.
243`--verbose`
245: Give verbose debugging output. Currently this only has an effect
246 with PDF output.
248`-v`, `--version`
250: Print version.
252`-h`, `--help`
254: Show usage message.
256Reader options
257--------------
259`-R`, `--parse-raw`
261: Parse untranslatable HTML codes and LaTeX environments as raw HTML
262 or LaTeX, instead of ignoring them. Affects only HTML and LaTeX
263 input. Raw HTML can be printed in markdown, reStructuredText, HTML,
264 Slidy, Slideous, DZSlides, reveal.js, and S5 output; raw LaTeX
265 can be printed in markdown, reStructuredText, LaTeX, and ConTeXt output.
266 The default is for the readers to omit untranslatable HTML codes and
267 LaTeX environments. (The LaTeX reader does pass through untranslatable
268 LaTeX *commands*, even if `-R` is not specified.)
270`-S`, `--smart`
272: Produce typographically correct output, converting straight quotes
273 to curly quotes, `---` to em-dashes, `--` to en-dashes, and
274 `...` to ellipses. Nonbreaking spaces are inserted after certain
275 abbreviations, such as "Mr." (Note: This option is significant only when
276 the input format is `markdown`, `markdown_strict`, `textile` or `twiki`.
277 It is selected automatically when the input format is `textile` or the
278 output format is `latex` or `context`, unless `--no-tex-ligatures`
279 is used.)
281`--old-dashes`
283: Selects the pandoc <= 1.8.2.1 behavior for parsing smart dashes: `-` before
284 a numeral is an en-dash, and `--` is an em-dash. This option is selected
285 automatically for `textile` input.
287`--base-header-level=`*NUMBER*
289: Specify the base level for headers (defaults to 1).
291`--indented-code-classes=`*CLASSES*
293: Specify classes to use for indented code blocks--for example,
294 `perl,numberLines` or `haskell`. Multiple classes may be separated
295 by spaces or commas.
297`--default-image-extension=`*EXTENSION*
299: Specify a default extension to use when image paths/URLs have no
300 extension. This allows you to use the same source for formats that
301 require different kinds of images. Currently this option only affects
302 the markdown and LaTeX readers.
304`--filter=`*EXECUTABLE*
306: Specify an executable to be used as a filter transforming the
307 Pandoc AST after the input is parsed and before the output is
308 written. The executable should read JSON from stdin and write
309 JSON to stdout. The JSON must be formatted like pandoc's own
310 JSON input and output. The name of the output format will be
311 passed to the filter as the first argument. Hence,
313 pandoc --filter ./caps.py -t latex
315 is equivalent to
317 pandoc -t json | ./caps.py latex | pandoc -f json -t latex
319 The latter form may be useful for debugging filters.
321 Filters may be written in any language. `Text.Pandoc.JSON`
322 exports `toJSONFilter` to facilitate writing filters in Haskell.
323 Those who would prefer to write filters in python can use the
324 module `pandocfilters`, installable from PyPI. See
325 <http://github.com/jgm/pandocfilters> for the module and several
326 examples. There are also pandoc filter libraries in
327 [PHP](https://github.com/vinai/pandocfilters-php),
328 [perl](https://metacpan.org/pod/Pandoc::Filter), and
329 [javascript/node.js](https://github.com/mvhenderson/pandoc-filter-node).
331 Note that the *EXECUTABLE* will be sought in the user's
332 `PATH`, and not in the working directory, if no directory is
333 provided. If you want to run a script in the working directory,
334 preface the filename with `./`.
336`-M` *KEY*[`=`*VAL*], `--metadata=`*KEY*[`:`*VAL*]
338: Set the metadata field *KEY* to the value *VAL*. A value specified
339 on the command line overrides a value specified in the document.
340 Values will be parsed as YAML boolean or string values. If no value is
341 specified, the value will be treated as Boolean true. Like
342 `--variable`, `--metadata` causes template variables to be set.
343 But unlike `--variable`, `--metadata` affects the metadata of the
344 underlying document (which is accessible from filters and may be
345 printed in some output formats).
347`--normalize`
349: Normalize the document after reading: merge adjacent
350 `Str` or `Emph` elements, for example, and remove repeated `Space`s.
352`-p`, `--preserve-tabs`
354: Preserve tabs instead of converting them to spaces (the default).
355 Note that this will only affect tabs in literal code spans and code
356 blocks; tabs in regular text will be treated as spaces.
358`--tab-stop=`*NUMBER*
360: Specify the number of spaces per tab (default is 4).
362`--track-changes=accept`|`reject`|`all`
364: Specifies what to do with insertions and deletions produced by the MS
365 Word "track-changes" feature. `accept` (the default), inserts all
366 insertions, and ignores all deletions. `reject` inserts all
367 deletions and ignores insertions. `all` puts in both insertions
368 and deletions, wrapped in spans with `insertion` and `deletion`
369 classes, respectively. The author and time of change is
370 included. `all` is useful for scripting: only accepting changes
371 from a certain reviewer, say, or before a certain date. This
372 option only affects the docx reader.
374`--extract-media=`*DIR*
376: Extract images and other media contained in a docx or epub container
377 to the path *DIR*, creating it if necessary, and adjust the images
378 references in the document so they point to the extracted files.
379 This option only affects the docx and epub readers.
381General writer options
382----------------------
384`-s`, `--standalone`
386: Produce output with an appropriate header and footer (e.g. a
387 standalone HTML, LaTeX, or RTF file, not a fragment). This option
388 is set automatically for `pdf`, `epub`, `epub3`, `fb2`, `docx`, and `odt`
389 output.
391`--template=`*FILE*
393: Use *FILE* as a custom template for the generated document. Implies
394 `--standalone`. See [Templates](#templates) below for a description
395 of template syntax. If no extension is specified, an extension
396 corresponding to the writer will be added, so that `--template=special`
397 looks for `special.html` for HTML output. If the template is not
398 found, pandoc will search for it in the user data directory
399 (see `--data-dir`). If this option is not used, a default
400 template appropriate for the output format will be used (see
401 `-D/--print-default-template`).
403`-V` *KEY*[`=`*VAL*], `--variable=`*KEY*[`:`*VAL*]
405: Set the template variable *KEY* to the value *VAL* when rendering the
406 document in standalone mode. This is generally only useful when the
407 `--template` option is used to specify a custom template, since
408 pandoc automatically sets the variables used in the default
409 templates. If no *VAL* is specified, the key will be given the
410 value `true`.
412`-D` *FORMAT*, `--print-default-template=`*FORMAT*
414: Print the default template for an output *FORMAT*. (See `-t`
415 for a list of possible *FORMAT*s.)
417`--print-default-data-file=`*FILE*
419: Print a default data file.
421`--no-wrap`
423: Disable text wrapping in output. By default, text is wrapped
424 appropriately for the output format.
426`--columns=`*NUMBER*
428: Specify length of lines in characters (for text wrapping).
430`--toc`, `--table-of-contents`
432: Include an automatically generated table of contents (or, in
433 the case of `latex`, `context`, and `rst`, an instruction to create
434 one) in the output document. This option has no effect on `man`,
435 `docbook`, `slidy`, `slideous`, `s5`, `docx`, or `odt` output.
437`--toc-depth=`*NUMBER*
439: Specify the number of section levels to include in the table
440 of contents. The default is 3 (which means that level 1, 2, and 3
441 headers will be listed in the contents).
443`--no-highlight`
445: Disables syntax highlighting for code blocks and inlines, even when
446 a language attribute is given.
448`--highlight-style=`*STYLE*
450: Specifies the coloring style to be used in highlighted source code.
451 Options are `pygments` (the default), `kate`, `monochrome`,
452 `espresso`, `zenburn`, `haddock`, and `tango`.
454`-H` *FILE*, `--include-in-header=`*FILE*
456: Include contents of *FILE*, verbatim, at the end of the header.
457 This can be used, for example, to include special
458 CSS or javascript in HTML documents. This option can be used
459 repeatedly to include multiple files in the header. They will be
460 included in the order specified. Implies `--standalone`.
462`-B` *FILE*, `--include-before-body=`*FILE*
464: Include contents of *FILE*, verbatim, at the beginning of the
465 document body (e.g. after the `<body>` tag in HTML, or the
466 `\begin{document}` command in LaTeX). This can be used to include
467 navigation bars or banners in HTML documents. This option can be
468 used repeatedly to include multiple files. They will be included in
469 the order specified. Implies `--standalone`.
471`-A` *FILE*, `--include-after-body=`*FILE*
473: Include contents of *FILE*, verbatim, at the end of the document
474 body (before the `</body>` tag in HTML, or the
475 `\end{document}` command in LaTeX). This option can be be used
476 repeatedly to include multiple files. They will be included in the
477 order specified. Implies `--standalone`.
479Options affecting specific writers
480----------------------------------
482`--self-contained`
484: Produce a standalone HTML file with no external dependencies, using
485 `data:` URIs to incorporate the contents of linked scripts, stylesheets,
486 images, and videos. The resulting file should be "self-contained,"
487 in the sense that it needs no external files and no net access to be
488 displayed properly by a browser. This option works only with HTML output
489 formats, including `html`, `html5`, `html+lhs`, `html5+lhs`, `s5`,
490 `slidy`, `slideous`, `dzslides`, and `revealjs`. Scripts, images, and
491 stylesheets at absolute URLs will be downloaded; those at relative URLs
492 will be sought relative to the working directory (if the first source
493 file is local) or relative to the base URL (if the first source
494 file is remote). `--self-contained` does not work with `--mathjax`.
496`--offline`
498: Deprecated synonym for `--self-contained`.
500`-5`, `--html5`
502: Produce HTML5 instead of HTML4. This option has no effect for writers
503 other than `html`. (*Deprecated:* Use the `html5` output format instead.)
505`--html-q-tags`
507: Use `<q>` tags for quotes in HTML.
509`--ascii`
511: Use only ascii characters in output. Currently supported only
512 for HTML output (which uses numerical entities instead of
513 UTF-8 when this option is selected).
515`--reference-links`
517: Use reference-style links, rather than inline links, in writing markdown
518 or reStructuredText. By default inline links are used.
520`--atx-headers`
522: Use ATX style headers in markdown and asciidoc output. The default is
523 to use setext-style headers for levels 1-2, and then ATX headers.
525`--chapters`
527: Treat top-level headers as chapters in LaTeX, ConTeXt, and DocBook
528 output. When the LaTeX template uses the report, book, or
529 memoir class, this option is implied. If `beamer` is the output
530 format, top-level headers will become `\part{..}`.
532`-N`, `--number-sections`
534: Number section headings in LaTeX, ConTeXt, HTML, or EPUB output.
535 By default, sections are not numbered. Sections with class
536 `unnumbered` will never be numbered, even if `--number-sections`
537 is specified.
539`--number-offset=`*NUMBER*[`,`*NUMBER*`,`*...*]
541: Offset for section headings in HTML output (ignored in other
542 output formats). The first number is added to the section number for
543 top-level headers, the second for second-level headers, and so on.
544 So, for example, if you want the first top-level header in your
545 document to be numbered "6", specify `--number-offset=5`.
546 If your document starts with a level-2 header which you want to
547 be numbered "1.5", specify `--number-offset=1,4`.
548 Offsets are 0 by default. Implies `--number-sections`.
550`--no-tex-ligatures`
552: Do not convert quotation marks, apostrophes, and dashes to
553 the TeX ligatures when writing LaTeX or ConTeXt. Instead, just
554 use literal unicode characters. This is needed for using advanced
555 OpenType features with XeLaTeX and LuaLaTeX. Note: normally
556 `--smart` is selected automatically for LaTeX and ConTeXt
557 output, but it must be specified explicitly if `--no-tex-ligatures`
558 is selected. If you use literal curly quotes, dashes, and ellipses
559 in your source, then you may want to use `--no-tex-ligatures`
560 without `--smart`.
562`--listings`
564: Use listings package for LaTeX code blocks
566`-i`, `--incremental`
568: Make list items in slide shows display incrementally (one by one).
569 The default is for lists to be displayed all at once.
571`--slide-level=`*NUMBER*
573: Specifies that headers with the specified level create
574 slides (for `beamer`, `s5`, `slidy`, `slideous`, `dzslides`). Headers
575 above this level in the hierarchy are used to divide the
576 slide show into sections; headers below this level create
577 subheads within a slide. The default is to set the slide level
578 based on the contents of the document; see
579 [Structuring the slide show](#structuring-the-slide-show), below.
581`--section-divs`
583: Wrap sections in `<div>` tags (or `<section>` tags in HTML5),
584 and attach identifiers to the enclosing `<div>` (or `<section>`)
585 rather than the header itself.
586 See [Section identifiers](#header-identifiers-in-html-latex-and-context), below.
588`--email-obfuscation=none`|`javascript`|`references`
590: Specify a method for obfuscating `mailto:` links in HTML documents.
591 `none` leaves `mailto:` links as they are. `javascript` obfuscates
592 them using javascript. `references` obfuscates them by printing their
593 letters as decimal or hexadecimal character references.
595`--id-prefix=`*STRING*
597: Specify a prefix to be added to all automatically generated identifiers
598 in HTML and DocBook output, and to footnote numbers in markdown output.
599 This is useful for preventing duplicate identifiers when generating
600 fragments to be included in other pages.
602`-T` *STRING*, `--title-prefix=`*STRING*
604: Specify *STRING* as a prefix at the beginning of the title
605 that appears in the HTML header (but not in the title as it
606 appears at the beginning of the HTML body). Implies
607 `--standalone`.
609`-c` *URL*, `--css=`*URL*
611: Link to a CSS style sheet. This option can be be used repeatedly to
612 include multiple files. They will be included in the order specified.
614`--reference-odt=`*FILE*
616: Use the specified file as a style reference in producing an ODT.
617 For best results, the reference ODT should be a modified version
618 of an ODT produced using pandoc. The contents of the reference ODT
619 are ignored, but its stylesheets are used in the new ODT. If no
620 reference ODT is specified on the command line, pandoc will look
621 for a file `reference.odt` in the user data directory (see
622 `--data-dir`). If this is not found either, sensible defaults will be
623 used.
625`--reference-docx=`*FILE*
627: Use the specified file as a style reference in producing a docx file.
628 For best results, the reference docx should be a modified version
629 of a docx file produced using pandoc. The contents of the reference docx
630 are ignored, but its stylesheets and document properties (including
631 margins, page size, header, and footer) are used in the new docx. If no
632 reference docx is specified on the command line, pandoc will look
633 for a file `reference.docx` in the user data directory (see
634 `--data-dir`). If this is not found either, sensible defaults will be
635 used. The following styles are used by pandoc: [paragraph]
636 Normal, Compact, Title, Subtitle, Authors, Date, Abstract, Heading 1,
637 Heading 2, Heading 3, Heading 4, Heading 5, Block Text, Definition Term,
638 Definition, Bibliography, Body Text, Table Caption, Image Caption,
639 Figure, FigureWithCaption;
640 [character] Default Paragraph Font, Body Text Char, Verbatim Char,
641 Footnote Reference, Hyperlink.
643`--epub-stylesheet=`*FILE*
645: Use the specified CSS file to style the EPUB. If no stylesheet
646 is specified, pandoc will look for a file `epub.css` in the
647 user data directory (see `--data-dir`). If it is not
648 found there, sensible defaults will be used.
650`--epub-cover-image=`*FILE*
652: Use the specified image as the EPUB cover. It is recommended
653 that the image be less than 1000px in width and height. Note that
654 in a markdown source document you can also specify `cover-image`
655 in a YAML metadata block (see [EPUB Metadata], below).
657`--epub-metadata=`*FILE*
659: Look in the specified XML file for metadata for the EPUB.
660 The file should contain a series of Dublin Core elements,
661 as documented at <http://dublincore.org/documents/dces/>.
662 For example:
664 <dc:rights>Creative Commons</dc:rights>
665 <dc:language>es-AR</dc:language>
667 By default, pandoc will include the following metadata elements:
668 `<dc:title>` (from the document title), `<dc:creator>` (from the
669 document authors), `<dc:date>` (from the document date, which should
670 be in [ISO 8601 format]), `<dc:language>` (from the `lang`
671 variable, or, if is not set, the locale), and `<dc:identifier
672 id="BookId">` (a randomly generated UUID). Any of these may be
673 overridden by elements in the metadata file.
675 Note: if the source document is markdown, a YAML metadata block
676 in the document can be used instead. See below under
677 [EPUB Metadata].
679`--epub-embed-font=`*FILE*
681: Embed the specified font in the EPUB. This option can be repeated
682 to embed multiple fonts. Wildcards can also be used: for example,
683 `DejaVuSans-*.ttf`. However, if you use wildcards on the command
684 line, be sure to escape them or put the whole filename in single quotes,
685 to prevent them from being interpreted by the shell. To use the
686 embedded fonts, you will need to add declarations like the following
687 to your CSS (see `--epub-stylesheet`):
689 @font-face {
690 font-family: DejaVuSans;
691 font-style: normal;
692 font-weight: normal;
693 src:url("DejaVuSans-Regular.ttf");
694 }
695 @font-face {
696 font-family: DejaVuSans;
697 font-style: normal;
698 font-weight: bold;
699 src:url("DejaVuSans-Bold.ttf");
700 }
701 @font-face {
702 font-family: DejaVuSans;
703 font-style: italic;
704 font-weight: normal;
705 src:url("DejaVuSans-Oblique.ttf");
706 }
707 @font-face {
708 font-family: DejaVuSans;
709 font-style: italic;
710 font-weight: bold;
711 src:url("DejaVuSans-BoldOblique.ttf");
712 }
713 body { font-family: "DejaVuSans"; }
715`--epub-chapter-level=`*NUMBER*
717: Specify the header level at which to split the EPUB into separate
718 "chapter" files. The default is to split into chapters at level 1
719 headers. This option only affects the internal composition of the
720 EPUB, not the way chapters and sections are displayed to users. Some
721 readers may be slow if the chapter files are too large, so for large
722 documents with few level 1 headers, one might want to use a chapter
723 level of 2 or 3.
725`--latex-engine=pdflatex`|`lualatex`|`xelatex`
727: Use the specified LaTeX engine when producing PDF output.
728 The default is `pdflatex`. If the engine is not in your PATH,
729 the full path of the engine may be specified here.
731`--latex-engine-opt=`*STRING*
733: Use the given string as a command-line argument to the `latex-engine`.
734 If used multiple times, the arguments are provided with spaces between
735 them. Note that no check for duplicate options is done.
737Citation rendering
738------------------
740`--bibliography=`*FILE*
742: Set the `bibliography` field in the document's metadata to *FILE*,
743 overriding any value set in the metadata, and process citations
744 using `pandoc-citeproc`. (This is equivalent to
745 `--metadata bibliography=FILE --filter pandoc-citeproc`.)
747`--csl=`*FILE*
749: Set the `csl` field in the document's metadata to *FILE*,
750 overriding any value set in the metadata. (This is equivalent to
751 `--metadata csl=FILE`.)
753`--citation-abbreviations=`*FILE*
755: Set the `citation-abbreviations` field in the document's metadata to
756 *FILE*, overriding any value set in the metadata. (This is equivalent to
757 `--metadata citation-abbreviations=FILE`.)
759`--natbib`
761: Use natbib for citations in LaTeX output. This option is not for use
762 with the `pandoc-citeproc` filter or with PDF output. It is intended for
763 use in producing a LaTeX file that can be processed with pdflatex and
764 bibtex.
766`--biblatex`
768: Use biblatex for citations in LaTeX output. This option is not for use
769 with the `pandoc-citeproc` filter or with PDF output. It is intended for
770 use in producing a LaTeX file that can be processed with pdflatex and
771 bibtex or biber.
773Math rendering in HTML
774----------------------
776`-m` [*URL*], `--latexmathml`[`=`*URL*]
778: Use the [LaTeXMathML] script to display embedded TeX math in HTML output.
779 To insert a link to a local copy of the `LaTeXMathML.js` script,
780 provide a *URL*. If no *URL* is provided, the contents of the
781 script will be inserted directly into the HTML header, preserving
782 portability at the price of efficiency. If you plan to use math on
783 several pages, it is much better to link to a copy of the script,
784 so it can be cached.
786`--mathml`[`=`*URL*]
788: Convert TeX math to MathML (in `docbook` as well as `html` and `html5`).
789 In standalone `html` output, a small javascript (or a link to such a
790 script if a *URL* is supplied) will be inserted that allows the MathML to
791 be viewed on some browsers.
793`--jsmath`[`=`*URL*]
795: Use [jsMath] to display embedded TeX math in HTML output.
796 The *URL* should point to the jsMath load script (e.g.
797 `jsMath/easy/load.js`); if provided, it will be linked to in
798 the header of standalone HTML documents. If a *URL* is not provided,
799 no link to the jsMath load script will be inserted; it is then
800 up to the author to provide such a link in the HTML template.
802`--mathjax`[`=`*URL*]
804: Use [MathJax] to display embedded TeX math in HTML output.
805 The *URL* should point to the `MathJax.js` load script.
806 If a *URL* is not provided, a link to the MathJax CDN will
807 be inserted.
809`--gladtex`
811: Enclose TeX math in `<eq>` tags in HTML output. These can then
812 be processed by [gladTeX] to produce links to images of the typeset
813 formulas.
815`--mimetex`[`=`*URL*]
817: Render TeX math using the [mimeTeX] CGI script. If *URL* is not
818 specified, it is assumed that the script is at `/cgi-bin/mimetex.cgi`.
820`--webtex`[`=`*URL*]
822: Render TeX formulas using an external script that converts TeX
823 formulas to images. The formula will be concatenated with the URL
824 provided. If *URL* is not specified, the Google Chart API will be used.
826`--katex`[`=`*URL*]
828: Use [KaTeX] to display embedded TeX math in HTML output.
829 The *URL* should point to the `katex.js` load script. If a *URL* is
830 not provided, a link to the KaTeX CDN will be inserted.
832`--katex-stylesheet=`*URL*
834: The *URL* should point to the `katex.css` stylesheet. If this option is
835 not specified, a link to the KaTeX CDN will be inserted. Note that this
836 option does not imply `--katex`.
838Options for wrapper scripts
839---------------------------
841`--dump-args`
843: Print information about command-line arguments to *stdout*, then exit.
844 This option is intended primarily for use in wrapper scripts.
845 The first line of output contains the name of the output file specified
846 with the `-o` option, or `-` (for *stdout*) if no output file was
847 specified. The remaining lines contain the command-line arguments,
848 one per line, in the order they appear. These do not include regular
849 Pandoc options and their arguments, but do include any options appearing
850 after a `--` separator at the end of the line.
852`--ignore-args`
854: Ignore command-line arguments (for use in wrapper scripts).
855 Regular Pandoc options are not ignored. Thus, for example,
857 pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1
859 is equivalent to
861 pandoc -o foo.html -s
863[LaTeXMathML]: http://math.etsu.edu/LaTeXMathML/
864[jsMath]: http://www.math.union.edu/~dpvc/jsmath/
865[MathJax]: http://www.mathjax.org/
866[gladTeX]: http://ans.hsh.no/home/mgg/gladtex/
867[mimeTeX]: http://www.forkosh.com/mimetex.html
868[CSL]: http://CitationStyles.org
870Templates
871=========
873When the `-s/--standalone` option is used, pandoc uses a template to
874add header and footer material that is needed for a self-standing
875document. To see the default template that is used, just type
877 pandoc -D FORMAT
879where `FORMAT` is the name of the output format. A custom template
880can be specified using the `--template` option. You can also override
881the system default templates for a given output format `FORMAT`
882by putting a file `templates/default.FORMAT` in the user data
883directory (see `--data-dir`, above). *Exceptions:* For `odt` output,
884customize the `default.opendocument` template. For `pdf` output,
885customize the `default.latex` template.
887Templates may contain *variables*. Variable names are sequences of
888alphanumerics, `-`, and `_`, starting with a letter. A variable name
889surrounded by `$` signs will be replaced by its value. For example,
890the string `$title$` in
892 <title>$title$</title>
894will be replaced by the document title.
896To write a literal `$` in a template, use `$$`.
898Some variables are set automatically by pandoc. These vary somewhat
899depending on the output format, but include metadata fields (such
900as `title`, `author`, and `date`) as well as the following:
902`header-includes`
903: contents specified by `-H/--include-in-header` (may have multiple
904 values)
906`toc`
907: non-null value if `--toc/--table-of-contents` was specified
909`include-before`
910: contents specified by `-B/--include-before-body` (may have
911 multiple values)
913`include-after`
914: contents specified by `-A/--include-after-body` (may have
915 multiple values)
917`body`
918: body of document
920`lang`
921: language code for HTML or LaTeX documents
923`slidy-url`
924: base URL for Slidy documents (defaults to
925 `http://www.w3.org/Talks/Tools/Slidy2`)
927`slideous-url`
928: base URL for Slideous documents (defaults to `slideous`)
930`s5-url`
931: base URL for S5 documents (defaults to `s5/default`)
933`revealjs-url`
934: base URL for reveal.js documents (defaults to `reveal.js`)
936`theme`
937: reveal.js or LaTeX beamer theme
939`transition`
940: reveal.js transition
942`fontsize`
943: font size (10pt, 11pt, 12pt) for LaTeX documents
945`documentclass`
946: document class for LaTeX documents
948`classoption`
949: option for LaTeX documentclass, e.g. `oneside`; may be repeated
950 for multiple options
952`geometry`
953: options for LaTeX `geometry` class, e.g. `margin=1in`;
954 may be repeated for multiple options
956`linestretch`
957: adjusts line spacing (requires the `setspace` package)
959`fontfamily`
960: font package to use for LaTeX documents (with pdflatex):
961 TeXLive has `bookman` (Bookman), `utopia` or `fourier` (Utopia),
962 `fouriernc` (New Century Schoolbook), `times` or `txfonts` (Times),
963 `mathpazo` or `pxfonts` or `mathpple` (Palatino),
964 `libertine` (Linux Libertine), `arev` (Arev Sans),
965 and the default `lmodern`, among others.
967`mainfont`, `sansfont`, `monofont`, `mathfont`
968: fonts for LaTeX documents (works only with xelatex
969 and lualatex)
971`colortheme`
972: colortheme for LaTeX beamer documents
974`fonttheme`
975: fonttheme for LaTeX beamer documents
977`linkcolor`
978: color for internal links in LaTeX documents (`red`, `green`,
979 `magenta`, `cyan`, `blue`, `black`)
981`urlcolor`
982: color for external links in LaTeX documents
984`citecolor`
985: color for citation links in LaTeX documents
987`links-as-notes`
988: causes links to be printed as footnotes in LaTeX documents
990`toc`
991: include table of contents in LaTeX documents
993`toc-depth`
994: level of section to include in table of contents in LaTeX documents
996`toc-title`
997: title of table of contents (works only with EPUB and docx)
999`lof`
1000: include list of figures in LaTeX documents
1002`lot`
1003: include list of tables in LaTeX documents
1005`biblio-style`
1006: bibliography style in LaTeX, when used with `--natbib`
1008`biblio-files`
1009: bibliography files to use in LaTeX, with `--natbib` or `--biblatex`
1011`section`
1012: section number in man pages
1014`header`
1015: header in man pages
1017`footer`
1018: footer in man pages
1020Variables may be set at the command line using the `-V/--variable`
1021option. Variables set in this way override metadata fields with
1022the same name.
1024Templates may contain conditionals. The syntax is as follows:
1026 $if(variable)$
1028 $else$
1030 $endif$
1032This will include `X` in the template if `variable` has a non-null
1033value; otherwise it will include `Y`. `X` and `Y` are placeholders for
1034any valid template text, and may include interpolated variables or other
1035conditionals. The `$else$` section may be omitted.
1037When variables can have multiple values (for example, `author` in
1038a multi-author document), you can use the `$for$` keyword:
1040 $for(author)$
1041 <meta name="author" content="$author$" />
1042 $endfor$
1044You can optionally specify a separator to be used between
1045consecutive items:
1047 $for(author)$$author$$sep$, $endfor$
1049A dot can be used to select a field of a variable that takes
1050an object as its value. So, for example:
1052 $author.name$ ($author.affiliation$)
1054If you use custom templates, you may need to revise them as pandoc
1055changes. We recommend tracking the changes in the default templates,
1056and modifying your custom templates accordingly. An easy way to do this
1057is to fork the pandoc-templates repository
1058(<http://github.com/jgm/pandoc-templates>) and merge in changes after each
1059pandoc release.
1061Pandoc's markdown
1062=================
1064Pandoc understands an extended and slightly revised version of
1065John Gruber's [markdown] syntax. This document explains the syntax,
1066noting differences from standard markdown. Except where noted, these
1067differences can be suppressed by using the `markdown_strict` format instead
1068of `markdown`. An extensions can be enabled by adding `+EXTENSION`
1069to the format name and disabled by adding `-EXTENSION`. For example,
1070`markdown_strict+footnotes` is strict markdown with footnotes
1071enabled, while `markdown-footnotes-pipe_tables` is pandoc's
1072markdown without footnotes or pipe tables.
1074Philosophy
1075----------
1077Markdown is designed to be easy to write, and, even more importantly,
1078easy to read:
1080> A Markdown-formatted document should be publishable as-is, as plain
1081> text, without looking like it's been marked up with tags or formatting
1082> instructions.
1083> -- [John Gruber](http://daringfireball.net/projects/markdown/syntax#philosophy)
1085This principle has guided pandoc's decisions in finding syntax for
1086tables, footnotes, and other extensions.
1088There is, however, one respect in which pandoc's aims are different
1089from the original aims of markdown. Whereas markdown was originally
1090designed with HTML generation in mind, pandoc is designed for multiple
1091output formats. Thus, while pandoc allows the embedding of raw HTML,
1092it discourages it, and provides other, non-HTMLish ways of representing
1093important document elements like definition lists, tables, mathematics, and
1094footnotes.
1096Paragraphs
1097----------
1099A paragraph is one or more lines of text followed by one or more blank line.
1100Newlines are treated as spaces, so you can reflow your paragraphs as you like.
1101If you need a hard line break, put two or more spaces at the end of a line.
1103#### Extension: `escaped_line_breaks` ####
1105A backslash followed by a newline is also a hard line break.
1106Note: in multiline and grid table cells, this is the only way
1107to create a hard line break, since trailing spaces in the cells
1108are ignored.
1110Headers
1111-------
1113There are two kinds of headers, Setext and atx.
1115### Setext-style headers ###
1117A setext-style header is a line of text "underlined" with a row of `=` signs
1118(for a level one header) or `-` signs (for a level two header):
1120 A level-one header
1121 ==================
1123 A level-two header
1124 ------------------
1126The header text can contain inline formatting, such as emphasis (see
1127[Inline formatting](#inline-formatting), below).
1130### Atx-style headers ###
1132An Atx-style header consists of one to six `#` signs and a line of
1133text, optionally followed by any number of `#` signs. The number of
1134`#` signs at the beginning of the line is the header level:
1136 ## A level-two header
1138 ### A level-three header ###
1140As with setext-style headers, the header text can contain formatting:
1142 # A level-one header with a [link](/url) and *emphasis*
1144#### Extension: `blank_before_header` ####
1146Standard markdown syntax does not require a blank line before a header.
1147Pandoc does require this (except, of course, at the beginning of the
1148document). The reason for the requirement is that it is all too easy for a
1149`#` to end up at the beginning of a line by accident (perhaps through line
1150wrapping). Consider, for example:
1152 I like several of their flavors of ice cream:
1153 #22, for example, and #5.
1156### Header identifiers in HTML, LaTeX, and ConTeXt ###
1158#### Extension: `header_attributes` ####
1160Headers can be assigned attributes using this syntax at the end
1161of the line containing the header text:
1163 {#identifier .class .class key=value key=value}
1165Thus, for example, the following headers will all be assigned the identifier
1166`foo`:
1168 # My header {#foo}
1170 ## My header ## {#foo}
1172 My other header {#foo}
1173 ---------------
1175(This syntax is compatible with [PHP Markdown Extra].)
1177Note that although this syntax allows assignment of classes and key/value
1178attributes, writers generally don't use all of this information. Identifiers,
1179classes, and key/value attributes are used in HTML and HTML-based formats such
1180as EPUB and slidy. Identifiers are used for labels and link anchors in the
1181LaTeX, ConTeXt, Textile, and AsciiDoc writers.
1183Headers with the class `unnumbered` will not be numbered, even if
1184`--number-sections` is specified. A single hyphen (`-`) in an attribute
1185context is equivalent to `.unnumbered`, and preferable in non-English
1186documents. So,
1188 # My header {-}
1190is just the same as
1192 # My header {.unnumbered}
1194#### Extension: `auto_identifiers` ####
1196A header without an explicitly specified identifier will be
1197automatically assigned a unique identifier based on the header text.
1198To derive the identifier from the header text,
1200 - Remove all formatting, links, etc.
1201 - Remove all footnotes.
1202 - Remove all punctuation, except underscores, hyphens, and periods.
1203 - Replace all spaces and newlines with hyphens.
1204 - Convert all alphabetic characters to lowercase.
1205 - Remove everything up to the first letter (identifiers may
1206 not begin with a number or punctuation mark).
1207 - If nothing is left after this, use the identifier `section`.
1209Thus, for example,
1211 Header Identifier
1212 ------------------------------- ----------------------------
1213 Header identifiers in HTML `header-identifiers-in-html`
1214 *Dogs*?--in *my* house? `dogs--in-my-house`
1215 [HTML], [S5], or [RTF]? `html-s5-or-rtf`
1216 3. Applications `applications`
1217 33 `section`
1219These rules should, in most cases, allow one to determine the identifier
1220from the header text. The exception is when several headers have the
1221same text; in this case, the first will get an identifier as described
1222above; the second will get the same identifier with `-1` appended; the
1223third with `-2`; and so on.
1225These identifiers are used to provide link targets in the table of
1226contents generated by the `--toc|--table-of-contents` option. They
1227also make it easy to provide links from one section of a document to
1228another. A link to this section, for example, might look like this:
1230 See the section on
1231 [header identifiers](#header-identifiers-in-html-latex-and-context).
1233Note, however, that this method of providing links to sections works
1234only in HTML, LaTeX, and ConTeXt formats.
1236If the `--section-divs` option is specified, then each section will
1237be wrapped in a `div` (or a `section`, if `--html5` was specified),
1238and the identifier will be attached to the enclosing `<div>`
1239(or `<section>`) tag rather than the header itself. This allows entire
1240sections to be manipulated using javascript or treated differently in
1241CSS.
1243#### Extension: `implicit_header_references` ####
1245Pandoc behaves as if reference links have been defined for each header.
1246So, instead of
1248 [header identifiers](#header-identifiers-in-html)
1250you can simply write
1252 [header identifiers]
1256 [header identifiers][]
1260 [the section on header identifiers][header identifiers]
1262If there are multiple headers with identical text, the corresponding
1263reference will link to the first one only, and you will need to use explicit
1264links to link to the others, as described above.
1266Unlike regular reference links, these references are case-sensitive.
1268Note: if you have defined an explicit identifier for a header,
1269then implicit references to it will not work.
1271Block quotations
1272----------------
1274Markdown uses email conventions for quoting blocks of text.
1275A block quotation is one or more paragraphs or other block elements
1276(such as lists or headers), with each line preceded by a `>` character
1277and a space. (The `>` need not start at the left margin, but it should
1278not be indented more than three spaces.)
1280 > This is a block quote. This
1281 > paragraph has two lines.
1283 > 1. This is a list inside a block quote.
1284 > 2. Second item.
1286A "lazy" form, which requires the `>` character only on the first
1287line of each block, is also allowed:
1289 > This is a block quote. This
1290 paragraph has two lines.
1292 > 1. This is a list inside a block quote.
1293 2. Second item.
1295Among the block elements that can be contained in a block quote are
1296other block quotes. That is, block quotes can be nested:
1298 > This is a block quote.
1300 > > A block quote within a block quote.
1302#### Extension: `blank_before_blockquote` ####
1304Standard markdown syntax does not require a blank line before a block
1305quote. Pandoc does require this (except, of course, at the beginning of the
1306document). The reason for the requirement is that it is all too easy for a
1307`>` to end up at the beginning of a line by accident (perhaps through line
1308wrapping). So, unless the `markdown_strict` format is used, the following does
1309not produce a nested block quote in pandoc:
1311 > This is a block quote.
1312 >> Nested.
1315Verbatim (code) blocks
1316----------------------
1318### Indented code blocks ###
1320A block of text indented four spaces (or one tab) is treated as verbatim
1321text: that is, special characters do not trigger special formatting,
1322and all spaces and line breaks are preserved. For example,
1324 if (a > 3) {
1325 moveShip(5 * gravity, DOWN);
1328The initial (four space or one tab) indentation is not considered part
1329of the verbatim text, and is removed in the output.
1331Note: blank lines in the verbatim text need not begin with four spaces.
1334### Fenced code blocks ###
1336#### Extension: `fenced_code_blocks` ####
1338In addition to standard indented code blocks, Pandoc supports
1339*fenced* code blocks. These begin with a row of three or more
1340tildes (`~`) or backticks (`` ` ``) and end with a row of tildes or
1341backticks that must be at least as long as the starting row. Everything
1342between these lines is treated as code. No indentation is necessary:
1344 ~~~~~~~
1345 if (a > 3) {
1346 moveShip(5 * gravity, DOWN);
1348 ~~~~~~~
1350Like regular code blocks, fenced code blocks must be separated
1351from surrounding text by blank lines.
1353If the code itself contains a row of tildes or backticks, just use a longer
1354row of tildes or backticks at the start and end:
1356 ~~~~~~~~~~~~~~~~
1357 ~~~~~~~~~~
1358 code including tildes
1359 ~~~~~~~~~~
1360 ~~~~~~~~~~~~~~~~
1362#### Extension: `fenced_code_attributes` ####
1364Optionally, you may attach attributes to the code block using
1365this syntax:
1367 ~~~~ {#mycode .haskell .numberLines startFrom="100"}
1368 qsort [] = []
1369 qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
1370 qsort (filter (>= x) xs)
1371 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1373Here `mycode` is an identifier, `haskell` and `numberLines` are classes, and
1374`startFrom` is an attribute with value `100`. Some output formats can use this
1375information to do syntax highlighting. Currently, the only output formats
1376that uses this information are HTML and LaTeX. If highlighting is supported
1377for your output format and language, then the code block above will appear
1378highlighted, with numbered lines. (To see which languages are supported, do
1379`pandoc --version`.) Otherwise, the code block above will appear as follows:
1381 <pre id="mycode" class="haskell numberLines" startFrom="100">
1382 <code>
1383 ...
1384 </code>
1385 </pre>
1387A shortcut form can also be used for specifying the language of
1388the code block:
1390 ```haskell
1391 qsort [] = []
1392 ```
1394This is equivalent to:
1396 ``` {.haskell}
1397 qsort [] = []
1398 ```
1400If the `fenced_code_attributes` extension is disabled, but
1401input contains class attribute(s) for the codeblock, the first
1402class attribute will be printed after the opening fence as a bare
1403word.
1405To prevent all highlighting, use the `--no-highlight` flag.
1406To set the highlighting style, use `--highlight-style`.
1408Line blocks
1409-----------
1411#### Extension: `line_blocks` ####
1413A line block is a sequence of lines beginning with a vertical bar (`|`)
1414followed by a space. The division into lines will be preserved in
1415the output, as will any leading spaces; otherwise, the lines will
1416be formatted as markdown. This is useful for verse and addresses:
1418 | The limerick packs laughs anatomical
1419 | In space that is quite economical.
1420 | But the good ones I've seen
1421 | So seldom are clean
1422 | And the clean ones so seldom are comical
1424 | 200 Main St.
1425 | Berkeley, CA 94718
1427The lines can be hard-wrapped if needed, but the continuation
1428line must begin with a space.
1430 | The Right Honorable Most Venerable and Righteous Samuel L.
1431 Constable, Jr.
1432 | 200 Main St.
1433 | Berkeley, CA 94718
1435This syntax is borrowed from [reStructuredText].
1437Lists
1438-----
1440### Bullet lists ###
1442A bullet list is a list of bulleted list items. A bulleted list
1443item begins with a bullet (`*`, `+`, or `-`). Here is a simple
1444example:
1446 * one
1447 * two
1448 * three
1450This will produce a "compact" list. If you want a "loose" list, in which
1451each item is formatted as a paragraph, put spaces between the items:
1453 * one
1455 * two
1457 * three
1459The bullets need not be flush with the left margin; they may be
1460indented one, two, or three spaces. The bullet must be followed
1461by whitespace.
1463List items look best if subsequent lines are flush with the first
1464line (after the bullet):
1466 * here is my first
1467 list item.
1468 * and my second.
1470But markdown also allows a "lazy" format:
1472 * here is my first
1473 list item.
1474 * and my second.
1476### The four-space rule ###
1478A list item may contain multiple paragraphs and other block-level
1479content. However, subsequent paragraphs must be preceded by a blank line
1480and indented four spaces or a tab. The list will look better if the first
1481paragraph is aligned with the rest:
1483 * First paragraph.
1485 Continued.
1487 * Second paragraph. With a code block, which must be indented
1488 eight spaces:
1490 { code }
1492List items may include other lists. In this case the preceding blank
1493line is optional. The nested list must be indented four spaces or
1494one tab:
1496 * fruits
1497 + apples
1498 - macintosh
1499 - red delicious
1500 + pears
1501 + peaches
1502 * vegetables
1503 + broccoli
1504 + chard
1506As noted above, markdown allows you to write list items "lazily," instead of
1507indenting continuation lines. However, if there are multiple paragraphs or
1508other blocks in a list item, the first line of each must be indented.
1510 + A lazy, lazy, list
1511 item.
1513 + Another one; this looks
1514 bad but is legal.
1516 Second paragraph of second
1517 list item.
1519**Note:** Although the four-space rule for continuation paragraphs
1520comes from the official [markdown syntax guide], the reference implementation,
1521`Markdown.pl`, does not follow it. So pandoc will give different results than
1522`Markdown.pl` when authors have indented continuation paragraphs fewer than
1523four spaces.
1525The [markdown syntax guide] is not explicit whether the four-space
1526rule applies to *all* block-level content in a list item; it only
1527mentions paragraphs and code blocks. But it implies that the rule
1528applies to all block-level content (including nested lists), and
1529pandoc interprets it that way.
1531 [markdown syntax guide]:
1532 http://daringfireball.net/projects/markdown/syntax#list
1534### Ordered lists ###
1536Ordered lists work just like bulleted lists, except that the items
1537begin with enumerators rather than bullets.
1539In standard markdown, enumerators are decimal numbers followed
1540by a period and a space. The numbers themselves are ignored, so
1541there is no difference between this list:
1543 1. one
1544 2. two
1545 3. three
1547and this one:
1549 5. one
1550 7. two
1551 1. three
1553#### Extension: `fancy_lists` ####
1555Unlike standard markdown, Pandoc allows ordered list items to be marked
1556with uppercase and lowercase letters and roman numerals, in addition to
1557arabic numerals. List markers may be enclosed in parentheses or followed by a
1558single right-parentheses or period. They must be separated from the
1559text that follows by at least one space, and, if the list marker is a
1560capital letter with a period, by at least two spaces.[^2]
1562[^2]: The point of this rule is to ensure that normal paragraphs
1563 starting with people's initials, like
1565 B. Russell was an English philosopher.
1567 do not get treated as list items.
1569 This rule will not prevent
1571 (C) 2007 Joe Smith
1573 from being interpreted as a list item. In this case, a backslash
1574 escape can be used:
1576 (C\) 2007 Joe Smith
1578The `fancy_lists` extension also allows '`#`' to be used as an
1579ordered list marker in place of a numeral:
1581 #. one
1582 #. two
1584#### Extension: `startnum` ####
1586Pandoc also pays attention to the type of list marker used, and to the
1587starting number, and both of these are preserved where possible in the
1588output format. Thus, the following yields a list with numbers followed
1589by a single parenthesis, starting with 9, and a sublist with lowercase
1590roman numerals:
1592 9) Ninth
1593 10) Tenth
1594 11) Eleventh
1595 i. subone
1596 ii. subtwo
1597 iii. subthree
1599Pandoc will start a new list each time a different type of list
1600marker is used. So, the following will create three lists:
1602 (2) Two
1603 (5) Three
1604 1. Four
1605 * Five
1607If default list markers are desired, use `#.`:
1609 #. one
1610 #. two
1611 #. three
1614### Definition lists ###
1616#### Extension: `definition_lists` ####
1618Pandoc supports definition lists, using the syntax of
1619[PHP Markdown Extra] with some extensions.[^3]
1621 Term 1
1623 : Definition 1
1625 Term 2 with *inline markup*
1627 : Definition 2
1629 { some code, part of Definition 2 }
1631 Third paragraph of definition 2.
1633Each term must fit on one line, which may optionally be followed by
1634a blank line, and must be followed by one or more definitions.
1635A definition begins with a colon or tilde, which may be indented one
1636or two spaces.
1638A term may have multiple definitions, and each definition may consist of one or
1639more block elements (paragraph, code block, list, etc.), each indented four
1640spaces or one tab stop. The body of the definition (including the first line,
1641aside from the colon or tilde) should be indented four spaces. However,
1642as with other markdown lists, you can "lazily" omit indentation except
1643at the beginning of a paragraph or other block element:
1645 Term 1
1647 : Definition
1648 with lazy continuation.
1650 Second paragraph of the definition.
1652If you leave space before the definition (as in the example above),
1653the text of the definition will be treated as a paragraph. In some
1654output formats, this will mean greater spacing between term/definition
1655pairs. For a more compact definition list, omit the space before the
1656definition:
1658 Term 1
1659 ~ Definition 1
1661 Term 2
1662 ~ Definition 2a
1663 ~ Definition 2b
1665Note that space between items in a definition list is required.
1666(A variant that loosens this requirement, but disallows "lazy"
1667hard wrapping, can be activated with `compact_definition_lists`: see
1668[Non-pandoc extensions](#non-pandoc-extensions), below.)
1670[^3]: I have been influenced by the suggestions of [David Wheeler](http://www.justatheory.com/computers/markup/modest-markdown-proposal.html).
1672[PHP Markdown Extra]: http://www.michelf.com/projects/php-markdown/extra/
1675### Numbered example lists ###
1677#### Extension: `example_lists` ####
1679The special list marker `@` can be used for sequentially numbered
1680examples. The first list item with a `@` marker will be numbered '1',
1681the next '2', and so on, throughout the document. The numbered examples
1682need not occur in a single list; each new list using `@` will take up
1683where the last stopped. So, for example:
1685 (@) My first example will be numbered (1).
1686 (@) My second example will be numbered (2).
1688 Explanation of examples.
1690 (@) My third example will be numbered (3).
1692Numbered examples can be labeled and referred to elsewhere in the
1693document:
1695 (@good) This is a good example.
1697 As (@good) illustrates, ...
1699The label can be any string of alphanumeric characters, underscores,
1700or hyphens.
1703### Compact and loose lists ###
1705Pandoc behaves differently from `Markdown.pl` on some "edge
1706cases" involving lists. Consider this source:
1708 + First
1709 + Second:
1710 - Fee
1711 - Fie
1712 - Foe
1714 + Third
1716Pandoc transforms this into a "compact list" (with no `<p>` tags around
1717"First", "Second", or "Third"), while markdown puts `<p>` tags around
1718"Second" and "Third" (but not "First"), because of the blank space
1719around "Third". Pandoc follows a simple rule: if the text is followed by
1720a blank line, it is treated as a paragraph. Since "Second" is followed
1721by a list, and not a blank line, it isn't treated as a paragraph. The
1722fact that the list is followed by a blank line is irrelevant. (Note:
1723Pandoc works this way even when the `markdown_strict` format is specified. This
1724behavior is consistent with the official markdown syntax description,
1725even though it is different from that of `Markdown.pl`.)
1728### Ending a list ###
1730What if you want to put an indented code block after a list?
1732 - item one
1733 - item two
1735 { my code block }
1737Trouble! Here pandoc (like other markdown implementations) will treat
1738`{ my code block }` as the second paragraph of item two, and not as
1739a code block.
1741To "cut off" the list after item two, you can insert some non-indented
1742content, like an HTML comment, which won't produce visible output in
1743any format:
1745 - item one
1746 - item two
1748 <!-- end of list -->
1750 { my code block }
1752You can use the same trick if you want two consecutive lists instead
1753of one big list:
1755 1. one
1756 2. two
1757 3. three
1759 <!-- -->
1761 1. uno
1762 2. dos
1763 3. tres
1765Horizontal rules
1766----------------
1768A line containing a row of three or more `*`, `-`, or `_` characters
1769(optionally separated by spaces) produces a horizontal rule:
1771 * * * *
1773 ---------------
1776Tables
1777------
1779Four kinds of tables may be used. The first three kinds presuppose the use of
1780a fixed-width font, such as Courier. The fourth kind can be used with
1781proportionally spaced fonts, as it does not require lining up columns.
1783#### Extension: `table_captions` ####
1785A caption may optionally be provided with all 4 kinds of tables (as
1786illustrated in the examples below). A caption is a paragraph beginning
1787with the string `Table:` (or just `:`), which will be stripped off.
1788It may appear either before or after the table.
1790#### Extension: `simple_tables` ####
1792Simple tables look like this:
1794 Right Left Center Default
1795 ------- ------ ---------- -------
1796 12 12 12 12
1797 123 123 123 123
1798 1 1 1 1
1800 Table: Demonstration of simple table syntax.
1802The headers and table rows must each fit on one line. Column
1803alignments are determined by the position of the header text relative
1804to the dashed line below it:[^4]
1806 - If the dashed line is flush with the header text on the right side
1807 but extends beyond it on the left, the column is right-aligned.
1808 - If the dashed line is flush with the header text on the left side
1809 but extends beyond it on the right, the column is left-aligned.
1810 - If the dashed line extends beyond the header text on both sides,
1811 the column is centered.
1812 - If the dashed line is flush with the header text on both sides,
1813 the default alignment is used (in most cases, this will be left).
1815[^4]: This scheme is due to Michel Fortin, who proposed it on the
1816 [Markdown discussion list](http://six.pairlist.net/pipermail/markdown-discuss/2005-March/001097.html).
1818The table must end with a blank line, or a line of dashes followed by
1819a blank line.
1821The column headers may be omitted, provided a dashed line is used
1822to end the table. For example:
1824 ------- ------ ---------- -------
1825 12 12 12 12
1826 123 123 123 123
1827 1 1 1 1
1828 ------- ------ ---------- -------
1830When headers are omitted, column alignments are determined on the basis
1831of the first line of the table body. So, in the tables above, the columns
1832would be right, left, center, and right aligned, respectively.
1834#### Extension: `multiline_tables` ####
1836Multiline tables allow headers and table rows to span multiple lines
1837of text (but cells that span multiple columns or rows of the table are
1838not supported). Here is an example:
1840 -------------------------------------------------------------
1841 Centered Default Right Left
1842 Header Aligned Aligned Aligned
1843 ----------- ------- --------------- -------------------------
1844 First row 12.0 Example of a row that
1845 spans multiple lines.
1847 Second row 5.0 Here's another one. Note
1848 the blank line between
1849 rows.
1850 -------------------------------------------------------------
1852 Table: Here's the caption. It, too, may span
1853 multiple lines.
1855These work like simple tables, but with the following differences:
1857 - They must begin with a row of dashes, before the header text
1858 (unless the headers are omitted).
1859 - They must end with a row of dashes, then a blank line.
1860 - The rows must be separated by blank lines.
1862In multiline tables, the table parser pays attention to the widths of
1863the columns, and the writers try to reproduce these relative widths in
1864the output. So, if you find that one of the columns is too narrow in the
1865output, try widening it in the markdown source.
1867Headers may be omitted in multiline tables as well as simple tables:
1869 ----------- ------- --------------- -------------------------
1870 First row 12.0 Example of a row that
1871 spans multiple lines.
1873 Second row 5.0 Here's another one. Note
1874 the blank line between
1875 rows.
1876 ----------- ------- --------------- -------------------------
1878 : Here's a multiline table without headers.
1880It is possible for a multiline table to have just one row, but the row
1881should be followed by a blank line (and then the row of dashes that ends
1882the table), or the table may be interpreted as a simple table.
1884#### Extension: `grid_tables` ####
1886Grid tables look like this:
1888 : Sample grid table.
1890 +---------------+---------------+--------------------+
1891 | Fruit | Price | Advantages |
1892 +===============+===============+====================+
1893 | Bananas | $1.34 | - built-in wrapper |
1894 | | | - bright color |
1895 +---------------+---------------+--------------------+
1896 | Oranges | $2.10 | - cures scurvy |
1897 | | | - tasty |
1898 +---------------+---------------+--------------------+
1900The row of `=`s separates the header from the table body, and can be
1901omitted for a headerless table. The cells of grid tables may contain
1902arbitrary block elements (multiple paragraphs, code blocks, lists,
1903etc.). Alignments are not supported, nor are cells that span multiple
1904columns or rows. Grid tables can be created easily using [Emacs table mode].
1906 [Emacs table mode]: http://table.sourceforge.net/
1908#### Extension: `pipe_tables` ####
1910Pipe tables look like this:
1912 | Right | Left | Default | Center |
1913 |------:|:-----|---------|:------:|
1914 | 12 | 12 | 12 | 12 |
1915 | 123 | 123 | 123 | 123 |
1916 | 1 | 1 | 1 | 1 |
1918 : Demonstration of pipe table syntax.
1920The syntax is [the same as in PHP markdown extra]. The beginning and
1921ending pipe characters are optional, but pipes are required between all
1922columns. The colons indicate column alignment as shown. The header
1923cannot be omitted. To simulate a headerless table, include a header
1924with blank cells.
1926Since the pipes indicate column boundaries, columns need not be vertically
1927aligned, as they are in the above example. So, this is a perfectly
1928legal (though ugly) pipe table:
1930 fruit| price
1931 -----|-----:
1932 apple|2.05
1933 pear|1.37
1934 orange|3.09
1936The cells of pipe tables cannot contain block elements like paragraphs
1937and lists, and cannot span multiple lines. Note also that in LaTeX/PDF
1938output, the cells produced by pipe tables will not wrap, since there
1939is no information available about relative widths. If you want content
1940to wrap within cells, use multiline or grid tables.
1942 [the same as in PHP markdown extra]:
1943 http://michelf.ca/projects/php-markdown/extra/#table
1945Note: Pandoc also recognizes pipe tables of the following
1946form, as can produced by Emacs' orgtbl-mode:
1948 | One | Two |
1949 |-----+-------|
1950 | my | table |
1951 | is | nice |
1953The difference is that `+` is used instead of `|`. Other orgtbl features
1954are not supported. In particular, to get non-default column alignment,
1955you'll need to add colons as above.
1957Metadata blocks
1958---------------
1960#### Extension: `pandoc_title_block` ####
1962If the file begins with a title block
1964 % title
1965 % author(s) (separated by semicolons)
1966 % date
1968it will be parsed as bibliographic information, not regular text. (It
1969will be used, for example, in the title of standalone LaTeX or HTML
1970output.) The block may contain just a title, a title and an author,
1971or all three elements. If you want to include an author but no
1972title, or a title and a date but no author, you need a blank line:
1975 % Author
1977 % My title
1979 % June 15, 2006
1981The title may occupy multiple lines, but continuation lines must
1982begin with leading space, thus:
1984 % My title
1985 on multiple lines
1987If a document has multiple authors, the authors may be put on
1988separate lines with leading space, or separated by semicolons, or
1989both. So, all of the following are equivalent:
1991 % Author One
1992 Author Two
1994 % Author One; Author Two
1996 % Author One;
1997 Author Two
1999The date must fit on one line.
2001All three metadata fields may contain standard inline formatting
2002(italics, links, footnotes, etc.).
2004Title blocks will always be parsed, but they will affect the output only
2005when the `--standalone` (`-s`) option is chosen. In HTML output, titles
2006will appear twice: once in the document head -- this is the title that
2007will appear at the top of the window in a browser -- and once at the
2008beginning of the document body. The title in the document head can have
2009an optional prefix attached (`--title-prefix` or `-T` option). The title
2010in the body appears as an H1 element with class "title", so it can be
2011suppressed or reformatted with CSS. If a title prefix is specified with
2012`-T` and no title block appears in the document, the title prefix will
2013be used by itself as the HTML title.
2015The man page writer extracts a title, man page section number, and
2016other header and footer information from the title line. The title
2017is assumed to be the first word on the title line, which may optionally
2018end with a (single-digit) section number in parentheses. (There should
2019be no space between the title and the parentheses.) Anything after
2020this is assumed to be additional footer and header text. A single pipe
2021character (`|`) should be used to separate the footer text from the header
2022text. Thus,
2024 % PANDOC(1)
2026will yield a man page with the title `PANDOC` and section 1.
2028 % PANDOC(1) Pandoc User Manuals
2030will also have "Pandoc User Manuals" in the footer.
2032 % PANDOC(1) Pandoc User Manuals | Version 4.0
2034will also have "Version 4.0" in the header.
2036#### Extension: `yaml_metadata_block` ####
2038A YAML metadata block is a valid YAML object, delimited by a line of three
2039hyphens (`---`) at the top and a line of three hyphens (`---`) or three dots
2040(`...`) at the bottom. A YAML metadata block may occur anywhere in the
2041document, but if it is not at the beginning, it must be preceded by a blank
2042line. (Note that, because of the way pandoc concatenates input files when
2043several are provided, you may also keep the metadata in a separate YAML file
2044and pass it to pandoc as an argument, along with your markdown files:
2046 pandoc chap1.md chap2.md chap3.md metadata.yaml -s -o book.html
2048Just be sure that the YAML file begins with `---` and ends with `---` or
2049`...`.)
2051Metadata will be taken from the fields of the YAML object and added to any
2052existing document metadata. Metadata can contain lists and objects (nested
2053arbitrarily), but all string scalars will be interpreted as markdown. Fields
2054with names ending in an underscore will be ignored by pandoc. (They may be
2055given a role by external processors.)
2057A document may contain multiple metadata blocks. The metadata fields will
2058be combined through a *left-biased union*: if two metadata blocks attempt
2059to set the same field, the value from the first block will be taken.
2061When pandoc is used with `-t markdown` to create a markdown document,
2062a YAML metadata block will be produced only if the `-s/--standalone`
2063option is used. All of the metadata will appear in a single block
2064at the beginning of the document.
2066Note that YAML escaping rules must be followed. Thus, for example,
2067if a title contains a colon, it must be quoted. The pipe character
2068(`|`) can be used to begin an indented block that will be interpreted
2069literally, without need for escaping. This form is necessary
2070when the field contains blank lines:
2072 ---
2073 title: 'This is the title: it contains a colon'
2074 author:
2075 - name: Author One
2076 affiliation: University of Somewhere
2077 - name: Author Two
2078 affiliation: University of Nowhere
2079 tags: [nothing, nothingness]
2080 abstract: |
2081 This is the abstract.
2083 It consists of two paragraphs.
2084 ...
2086Template variables will be set automatically from the metadata. Thus, for
2087example, in writing HTML, the variable `abstract` will be set to the HTML
2088equivalent of the markdown in the `abstract` field:
2090 <p>This is the abstract.</p>
2091 <p>It consists of two paragraphs.</p>
2093Note: The `author` variable in the default templates expects a simple list or
2094string. To use the structured authors in the example, you would need a
2095custom template. For example:
2097 $for(author)$
2098 $if(author.name)$
2099 $author.name$$if(author.affiliation)$ ($author.affiliation$)$endif$
2100 $else$
2101 $author$
2102 $endif$
2103 $endfor$
2106Backslash escapes
2107-----------------
2109#### Extension: `all_symbols_escapable` ####
2111Except inside a code block or inline code, any punctuation or space
2112character preceded by a backslash will be treated literally, even if it
2113would normally indicate formatting. Thus, for example, if one writes
2115 *\*hello\**
2117one will get
2119 <em>*hello*</em>
2121instead of
2123 <strong>hello</strong>
2125This rule is easier to remember than standard markdown's rule,
2126which allows only the following characters to be backslash-escaped:
2128 \`*_{}[]()>#+-.!
2130(However, if the `markdown_strict` format is used, the standard markdown rule
2131will be used.)
2133A backslash-escaped space is parsed as a nonbreaking space. It will
2134appear in TeX output as `~` and in HTML and XML as `\&#160;` or
2135`\&nbsp;`.
2137A backslash-escaped newline (i.e. a backslash occurring at the end of
2138a line) is parsed as a hard line break. It will appear in TeX output as
2139`\\` and in HTML as `<br />`. This is a nice alternative to
2140markdown's "invisible" way of indicating hard line breaks using
2141two trailing spaces on a line.
2143Backslash escapes do not work in verbatim contexts.
2145Smart punctuation
2146-----------------
2148#### Extension ####
2150If the `--smart` option is specified, pandoc will produce typographically
2151correct output, converting straight quotes to curly quotes, `---` to
2152em-dashes, `--` to en-dashes, and `...` to ellipses. Nonbreaking spaces
2153are inserted after certain abbreviations, such as "Mr."
2155Note: if your LaTeX template uses the `csquotes` package, pandoc will
2156detect automatically this and use `\enquote{...}` for quoted text.
2158Inline formatting
2159-----------------
2161### Emphasis ###
2163To *emphasize* some text, surround it with `*`s or `_`, like this:
2165 This text is _emphasized with underscores_, and this
2166 is *emphasized with asterisks*.
2168Double `*` or `_` produces **strong emphasis**:
2170 This is **strong emphasis** and __with underscores__.
2172A `*` or `_` character surrounded by spaces, or backslash-escaped,
2173will not trigger emphasis:
2175 This is * not emphasized *, and \*neither is this\*.
2177#### Extension: `intraword_underscores` ####
2179Because `_` is sometimes used inside words and identifiers,
2180pandoc does not interpret a `_` surrounded by alphanumeric
2181characters as an emphasis marker. If you want to emphasize
2182just part of a word, use `*`:
2184 feas*ible*, not feas*able*.
2187### Strikeout ###
2189#### Extension: `strikeout` ####
2191To strikeout a section of text with a horizontal line, begin and end it
2192with `~~`. Thus, for example,
2194 This ~~is deleted text.~~
2197### Superscripts and subscripts ###
2199#### Extension: `superscript`, `subscript` ####
2201Superscripts may be written by surrounding the superscripted text by `^`
2202characters; subscripts may be written by surrounding the subscripted
2203text by `~` characters. Thus, for example,
2205 H~2~O is a liquid. 2^10^ is 1024.
2207If the superscripted or subscripted text contains spaces, these spaces
2208must be escaped with backslashes. (This is to prevent accidental
2209superscripting and subscripting through the ordinary use of `~` and `^`.)
2210Thus, if you want the letter P with 'a cat' in subscripts, use
2211`P~a\ cat~`, not `P~a cat~`.
2214### Verbatim ###
2216To make a short span of text verbatim, put it inside backticks:
2218 What is the difference between `>>=` and `>>`?
2220If the verbatim text includes a backtick, use double backticks:
2222 Here is a literal backtick `` ` ``.
2224(The spaces after the opening backticks and before the closing
2225backticks will be ignored.)
2227The general rule is that a verbatim span starts with a string
2228of consecutive backticks (optionally followed by a space)
2229and ends with a string of the same number of backticks (optionally
2230preceded by a space).
2232Note that backslash-escapes (and other markdown constructs) do not
2233work in verbatim contexts:
2235 This is a backslash followed by an asterisk: `\*`.
2237#### Extension: `inline_code_attributes` ####
2239Attributes can be attached to verbatim text, just as with
2240[fenced code blocks](#fenced-code-blocks):
2242 `<$>`{.haskell}
2244### Small caps ###
2246To write small caps, you can use an HTML span tag:
2248 <span style="font-variant:small-caps;">Small caps</span>
2250(The semicolon is optional and there may be space after the
2251colon.) This will work in all output formats that support small caps.
2253Math
2254----
2256#### Extension: `tex_math_dollars` ####
2258Anything between two `$` characters will be treated as TeX math. The
2259opening `$` must have a non-space character immediately to its right,
2260while the closing `$` must have a non-space character immediately to its
2261left, and must not be followed immediately by a digit. Thus,
2262`$20,000 and $30,000` won't parse as math. If for some reason
2263you need to enclose text in literal `$` characters, backslash-escape
2264them and they won't be treated as math delimiters.
2266TeX math will be printed in all output formats. How it is rendered
2267depends on the output format:
2269Markdown, LaTeX, Org-Mode, ConTeXt
2270 ~ It will appear verbatim between `$` characters.
2272reStructuredText
2273 ~ It will be rendered using an interpreted text role `:math:`, as described
2274 [here](http://docutils.sourceforge.net/docs/ref/rst/roles.html#math)
2276AsciiDoc
2277 ~ It will be rendered as `latexmath:[...]`.
2279Texinfo
2280 ~ It will be rendered inside a `@math` command.
2282groff man
2283 ~ It will be rendered verbatim without `$`'s.
2285MediaWiki, DokuWiki
2286 ~ It will be rendered inside `<math>` tags.
2288Textile
2289 ~ It will be rendered inside `<span class="math">` tags.
2291RTF, OpenDocument, ODT
2292 ~ It will be rendered, if possible, using unicode characters,
2293 and will otherwise appear verbatim.
2295Docbook
2296 ~ If the `--mathml` flag is used, it will be rendered using mathml
2297 in an `inlineequation` or `informalequation` tag. Otherwise it
2298 will be rendered, if possible, using unicode characters.
2300Docx
2301 ~ It will be rendered using OMML math markup.
2303FictionBook2
2304 ~ If the `--webtex` option is used, formulas are rendered as images
2305 using Google Charts or other compatible web service, downloaded
2306 and embedded in the e-book. Otherwise, they will appear verbatim.
2308HTML, Slidy, DZSlides, S5, EPUB
2309 ~ The way math is rendered in HTML will depend on the
2310 command-line options selected:
2312 1. The default is to render TeX math as far as possible using unicode
2313 characters, as with RTF, DocBook, and OpenDocument output. Formulas
2314 are put inside a `span` with `class="math"`, so that they may be
2315 styled differently from the surrounding text if needed.
2317 2. If the `--latexmathml` option is used, TeX math will be displayed
2318 between `$` or `$$` characters and put in `<span>` tags with class `LaTeX`.
2319 The [LaTeXMathML] script will be used to render it as formulas.
2320 (This trick does not work in all browsers, but it works in Firefox.
2321 In browsers that do not support LaTeXMathML, TeX math will appear
2322 verbatim between `$` characters.)
2324 3. If the `--jsmath` option is used, TeX math will be put inside
2325 `<span>` tags (for inline math) or `<div>` tags (for display math)
2326 with class `math`. The [jsMath] script will be used to render
2327 it.
2329 4. If the `--mimetex` option is used, the [mimeTeX] CGI script will
2330 be called to generate images for each TeX formula. This should
2331 work in all browsers. The `--mimetex` option takes an optional URL
2332 as argument. If no URL is specified, it will be assumed that the
2333 mimeTeX CGI script is at `/cgi-bin/mimetex.cgi`.
2335 5. If the `--gladtex` option is used, TeX formulas will be enclosed
2336 in `<eq>` tags in the HTML output. The resulting `htex` file may then
2337 be processed by [gladTeX], which will produce image files for each
2338 formula and an `html` file with links to these images. So, the
2339 procedure is:
2341 pandoc -s --gladtex myfile.txt -o myfile.htex
2342 gladtex -d myfile-images myfile.htex
2343 # produces myfile.html and images in myfile-images
2345 6. If the `--webtex` option is used, TeX formulas will be converted
2346 to `<img>` tags that link to an external script that converts
2347 formulas to images. The formula will be URL-encoded and concatenated
2348 with the URL provided. If no URL is specified, the Google Chart
2349 API will be used (`http://chart.apis.google.com/chart?cht=tx&chl=`).
2351 7. If the `--mathjax` option is used, TeX math will be displayed
2352 between `\(...\)` (for inline math) or `\[...\]` (for display
2353 math) and put in `<span>` tags with class `math`.
2354 The [MathJax] script will be used to render it as formulas.
2356Raw HTML
2357--------
2359#### Extension: `raw_html` ####
2361Markdown allows you to insert raw HTML (or DocBook) anywhere in a document
2362(except verbatim contexts, where `<`, `>`, and `&` are interpreted
2363literally). (Technically this is not an extension, since standard
2364markdown allows it, but it has been made an extension so that it can
2365be disabled if desired.)
2367The raw HTML is passed through unchanged in HTML, S5, Slidy, Slideous,
2368DZSlides, EPUB, Markdown, and Textile output, and suppressed in other
2369formats.
2371#### Extension: `markdown_in_html_blocks` ####
2373Standard markdown allows you to include HTML "blocks": blocks
2374of HTML between balanced tags that are separated from the surrounding text
2375with blank lines, and start and end at the left margin. Within
2376these blocks, everything is interpreted as HTML, not markdown;
2377so (for example), `*` does not signify emphasis.
2379Pandoc behaves this way when the `markdown_strict` format is used; but
2380by default, pandoc interprets material between HTML block tags as markdown.
2381Thus, for example, Pandoc will turn
2383 <table>
2384 <tr>
2385 <td>*one*</td>
2386 <td>[a link](http://google.com)</td>
2387 </tr>
2388 </table>
2390into
2392 <table>
2393 <tr>
2394 <td><em>one</em></td>
2395 <td><a href="http://google.com">a link</a></td>
2396 </tr>
2397 </table>
2399whereas `Markdown.pl` will preserve it as is.
2401There is one exception to this rule: text between `<script>` and
2402`<style>` tags is not interpreted as markdown.
2404This departure from standard markdown should make it easier to mix
2405markdown with HTML block elements. For example, one can surround
2406a block of markdown text with `<div>` tags without preventing it
2407from being interpreted as markdown.
2409#### Extension: `native_divs` ####
2411Use native pandoc `Div` blocks for content inside `<div>` tags.
2412For the most part this should give the same output as
2413`markdown_in_html_blocks`, but it makes it easier to write pandoc
2414filters to manipulate groups of blocks.
2416#### Extension: `native_spans` ####
2418Use native pandoc `Span` blocks for content inside `<span>` tags.
2419For the most part this should give the same output as `raw_html`,
2420but it makes it easier to write pandoc filters to manipulate groups
2421of inlines.
2423Raw TeX
2424-------
2426#### Extension: `raw_tex` ####
2428In addition to raw HTML, pandoc allows raw LaTeX, TeX, and ConTeXt to be
2429included in a document. Inline TeX commands will be preserved and passed
2430unchanged to the LaTeX and ConTeXt writers. Thus, for example, you can use
2431LaTeX to include BibTeX citations:
2433 This result was proved in \cite{jones.1967}.
2435Note that in LaTeX environments, like
2437 \begin{tabular}{|l|l|}\hline
2438 Age & Frequency \\ \hline
2439 18--25 & 15 \\
2440 26--35 & 33 \\
2441 36--45 & 22 \\ \hline
2442 \end{tabular}
2444the material between the begin and end tags will be interpreted as raw
2445LaTeX, not as markdown.
2447Inline LaTeX is ignored in output formats other than Markdown, LaTeX,
2448and ConTeXt.
2450LaTeX macros
2451------------
2453#### Extension: `latex_macros` ####
2455For output formats other than LaTeX, pandoc will parse LaTeX `\newcommand` and
2456`\renewcommand` definitions and apply the resulting macros to all LaTeX
2457math. So, for example, the following will work in all output formats,
2458not just LaTeX:
2460 \newcommand{\tuple}[1]{\langle #1 \rangle}
2462 $\tuple{a, b, c}$
2464In LaTeX output, the `\newcommand` definition will simply be passed
2465unchanged to the output.
2468Links
2469-----
2471Markdown allows links to be specified in several ways.
2473### Automatic links ###
2475If you enclose a URL or email address in pointy brackets, it
2476will become a link:
2478 <http://google.com>
2479 <sam@green.eggs.ham>
2481### Inline links ###
2483An inline link consists of the link text in square brackets,
2484followed by the URL in parentheses. (Optionally, the URL can
2485be followed by a link title, in quotes.)
2487 This is an [inline link](/url), and here's [one with
2488 a title](http://fsf.org "click here for a good time!").
2490There can be no space between the bracketed part and the parenthesized part.
2491The link text can contain formatting (such as emphasis), but the title cannot.
2493Email addresses in inline links are not autodetected, so they have to be
2494prefixed with `mailto`:
2496 [Write me!](mailto:sam@green.eggs.ham)
2498### Reference links ###
2500An *explicit* reference link has two parts, the link itself and the link
2501definition, which may occur elsewhere in the document (either
2502before or after the link).
2504The link consists of link text in square brackets, followed by a label in
2505square brackets. (There can be space between the two.) The link definition
2506consists of the bracketed label, followed by a colon and a space, followed by
2507the URL, and optionally (after a space) a link title either in quotes or in
2508parentheses. The label must not be parseable as a citation (assuming
2509the `citations` extension is enabled): citations take precedence over
2510link labels.
2512Here are some examples:
2514 [my label 1]: /foo/bar.html "My title, optional"
2515 [my label 2]: /foo
2516 [my label 3]: http://fsf.org (The free software foundation)
2517 [my label 4]: /bar#special 'A title in single quotes'
2519The URL may optionally be surrounded by angle brackets:
2521 [my label 5]: <http://foo.bar.baz>
2523The title may go on the next line:
2525 [my label 3]: http://fsf.org
2526 "The free software foundation"
2528Note that link labels are not case sensitive. So, this will work:
2530 Here is [my link][FOO]
2532 [Foo]: /bar/baz
2534In an *implicit* reference link, the second pair of brackets is
2535empty:
2537 See [my website][].
2539 [my website]: http://foo.bar.baz
2541Note: In `Markdown.pl` and most other markdown implementations,
2542reference link definitions cannot occur in nested constructions
2543such as list items or block quotes. Pandoc lifts this arbitrary
2544seeming restriction. So the following is fine in pandoc, though
2545not in most other implementations:
2547 > My block [quote].
2549 > [quote]: /foo
2551#### Extension: `shortcut_reference_links` ####
2553In a *shortcut* reference link, the second pair of brackets may
2554be omitted entirely:
2556 See [my website].
2558 [my website]: http://foo.bar.baz
2560### Internal links ###
2562To link to another section of the same document, use the automatically
2563generated identifier (see [Header identifiers in HTML, LaTeX, and
2564ConTeXt](#header-identifiers-in-html-latex-and-context), below).
2565For example:
2567 See the [Introduction](#introduction).
2571 See the [Introduction].
2573 [Introduction]: #introduction
2575Internal links are currently supported for HTML formats (including
2576HTML slide shows and EPUB), LaTeX, and ConTeXt.
2578Images
2579------
2581A link immediately preceded by a `!` will be treated as an image.
2582The link text will be used as the image's alt text:
2584 ![la lune](lalune.jpg "Voyage to the moon")
2586 ![movie reel]
2588 [movie reel]: movie.gif
2590#### Extension: `implicit_figures` ####
2592An image occurring by itself in a paragraph will be rendered as
2593a figure with a caption.[^5] (In LaTeX, a figure environment will be
2594used; in HTML, the image will be placed in a `div` with class
2595`figure`, together with a caption in a `p` with class `caption`.)
2596The image's alt text will be used as the caption.
2598 ![This is the caption](/url/of/image.png)
2600[^5]: This feature is not yet implemented for RTF, OpenDocument, or
2601 ODT. In those formats, you'll just get an image in a paragraph by
2602 itself, with no caption.
2604If you just want a regular inline image, just make sure it is not
2605the only thing in the paragraph. One way to do this is to insert a
2606nonbreaking space after the image:
2608 ![This image won't be a figure](/url/of/image.png)\
2611Footnotes
2612---------
2614#### Extension: `footnotes` ####
2616Pandoc's markdown allows footnotes, using the following syntax:
2618 Here is a footnote reference,[^1] and another.[^longnote]
2620 [^1]: Here is the footnote.
2622 [^longnote]: Here's one with multiple blocks.
2624 Subsequent paragraphs are indented to show that they
2625 belong to the previous footnote.
2627 { some.code }
2629 The whole paragraph can be indented, or just the first
2630 line. In this way, multi-paragraph footnotes work like
2631 multi-paragraph list items.
2633 This paragraph won't be part of the note, because it
2634 isn't indented.
2636The identifiers in footnote references may not contain spaces, tabs,
2637or newlines. These identifiers are used only to correlate the
2638footnote reference with the note itself; in the output, footnotes
2639will be numbered sequentially.
2641The footnotes themselves need not be placed at the end of the
2642document. They may appear anywhere except inside other block elements
2643(lists, block quotes, tables, etc.).
2645#### Extension: `inline_notes` ####
2647Inline footnotes are also allowed (though, unlike regular notes,
2648they cannot contain multiple paragraphs). The syntax is as follows:
2650 Here is an inline note.^[Inlines notes are easier to write, since
2651 you don't have to pick an identifier and move down to type the
2652 note.]
2654Inline and regular footnotes may be mixed freely.
2657Citations
2658---------
2660#### Extension: `citations` ####
2662Using an external filter, `pandoc-citeproc`, pandoc can automatically generate
2663citations and a bibliography in a number of styles. Basic usage is
2665 pandoc --filter pandoc-citeproc myinput.txt
2667In order to use this feature, you will need to specify a bibliography file
2668using the `bibliography` metadata field in a YAML metadata section.
2669The bibliography may have any of these formats:
2671 Format File extension
2672 ------------ --------------
2673 BibLaTeX .bib
2674 BibTeX .bibtex
2675 Copac .copac
2676 CSL JSON .json
2677 CSL YAML .yaml
2678 EndNote .enl
2679 EndNote XML .xml
2680 ISI .wos
2681 MEDLINE .medline
2682 MODS .mods
2683 RIS .ris
2685Note that `.bib` can generally be used with both BibTeX and BibLaTeX
2686files, but you can use `.bibtex` to force BibTeX.
2688Note that `pandoc-citeproc --bib2json` and `pandoc-citeproc --bib2yaml`
2689can produce `.json` and `.yaml` files from any of the supported formats.
2691As an alternative to specifying a bibliography file, you can include
2692the citation data directly in the `references` field of the
2693document's YAML metadata. The field should contain an array of
2694YAML-encoded references, for example:
2696 ---
2697 references:
2698 - type: article-journal
2699 id: WatsonCrick1953
2700 author:
2701 - family: Watson
2702 given: J. D.
2703 - family: Crick
2704 given: F. H. C.
2705 issued:
2706 date-parts:
2707 - - 1953
2708 - 4
2709 - 25
2710 title: 'Molecular structure of nucleic acids: a structure for deoxyribose
2711 nucleic acid'
2712 title-short: Molecular structure of nucleic acids
2713 container-title: Nature
2714 volume: 171
2715 issue: 4356
2716 page: 737-738
2717 DOI: 10.1038/171737a0
2718 URL: http://www.nature.com/nature/journal/v171/n4356/abs/171737a0.html
2719 language: en-GB
2720 ...
2722(`pandoc-citeproc --bib2yaml` can produce these from a bibliography file in one
2723of the supported formats.)
2725By default, `pandoc-citeproc` will use the Chicago Manual of Style author-date
2726format for citations and references. To use another style, you will need to
2727specify a [CSL] 1.0 style file in the `csl` metadata field. A repository of CSL
2728styles can be found at <https://github.com/citation-style-language/styles>. See
2729also <http://zotero.org/styles> for easy browsing. A primer on creating and
2730modifying CSL styles can be found at
2731<http://citationstyles.org/downloads/primer.html>.
2733Citations go inside square brackets and are separated by semicolons.
2734Each citation must have a key, composed of '@' + the citation
2735identifier from the database, and may optionally have a prefix,
2736a locator, and a suffix. The citation key must begin with a letter, digit,
2737or `_`, and may contain alphanumerics, `_`, and internal punctuation
2738characters (`:.#$%&-+?<>~/`). Here are some examples:
2740 Blah blah [see @doe99, pp. 33-35; also @smith04, ch. 1].
2742 Blah blah [@doe99, pp. 33-35, 38-39 and *passim*].
2744 Blah blah [@smith04; @doe99].
2746A minus sign (`-`) before the `@` will suppress mention of
2747the author in the citation. This can be useful when the
2748author is already mentioned in the text:
2750 Smith says blah [-@smith04].
2752You can also write an in-text citation, as follows:
2754 @smith04 says blah.
2756 @smith04 [p. 33] says blah.
2758If the style calls for a list of works cited, it will be placed
2759at the end of the document. Normally, you will want to end your
2760document with an appropriate header:
2762 last paragraph...
2764 # References
2766The bibliography will be inserted after this header. Note that
2767the `unnumbered` class will be added to this header, so that the
2768section will not be numbered.
2770If you want to include items in the bibliography without actually
2771citing them in the body text, you can define a dummy `nocite` metadata
2772field and put the citations there:
2774 ---
2775 nocite: |
2776 @item1, @item2
2777 ...
2779 @item3
2781In this example, the document will contain a citation for `item3`
2782only, but the bibliography will contain entries for `item1`, `item2`, and
2783`item3`.
2785Non-pandoc extensions
2786---------------------
2788The following markdown syntax extensions are not enabled by default
2789in pandoc, but may be enabled by adding `+EXTENSION` to the format
2790name, where `EXTENSION` is the name of the extension. Thus, for
2791example, `markdown+hard_line_breaks` is markdown with hard line breaks.
2793#### Extension: `lists_without_preceding_blankline` ####
2795Allow a list to occur right after a paragraph, with no intervening
2796blank space.
2798#### Extension: `hard_line_breaks` ####
2800Causes all newlines within a paragraph to be interpreted as hard line
2801breaks instead of spaces.
2803#### Extension: `ignore_line_breaks` ####
2805Causes newlines within a paragraph to be ignored, rather than being
2806treated as spaces or as hard line breaks. This option is intended for
2807use with East Asian languages where spaces are not used between words,
2808but text is divided into lines for readability.
2810#### Extension: `tex_math_single_backslash` ####
2812Causes anything between `\(` and `\)` to be interpreted as inline
2813TeX math, and anything between `\[` and `\]` to be interpreted
2814as display TeX math. Note: a drawback of this extension is that
2815it precludes escaping `(` and `[`.
2817#### Extension: `tex_math_double_backslash` ####
2819Causes anything between `\\(` and `\\)` to be interpreted as inline
2820TeX math, and anything between `\\[` and `\\]` to be interpreted
2821as display TeX math.
2823#### Extension: `markdown_attribute` ####
2825By default, pandoc interprets material inside block-level tags as markdown.
2826This extension changes the behavior so that markdown is only parsed
2827inside block-level tags if the tags have the attribute `markdown=1`.
2829#### Extension: `mmd_title_block` ####
2831Enables a [MultiMarkdown] style title block at the top of
2832the document, for example:
2834 Title: My title
2835 Author: John Doe
2836 Date: September 1, 2008
2837 Comment: This is a sample mmd title block, with
2838 a field spanning multiple lines.
2840See the MultiMarkdown documentation for details. If `pandoc_title_block` or
2841`yaml_metadata_block` is enabled, it will take precedence over
2842`mmd_title_block`.
2844 [MultiMarkdown]: http://fletcherpenney.net/multimarkdown/
2846#### Extension: `abbreviations` ####
2848Parses PHP Markdown Extra abbreviation keys, like
2850 *[HTML]: Hyper Text Markup Language
2852Note that the pandoc document model does not support
2853abbreviations, so if this extension is enabled, abbreviation keys are
2854simply skipped (as opposed to being parsed as paragraphs).
2856#### Extension: `autolink_bare_uris` ####
2858Makes all absolute URIs into links, even when not surrounded by
2859pointy braces `<...>`.
2861#### Extension: `ascii_identifiers` ####
2863Causes the identifiers produced by `auto_identifiers` to be pure ASCII.
2864Accents are stripped off of accented latin letters, and non-latin
2865letters are omitted.
2867#### Extension: `link_attributes` ####
2869Parses multimarkdown style key-value attributes on link and image references.
2870Note that pandoc's internal document model provides nowhere to put
2871these, so they are presently just ignored.
2873#### Extension: `mmd_header_identifiers` ####
2875Parses multimarkdown style header identifiers (in square brackets,
2876after the header but before any trailing `#`s in an ATX header).
2878#### Extension: `compact_definition_lists` ####
2880Activates the definition list syntax of pandoc 1.12.x and earlier.
2881This syntax differs from the one described [above](#definition-lists)
2882in several respects:
2884 - No blank line is required between consecutive items of the
2885 definition list.
2886 - To get a "tight" or "compact" list, omit space between consecutive
2887 items; the space between a term and its definition does not affect
2888 anything.
2889 - Lazy wrapping of paragraphs is not allowed: the entire definition must
2890 be indented four spaces.[^6]
2892[^6]: To see why laziness is incompatible with relaxing the requirement
2893 of a blank line between items, consider the following example:
2895 bar
2896 : definition
2897 foo
2898 : definition
2900 Is this a single list item with two definitions of "bar," the first of
2901 which is lazily wrapped, or two list items? To remove the ambiguity
2902 we must either disallow lazy wrapping or require a blank line between
2903 list items.
2905Markdown variants
2906-----------------
2908In addition to pandoc's extended markdown, the following markdown
2909variants are supported:
2911`markdown_phpextra` (PHP Markdown Extra)
2912: `footnotes`, `pipe_tables`, `raw_html`, `markdown_attribute`,
2913 `fenced_code_blocks`, `definition_lists`, `intraword_underscores`,
2914 `header_attributes`, `abbreviations`.
2916`markdown_github` (GitHub-flavored Markdown)
2917: `pipe_tables`, `raw_html`, `tex_math_single_backslash`,
2918 `fenced_code_blocks`, `auto_identifiers`,
2919 `ascii_identifiers`, `backtick_code_blocks`, `autolink_bare_uris`,
2920 `intraword_underscores`, `strikeout`, `hard_line_breaks`
2922`markdown_mmd` (MultiMarkdown)
2923: `pipe_tables` `raw_html`, `markdown_attribute`, `link_attributes`,
2924 `raw_tex`, `tex_math_double_backslash`, `intraword_underscores`,
2925 `mmd_title_block`, `footnotes`, `definition_lists`,
2926 `all_symbols_escapable`, `implicit_header_references`,
2927 `auto_identifiers`, `mmd_header_identifiers`
2929`markdown_strict` (Markdown.pl)
2930: `raw_html`
2932Extensions with formats other than markdown
2933-------------------------------------------
2935Some of the extensions discussed above can be used with formats
2936other than markdown:
2938* `auto_identifiers` can be used with `latex`, `rst`, `mediawiki`,
2939 and `textile` input (and is used by default).
2941* `tex_math_dollars`, `tex_math_single_backslash`, and
2942 `tex_math_double_backslash` can be used with `html` input.
2943 (This is handy for reading web pages formatted using MathJax,
2944 for example.)
2946Producing slide shows with Pandoc
2947=================================
2949You can use Pandoc to produce an HTML + javascript slide presentation
2950that can be viewed via a web browser. There are five ways to do this,
2951using [S5], [DZSlides], [Slidy], [Slideous], or [reveal.js].
2952You can also produce a PDF slide show using LaTeX [beamer].
2954Here's the markdown source for a simple slide show, `habits.txt`:
2956 % Habits
2957 % John Doe
2958 % March 22, 2005
2960 # In the morning
2962 ## Getting up
2964 - Turn off alarm
2965 - Get out of bed
2967 ## Breakfast
2969 - Eat eggs
2970 - Drink coffee
2972 # In the evening
2974 ## Dinner
2976 - Eat spaghetti
2977 - Drink wine
2979 ------------------
2981 ![picture of spaghetti](images/spaghetti.jpg)
2983 ## Going to sleep
2985 - Get in bed
2986 - Count sheep
2988To produce an HTML/javascript slide show, simply type
2990 pandoc -t FORMAT -s habits.txt -o habits.html
2992where `FORMAT` is either `s5`, `slidy`, `slideous`, `dzslides`, or `revealjs`.
2994For Slidy, Slideous, reveal.js, and S5, the file produced by pandoc with the
2995`-s/--standalone` option embeds a link to javascripts and CSS files, which are
2996assumed to be available at the relative path `s5/default` (for S5), `slideous`
2997(for Slideous), `reveal.js` (for reveal.js), or at the Slidy website at
2998`w3.org` (for Slidy). (These paths can be changed by setting the `slidy-url`,
2999`slideous-url`, `revealjs-url`, or `s5-url` variables; see `--variable`,
3000above.) For DZSlides, the (relatively short) javascript and css are included in
3001the file by default.
3003With all HTML slide formats, the `--self-contained` option can be used to
3004produce a single file that contains all of the data necessary to display the
3005slide show, including linked scripts, stylesheets, images, and videos.
3007To produce a PDF slide show using beamer, type
3009 pandoc -t beamer habits.txt -o habits.pdf
3011Note that a reveal.js slide show can also be converted to a PDF
3012by printing it to a file from the browser.
3014Structuring the slide show
3015--------------------------
3017By default, the *slide level* is the highest header level in
3018the hierarchy that is followed immediately by content, and not another
3019header, somewhere in the document. In the example above, level 1 headers
3020are always followed by level 2 headers, which are followed by content,
3021so 2 is the slide level. This default can be overridden using
3022the `--slide-level` option.
3024The document is carved up into slides according to the following
3025rules:
3027 * A horizontal rule always starts a new slide.
3029 * A header at the slide level always starts a new slide.
3031 * Headers *below* the slide level in the hierarchy create
3032 headers *within* a slide.
3034 * Headers *above* the slide level in the hierarchy create
3035 "title slides," which just contain the section title
3036 and help to break the slide show into sections.
3038 * A title page is constructed automatically from the document's title
3039 block, if present. (In the case of beamer, this can be disabled
3040 by commenting out some lines in the default template.)
3042These rules are designed to support many different styles of slide show. If
3043you don't care about structuring your slides into sections and subsections,
3044you can just use level 1 headers for all each slide. (In that case, level 1
3045will be the slide level.) But you can also structure the slide show into
3046sections, as in the example above.
3048Note: in reveal.js slide shows, if slide level is 2, a two-dimensional
3049layout will be produced, with level 1 headers building horizontally
3050and level 2 headers building vertically. It is not recommended that
3051you use deeper nesting of section levels with reveal.js.
3053Incremental lists
3054-----------------
3056By default, these writers produces lists that display "all at once."
3057If you want your lists to display incrementally (one item at a time),
3058use the `-i` option. If you want a particular list to depart from the
3059default (that is, to display incrementally without the `-i` option and
3060all at once with the `-i` option), put it in a block quote:
3062 > - Eat spaghetti
3063 > - Drink wine
3065In this way incremental and nonincremental lists can be mixed in
3066a single document.
3068Inserting pauses
3069----------------
3071You can add "pauses" within a slide by including a paragraph containing
3072three dots, separated by spaces:
3074 # Slide with a pause
3076 content before the pause
3078 . . .
3080 content after the pause
3082Styling the slides
3083------------------
3085You can change the style of HTML slides by putting customized CSS files
3086in `$DATADIR/s5/default` (for S5), `$DATADIR/slidy` (for Slidy),
3087or `$DATADIR/slideous` (for Slideous),
3088where `$DATADIR` is the user data directory (see `--data-dir`, above).
3089The originals may be found in pandoc's system data directory (generally
3090`$CABALDIR/pandoc-VERSION/s5/default`). Pandoc will look there for any
3091files it does not find in the user data directory.
3093For dzslides, the CSS is included in the HTML file itself, and may
3094be modified there.
3096For reveal.js, themes can be used by setting the `theme` variable,
3097for example:
3099 -V theme=moon
3101Or you can specify a custom stylesheet using the `--css` option.
3103To style beamer slides, you can specify a beamer "theme" or "colortheme"
3104using the `-V` option:
3106 pandoc -t beamer habits.txt -V theme:Warsaw -o habits.pdf
3108Note that header attributes will turn into slide attributes
3109(on a `<div>` or `<section>`) in HTML slide formats, allowing you
3110to style individual slides. In Beamer, the only header attribute
3111that affects slides is the `allowframebreaks` class, which sets the
3112`allowframebreaks` option, causing multiple slides to be created
3113if the content overfills the frame. This is recommended especially for
3114bibliographies:
3116 # References {.allowframebreaks}
3118Speaker notes
3119-------------
3121reveal.js has good support for speaker notes. You can add notes to your
3122markdown document thus:
3124 <div class="notes">
3125 This is my note.
3127 - It can contain markdown
3128 - like this list
3130 </div>
3132To show the notes window, press `s` while viewing the presentation.
3133Notes are not yet supported for other slide formats, but the notes
3134will not appear on the slides themselves.
3136EPUB Metadata
3137=============
3139EPUB metadata may be specified using the `--epub-metadata` option, but
3140if the source document is markdown, it is better to use a YAML metadata
3141block. Here is an example:
3143 ---
3144 title:
3145 - type: main
3146 text: My Book
3147 - type: subtitle
3148 text: An investigation of metadata
3149 creator:
3150 - role: author
3151 text: John Smith
3152 - role: editor
3153 text: Sarah Jones
3154 identifier:
3155 - scheme: DOI
3156 text: doi:10.234234.234/33
3157 publisher: My Press
3158 rights: © 2007 John Smith, CC BY-NC
3159 ...
3161The following fields are recognized:
3163`identifier`
3164 ~ Either a string value or an object with fields `text` and
3165 `scheme`. Valid values for `scheme` are `ISBN-10`,
3166 `GTIN-13`, `UPC`, `ISMN-10`, `DOI`, `LCCN`, `GTIN-14`,
3167 `ISBN-13`, `Legal deposit number`, `URN`, `OCLC`,
3168 `ISMN-13`, `ISBN-A`, `JP`, `OLCC`.
3170`title`
3171 ~ Either a string value, or an object with fields `file-as` and
3172 `type`, or a list of such objects. Valid values for `type` are
3173 `main`, `subtitle`, `short`, `collection`, `edition`, `extended`.
3175`creator`
3176 ~ Either a string value, or an object with fields `role`, `file-as`,
3177 and `text`, or a list of such objects. Valid values for `role` are
3178 [marc relators](http://www.loc.gov/marc/relators/relaterm.html), but
3179 pandoc will attempt to translate the human-readable versions
3180 (like "author" and "editor") to the appropriate marc relators.
3182`contributor`
3183 ~ Same format as `creator`.
3185`date`
3186 ~ A string value in `YYYY-MM-DD` format. (Only the year is necessary.)
3187 Pandoc will attempt to convert other common date formats.
3189`language`
3190 ~ A string value in [RFC5646] format. Pandoc will default to the local
3191 language if nothing is specified.
3193`subject`
3194 ~ A string value or a list of such values.
3196`description`
3197 ~ A string value.
3199`type`
3200 ~ A string value.
3202`format`
3203 ~ A string value.
3205`relation`
3206 ~ A string value.
3208`coverage`
3209 ~ A string value.
3211`rights`
3212 ~ A string value.
3214`cover-image`
3215 ~ A string value (path to cover image).
3217`stylesheet`
3218 ~ A string value (path to CSS stylesheet).
3220`page-progression-direction`
3221 ~ Either `ltr` or `rtl`. Specifies the `page-progression-direction`
3222 spine [attribute][EPUBspine].
3224Literate Haskell support
3225========================
3227If you append `+lhs` (or `+literate_haskell`) to an appropriate input or output
3228format (`markdown`, `markdown_strict`, `rst`, or `latex` for input or output;
3229`beamer`, `html` or `html5` for output only), pandoc will treat the document as
3230literate Haskell source. This means that
3232 - In markdown input, "bird track" sections will be parsed as Haskell
3233 code rather than block quotations. Text between `\begin{code}`
3234 and `\end{code}` will also be treated as Haskell code.
3236 - In markdown output, code blocks with classes `haskell` and `literate`
3237 will be rendered using bird tracks, and block quotations will be
3238 indented one space, so they will not be treated as Haskell code.
3239 In addition, headers will be rendered setext-style (with underlines)
3240 rather than atx-style (with '#' characters). (This is because ghc
3241 treats '#' characters in column 1 as introducing line numbers.)
3243 - In restructured text input, "bird track" sections will be parsed
3244 as Haskell code.
3246 - In restructured text output, code blocks with class `haskell` will
3247 be rendered using bird tracks.
3249 - In LaTeX input, text in `code` environments will be parsed as
3250 Haskell code.
3252 - In LaTeX output, code blocks with class `haskell` will be rendered
3253 inside `code` environments.
3255 - In HTML output, code blocks with class `haskell` will be rendered
3256 with class `literatehaskell` and bird tracks.
3258Examples:
3260 pandoc -f markdown+lhs -t html
3262reads literate Haskell source formatted with markdown conventions and writes
3263ordinary HTML (without bird tracks).
3265 pandoc -f markdown+lhs -t html+lhs
3267writes HTML with the Haskell code in bird tracks, so it can be copied
3268and pasted as literate Haskell source.
3270Custom writers
3271==============
3273Pandoc can be extended with custom writers written in [lua]. (Pandoc
3274includes a lua interpreter, so lua need not be installed separately.)
3276To use a custom writer, simply specify the path to the lua script
3277in place of the output format. For example:
3279 pandoc -t data/sample.lua
3281Creating a custom writer requires writing a lua function for each
3282possible element in a pandoc document. To get a documented example
3283which you can modify according to your needs, do
3285 pandoc --print-default-data-file sample.lua
3287Authors
3288=======
3290© 2006-2013 John MacFarlane (jgm at berkeley dot edu). Released under the
3291[GPL], version 2 or greater. This software carries no warranty of
3292any kind. (See COPYRIGHT for full copyright and warranty notices.)
3293Other contributors include Recai Oktaş, Paulo Tanimoto, Peter Wang,
3294Andrea Rossato, Eric Kow, infinity0x, Luke Plant, shreevatsa.public,
3295Puneeth Chaganti, Paul Rivier, rodja.trappe, Bradley Kuhn, thsutton,
3296Nathan Gass, Jonathan Daugherty, Jérémy Bobbio, Justin Bogner, qerub,
3297Christopher Sawicki, Kelsey Hightower, Masayoshi Takahashi, Antoine
3298Latter, Ralf Stephan, Eric Seidel, B. Scott Michel, Gavin Beatty,
3299Sergey Astanin, Arlo O'Keeffe, Denis Laxalde, Brent Yorgey, David Lazar,
3300Jamie F. Olson, Matthew Pickering, Albert Krewinkel, mb21, Jesse
3301Rosenthal.
3303[markdown]: http://daringfireball.net/projects/markdown/
3304[reStructuredText]: http://docutils.sourceforge.net/docs/ref/rst/introduction.html
3305[S5]: http://meyerweb.com/eric/tools/s5/
3306[Slidy]: http://www.w3.org/Talks/Tools/Slidy/
3307[Slideous]: http://goessner.net/articles/slideous/
3308[HTML]: http://www.w3.org/TR/html40/
3309[HTML 5]: http://www.w3.org/TR/html5/
3310[XHTML]: http://www.w3.org/TR/xhtml1/
3311[LaTeX]: http://www.latex-project.org/
3312[beamer]: http://www.tex.ac.uk/CTAN/macros/latex/contrib/beamer
3313[ConTeXt]: http://www.pragma-ade.nl/
3314[RTF]: http://en.wikipedia.org/wiki/Rich_Text_Format
3315[DocBook]: http://www.docbook.org/
3316[OPML]: http://dev.opml.org/spec2.html
3317[OpenDocument]: http://opendocument.xml.org/
3318[ODT]: http://en.wikipedia.org/wiki/OpenDocument
3319[Textile]: http://redcloth.org/textile
3320[MediaWiki markup]: http://www.mediawiki.org/wiki/Help:Formatting
3321[DokuWiki markup]: https://www.dokuwiki.org/dokuwiki
3322[TWiki markup]: http://twiki.org/cgi-bin/view/TWiki/TextFormattingRules
3323[Haddock markup]: http://www.haskell.org/haddock/doc/html/ch03s08.html
3324[groff man]: http://developer.apple.com/DOCUMENTATION/Darwin/Reference/ManPages/man7/groff_man.7.html
3325[Haskell]: http://www.haskell.org/
3326[GNU Texinfo]: http://www.gnu.org/software/texinfo/
3327[Emacs Org-Mode]: http://orgmode.org
3328[AsciiDoc]: http://www.methods.co.nz/asciidoc/
3329[GPL]: http://www.gnu.org/copyleft/gpl.html "GNU General Public License"
3330[DZSlides]: http://paulrouget.com/dzslides/
3331[ISO 8601 format]: http://www.w3.org/TR/NOTE-datetime
3332[Word docx]: http://www.microsoft.com/interop/openup/openxml/default.aspx
3333[PDF]: http://www.adobe.com/pdf/
3334[reveal.js]: http://lab.hakim.se/reveal-js/
3335[FictionBook2]: http://www.fictionbook.org/index.php/Eng:XML_Schema_Fictionbook_2.1
3336[lua]: http://www.lua.org
3337[marc relators]: http://www.loc.gov/marc/relators/relaterm.html
3338[RFC5646]: http://tools.ietf.org/html/rfc5646
3339[InDesign ICML]: https://www.adobe.com/content/dam/Adobe/en/devnet/indesign/cs55-docs/IDML/idml-specification.pdf
3340[txt2tags]: http://txt2tags.org/
3341[EPUB]: http://idpf.org/epub
3342[EPUBspine]: http://www.idpf.org/epub/301/spec/epub-publications.html#sec-spine-elem
3343[KaTeX]: https://github.com/Khan/KaTeX
3344[CommonMark]: http://commonmark.org