git.iko.soy/typeable/pandoc
on 1.12.0.2 help sign in
2845 lines 102 kB history raw
1% Pandoc User's Guide
2% John MacFarlane
3% January 19, 2013
5Synopsis
6========
8pandoc [*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] and (subsets of) [Textile], [reStructuredText], [HTML],
16[LaTeX], [MediaWiki markup], [Haddock markup], [OPML], and [DocBook]; and
17it can write plain text, [markdown], [reStructuredText], [XHTML], [HTML 5],
18[LaTeX] (including [beamer] slide shows), [ConTeXt], [RTF], [OPML], [DocBook],
19[OpenDocument], [ODT], [Word docx], [GNU Texinfo], [MediaWiki markup],
20[EPUB] (v2 or v3), [FictionBook2], [Textile], [groff man] pages, [Emacs
21Org-Mode], [AsciiDoc], and [Slidy], [Slideous], [DZSlides], [reveal.js]
22or [S5] HTML slide shows. It can also produce [PDF] output on systems
23where LaTeX is installed.
25Pandoc's enhanced version of markdown includes syntax for footnotes,
26tables, flexible ordered lists, definition lists, fenced code blocks,
27superscript, subscript, strikeout, title blocks, automatic tables of
28contents, embedded LaTeX math, citations, and markdown inside HTML block
29elements. (These enhancements, described below under
30[Pandoc's markdown](#pandocs-markdown), can be disabled using the
31`markdown_strict` input or output format.)
33In contrast to most existing tools for converting markdown to HTML, which
34use regex substitutions, Pandoc has a modular design: it consists of a
35set of readers, which parse text in a given format and produce a native
36representation of the document, and a set of writers, which convert
37this native representation into a target format. Thus, adding an input
38or output format requires only adding a reader or writer.
40Using `pandoc`
41--------------
43If no *input-file* is specified, input is read from *stdin*.
44Otherwise, the *input-files* are concatenated (with a blank
45line between each) and used as input. Output goes to *stdout* by
46default (though output to *stdout* is disabled for the `odt`, `docx`,
47`epub`, and `epub3` output formats). For output to a file, use the
48`-o` option:
50 pandoc -o output.html input.txt
52Instead of a file, an absolute URI may be given. In this case
53pandoc will fetch the content using HTTP:
55 pandoc -f html -t markdown http://www.fsf.org
57If multiple input files are given, `pandoc` will concatenate them all (with
58blank lines between them) before parsing.
60The format of the input and output can be specified explicitly using
61command-line options. The input format can be specified using the
62`-r/--read` or `-f/--from` options, the output format using the
63`-w/--write` or `-t/--to` options. Thus, to convert `hello.txt` from
64markdown to LaTeX, you could type:
66 pandoc -f markdown -t latex hello.txt
68To convert `hello.html` from html to markdown:
70 pandoc -f html -t markdown hello.html
72Supported output formats are listed below under the `-t/--to` option.
73Supported input formats are listed below under the `-f/--from` option. Note
74that the `rst`, `textile`, `latex`, and `html` readers are not complete;
75there are some constructs that they do not parse.
77If the input or output format is not specified explicitly, `pandoc`
78will attempt to guess it from the extensions of
79the input and output filenames. Thus, for example,
81 pandoc -o hello.tex hello.txt
83will convert `hello.txt` from markdown to LaTeX. If no output file
84is specified (so that output goes to *stdout*), or if the output file's
85extension is unknown, the output format will default to HTML.
86If no input file is specified (so that input comes from *stdin*), or
87if the input files' extensions are unknown, the input format will
88be assumed to be markdown unless explicitly specified.
90Pandoc uses the UTF-8 character encoding for both input and output.
91If your local character encoding is not UTF-8, you
92should pipe input and output through `iconv`:
94 iconv -t utf-8 input.txt | pandoc | iconv -f utf-8
96Creating a PDF
97--------------
99Earlier versions of pandoc came with a program, `markdown2pdf`, that
100used pandoc and pdflatex to produce a PDF. This is no longer needed,
101since `pandoc` can now produce `pdf` output itself. To produce a PDF, simply
102specify an output file with a `.pdf` extension. Pandoc will create a latex
103file and use pdflatex (or another engine, see `--latex-engine`) to convert it
104to PDF:
106 pandoc test.txt -o test.pdf
108Production of a PDF requires that a LaTeX engine be installed (see
109`--latex-engine`, below), and assumes that the following LaTeX packages are
110available: `amssymb`, `amsmath`, `ifxetex`, `ifluatex`, `listings` (if the
111`--listings` option is used), `fancyvrb`, `longtable`, `url`,
112`graphicx`, `hyperref`, `ulem`, `babel` (if the `lang` variable is set),
113`fontspec` (if `xelatex` or `lualatex` is used as the LaTeX engine), `xltxtra`
114and `xunicode` (if `xelatex` is used).
116`hsmarkdown`
117------------
119A user who wants a drop-in replacement for `Markdown.pl` may create
120a symbolic link to the `pandoc` executable called `hsmarkdown`. When
121invoked under the name `hsmarkdown`, `pandoc` will behave as if
122invoked with `-f markdown_strict --email-obfuscation=references`,
123and all command-line options will be treated as regular arguments.
124However, this approach does not work under Cygwin, due to problems with
125its simulation of symbolic links.
127[Cygwin]: http://www.cygwin.com/
128[`iconv`]: http://www.gnu.org/software/libiconv/
129[CTAN]: http://www.ctan.org "Comprehensive TeX Archive Network"
130[TeX Live]: http://www.tug.org/texlive/
131[MacTeX]: http://www.tug.org/mactex/
133Options
134=======
136General options
137---------------
139`-f` *FORMAT*, `-r` *FORMAT*, `--from=`*FORMAT*, `--read=`*FORMAT*
140: Specify input format. *FORMAT* can be `native` (native Haskell),
141 `json` (JSON version of native AST), `markdown` (pandoc's
142 extended markdown), `markdown_strict` (original unextended markdown),
143 `markdown_phpextra` (PHP Markdown Extra extended markdown),
144 `markdown_github` (github extended markdown),
145 `textile` (Textile), `rst` (reStructuredText), `html` (HTML),
146 `docbook` (DocBook), `opml` (OPML), `mediawiki` (MediaWiki markup),
147 `haddock` (Haddock markup), or `latex` (LaTeX).
148 If `+lhs` is appended to `markdown`, `rst`, `latex`, or `html`,
149 the input will be treated as literate Haskell source:
150 see [Literate Haskell support](#literate-haskell-support), below.
151 Markdown syntax extensions can be individually enabled or disabled
152 by appending `+EXTENSION` or `-EXTENSION` to the format name.
153 So, for example, `markdown_strict+footnotes+definition_lists`
154 is strict markdown with footnotes and definition lists enabled,
155 and `markdown-pipe_tables+hard_line_breaks` is pandoc's markdown
156 without pipe tables and with hard line breaks. See [Pandoc's
157 markdown](#pandocs-markdown), below, for a list of extensions and
158 their names.
160`-t` *FORMAT*, `-w` *FORMAT*, `--to=`*FORMAT*, `--write=`*FORMAT*
161: Specify output format. *FORMAT* can be `native` (native Haskell),
162 `json` (JSON version of native AST), `plain` (plain text),
163 `markdown` (pandoc's extended markdown), `markdown_strict` (original
164 unextended markdown), `markdown_phpextra` (PHP Markdown extra
165 extended markdown), `markdown_github` (github extended markdown),
166 `rst` (reStructuredText), `html` (XHTML 1), `html5` (HTML 5),
167 `latex` (LaTeX), `beamer` (LaTeX beamer slide show),
168 `context` (ConTeXt), `man` (groff man), `mediawiki` (MediaWiki markup),
169 `textile` (Textile), `org` (Emacs Org-Mode), `texinfo` (GNU Texinfo),
170 `opml` (OPML), `docbook` (DocBook), `opendocument` (OpenDocument), `odt`
171 (OpenOffice text document), `docx` (Word docx),
172 `rtf` (rich text format), `epub` (EPUB v2 book), `epub3`
173 (EPUB v3), `fb2` (FictionBook2 e-book), `asciidoc` (AsciiDoc), `slidy`
174 (Slidy HTML and javascript slide show), `slideous` (Slideous HTML and
175 javascript slide show), `dzslides` (DZSlides HTML5 + javascript slide
176 show), `revealjs` (reveal.js HTML5 + javascript slide show), `s5`
177 (S5 HTML and javascript slide show), or the path of a custom
178 lua writer (see [Custom writers](#custom-writers), below). Note that
179 `odt`, `epub`, and `epub3` output will not be directed to *stdout*; an
180 output filename must be specified using the `-o/--output` option. If
181 `+lhs` is appended to `markdown`, `rst`, `latex`, `beamer`, `html`, or
182 `html5`, the output will be rendered as literate Haskell source: see
183 [Literate Haskell support](#literate-haskell-support), below. Markdown
184 syntax extensions can be individually enabled or disabled by appending
185 `+EXTENSION` or `-EXTENSION` to the format name, as described above
186 under `-f`.
188`-o` *FILE*, `--output=`*FILE*
189: Write output to *FILE* instead of *stdout*. If *FILE* is
190 `-`, output will go to *stdout*. (Exception: if the output
191 format is `odt`, `docx`, `epub`, or `epub3`, output to stdout is disabled.)
193`--data-dir=`*DIRECTORY*
194: Specify the user data directory to search for pandoc data files.
195 If this option is not specified, the default user data directory
196 will be used. This is
198 $HOME/.pandoc
200 in unix,
202 C:\Documents And Settings\USERNAME\Application Data\pandoc
204 in Windows XP, and
206 C:\Users\USERNAME\AppData\Roaming\pandoc
208 in Windows 7. (You can find the default user data directory
209 on your system by looking at the output of `pandoc --version`.)
210 A `reference.odt`, `reference.docx`, `default.csl`,
211 `epub.css`, `templates`, `slidy`, `slideous`, or `s5` directory
212 placed in this directory will override pandoc's normal defaults.
214`-v`, `--version`
215: Print version.
217`-h`, `--help`
218: Show usage message.
220Reader options
221--------------
223`-R`, `--parse-raw`
224: Parse untranslatable HTML codes and LaTeX environments as raw HTML
225 or LaTeX, instead of ignoring them. Affects only HTML and LaTeX
226 input. Raw HTML can be printed in markdown, reStructuredText, HTML,
227 Slidy, Slideous, DZSlides, reveal.js, and S5 output; raw LaTeX
228 can be printed in markdown, reStructuredText, LaTeX, and ConTeXt output.
229 The default is for the readers to omit untranslatable HTML codes and
230 LaTeX environments. (The LaTeX reader does pass through untranslatable
231 LaTeX *commands*, even if `-R` is not specified.)
233`-S`, `--smart`
234: Produce typographically correct output, converting straight quotes
235 to curly quotes, `---` to em-dashes, `--` to en-dashes, and
236 `...` to ellipses. Nonbreaking spaces are inserted after certain
237 abbreviations, such as "Mr." (Note: This option is significant only when
238 the input format is `markdown`, `markdown_strict`, or `textile`. It
239 is selected automatically when the input format is `textile` or the
240 output format is `latex` or `context`, unless `--no-tex-ligatures`
241 is used.)
243`--old-dashes`
244: Selects the pandoc <= 1.8.2.1 behavior for parsing smart dashes: `-` before
245 a numeral is an en-dash, and `--` is an em-dash. This option is selected
246 automatically for `textile` input.
248`--base-header-level=`*NUMBER*
249: Specify the base level for headers (defaults to 1).
251`--indented-code-classes=`*CLASSES*
252: Specify classes to use for indented code blocks--for example,
253 `perl,numberLines` or `haskell`. Multiple classes may be separated
254 by spaces or commas.
256`--default-image-extension=`*EXTENSION*
257: Specify a default extension to use when image paths/URLs have no
258 extension. This allows you to use the same source for formats that
259 require different kinds of images. Currently this option only affects
260 the markdown and LaTeX readers.
262`--filter=`*EXECUTABLE*
263: Specify an executable to be used as a filter transforming the
264 Pandoc AST after the input is parsed and before the output is
265 written. The executable should read JSON from stdin and write
266 JSON to stdout. The JSON must be formatted like pandoc's own
267 JSON input and output. The name of the output format will be
268 passed to the filter as the first argument. Hence,
270 pandoc --filter ./caps.py -t latex
272 is equivalent to
274 pandoc -t json | ./caps.py latex | pandoc -f json -t latex
276 The latter form may be useful for debugging filters.
278 Filters may be written in any language. `Text.Pandoc.JSON`
279 exports `toJSONFilter` to facilitate writing filters in Haskell.
280 Those who would prefer to write filters in python can use the
281 module `pandocfilters`, installable from PyPI. See
282 <http://github.com/jgm/pandocfilters> for the module and several
283 examples. Note that the *EXECUTABLE* will be sought in the user's
284 `PATH`, and not in the working directory, if no directory is
285 provided. If you want to run a script in the working directory,
286 preface the filename with `./`.
288`-M` *KEY[=VAL]*, `--metadata=`*KEY[:VAL]*
289: Set the metadata field *KEY* to the value *VAL*. A value specified
290 on the command line overrides a value specified in the document.
291 Values will be parsed as YAML boolean or string values. If no value is
292 specified, the value will be treated as Boolean true. Like
293 `--variable`, `--metadata` causes template variables to be set.
294 But unlike `--variable`, `--metadata` affects the metadata of the
295 underlying document (which is accessible from filters and may be
296 printed in some output formats).
298`--normalize`
299: Normalize the document after reading: merge adjacent
300 `Str` or `Emph` elements, for example, and remove repeated `Space`s.
302`-p`, `--preserve-tabs`
303: Preserve tabs instead of converting them to spaces (the default).
304 Note that this will only affect tabs in literal code spans and code
305 blocks; tabs in regular text will be treated as spaces.
307`--tab-stop=`*NUMBER*
308: Specify the number of spaces per tab (default is 4).
310General writer options
311----------------------
313`-s`, `--standalone`
314: Produce output with an appropriate header and footer (e.g. a
315 standalone HTML, LaTeX, or RTF file, not a fragment). This option
316 is set automatically for `pdf`, `epub`, `epub3`, `fb2`, `docx`, and `odt`
317 output.
319`--template=`*FILE*
320: Use *FILE* as a custom template for the generated document. Implies
321 `--standalone`. See [Templates](#templates) below for a description
322 of template syntax. If no extension is specified, an extension
323 corresponding to the writer will be added, so that `--template=special`
324 looks for `special.html` for HTML output. If the template is not
325 found, pandoc will search for it in the user data directory
326 (see `--data-dir`). If this option is not used, a default
327 template appropriate for the output format will be used (see
328 `-D/--print-default-template`).
330`-V` *KEY[=VAL]*, `--variable=`*KEY[:VAL]*
331: Set the template variable *KEY* to the value *VAL* when rendering the
332 document in standalone mode. This is generally only useful when the
333 `--template` option is used to specify a custom template, since
334 pandoc automatically sets the variables used in the default
335 templates. If no *VAL* is specified, the key will be given the
336 value `true`.
338`-D` *FORMAT*, `--print-default-template=`*FORMAT*
339: Print the default template for an output *FORMAT*. (See `-t`
340 for a list of possible *FORMAT*s.)
342`--print-default-data-file=`*FILE*
343: Print a default data file.
345`--no-wrap`
346: Disable text wrapping in output. By default, text is wrapped
347 appropriately for the output format.
349`--columns`=*NUMBER*
350: Specify length of lines in characters (for text wrapping).
352`--toc`, `--table-of-contents`
353: Include an automatically generated table of contents (or, in
354 the case of `latex`, `context`, and `rst`, an instruction to create
355 one) in the output document. This option has no effect on `man`,
356 `docbook`, `slidy`, `slideous`, `s5`, `docx`, or `odt` output.
358`--toc-depth=`*NUMBER*
359: Specify the number of section levels to include in the table
360 of contents. The default is 3 (which means that level 1, 2, and 3
361 headers will be listed in the contents).
363`--no-highlight`
364: Disables syntax highlighting for code blocks and inlines, even when
365 a language attribute is given.
367`--highlight-style`=*STYLE*
368: Specifies the coloring style to be used in highlighted source code.
369 Options are `pygments` (the default), `kate`, `monochrome`,
370 `espresso`, `zenburn`, `haddock`, and `tango`.
372`-H` *FILE*, `--include-in-header=`*FILE*
373: Include contents of *FILE*, verbatim, at the end of the header.
374 This can be used, for example, to include special
375 CSS or javascript in HTML documents. This option can be used
376 repeatedly to include multiple files in the header. They will be
377 included in the order specified. Implies `--standalone`.
379`-B` *FILE*, `--include-before-body=`*FILE*
380: Include contents of *FILE*, verbatim, at the beginning of the
381 document body (e.g. after the `<body>` tag in HTML, or the
382 `\begin{document}` command in LaTeX). This can be used to include
383 navigation bars or banners in HTML documents. This option can be
384 used repeatedly to include multiple files. They will be included in
385 the order specified. Implies `--standalone`.
387`-A` *FILE*, `--include-after-body=`*FILE*
388: Include contents of *FILE*, verbatim, at the end of the document
389 body (before the `</body>` tag in HTML, or the
390 `\end{document}` command in LaTeX). This option can be be used
391 repeatedly to include multiple files. They will be included in the
392 order specified. Implies `--standalone`.
394Options affecting specific writers
395----------------------------------
397`--self-contained`
398: Produce a standalone HTML file with no external dependencies, using
399 `data:` URIs to incorporate the contents of linked scripts, stylesheets,
400 images, and videos. The resulting file should be "self-contained,"
401 in the sense that it needs no external files and no net access to be
402 displayed properly by a browser. This option works only with HTML output
403 formats, including `html`, `html5`, `html+lhs`, `html5+lhs`, `s5`,
404 `slidy`, `slideous`, `dzslides`, and `revealjs`. Scripts, images, and
405 stylesheets at absolute URLs will be downloaded; those at relative URLs
406 will be sought first relative to the working directory, then relative to
407 the user data directory (see `--data-dir`), and finally relative to
408 pandoc's default data directory. `--self-contained` does not
409 work with `--mathjax`.
411`--offline`
412: Deprecated synonym for `--self-contained`.
414`-5`, `--html5`
415: Produce HTML5 instead of HTML4. This option has no effect for writers
416 other than `html`. (*Deprecated:* Use the `html5` output format instead.)
418`--html-q-tags`
419: Use `<q>` tags for quotes in HTML.
421`--ascii`
422: Use only ascii characters in output. Currently supported only
423 for HTML output (which uses numerical entities instead of
424 UTF-8 when this option is selected).
426`--reference-links`
427: Use reference-style links, rather than inline links, in writing markdown
428 or reStructuredText. By default inline links are used.
430`--atx-headers`
431: Use ATX style headers in markdown and asciidoc output. The default is
432 to use setext-style headers for levels 1-2, and then ATX headers.
434`--chapters`
435: Treat top-level headers as chapters in LaTeX, ConTeXt, and DocBook
436 output. When the LaTeX template uses the report, book, or
437 memoir class, this option is implied. If `--beamer` is used,
438 top-level headers will become `\part{..}`.
440`-N`, `--number-sections`
441: Number section headings in LaTeX, ConTeXt, HTML, or EPUB output.
442 By default, sections are not numbered. Sections with class
443 `unnumbered` will never be numbered, even if `--number-sections`
444 is specified.
446`--number-offset`=*NUMBER[,NUMBER,...]*,
447: Offset for section headings in HTML output (ignored in other
448 output formats). The first number is added to the section number for
449 top-level headers, the second for second-level headers, and so on.
450 So, for example, if you want the first top-level header in your
451 document to be numbered "6", specify `--number-offset=5`.
452 If your document starts with a level-2 header which you want to
453 be numbered "1.5", specify `--number-offset=1,4`.
454 Offsets are 0 by default. Implies `--number-sections`.
456`--no-tex-ligatures`
457: Do not convert quotation marks, apostrophes, and dashes to
458 the TeX ligatures when writing LaTeX or ConTeXt. Instead, just
459 use literal unicode characters. This is needed for using advanced
460 OpenType features with XeLaTeX and LuaLaTeX. Note: normally
461 `--smart` is selected automatically for LaTeX and ConTeXt
462 output, but it must be specified explicitly if `--no-tex-ligatures`
463 is selected. If you use literal curly quotes, dashes, and ellipses
464 in your source, then you may want to use `--no-tex-ligatures`
465 without `--smart`.
467`--listings`
468: Use listings package for LaTeX code blocks
470`-i`, `--incremental`
471: Make list items in slide shows display incrementally (one by one).
472 The default is for lists to be displayed all at once.
474`--slide-level`=*NUMBER*
475: Specifies that headers with the specified level create
476 slides (for `beamer`, `s5`, `slidy`, `slideous`, `dzslides`). Headers
477 above this level in the hierarchy are used to divide the
478 slide show into sections; headers below this level create
479 subheads within a slide. The default is to set the slide level
480 based on the contents of the document; see
481 [Structuring the slide show](#structuring-the-slide-show), below.
483`--section-divs`
484: Wrap sections in `<div>` tags (or `<section>` tags in HTML5),
485 and attach identifiers to the enclosing `<div>` (or `<section>`)
486 rather than the header itself.
487 See [Section identifiers](#header-identifiers-in-html-latex-and-context), below.
489`--email-obfuscation=`*none|javascript|references*
490: Specify a method for obfuscating `mailto:` links in HTML documents.
491 *none* leaves `mailto:` links as they are. *javascript* obfuscates
492 them using javascript. *references* obfuscates them by printing their
493 letters as decimal or hexadecimal character references.
495`--id-prefix`=*STRING*
496: Specify a prefix to be added to all automatically generated identifiers
497 in HTML and DocBook output, and to footnote numbers in markdown output.
498 This is useful for preventing duplicate identifiers when generating
499 fragments to be included in other pages.
501`-T` *STRING*, `--title-prefix=`*STRING*
502: Specify *STRING* as a prefix at the beginning of the title
503 that appears in the HTML header (but not in the title as it
504 appears at the beginning of the HTML body). Implies
505 `--standalone`.
507`-c` *URL*, `--css=`*URL*
508: Link to a CSS style sheet. This option can be be used repeatedly to
509 include multiple files. They will be included in the order specified.
511`--reference-odt=`*FILE*
512: Use the specified file as a style reference in producing an ODT.
513 For best results, the reference ODT should be a modified version
514 of an ODT produced using pandoc. The contents of the reference ODT
515 are ignored, but its stylesheets are used in the new ODT. If no
516 reference ODT is specified on the command line, pandoc will look
517 for a file `reference.odt` in the user data directory (see
518 `--data-dir`). If this is not found either, sensible defaults will be
519 used.
521`--reference-docx=`*FILE*
522: Use the specified file as a style reference in producing a docx file.
523 For best results, the reference docx should be a modified version
524 of a docx file produced using pandoc. The contents of the reference docx
525 are ignored, but its stylesheets are used in the new docx. If no
526 reference docx is specified on the command line, pandoc will look
527 for a file `reference.docx` in the user data directory (see
528 `--data-dir`). If this is not found either, sensible defaults will be
529 used. The following styles are used by pandoc: [paragraph]
530 Normal, Compact, Title, Authors, Date, Heading 1, Heading 2, Heading 3,
531 Heading 4, Heading 5, Block Quote, Definition Term, Definition,
532 Body Text, Table Caption, Image Caption; [character] Default
533 Paragraph Font, Body Text Char, Verbatim Char, Footnote Ref,
534 Link.
536`--epub-stylesheet=`*FILE*
537: Use the specified CSS file to style the EPUB. If no stylesheet
538 is specified, pandoc will look for a file `epub.css` in the
539 user data directory (see `--data-dir`). If it is not
540 found there, sensible defaults will be used.
542`--epub-cover-image=`*FILE*
543: Use the specified image as the EPUB cover. It is recommended
544 that the image be less than 1000px in width and height.
546`--epub-metadata=`*FILE*
547: Look in the specified XML file for metadata for the EPUB.
548 The file should contain a series of Dublin Core elements,
549 as documented at <http://dublincore.org/documents/dces/>.
550 For example:
552 <dc:rights>Creative Commons</dc:rights>
553 <dc:language>es-AR</dc:language>
555 By default, pandoc will include the following metadata elements:
556 `<dc:title>` (from the document title), `<dc:creator>` (from the
557 document authors), `<dc:date>` (from the document date, which should
558 be in [ISO 8601 format]), `<dc:language>` (from the `lang`
559 variable, or, if is not set, the locale), and `<dc:identifier
560 id="BookId">` (a randomly generated UUID). Any of these may be
561 overridden by elements in the metadata file.
563`--epub-embed-font=`*FILE*
564: Embed the specified font in the EPUB. This option can be repeated
565 to embed multiple fonts. To use embedded fonts, you
566 will need to add declarations like the following to your CSS (see
567 `--epub-stylesheet`):
569 @font-face {
570 font-family: DejaVuSans;
571 font-style: normal;
572 font-weight: normal;
573 src:url("DejaVuSans-Regular.ttf");
574 }
575 @font-face {
576 font-family: DejaVuSans;
577 font-style: normal;
578 font-weight: bold;
579 src:url("DejaVuSans-Bold.ttf");
580 }
581 @font-face {
582 font-family: DejaVuSans;
583 font-style: italic;
584 font-weight: normal;
585 src:url("DejaVuSans-Oblique.ttf");
586 }
587 @font-face {
588 font-family: DejaVuSans;
589 font-style: italic;
590 font-weight: bold;
591 src:url("DejaVuSans-BoldOblique.ttf");
592 }
593 body { font-family: "DejaVuSans"; }
595`--epub-chapter-level=`*NUMBER*
596: Specify the header level at which to split the EPUB into separate
597 "chapter" files. The default is to split into chapters at level 1
598 headers. This option only affects the internal composition of the
599 EPUB, not the way chapters and sections are displayed to users. Some
600 readers may be slow if the chapter files are too large, so for large
601 documents with few level 1 headers, one might want to use a chapter
602 level of 2 or 3.
604`--latex-engine=`*pdflatex|lualatex|xelatex*
605: Use the specified LaTeX engine when producing PDF output.
606 The default is `pdflatex`. If the engine is not in your PATH,
607 the full path of the engine may be specified here.
609Citation rendering
610------------------
612`--bibliography=`*FILE*
613: Set the `bibliography` field in the document's metadata to *FILE*,
614 overriding any value set in the metadata, and process citations
615 using `pandoc-citeproc`. (This is equivalent to
616 `--metadata bibliography=FILE --filter pandoc-citeproc`.)
618`--csl=`*FILE*
619: Set the `csl` field in the document's metadata to *FILE*,
620 overriding any value set in the metadata. (This is equivalent to
621 `--metadata csl=FILE`.)
623`--citation-abbreviations=`*FILE*
624: Set the `citation-abbreviations` field in the document's metadata to
625 *FILE*, overriding any value set in the metadata. (This is equivalent to
626 `--metadata citation-abbreviations=FILE`.)
628`--natbib`
629: Use natbib for citations in LaTeX output.
631`--biblatex`
632: Use biblatex for citations in LaTeX output.
634Math rendering in HTML
635----------------------
637`-m` [*URL*], `--latexmathml`[=*URL*]
638: Use the [LaTeXMathML] script to display embedded TeX math in HTML output.
639 To insert a link to a local copy of the `LaTeXMathML.js` script,
640 provide a *URL*. If no *URL* is provided, the contents of the
641 script will be inserted directly into the HTML header, preserving
642 portability at the price of efficiency. If you plan to use math on
643 several pages, it is much better to link to a copy of the script,
644 so it can be cached.
646`--mathml`[=*URL*]
647: Convert TeX math to MathML (in `docbook` as well as `html` and `html5`).
648 In standalone `html` output, a small javascript (or a link to such a
649 script if a *URL* is supplied) will be inserted that allows the MathML to
650 be viewed on some browsers.
652`--jsmath`[=*URL*]
653: Use [jsMath] to display embedded TeX math in HTML output.
654 The *URL* should point to the jsMath load script (e.g.
655 `jsMath/easy/load.js`); if provided, it will be linked to in
656 the header of standalone HTML documents. If a *URL* is not provided,
657 no link to the jsMath load script will be inserted; it is then
658 up to the author to provide such a link in the HTML template.
660`--mathjax`[=*URL*]
661: Use [MathJax] to display embedded TeX math in HTML output.
662 The *URL* should point to the `MathJax.js` load script.
663 If a *URL* is not provided, a link to the MathJax CDN will
664 be inserted.
666`--gladtex`
667: Enclose TeX math in `<eq>` tags in HTML output. These can then
668 be processed by [gladTeX] to produce links to images of the typeset
669 formulas.
671`--mimetex`[=*URL*]
672: Render TeX math using the [mimeTeX] CGI script. If *URL* is not
673 specified, it is assumed that the script is at `/cgi-bin/mimetex.cgi`.
675`--webtex`[=*URL*]
676: Render TeX formulas using an external script that converts TeX
677 formulas to images. The formula will be concatenated with the URL
678 provided. If *URL* is not specified, the Google Chart API will be used.
680Options for wrapper scripts
681---------------------------
683`--dump-args`
684: Print information about command-line arguments to *stdout*, then exit.
685 This option is intended primarily for use in wrapper scripts.
686 The first line of output contains the name of the output file specified
687 with the `-o` option, or `-` (for *stdout*) if no output file was
688 specified. The remaining lines contain the command-line arguments,
689 one per line, in the order they appear. These do not include regular
690 Pandoc options and their arguments, but do include any options appearing
691 after a `--` separator at the end of the line.
693`--ignore-args`
694: Ignore command-line arguments (for use in wrapper scripts).
695 Regular Pandoc options are not ignored. Thus, for example,
697 pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1
699 is equivalent to
701 pandoc -o foo.html -s
703[LaTeXMathML]: http://math.etsu.edu/LaTeXMathML/
704[jsMath]: http://www.math.union.edu/~dpvc/jsmath/
705[MathJax]: http://www.mathjax.org/
706[gladTeX]: http://ans.hsh.no/home/mgg/gladtex/
707[mimeTeX]: http://www.forkosh.com/mimetex.html
708[CSL]: http://CitationStyles.org
710Templates
711=========
713When the `-s/--standalone` option is used, pandoc uses a template to
714add header and footer material that is needed for a self-standing
715document. To see the default template that is used, just type
717 pandoc -D FORMAT
719where `FORMAT` is the name of the output format. A custom template
720can be specified using the `--template` option. You can also override
721the system default templates for a given output format `FORMAT`
722by putting a file `templates/default.FORMAT` in the user data
723directory (see `--data-dir`, above). *Exceptions:* For `odt` output,
724customize the `default.opendocument` template. For `pdf` output,
725customize the `default.latex` template.
727Templates may contain *variables*. Variable names are sequences of
728alphanumerics, `-`, and `_`, starting with a letter. A variable name
729surrounded by `$` signs will be replaced by its value. For example,
730the string `$title$` in
732 <title>$title$</title>
734will be replaced by the document title.
736To write a literal `$` in a template, use `$$`.
738Some variables are set automatically by pandoc. These vary somewhat
739depending on the output format, but include metadata fields (such
740as `title`, `author`, and `date`) as well as the following:
742`header-includes`
743: contents specified by `-H/--include-in-header` (may have multiple
744 values)
745`toc`
746: non-null value if `--toc/--table-of-contents` was specified
747`include-before`
748: contents specified by `-B/--include-before-body` (may have
749 multiple values)
750`include-after`
751: contents specified by `-A/--include-after-body` (may have
752 multiple values)
753`body`
754: body of document
755`lang`
756: language code for HTML or LaTeX documents
757`slidy-url`
758: base URL for Slidy documents (defaults to
759 `http://www.w3.org/Talks/Tools/Slidy2`)
760`slideous-url`
761: base URL for Slideous documents (defaults to `default`)
762`s5-url`
763: base URL for S5 documents (defaults to `ui/default`)
764`revealjs-url`
765: base URL for reveal.js documents (defaults to `reveal.js`)
766`theme`
767: reveal.js or LaTeX beamer theme
768`transition`
769: reveal.js transition
770`fontsize`
771: font size (10pt, 11pt, 12pt) for LaTeX documents
772`documentclass`
773: document class for LaTeX documents
774`classoption`
775: option for LaTeX documentclass, e.g. `oneside`; may be repeated
776 for multiple options
777`geometry`
778: options for LaTeX `geometry` class, e.g. `margin=1in`;
779 may be repeated for multiple options
780`mainfont`, `sansfont`, `monofont`, `mathfont`
781: fonts for LaTeX documents (works only with xelatex
782 and lualatex)
783`colortheme`
784: colortheme for LaTeX beamer documents
785`fonttheme`
786: fonttheme for LaTeX beamer documents
787`linkcolor`
788: color for internal links in LaTeX documents (`red`, `green`,
789 `magenta`, `cyan`, `blue`, `black`)
790`urlcolor`
791: color for external links in LaTeX documents
792`citecolor`
793: color for citation links in LaTeX documents
794`links-as-notes`
795: causes links to be printed as footnotes in LaTeX documents
796`biblio-style`
797: bibliography style in LaTeX, when used with `--natbib`
798`section`
799: section number in man pages
800`header`
801: header in man pages
802`footer`
803: footer in man pages
805Variables may be set at the command line using the `-V/--variable`
806option. Variables set in this way override metadata fields with
807the same name.
809Templates may contain conditionals. The syntax is as follows:
811 $if(variable)$
812 X
813 $else$
814 Y
815 $endif$
817This will include `X` in the template if `variable` has a non-null
818value; otherwise it will include `Y`. `X` and `Y` are placeholders for
819any valid template text, and may include interpolated variables or other
820conditionals. The `$else$` section may be omitted.
822When variables can have multiple values (for example, `author` in
823a multi-author document), you can use the `$for$` keyword:
825 $for(author)$
826 <meta name="author" content="$author$" />
827 $endfor$
829You can optionally specify a separator to be used between
830consecutive items:
832 $for(author)$$author$$sep$, $endfor$
834A dot can be used to select a field of a variable that takes
835an object as its value. So, for example:
837 $author.name$ ($author.affiliation$)
839If you use custom templates, you may need to revise them as pandoc
840changes. We recommend tracking the changes in the default templates,
841and modifying your custom templates accordingly. An easy way to do this
842is to fork the pandoc-templates repository
843(<http://github.com/jgm/pandoc-templates>) and merge in changes after each
844pandoc release.
846Pandoc's markdown
847=================
849Pandoc understands an extended and slightly revised version of
850John Gruber's [markdown] syntax. This document explains the syntax,
851noting differences from standard markdown. Except where noted, these
852differences can be suppressed by using the `markdown_strict` format instead
853of `markdown`. An extensions can be enabled by adding `+EXTENSION`
854to the format name and disabled by adding `-EXTENSION`. For example,
855`markdown_strict+footnotes` is strict markdown with footnotes
856enabled, while `markdown-footnotes-pipe_tables` is pandoc's
857markdown without footnotes or pipe tables.
859Philosophy
860----------
862Markdown is designed to be easy to write, and, even more importantly,
863easy to read:
865> A Markdown-formatted document should be publishable as-is, as plain
866> text, without looking like it's been marked up with tags or formatting
867> instructions.
868> -- [John Gruber](http://daringfireball.net/projects/markdown/syntax#philosophy)
870This principle has guided pandoc's decisions in finding syntax for
871tables, footnotes, and other extensions.
873There is, however, one respect in which pandoc's aims are different
874from the original aims of markdown. Whereas markdown was originally
875designed with HTML generation in mind, pandoc is designed for multiple
876output formats. Thus, while pandoc allows the embedding of raw HTML,
877it discourages it, and provides other, non-HTMLish ways of representing
878important document elements like definition lists, tables, mathematics, and
879footnotes.
881Paragraphs
882----------
884A paragraph is one or more lines of text followed by one or more blank line.
885Newlines are treated as spaces, so you can reflow your paragraphs as you like.
886If you need a hard line break, put two or more spaces at the end of a line.
888**Extension: `escaped_line_breaks`**
890A backslash followed by a newline is also a hard line break.
892Headers
893-------
895There are two kinds of headers, Setext and atx.
897### Setext-style headers ###
899A setext-style header is a line of text "underlined" with a row of `=` signs
900(for a level one header) or `-` signs (for a level two header):
902 A level-one header
903 ==================
905 A level-two header
906 ------------------
908The header text can contain inline formatting, such as emphasis (see
909[Inline formatting](#inline-formatting), below).
912### Atx-style headers ###
914An Atx-style header consists of one to six `#` signs and a line of
915text, optionally followed by any number of `#` signs. The number of
916`#` signs at the beginning of the line is the header level:
918 ## A level-two header
920 ### A level-three header ###
922As with setext-style headers, the header text can contain formatting:
924 # A level-one header with a [link](/url) and *emphasis*
926**Extension: `blank_before_header`**
928Standard markdown syntax does not require a blank line before a header.
929Pandoc does require this (except, of course, at the beginning of the
930document). The reason for the requirement is that it is all too easy for a
931`#` to end up at the beginning of a line by accident (perhaps through line
932wrapping). Consider, for example:
934 I like several of their flavors of ice cream:
935 #22, for example, and #5.
938### Header identifiers in HTML, LaTeX, and ConTeXt ###
940**Extension: `header_attributes`**
942Headers can be assigned attributes using this syntax at the end
943of the line containing the header text:
945 {#identifier .class .class key=value key=value}
947Although this syntax allows assignment of classes and key/value attributes,
948only identifiers currently have any affect in the writers (and only in some
949writers: HTML, LaTeX, ConTeXt, Textile, AsciiDoc). Thus, for example,
950the following headers will all be assigned the identifier `foo`:
952 # My header {#foo}
954 ## My header ## {#foo}
956 My other header {#foo}
957 ---------------
959(This syntax is compatible with [PHP Markdown Extra].)
961Headers with the class `unnumbered` will not be numbered, even if
962`--number-sections` is specified. A single hyphen (`-`) in an attribute
963context is equivalent to `.unnumbered`, and preferable in non-English
964documents. So,
966 # My header {-}
968is just the same as
970 # My header {.unnumbered}
972**Extension: `auto_identifiers`**
974A header without an explicitly specified identifier will be
975automatically assigned a unique identifier based on the header text.
976To derive the identifier from the header text,
978 - Remove all formatting, links, etc.
979 - Remove all footnotes.
980 - Remove all punctuation, except underscores, hyphens, and periods.
981 - Replace all spaces and newlines with hyphens.
982 - Convert all alphabetic characters to lowercase.
983 - Remove everything up to the first letter (identifiers may
984 not begin with a number or punctuation mark).
985 - If nothing is left after this, use the identifier `section`.
987Thus, for example,
989 Header Identifier
990 ------------------------------- ----------------------------
991 Header identifiers in HTML `header-identifiers-in-html`
992 *Dogs*?--in *my* house? `dogs--in-my-house`
993 [HTML], [S5], or [RTF]? `html-s5-or-rtf`
994 3. Applications `applications`
995 33 `section`
997These rules should, in most cases, allow one to determine the identifier
998from the header text. The exception is when several headers have the
999same text; in this case, the first will get an identifier as described
1000above; the second will get the same identifier with `-1` appended; the
1001third with `-2`; and so on.
1003These identifiers are used to provide link targets in the table of
1004contents generated by the `--toc|--table-of-contents` option. They
1005also make it easy to provide links from one section of a document to
1006another. A link to this section, for example, might look like this:
1008 See the section on
1009 [header identifiers](#header-identifiers-in-html-latex-and-context).
1011Note, however, that this method of providing links to sections works
1012only in HTML, LaTeX, and ConTeXt formats.
1014If the `--section-divs` option is specified, then each section will
1015be wrapped in a `div` (or a `section`, if `--html5` was specified),
1016and the identifier will be attached to the enclosing `<div>`
1017(or `<section>`) tag rather than the header itself. This allows entire
1018sections to be manipulated using javascript or treated differently in
1019CSS.
1021**Extension: `implicit_header_references`**
1023Pandoc behaves as if reference links have been defined for each header.
1024So, instead of
1026 [header identifiers](#header-identifiers-in-html)
1028you can simply write
1030 [header identifiers]
1034 [header identifiers][]
1038 [the section on header identifiers][header identifiers]
1040If there are multiple headers with identical text, the corresponding
1041reference will link to the first one only, and you will need to use explicit
1042links to link to the others, as described above.
1044Unlike regular reference links, these references are case-sensitive.
1046Note: if you have defined an explicit identifier for a header,
1047then implicit references to it will not work.
1049Block quotations
1050----------------
1052Markdown uses email conventions for quoting blocks of text.
1053A block quotation is one or more paragraphs or other block elements
1054(such as lists or headers), with each line preceded by a `>` character
1055and a space. (The `>` need not start at the left margin, but it should
1056not be indented more than three spaces.)
1058 > This is a block quote. This
1059 > paragraph has two lines.
1061 > 1. This is a list inside a block quote.
1062 > 2. Second item.
1064A "lazy" form, which requires the `>` character only on the first
1065line of each block, is also allowed:
1067 > This is a block quote. This
1068 paragraph has two lines.
1070 > 1. This is a list inside a block quote.
1071 2. Second item.
1073Among the block elements that can be contained in a block quote are
1074other block quotes. That is, block quotes can be nested:
1076 > This is a block quote.
1078 > > A block quote within a block quote.
1080**Extension: `blank_before_blockquote`**
1082Standard markdown syntax does not require a blank line before a block
1083quote. Pandoc does require this (except, of course, at the beginning of the
1084document). The reason for the requirement is that it is all too easy for a
1085`>` to end up at the beginning of a line by accident (perhaps through line
1086wrapping). So, unless the `markdown_strict` format is used, the following does
1087not produce a nested block quote in pandoc:
1089 > This is a block quote.
1090 >> Nested.
1093Verbatim (code) blocks
1094----------------------
1096### Indented code blocks ###
1098A block of text indented four spaces (or one tab) is treated as verbatim
1099text: that is, special characters do not trigger special formatting,
1100and all spaces and line breaks are preserved. For example,
1102 if (a > 3) {
1103 moveShip(5 * gravity, DOWN);
1106The initial (four space or one tab) indentation is not considered part
1107of the verbatim text, and is removed in the output.
1109Note: blank lines in the verbatim text need not begin with four spaces.
1112### Fenced code blocks ###
1114**Extension: `fenced_code_blocks`**
1116In addition to standard indented code blocks, Pandoc supports
1117*fenced* code blocks. These begin with a row of three or more
1118tildes (`~`) or backticks (`` ` ``) and end with a row of tildes or
1119backticks that must be at least as long as the starting row. Everything
1120between these lines is treated as code. No indentation is necessary:
1122 ~~~~~~~
1123 if (a > 3) {
1124 moveShip(5 * gravity, DOWN);
1126 ~~~~~~~
1128Like regular code blocks, fenced code blocks must be separated
1129from surrounding text by blank lines.
1131If the code itself contains a row of tildes or backticks, just use a longer
1132row of tildes or backticks at the start and end:
1134 ~~~~~~~~~~~~~~~~
1135 ~~~~~~~~~~
1136 code including tildes
1137 ~~~~~~~~~~
1138 ~~~~~~~~~~~~~~~~
1140Optionally, you may attach attributes to the code block using
1141this syntax:
1143 ~~~~ {#mycode .haskell .numberLines startFrom="100"}
1144 qsort [] = []
1145 qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
1146 qsort (filter (>= x) xs)
1147 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1149Here `mycode` is an identifier, `haskell` and `numberLines` are classes, and
1150`startFrom` is an attribute with value `100`. Some output formats can use this
1151information to do syntax highlighting. Currently, the only output formats
1152that uses this information are HTML and LaTeX. If highlighting is supported
1153for your output format and language, then the code block above will appear
1154highlighted, with numbered lines. (To see which languages are supported, do
1155`pandoc --version`.) Otherwise, the code block above will appear as follows:
1157 <pre id="mycode" class="haskell numberLines" startFrom="100">
1158 <code>
1159 ...
1160 </code>
1161 </pre>
1163A shortcut form can also be used for specifying the language of
1164the code block:
1166 ```haskell
1167 qsort [] = []
1168 ```
1170This is equivalent to:
1172 ``` {.haskell}
1173 qsort [] = []
1174 ```
1176To prevent all highlighting, use the `--no-highlight` flag.
1177To set the highlighting style, use `--highlight-style`.
1179Line blocks
1180-----------
1182**Extension: `line_blocks`**
1184A line block is a sequence of lines beginning with a vertical bar (`|`)
1185followed by a space. The division into lines will be preserved in
1186the output, as will any leading spaces; otherwise, the lines will
1187be formatted as markdown. This is useful for verse and addresses:
1189 | The limerick packs laughs anatomical
1190 | In space that is quite economical.
1191 | But the good ones I've seen
1192 | So seldom are clean
1193 | And the clean ones so seldom are comical
1195 | 200 Main St.
1196 | Berkeley, CA 94718
1198The lines can be hard-wrapped if needed, but the continuation
1199line must begin with a space.
1201 | The Right Honorable Most Venerable and Righteous Samuel L.
1202 Constable, Jr.
1203 | 200 Main St.
1204 | Berkeley, CA 94718
1206This syntax is borrowed from [reStructuredText].
1208Lists
1209-----
1211### Bullet lists ###
1213A bullet list is a list of bulleted list items. A bulleted list
1214item begins with a bullet (`*`, `+`, or `-`). Here is a simple
1215example:
1217 * one
1218 * two
1219 * three
1221This will produce a "compact" list. If you want a "loose" list, in which
1222each item is formatted as a paragraph, put spaces between the items:
1224 * one
1226 * two
1228 * three
1230The bullets need not be flush with the left margin; they may be
1231indented one, two, or three spaces. The bullet must be followed
1232by whitespace.
1234List items look best if subsequent lines are flush with the first
1235line (after the bullet):
1237 * here is my first
1238 list item.
1239 * and my second.
1241But markdown also allows a "lazy" format:
1243 * here is my first
1244 list item.
1245 * and my second.
1247### The four-space rule ###
1249A list item may contain multiple paragraphs and other block-level
1250content. However, subsequent paragraphs must be preceded by a blank line
1251and indented four spaces or a tab. The list will look better if the first
1252paragraph is aligned with the rest:
1254 * First paragraph.
1256 Continued.
1258 * Second paragraph. With a code block, which must be indented
1259 eight spaces:
1261 { code }
1263List items may include other lists. In this case the preceding blank
1264line is optional. The nested list must be indented four spaces or
1265one tab:
1267 * fruits
1268 + apples
1269 - macintosh
1270 - red delicious
1271 + pears
1272 + peaches
1273 * vegetables
1274 + brocolli
1275 + chard
1277As noted above, markdown allows you to write list items "lazily," instead of
1278indenting continuation lines. However, if there are multiple paragraphs or
1279other blocks in a list item, the first line of each must be indented.
1281 + A lazy, lazy, list
1282 item.
1284 + Another one; this looks
1285 bad but is legal.
1287 Second paragraph of second
1288 list item.
1290**Note:** Although the four-space rule for continuation paragraphs
1291comes from the official [markdown syntax guide], the reference implementation,
1292`Markdown.pl`, does not follow it. So pandoc will give different results than
1293`Markdown.pl` when authors have indented continuation paragraphs fewer than
1294four spaces.
1296The [markdown syntax guide] is not explicit whether the four-space
1297rule applies to *all* block-level content in a list item; it only
1298mentions paragraphs and code blocks. But it implies that the rule
1299applies to all block-level content (including nested lists), and
1300pandoc interprets it that way.
1302 [markdown syntax guide]:
1303 http://daringfireball.net/projects/markdown/syntax#list
1305### Ordered lists ###
1307Ordered lists work just like bulleted lists, except that the items
1308begin with enumerators rather than bullets.
1310In standard markdown, enumerators are decimal numbers followed
1311by a period and a space. The numbers themselves are ignored, so
1312there is no difference between this list:
1314 1. one
1315 2. two
1316 3. three
1318and this one:
1320 5. one
1321 7. two
1322 1. three
1324**Extension: `fancy_lists`**
1326Unlike standard markdown, Pandoc allows ordered list items to be marked
1327with uppercase and lowercase letters and roman numerals, in addition to
1328arabic numerals. List markers may be enclosed in parentheses or followed by a
1329single right-parentheses or period. They must be separated from the
1330text that follows by at least one space, and, if the list marker is a
1331capital letter with a period, by at least two spaces.[^2]
1333[^2]: The point of this rule is to ensure that normal paragraphs
1334 starting with people's initials, like
1336 B. Russell was an English philosopher.
1338 do not get treated as list items.
1340 This rule will not prevent
1342 (C) 2007 Joe Smith
1344 from being interpreted as a list item. In this case, a backslash
1345 escape can be used:
1347 (C\) 2007 Joe Smith
1349The `fancy_lists` extension also allows '`#`' to be used as an
1350ordered list marker in place of a numeral:
1352 #. one
1353 #. two
1355**Extension: `startnum`**
1357Pandoc also pays attention to the type of list marker used, and to the
1358starting number, and both of these are preserved where possible in the
1359output format. Thus, the following yields a list with numbers followed
1360by a single parenthesis, starting with 9, and a sublist with lowercase
1361roman numerals:
1363 9) Ninth
1364 10) Tenth
1365 11) Eleventh
1366 i. subone
1367 ii. subtwo
1368 iii. subthree
1370Pandoc will start a new list each time a different type of list
1371marker is used. So, the following will create three lists:
1373 (2) Two
1374 (5) Three
1375 1. Four
1376 * Five
1378If default list markers are desired, use `#.`:
1380 #. one
1381 #. two
1382 #. three
1385### Definition lists ###
1387**Extension: `definition_lists`**
1389Pandoc supports definition lists, using a syntax inspired by
1390[PHP Markdown Extra] and [reStructuredText]:[^3]
1392 Term 1
1394 : Definition 1
1396 Term 2 with *inline markup*
1398 : Definition 2
1400 { some code, part of Definition 2 }
1402 Third paragraph of definition 2.
1404Each term must fit on one line, which may optionally be followed by
1405a blank line, and must be followed by one or more definitions.
1406A definition begins with a colon or tilde, which may be indented one
1407or two spaces. The body of the definition (including the first line,
1408aside from the colon or tilde) should be indented four spaces. A term may have
1409multiple definitions, and each definition may consist of one or more block
1410elements (paragraph, code block, list, etc.), each indented four spaces or one
1411tab stop.
1413If you leave space after the definition (as in the example above),
1414the blocks of the definitions will be considered paragraphs. In some
1415output formats, this will mean greater spacing between term/definition
1416pairs. For a compact definition list, do not leave space between the
1417definition and the next term:
1419 Term 1
1420 ~ Definition 1
1421 Term 2
1422 ~ Definition 2a
1423 ~ Definition 2b
1425[^3]: I have also been influenced by the suggestions of [David Wheeler](http://www.justatheory.com/computers/markup/modest-markdown-proposal.html).
1427[PHP Markdown Extra]: http://www.michelf.com/projects/php-markdown/extra/
1430### Numbered example lists ###
1432**Extension: `example_lists`**
1434The special list marker `@` can be used for sequentially numbered
1435examples. The first list item with a `@` marker will be numbered '1',
1436the next '2', and so on, throughout the document. The numbered examples
1437need not occur in a single list; each new list using `@` will take up
1438where the last stopped. So, for example:
1440 (@) My first example will be numbered (1).
1441 (@) My second example will be numbered (2).
1443 Explanation of examples.
1445 (@) My third example will be numbered (3).
1447Numbered examples can be labeled and referred to elsewhere in the
1448document:
1450 (@good) This is a good example.
1452 As (@good) illustrates, ...
1454The label can be any string of alphanumeric characters, underscores,
1455or hyphens.
1458### Compact and loose lists ###
1460Pandoc behaves differently from `Markdown.pl` on some "edge
1461cases" involving lists. Consider this source:
1463 + First
1464 + Second:
1465 - Fee
1466 - Fie
1467 - Foe
1469 + Third
1471Pandoc transforms this into a "compact list" (with no `<p>` tags around
1472"First", "Second", or "Third"), while markdown puts `<p>` tags around
1473"Second" and "Third" (but not "First"), because of the blank space
1474around "Third". Pandoc follows a simple rule: if the text is followed by
1475a blank line, it is treated as a paragraph. Since "Second" is followed
1476by a list, and not a blank line, it isn't treated as a paragraph. The
1477fact that the list is followed by a blank line is irrelevant. (Note:
1478Pandoc works this way even when the `markdown_strict` format is specified. This
1479behavior is consistent with the official markdown syntax description,
1480even though it is different from that of `Markdown.pl`.)
1483### Ending a list ###
1485What if you want to put an indented code block after a list?
1487 - item one
1488 - item two
1490 { my code block }
1492Trouble! Here pandoc (like other markdown implementations) will treat
1493`{ my code block }` as the second paragraph of item two, and not as
1494a code block.
1496To "cut off" the list after item two, you can insert some non-indented
1497content, like an HTML comment, which won't produce visible output in
1498any format:
1500 - item one
1501 - item two
1503 <!-- end of list -->
1505 { my code block }
1507You can use the same trick if you want two consecutive lists instead
1508of one big list:
1510 1. one
1511 2. two
1512 3. three
1514 <!-- -->
1516 1. uno
1517 2. dos
1518 3. tres
1520Horizontal rules
1521----------------
1523A line containing a row of three or more `*`, `-`, or `_` characters
1524(optionally separated by spaces) produces a horizontal rule:
1526 * * * *
1528 ---------------
1531Tables
1532------
1534Four kinds of tables may be used. The first three kinds presuppose the use of
1535a fixed-width font, such as Courier. The fourth kind can be used with
1536proportionally spaced fonts, as it does not require lining up columns.
1538### Simple tables
1540**Extension: `simple_tables`, `table_captions`**
1542Simple tables look like this:
1544 Right Left Center Default
1545 ------- ------ ---------- -------
1546 12 12 12 12
1547 123 123 123 123
1548 1 1 1 1
1550 Table: Demonstration of simple table syntax.
1552The headers and table rows must each fit on one line. Column
1553alignments are determined by the position of the header text relative
1554to the dashed line below it:[^4]
1556 - If the dashed line is flush with the header text on the right side
1557 but extends beyond it on the left, the column is right-aligned.
1558 - If the dashed line is flush with the header text on the left side
1559 but extends beyond it on the right, the column is left-aligned.
1560 - If the dashed line extends beyond the header text on both sides,
1561 the column is centered.
1562 - If the dashed line is flush with the header text on both sides,
1563 the default alignment is used (in most cases, this will be left).
1565[^4]: This scheme is due to Michel Fortin, who proposed it on the
1566 [Markdown discussion list](http://six.pairlist.net/pipermail/markdown-discuss/2005-March/001097.html).
1568The table must end with a blank line, or a line of dashes followed by
1569a blank line. A caption may optionally be provided (as illustrated in
1570the example above). A caption is a paragraph beginning with the string
1571`Table:` (or just `:`), which will be stripped off. It may appear either
1572before or after the table.
1574The column headers may be omitted, provided a dashed line is used
1575to end the table. For example:
1577 ------- ------ ---------- -------
1578 12 12 12 12
1579 123 123 123 123
1580 1 1 1 1
1581 ------- ------ ---------- -------
1583When headers are omitted, column alignments are determined on the basis
1584of the first line of the table body. So, in the tables above, the columns
1585would be right, left, center, and right aligned, respectively.
1587### Multiline tables
1589**Extension: `multiline_tables`, `table_captions`**
1591Multiline tables allow headers and table rows to span multiple lines
1592of text (but cells that span multiple columns or rows of the table are
1593not supported). Here is an example:
1595 -------------------------------------------------------------
1596 Centered Default Right Left
1597 Header Aligned Aligned Aligned
1598 ----------- ------- --------------- -------------------------
1599 First row 12.0 Example of a row that
1600 spans multiple lines.
1602 Second row 5.0 Here's another one. Note
1603 the blank line between
1604 rows.
1605 -------------------------------------------------------------
1607 Table: Here's the caption. It, too, may span
1608 multiple lines.
1610These work like simple tables, but with the following differences:
1612 - They must begin with a row of dashes, before the header text
1613 (unless the headers are omitted).
1614 - They must end with a row of dashes, then a blank line.
1615 - The rows must be separated by blank lines.
1617In multiline tables, the table parser pays attention to the widths of
1618the columns, and the writers try to reproduce these relative widths in
1619the output. So, if you find that one of the columns is too narrow in the
1620output, try widening it in the markdown source.
1622Headers may be omitted in multiline tables as well as simple tables:
1624 ----------- ------- --------------- -------------------------
1625 First row 12.0 Example of a row that
1626 spans multiple lines.
1628 Second row 5.0 Here's another one. Note
1629 the blank line between
1630 rows.
1631 ----------- ------- --------------- -------------------------
1633 : Here's a multiline table without headers.
1635It is possible for a multiline table to have just one row, but the row
1636should be followed by a blank line (and then the row of dashes that ends
1637the table), or the table may be interpreted as a simple table.
1639### Grid tables
1641**Extension: `grid_tables`, `table_captions`**
1643Grid tables look like this:
1645 : Sample grid table.
1647 +---------------+---------------+--------------------+
1648 | Fruit | Price | Advantages |
1649 +===============+===============+====================+
1650 | Bananas | $1.34 | - built-in wrapper |
1651 | | | - bright color |
1652 +---------------+---------------+--------------------+
1653 | Oranges | $2.10 | - cures scurvy |
1654 | | | - tasty |
1655 +---------------+---------------+--------------------+
1657The row of `=`s separates the header from the table body, and can be
1658omitted for a headerless table. The cells of grid tables may contain
1659arbitrary block elements (multiple paragraphs, code blocks, lists,
1660etc.). Alignments are not supported, nor are cells that span multiple
1661columns or rows. Grid tables can be created easily using [Emacs table mode].
1663 [Emacs table mode]: http://table.sourceforge.net/
1665### Pipe tables
1667**Extension: `pipe_tables`, `table_captions`**
1669Pipe tables look like this:
1671 | Right | Left | Default | Center |
1672 |------:|:-----|---------|:------:|
1673 | 12 | 12 | 12 | 12 |
1674 | 123 | 123 | 123 | 123 |
1675 | 1 | 1 | 1 | 1 |
1677 : Demonstration of simple table syntax.
1679The syntax is [the same as in PHP markdown extra]. The beginning and
1680ending pipe characters are optional, but pipes are required between all
1681columns. The colons indicate column alignment as shown. The header
1682can be omitted, but the horizontal line must still be included, as
1683it defines column alignments.
1685Since the pipes indicate column boundaries, columns need not be vertically
1686aligned, as they are in the above example. So, this is a perfectly
1687legal (though ugly) pipe table:
1689 fruit| price
1690 -----|-----:
1691 apple|2.05
1692 pear|1.37
1693 orange|3.09
1695The cells of pipe tables cannot contain block elements like paragraphs
1696and lists, and cannot span multiple lines.
1698 [the same as in PHP markdown extra]:
1699 http://michelf.ca/projects/php-markdown/extra/#table
1701Note: Pandoc also recognizes pipe tables of the following
1702form, as can produced by Emacs' orgtbl-mode:
1704 | One | Two |
1705 |-----+-------|
1706 | my | table |
1707 | is | nice |
1709The difference is that `+` is used instead of `|`. Other orgtbl features
1710are not supported. In particular, to get non-default column alignment,
1711you'll need to add colons as above.
1713Title block
1714-----------
1716**Extension: `pandoc_title_block`**
1718If the file begins with a title block
1720 % title
1721 % author(s) (separated by semicolons)
1722 % date
1724it will be parsed as bibliographic information, not regular text. (It
1725will be used, for example, in the title of standalone LaTeX or HTML
1726output.) The block may contain just a title, a title and an author,
1727or all three elements. If you want to include an author but no
1728title, or a title and a date but no author, you need a blank line:
1731 % Author
1733 % My title
1735 % June 15, 2006
1737The title may occupy multiple lines, but continuation lines must
1738begin with leading space, thus:
1740 % My title
1741 on multiple lines
1743If a document has multiple authors, the authors may be put on
1744separate lines with leading space, or separated by semicolons, or
1745both. So, all of the following are equivalent:
1747 % Author One
1748 Author Two
1750 % Author One; Author Two
1752 % Author One;
1753 Author Two
1755The date must fit on one line.
1757All three metadata fields may contain standard inline formatting
1758(italics, links, footnotes, etc.).
1760Title blocks will always be parsed, but they will affect the output only
1761when the `--standalone` (`-s`) option is chosen. In HTML output, titles
1762will appear twice: once in the document head -- this is the title that
1763will appear at the top of the window in a browser -- and once at the
1764beginning of the document body. The title in the document head can have
1765an optional prefix attached (`--title-prefix` or `-T` option). The title
1766in the body appears as an H1 element with class "title", so it can be
1767suppressed or reformatted with CSS. If a title prefix is specified with
1768`-T` and no title block appears in the document, the title prefix will
1769be used by itself as the HTML title.
1771The man page writer extracts a title, man page section number, and
1772other header and footer information from the title line. The title
1773is assumed to be the first word on the title line, which may optionally
1774end with a (single-digit) section number in parentheses. (There should
1775be no space between the title and the parentheses.) Anything after
1776this is assumed to be additional footer and header text. A single pipe
1777character (`|`) should be used to separate the footer text from the header
1778text. Thus,
1780 % PANDOC(1)
1782will yield a man page with the title `PANDOC` and section 1.
1784 % PANDOC(1) Pandoc User Manuals
1786will also have "Pandoc User Manuals" in the footer.
1788 % PANDOC(1) Pandoc User Manuals | Version 4.0
1790will also have "Version 4.0" in the header.
1792YAML metadata block
1793-------------------
1795**Extension: `yaml_metadata_block`**
1797A YAML metadata block is a valid YAML object, delimited by a line of three
1798hyphens (`---`) at the top and a line of three hyphens (`---`) or three dots
1799(`...`) at the bottom. A YAML metadata block may occur anywhere in the
1800document, but if it is not at the beginning, it must be preceded by a blank
1801line.
1803Metadata will be taken from the fields of the YAML object and added to any
1804existing document metadata. Metadata can contain lists and objects (nested
1805arbitrarily), but all string scalars will be interpreted as markdown. Fields
1806with names ending in an underscore will be ignored by pandoc. (They may be
1807given a role by external processors.)
1809A document may contain multiple metadata blocks. The metadata fields will
1810be combined through a *left-biased union*: if two metadata blocks attempt
1811to set the same field, the value from the first block will be taken.
1813Note that YAML escaping rules must be followed. Thus, for example,
1814if a title contains a colon, it must be quoted. The pipe character
1815(`|`) can be used to begin an indented block that will be interpreted
1816literally, without need for escaping. This form is necessary
1817when the field contains blank lines:
1819 ---
1820 title: 'This is the title: it contains a colon'
1821 author:
1822 - name: Author One
1823 affiliation: University of Somewhere
1824 - name: Author Two
1825 affiliation: University of Nowhere
1826 tags: [nothing, nothingness]
1827 abstract: |
1828 This is the abstract.
1830 It consists of two paragraphs.
1831 ...
1833Template variables will be set automatically from the metadata. Thus, for
1834example, in writing HTML, the variable `abstract` will be set to the HTML
1835equivalent of the markdown in the `abstract` field:
1837 <p>This is the abstract.</p>
1838 <p>It consists of two paragraphs.</p>
1841Backslash escapes
1842-----------------
1844**Extension: `all_symbols_escapable`**
1846Except inside a code block or inline code, any punctuation or space
1847character preceded by a backslash will be treated literally, even if it
1848would normally indicate formatting. Thus, for example, if one writes
1850 *\*hello\**
1852one will get
1854 <em>*hello*</em>
1856instead of
1858 <strong>hello</strong>
1860This rule is easier to remember than standard markdown's rule,
1861which allows only the following characters to be backslash-escaped:
1863 \`*_{}[]()>#+-.!
1865(However, if the `markdown_strict` format is used, the standard markdown rule
1866will be used.)
1868A backslash-escaped space is parsed as a nonbreaking space. It will
1869appear in TeX output as `~` and in HTML and XML as `\&#160;` or
1870`\&nbsp;`.
1872A backslash-escaped newline (i.e. a backslash occurring at the end of
1873a line) is parsed as a hard line break. It will appear in TeX output as
1874`\\` and in HTML as `<br />`. This is a nice alternative to
1875markdown's "invisible" way of indicating hard line breaks using
1876two trailing spaces on a line.
1878Backslash escapes do not work in verbatim contexts.
1880Smart punctuation
1881-----------------
1883**Extension**
1885If the `--smart` option is specified, pandoc will produce typographically
1886correct output, converting straight quotes to curly quotes, `---` to
1887em-dashes, `--` to en-dashes, and `...` to ellipses. Nonbreaking spaces
1888are inserted after certain abbreviations, such as "Mr."
1890Note: if your LaTeX template uses the `csquotes` package, pandoc will
1891detect automatically this and use `\enquote{...}` for quoted text.
1893Inline formatting
1894-----------------
1896### Emphasis ###
1898To *emphasize* some text, surround it with `*`s or `_`, like this:
1900 This text is _emphasized with underscores_, and this
1901 is *emphasized with asterisks*.
1903Double `*` or `_` produces **strong emphasis**:
1905 This is **strong emphasis** and __with underscores__.
1907A `*` or `_` character surrounded by spaces, or backslash-escaped,
1908will not trigger emphasis:
1910 This is * not emphasized *, and \*neither is this\*.
1912**Extension: `intraword_underscores`**
1914Because `_` is sometimes used inside words and identifiers,
1915pandoc does not interpret a `_` surrounded by alphanumeric
1916characters as an emphasis marker. If you want to emphasize
1917just part of a word, use `*`:
1919 feas*ible*, not feas*able*.
1922### Strikeout ###
1924**Extension: `strikeout`**
1926To strikeout a section of text with a horizontal line, begin and end it
1927with `~~`. Thus, for example,
1929 This ~~is deleted text.~~
1932### Superscripts and subscripts ###
1934**Extension: `superscript`, `subscript`**
1936Superscripts may be written by surrounding the superscripted text by `^`
1937characters; subscripts may be written by surrounding the subscripted
1938text by `~` characters. Thus, for example,
1940 H~2~O is a liquid. 2^10^ is 1024.
1942If the superscripted or subscripted text contains spaces, these spaces
1943must be escaped with backslashes. (This is to prevent accidental
1944superscripting and subscripting through the ordinary use of `~` and `^`.)
1945Thus, if you want the letter P with 'a cat' in subscripts, use
1946`P~a\ cat~`, not `P~a cat~`.
1949### Verbatim ###
1951To make a short span of text verbatim, put it inside backticks:
1953 What is the difference between `>>=` and `>>`?
1955If the verbatim text includes a backtick, use double backticks:
1957 Here is a literal backtick `` ` ``.
1959(The spaces after the opening backticks and before the closing
1960backticks will be ignored.)
1962The general rule is that a verbatim span starts with a string
1963of consecutive backticks (optionally followed by a space)
1964and ends with a string of the same number of backticks (optionally
1965preceded by a space).
1967Note that backslash-escapes (and other markdown constructs) do not
1968work in verbatim contexts:
1970 This is a backslash followed by an asterisk: `\*`.
1972**Extension: `inline_code_attributes`**
1974Attributes can be attached to verbatim text, just as with
1975[fenced code blocks](#fenced-code-blocks):
1977 `<$>`{.haskell}
1979Math
1980----
1982**Extension: `tex_math_dollars`**
1984Anything between two `$` characters will be treated as TeX math. The
1985opening `$` must have a character immediately to its right, while the
1986closing `$` must have a character immediately to its left. Thus,
1987`$20,000 and $30,000` won't parse as math. If for some reason
1988you need to enclose text in literal `$` characters, backslash-escape
1989them and they won't be treated as math delimiters.
1991TeX math will be printed in all output formats. How it is rendered
1992depends on the output format:
1994Markdown, LaTeX, Org-Mode, ConTeXt
1995 ~ It will appear verbatim between `$` characters.
1997reStructuredText
1998 ~ It will be rendered using an interpreted text role `:math:`, as described
1999 [here](http://www.american.edu/econ/itex2mml/mathhack.rst).
2001AsciiDoc
2002 ~ It will be rendered as `latexmath:[...]`.
2004Texinfo
2005 ~ It will be rendered inside a `@math` command.
2007groff man
2008 ~ It will be rendered verbatim without `$`'s.
2010MediaWiki
2011 ~ It will be rendered inside `<math>` tags.
2013Textile
2014 ~ It will be rendered inside `<span class="math">` tags.
2016RTF, OpenDocument, ODT
2017 ~ It will be rendered, if possible, using unicode characters,
2018 and will otherwise appear verbatim.
2020Docbook
2021 ~ If the `--mathml` flag is used, it will be rendered using mathml
2022 in an `inlineequation` or `informalequation` tag. Otherwise it
2023 will be rendered, if possible, using unicode characters.
2025Docx
2026 ~ It will be rendered using OMML math markup.
2028FictionBook2
2029 ~ If the `--webtex` option is used, formulas are rendered as images
2030 using Google Charts or other compatible web service, downloaded
2031 and embedded in the e-book. Otherwise, they will appear verbatim.
2033HTML, Slidy, DZSlides, S5, EPUB
2034 ~ The way math is rendered in HTML will depend on the
2035 command-line options selected:
2037 1. The default is to render TeX math as far as possible using unicode
2038 characters, as with RTF, DocBook, and OpenDocument output. Formulas
2039 are put inside a `span` with `class="math"`, so that they may be
2040 styled differently from the surrounding text if needed.
2042 2. If the `--latexmathml` option is used, TeX math will be displayed
2043 between `$` or `$$` characters and put in `<span>` tags with class `LaTeX`.
2044 The [LaTeXMathML] script will be used to render it as formulas.
2045 (This trick does not work in all browsers, but it works in Firefox.
2046 In browsers that do not support LaTeXMathML, TeX math will appear
2047 verbatim between `$` characters.)
2049 3. If the `--jsmath` option is used, TeX math will be put inside
2050 `<span>` tags (for inline math) or `<div>` tags (for display math)
2051 with class `math`. The [jsMath] script will be used to render
2052 it.
2054 4. If the `--mimetex` option is used, the [mimeTeX] CGI script will
2055 be called to generate images for each TeX formula. This should
2056 work in all browsers. The `--mimetex` option takes an optional URL
2057 as argument. If no URL is specified, it will be assumed that the
2058 mimeTeX CGI script is at `/cgi-bin/mimetex.cgi`.
2060 5. If the `--gladtex` option is used, TeX formulas will be enclosed
2061 in `<eq>` tags in the HTML output. The resulting `htex` file may then
2062 be processed by [gladTeX], which will produce image files for each
2063 formula and an `html` file with links to these images. So, the
2064 procedure is:
2066 pandoc -s --gladtex myfile.txt -o myfile.htex
2067 gladtex -d myfile-images myfile.htex
2068 # produces myfile.html and images in myfile-images
2070 6. If the `--webtex` option is used, TeX formulas will be converted
2071 to `<img>` tags that link to an external script that converts
2072 formulas to images. The formula will be URL-encoded and concatenated
2073 with the URL provided. If no URL is specified, the Google Chart
2074 API will be used (`http://chart.apis.google.com/chart?cht=tx&chl=`).
2076 7. If the `--mathjax` option is used, TeX math will be displayed
2077 between `\(...\)` (for inline math) or `\[...\]` (for display
2078 math) and put in `<span>` tags with class `math`.
2079 The [MathJax] script will be used to render it as formulas.
2081Raw HTML
2082--------
2084**Extension: `raw_html`**
2086Markdown allows you to insert raw HTML (or DocBook) anywhere in a document
2087(except verbatim contexts, where `<`, `>`, and `&` are interpreted
2088literally). (Techncially this is not an extension, since standard
2089markdown allows it, but it has been made an extension so that it can
2090be disabled if desired.)
2092The raw HTML is passed through unchanged in HTML, S5, Slidy, Slideous,
2093DZSlides, EPUB, Markdown, and Textile output, and suppressed in other
2094formats.
2096**Extension: `markdown_in_html_blocks`**
2098Standard markdown allows you to include HTML "blocks": blocks
2099of HTML between balanced tags that are separated from the surrounding text
2100with blank lines, and start and end at the left margin. Within
2101these blocks, everything is interpreted as HTML, not markdown;
2102so (for example), `*` does not signify emphasis.
2104Pandoc behaves this way when the `markdown_strict` format is used; but
2105by default, pandoc interprets material between HTML block tags as markdown.
2106Thus, for example, Pandoc will turn
2108 <table>
2109 <tr>
2110 <td>*one*</td>
2111 <td>[a link](http://google.com)</td>
2112 </tr>
2113 </table>
2115into
2117 <table>
2118 <tr>
2119 <td><em>one</em></td>
2120 <td><a href="http://google.com">a link</a></td>
2121 </tr>
2122 </table>
2124whereas `Markdown.pl` will preserve it as is.
2126There is one exception to this rule: text between `<script>` and
2127`<style>` tags is not interpreted as markdown.
2129This departure from standard markdown should make it easier to mix
2130markdown with HTML block elements. For example, one can surround
2131a block of markdown text with `<div>` tags without preventing it
2132from being interpreted as markdown.
2134Raw TeX
2135-------
2137**Extension: `raw_tex`**
2139In addition to raw HTML, pandoc allows raw LaTeX, TeX, and ConTeXt to be
2140included in a document. Inline TeX commands will be preserved and passed
2141unchanged to the LaTeX and ConTeXt writers. Thus, for example, you can use
2142LaTeX to include BibTeX citations:
2144 This result was proved in \cite{jones.1967}.
2146Note that in LaTeX environments, like
2148 \begin{tabular}{|l|l|}\hline
2149 Age & Frequency \\ \hline
2150 18--25 & 15 \\
2151 26--35 & 33 \\
2152 36--45 & 22 \\ \hline
2153 \end{tabular}
2155the material between the begin and end tags will be interpreted as raw
2156LaTeX, not as markdown.
2158Inline LaTeX is ignored in output formats other than Markdown, LaTeX,
2159and ConTeXt.
2161LaTeX macros
2162------------
2164**Extension: `latex_macros`**
2166For output formats other than LaTeX, pandoc will parse LaTeX `\newcommand` and
2167`\renewcommand` definitions and apply the resulting macros to all LaTeX
2168math. So, for example, the following will work in all output formats,
2169not just LaTeX:
2171 \newcommand{\tuple}[1]{\langle #1 \rangle}
2173 $\tuple{a, b, c}$
2175In LaTeX output, the `\newcommand` definition will simply be passed
2176unchanged to the output.
2179Links
2180-----
2182Markdown allows links to be specified in several ways.
2184### Automatic links ###
2186If you enclose a URL or email address in pointy brackets, it
2187will become a link:
2189 <http://google.com>
2190 <sam@green.eggs.ham>
2192### Inline links ###
2194An inline link consists of the link text in square brackets,
2195followed by the URL in parentheses. (Optionally, the URL can
2196be followed by a link title, in quotes.)
2198 This is an [inline link](/url), and here's [one with
2199 a title](http://fsf.org "click here for a good time!").
2201There can be no space between the bracketed part and the parenthesized part.
2202The link text can contain formatting (such as emphasis), but the title cannot.
2205### Reference links ###
2207An *explicit* reference link has two parts, the link itself and the link
2208definition, which may occur elsewhere in the document (either
2209before or after the link).
2211The link consists of link text in square brackets, followed by a label in
2212square brackets. (There can be space between the two.) The link definition
2213consists of the bracketed label, followed by a colon and a space, followed by
2214the URL, and optionally (after a space) a link title either in quotes or in
2215parentheses.
2217Here are some examples:
2219 [my label 1]: /foo/bar.html "My title, optional"
2220 [my label 2]: /foo
2221 [my label 3]: http://fsf.org (The free software foundation)
2222 [my label 4]: /bar#special 'A title in single quotes'
2224The URL may optionally be surrounded by angle brackets:
2226 [my label 5]: <http://foo.bar.baz>
2228The title may go on the next line:
2230 [my label 3]: http://fsf.org
2231 "The free software foundation"
2233Note that link labels are not case sensitive. So, this will work:
2235 Here is [my link][FOO]
2237 [Foo]: /bar/baz
2239In an *implicit* reference link, the second pair of brackets is
2240empty, or omitted entirely:
2242 See [my website][], or [my website].
2244 [my website]: http://foo.bar.baz
2246Note: In `Markdown.pl` and most other markdown implementations,
2247reference link definitions cannot occur in nested constructions
2248such as list items or block quotes. Pandoc lifts this arbitrary
2249seeming restriction. So the following is fine in pandoc, though
2250not in most other implementations:
2252 > My block [quote].
2254 > [quote]: /foo
2256### Internal links
2258To link to another section of the same document, use the automatically
2259generated identifier (see [Header identifiers in HTML, LaTeX, and
2260ConTeXt](#header-identifiers-in-html-latex-and-context), below).
2261For example:
2263 See the [Introduction](#introduction).
2267 See the [Introduction].
2269 [Introduction]: #introduction
2271Internal links are currently supported for HTML formats (including
2272HTML slide shows and EPUB), LaTeX, and ConTeXt.
2274Images
2275------
2277A link immediately preceded by a `!` will be treated as an image.
2278The link text will be used as the image's alt text:
2280 ![la lune](lalune.jpg "Voyage to the moon")
2282 ![movie reel]
2284 [movie reel]: movie.gif
2286### Pictures with captions ###
2288**Extension: `implicit_figures`**
2290An image occurring by itself in a paragraph will be rendered as
2291a figure with a caption.[^5] (In LaTeX, a figure environment will be
2292used; in HTML, the image will be placed in a `div` with class
2293`figure`, together with a caption in a `p` with class `caption`.)
2294The image's alt text will be used as the caption.
2296 ![This is the caption](/url/of/image.png)
2298[^5]: This feature is not yet implemented for RTF, OpenDocument, or
2299 ODT. In those formats, you'll just get an image in a paragraph by
2300 itself, with no caption.
2302If you just want a regular inline image, just make sure it is not
2303the only thing in the paragraph. One way to do this is to insert a
2304nonbreaking space after the image:
2306 ![This image won't be a figure](/url/of/image.png)\
2309Footnotes
2310---------
2312**Extension: `footnotes`**
2314Pandoc's markdown allows footnotes, using the following syntax:
2316 Here is a footnote reference,[^1] and another.[^longnote]
2318 [^1]: Here is the footnote.
2320 [^longnote]: Here's one with multiple blocks.
2322 Subsequent paragraphs are indented to show that they
2323 belong to the previous footnote.
2325 { some.code }
2327 The whole paragraph can be indented, or just the first
2328 line. In this way, multi-paragraph footnotes work like
2329 multi-paragraph list items.
2331 This paragraph won't be part of the note, because it
2332 isn't indented.
2334The identifiers in footnote references may not contain spaces, tabs,
2335or newlines. These identifiers are used only to correlate the
2336footnote reference with the note itself; in the output, footnotes
2337will be numbered sequentially.
2339The footnotes themselves need not be placed at the end of the
2340document. They may appear anywhere except inside other block elements
2341(lists, block quotes, tables, etc.).
2343**Extension: `inline_notes`**
2345Inline footnotes are also allowed (though, unlike regular notes,
2346they cannot contain multiple paragraphs). The syntax is as follows:
2348 Here is an inline note.^[Inlines notes are easier to write, since
2349 you don't have to pick an identifier and move down to type the
2350 note.]
2352Inline and regular footnotes may be mixed freely.
2355Citations
2356---------
2358**Extension: `citations`**
2360Using an external filter, `pandoc-citeproc`, pandoc can automatically generate
2361citations and a bibliography in a number of styles. Basic usage is
2363 pandoc --filter pandoc-citeproc myinput.txt
2365In order to use this feature, you will need to specify a bibliography file
2366using the `bibliography` metadata field in a YAML metadata section.
2367The bibliography may have any of these formats:
2369 Format File extension
2370 ------------ --------------
2371 MODS .mods
2372 BibLaTeX .bib
2373 BibTeX .bibtex
2374 RIS .ris
2375 EndNote .enl
2376 EndNote XML .xml
2377 ISI .wos
2378 MEDLINE .medline
2379 Copac .copac
2380 JSON citeproc .json
2382Note that `.bib` can generally be used with both BibTeX and BibLaTeX
2383files, but you can use `.bibtex` to force BibTeX.
2385Alternatively you can use a `references` field in the document's YAML
2386metadata. This should include an array of YAML-encoded references,
2387for example:
2389 ---
2390 references:
2391 - id: fenner2012a
2392 title: One-click science marketing
2393 author:
2394 - family: Fenner
2395 given: Martin
2396 container-title: Nature Materials
2397 volume: 11
2398 URL: 'http://dx.doi.org/10.1038/nmat3283'
2399 DOI: 10.1038/nmat3283
2400 issue: 4
2401 publisher: Nature Publishing Group
2402 page: 261-263
2403 type: article-journal
2404 issued:
2405 year: 2012
2406 month: 3
2407 ...
2409(The program `mods2yaml`, which comes with `pandoc-citeproc`, can help produce
2410these from a MODS reference collection.)
2412By default, `pandoc-citeproc` will use a Chicago author-date format for
2413citations and references. To use another style, you will need to specify
2414a [CSL] 1.0 style file in the `csl` metadata field. A primer on creating and
2415modifying CSL styles can be found at
2416<http://citationstyles.org/downloads/primer.html>. A repository of CSL styles
2417can be found at <https://github.com/citation-style-language/styles>. See also
2418<http://zotero.org/styles> for easy browsing.
2420Citations go inside square brackets and are separated by semicolons.
2421Each citation must have a key, composed of '@' + the citation
2422identifier from the database, and may optionally have a prefix,
2423a locator, and a suffix. Here are some examples:
2425 Blah blah [see @doe99, pp. 33-35; also @smith04, ch. 1].
2427 Blah blah [@doe99, pp. 33-35, 38-39 and *passim*].
2429 Blah blah [@smith04; @doe99].
2431A minus sign (`-`) before the `@` will suppress mention of
2432the author in the citation. This can be useful when the
2433author is already mentioned in the text:
2435 Smith says blah [-@smith04].
2437You can also write an in-text citation, as follows:
2439 @smith04 says blah.
2441 @smith04 [p. 33] says blah.
2443If the style calls for a list of works cited, it will be placed
2444at the end of the document. Normally, you will want to end your
2445document with an appropriate header:
2447 last paragraph...
2449 # References
2451The bibliography will be inserted after this header.
2453Non-pandoc extensions
2454---------------------
2456The following markdown syntax extensions are not enabled by default
2457in pandoc, but may be enabled by adding `+EXTENSION` to the format
2458name, where `EXTENSION` is the name of the extension. Thus, for
2459example, `markdown+hard_line_breaks` is markdown with hard line breaks.
2461**Extension: `lists_without_preceding_blankline`**\
2462Allow a list to occur right after a paragraph, with no intervening
2463blank space.
2465**Extension: `hard_line_breaks`**\
2466Causes all newlines within a paragraph to be interpreted as hard line
2467breaks instead of spaces.
2469**Extension: `ignore_line_breaks`**\
2470Causes newlines within a paragraph to be ignored, rather than being
2471treated as spaces or as hard line breaks. This option is intended for
2472use with East Asian languages where spaces are not used between words,
2473but text is divided into lines for readability.
2475**Extension: `tex_math_single_backslash`**\
2476Causes anything between `\(` and `\)` to be interpreted as inline
2477TeX math, and anything between `\[` and `\]` to be interpreted
2478as display TeX math. Note: a drawback of this extension is that
2479it precludes escaping `(` and `[`.
2481**Extension: `tex_math_double_backslash`**\
2482Causes anything between `\\(` and `\\)` to be interpreted as inline
2483TeX math, and anything between `\\[` and `\\]` to be interpreted
2484as display TeX math.
2486**Extension: `markdown_attribute`**\
2487By default, pandoc interprets material inside block-level tags as markdown.
2488This extension changes the behavior so that markdown is only parsed
2489inside block-level tags if the tags have the attribute `markdown=1`.
2491**Extension: `mmd_title_block`**\
2492Enables a [MultiMarkdown] style title block at the top of
2493the document, for example:
2495 Title: My title
2496 Author: John Doe
2497 Date: September 1, 2008
2498 Comment: This is a sample mmd title block, with
2499 a field spanning multiple lines.
2501See the MultiMarkdown documentation for details. Note that only title,
2502author, and date are recognized; other fields are simply ignored by
2503pandoc. If `pandoc_title_block` or `yaml_metadata_block` is enabled,
2504it will take precedence over `mmd_title_block`.
2506 [MultiMarkdown]: http://fletcherpenney.net/multimarkdown/
2508**Extension: `abbreviations`**\
2509Parses PHP Markdown Extra abbreviation keys, like
2511 *[HTML]: Hyper Text Markup Language
2513Note that the pandoc document model does not support
2514abbreviations, so if this extension is enabled, abbreviation keys are
2515simply skipped (as opposed to being parsed as paragraphs).
2517**Extension: `autolink_bare_uris`**\
2518Makes all absolute URIs into links, even when not surrounded by
2519pointy braces `<...>`.
2521**Extension: `ascii_identifiers`**\
2522Causes the identifiers produced by `auto_identifiers` to be pure ASCII.
2523Accents are stripped off of accented latin letters, and non-latin
2524letters are omitted.
2526**Extension: `link_attributes`**\
2527Parses multimarkdown style key-value attributes on link and image references.
2528Note that pandoc's internal document model provides nowhere to put
2529these, so they are presently just ignored.
2531**Extension: `mmd_header_identifiers`**\
2532Parses multimarkdown style header identifiers (in square brackets,
2533after the header but before any trailing `#`s in an ATX header).
2535Markdown variants
2536-----------------
2538In addition to pandoc's extended markdown, the following markdown
2539variants are supported:
2541`markdown_phpextra` (PHP Markdown Extra)
2542: `footnotes`, `pipe_tables`, `raw_html`, `markdown_attribute`,
2543 `fenced_code_blocks`, `definition_lists`, `intraword_underscores`,
2544 `header_attributes`, `abbreviations`.
2546`markdown_github` (Github-flavored Markdown)
2547: `pipe_tables`, `raw_html`, `tex_math_single_backslash`,
2548 `fenced_code_blocks`, `fenced_code_attributes`, `auto_identifiers`,
2549 `ascii_identifiers`, `backtick_code_blocks`, `autolink_bare_uris`,
2550 `intraword_underscores`, `strikeout`, `hard_line_breaks`
2552`markdown_mmd` (MultiMarkdown)
2553: `pipe_tables` `raw_html`, `markdown_attribute`, `link_attributes`,
2554 `raw_tex`, `tex_math_double_backslash`, `intraword_underscores`,
2555 `mmd_title_block`, `footnotes`, `definition_lists`,
2556 `all_symbols_escapable`, `implicit_header_references`,
2557 `auto_identifiers`, `mmd_header_identifiers`
2559`markdown_strict` (Markdown.pl)
2560: `raw_html`
2562Producing slide shows with Pandoc
2563=================================
2565You can use Pandoc to produce an HTML + javascript slide presentation
2566that can be viewed via a web browser. There are five ways to do this,
2567using [S5], [DZSlides], [Slidy], [Slideous], or [reveal.js].
2568You can also produce a PDF slide show using LaTeX [beamer].
2570Here's the markdown source for a simple slide show, `habits.txt`:
2572 % Habits
2573 % John Doe
2574 % March 22, 2005
2576 # In the morning
2578 ## Getting up
2580 - Turn off alarm
2581 - Get out of bed
2583 ## Breakfast
2585 - Eat eggs
2586 - Drink coffee
2588 # In the evening
2590 ## Dinner
2592 - Eat spaghetti
2593 - Drink wine
2595 ------------------
2597 ![picture of spaghetti](images/spaghetti.jpg)
2599 ## Going to sleep
2601 - Get in bed
2602 - Count sheep
2604To produce an HTML/javascript slide show, simply type
2606 pandoc -t FORMAT -s habits.txt -o habits.html
2608where `FORMAT` is either `s5`, `slidy`, `slideous`, `dzslides`, or `revealjs`.
2610For Slidy, Slideous, reveal.js, and S5, the file produced by pandoc with the
2611`-s/--standalone` option embeds a link to javascripts and CSS files, which are
2612assumed to be available at the relative path `s5/default` (for S5), `slideous`
2613(for Slideous), `reveal.js` (for reveal.js), or at the Slidy website at
2614`w3.org` (for Slidy). (These paths can be changed by setting the `slidy-url`,
2615`slideous-url`, `revealjs-url`, or `s5-url` variables; see `--variable`,
2616above.) For DZSlides, the (relatively short) javascript and css are included in
2617the file by default.
2619With all HTML slide formats, the `--self-contained` option can be used to
2620produce a single file that contains all of the data necessary to display the
2621slide show, including linked scripts, stylesheets, images, and videos.
2623To produce a PDF slide show using beamer, type
2625 pandoc -t beamer habits.txt -o habits.pdf
2627Note that a reveal.js slide show can also be converted to a PDF
2628by printing it to a file from the browser.
2630Structuring the slide show
2631--------------------------
2633By default, the *slide level* is the highest header level in
2634the hierarchy that is followed immediately by content, and not another
2635header, somewhere in the document. In the example above, level 1 headers
2636are always followed by level 2 headers, which are followed by content,
2637so 2 is the slide level. This default can be overridden using
2638the `--slide-level` option.
2640The document is carved up into slides according to the following
2641rules:
2643 * A horizontal rule always starts a new slide.
2645 * A header at the slide level always starts a new slide.
2647 * Headers *below* the slide level in the hierarchy create
2648 headers *within* a slide.
2650 * Headers *above* the slide level in the hierarchy create
2651 "title slides," which just contain the section title
2652 and help to break the slide show into sections.
2654 * A title page is constructed automatically from the document's title
2655 block, if present. (In the case of beamer, this can be disabled
2656 by commenting out some lines in the default template.)
2658These rules are designed to support many different styles of slide show. If
2659you don't care about structuring your slides into sections and subsections,
2660you can just use level 1 headers for all each slide. (In that case, level 1
2661will be the slide level.) But you can also structure the slide show into
2662sections, as in the example above.
2664Note: in reveal.js slide shows, if slide level is 2, a two-dimensional
2665layout will be produced, with level 1 headers building horizontally
2666and level 2 headers building vertically. It is not recommended that
2667you use deeper nesting of section levels with reveal.js.
2669Incremental lists
2670-----------------
2672By default, these writers produces lists that display "all at once."
2673If you want your lists to display incrementally (one item at a time),
2674use the `-i` option. If you want a particular list to depart from the
2675default (that is, to display incrementally without the `-i` option and
2676all at once with the `-i` option), put it in a block quote:
2678 > - Eat spaghetti
2679 > - Drink wine
2681In this way incremental and nonincremental lists can be mixed in
2682a single document.
2684Inserting pauses
2685----------------
2687You can add "pauses" within a slide by including a paragraph containing
2688three dots, separated by spaces:
2690 # Slide with a pause
2692 content before the pause
2694 . . .
2696 content after the pause
2698Styling the slides
2699------------------
2701You can change the style of HTML slides by putting customized CSS files
2702in `$DATADIR/s5/default` (for S5), `$DATADIR/slidy` (for Slidy),
2703or `$DATADIR/slideous` (for Slideous),
2704where `$DATADIR` is the user data directory (see `--data-dir`, above).
2705The originals may be found in pandoc's system data directory (generally
2706`$CABALDIR/pandoc-VERSION/s5/default`). Pandoc will look there for any
2707files it does not find in the user data directory.
2709For dzslides, the CSS is included in the HTML file itself, and may
2710be modified there.
2712For reveal.js, themes can be used by setting the `theme` variable,
2713for example:
2715 -V theme=moon
2717Or you can specify a custom stylesheet using the `--css` option.
2719To style beamer slides, you can specify a beamer "theme" or "colortheme"
2720using the `-V` option:
2722 pandoc -t beamer habits.txt -V theme:Warsaw -o habits.pdf
2724Note that header attributes will turn into slide attributes
2725(on a `<div>` or `<section>`) in HTML slide formats, allowing you
2726to style individual slides. In Beamer, the only header attribute
2727that affects slides is the `allowframebreaks` class, which sets the
2728`allowframebreaks` option, causing multiple slides to be created
2729if the content overfills the frame. This is recommended especially for
2730bibliographies:
2732 # References {.allowframebreaks}
2734Literate Haskell support
2735========================
2737If you append `+lhs` (or `+literate_haskell`) to an appropriate input or output
2738format (`markdown`, `mardkown_strict`, `rst`, or `latex` for input or output;
2739`beamer`, `html` or `html5` for output only), pandoc will treat the document as
2740literate Haskell source. This means that
2742 - In markdown input, "bird track" sections will be parsed as Haskell
2743 code rather than block quotations. Text between `\begin{code}`
2744 and `\end{code}` will also be treated as Haskell code.
2746 - In markdown output, code blocks with classes `haskell` and `literate`
2747 will be rendered using bird tracks, and block quotations will be
2748 indented one space, so they will not be treated as Haskell code.
2749 In addition, headers will be rendered setext-style (with underlines)
2750 rather than atx-style (with '#' characters). (This is because ghc
2751 treats '#' characters in column 1 as introducing line numbers.)
2753 - In restructured text input, "bird track" sections will be parsed
2754 as Haskell code.
2756 - In restructured text output, code blocks with class `haskell` will
2757 be rendered using bird tracks.
2759 - In LaTeX input, text in `code` environments will be parsed as
2760 Haskell code.
2762 - In LaTeX output, code blocks with class `haskell` will be rendered
2763 inside `code` environments.
2765 - In HTML output, code blocks with class `haskell` will be rendered
2766 with class `literatehaskell` and bird tracks.
2768Examples:
2770 pandoc -f markdown+lhs -t html
2772reads literate Haskell source formatted with markdown conventions and writes
2773ordinary HTML (without bird tracks).
2775 pandoc -f markdown+lhs -t html+lhs
2777writes HTML with the Haskell code in bird tracks, so it can be copied
2778and pasted as literate Haskell source.
2780Custom writers
2781==============
2783Pandoc can be extended with custom writers written in [lua]. (Pandoc
2784includes a lua interpreter, so lua need not be installed separately.)
2786To use a custom writer, simply specify the path to the lua script
2787in place of the output format. For example:
2789 pandoc -t data/sample.lua
2791Creating a custom writer requires writing a lua function for each
2792possible element in a pandoc document. To get a documented example
2793which you can modify according to your needs, do
2795 pandoc --print-default-data-file sample.lua
2797Authors
2798=======
2800© 2006-2013 John MacFarlane (jgm at berkeley dot edu). Released under the
2801[GPL], version 2 or greater. This software carries no warranty of
2802any kind. (See COPYRIGHT for full copyright and warranty notices.)
2803Other contributors include Recai Oktaş, Paulo Tanimoto, Peter Wang,
2804Andrea Rossato, Eric Kow, infinity0x, Luke Plant, shreevatsa.public,
2805Puneeth Chaganti, Paul Rivier, rodja.trappe, Bradley Kuhn, thsutton,
2806Nathan Gass, Jonathan Daugherty, Jérémy Bobbio, Justin Bogner, qerub,
2807Christopher Sawicki, Kelsey Hightower, Masayoshi Takahashi, Antoine
2808Latter, Ralf Stephan, Eric Seidel, B. Scott Michel, Gavin Beatty,
2809Sergey Astanin, Arlo O'Keeffe, Denis Laxalde, Brent Yorgey, David Lazar,
2810Jamie F. Olson.
2812[markdown]: http://daringfireball.net/projects/markdown/
2813[reStructuredText]: http://docutils.sourceforge.net/docs/ref/rst/introduction.html
2814[S5]: http://meyerweb.com/eric/tools/s5/
2815[Slidy]: http://www.w3.org/Talks/Tools/Slidy/
2816[Slideous]: http://goessner.net/articles/slideous/
2817[HTML]: http://www.w3.org/TR/html40/
2818[HTML 5]: http://www.w3.org/TR/html5/
2819[XHTML]: http://www.w3.org/TR/xhtml1/
2820[LaTeX]: http://www.latex-project.org/
2821[beamer]: http://www.tex.ac.uk/CTAN/macros/latex/contrib/beamer
2822[ConTeXt]: http://www.pragma-ade.nl/
2823[RTF]: http://en.wikipedia.org/wiki/Rich_Text_Format
2824[DocBook]: http://www.docbook.org/
2825[OPML]: http://dev.opml.org/spec2.html
2826[OpenDocument]: http://opendocument.xml.org/
2827[ODT]: http://en.wikipedia.org/wiki/OpenDocument
2828[Textile]: http://redcloth.org/textile
2829[MediaWiki markup]: http://www.mediawiki.org/wiki/Help:Formatting
2830[Haddock markup]: http://www.haskell.org/haddock/doc/html/ch03s08.html
2831[groff man]: http://developer.apple.com/DOCUMENTATION/Darwin/Reference/ManPages/man7/groff_man.7.html
2832[Haskell]: http://www.haskell.org/
2833[GNU Texinfo]: http://www.gnu.org/software/texinfo/
2834[Emacs Org-Mode]: http://orgmode.org
2835[AsciiDoc]: http://www.methods.co.nz/asciidoc/
2836[EPUB]: http://www.idpf.org/
2837[GPL]: http://www.gnu.org/copyleft/gpl.html "GNU General Public License"
2838[DZSlides]: http://paulrouget.com/dzslides/
2839[ISO 8601 format]: http://www.w3.org/TR/NOTE-datetime
2840[Word docx]: http://www.microsoft.com/interop/openup/openxml/default.aspx
2841[PDF]: http://www.adobe.com/pdf/
2842[reveal.js]: http://lab.hakim.se/reveal-js/
2843[FictionBook2]: http://www.fictionbook.org/index.php/Eng:XML_Schema_Fictionbook_2.1
2844[lua]: http://www.lua.org