git.iko.soy/typeable/pandoc
on 1.10.0.3 help sign in
2598 lines 92 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], and [DocBook XML]; and it can write plain
17text, [markdown], [reStructuredText], [XHTML], [HTML 5], [LaTeX]
18(including [beamer] slide shows), [ConTeXt], [RTF], [DocBook XML],
19[OpenDocument XML], [ODT], [Word docx], [GNU Texinfo], [MediaWiki
20markup], [EPUB] (v2 or v3), [FictionBook2], [Textile], [groff man] pages, [Emacs
21Org-Mode], [AsciiDoc], and [Slidy], [Slideous], [DZSlides], or [S5] HTML
22slide shows. It can also produce [PDF] output on systems where LaTeX is
23installed.
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 XML), `mediawiki` (MediaWiki markup),
147 or `latex` (LaTeX). If `+lhs` is appended to `markdown`, `rst`,
148 `latex`, the input will be treated as literate Haskell source:
149 see [Literate Haskell support](#literate-haskell-support), below.
150 Markdown syntax extensions can be individually enabled or disabled
151 by appending `+EXTENSION` or `-EXTENSION` to the format name.
152 So, for example, `markdown_strict+footnotes+definition_lists`
153 is strict markdown with footnotes and definition lists enabled,
154 and `markdown-pipe_tables+hard_line_breaks` is pandoc's markdown
155 without pipe tables and with hard line breaks. See [Pandoc's
156 markdown](#pandocs-markdown), below, for a list of extensions and
157 their names.
159`-t` *FORMAT*, `-w` *FORMAT*, `--to=`*FORMAT*, `--write=`*FORMAT*
160: Specify output format. *FORMAT* can be `native` (native Haskell),
161 `json` (JSON version of native AST), `plain` (plain text),
162 `markdown` (pandoc's extended markdown), `markdown_strict` (original
163 unextended markdown), `markdown_phpextra` (PHP Markdown extra
164 extended markdown), `markdown_github` (github extended markdown),
165 `rst` (reStructuredText), `html` (XHTML
166 1), `html5` (HTML 5), `latex` (LaTeX), `beamer` (LaTeX beamer slide show),
167 `context` (ConTeXt), `man` (groff man), `mediawiki` (MediaWiki markup),
168 `textile` (Textile), `org` (Emacs Org-Mode), `texinfo` (GNU Texinfo),
169 `docbook` (DocBook XML), `opendocument` (OpenDocument XML), `odt`
170 (OpenOffice text document), `docx` (Word docx), `epub` (EPUB book), `epub3`
171 (EPUB v3), `fb2` (FictionBook2 e-book), `asciidoc` (AsciiDoc), `slidy`
172 (Slidy HTML and javascript slide show), `slideous` (Slideous HTML and
173 javascript slide show), `dzslides` (HTML5 + javascript slide show), `s5`
174 (S5 HTML and javascript slide show), or `rtf` (rich text format). Note that
175 `odt`, `epub`, and `epub3` output will not be directed to *stdout*; an output
176 filename must be specified using the `-o/--output` option. If `+lhs` is
177 appended to `markdown`, `rst`, `latex`, `beamer`, `html`, or `html5`, the
178 output will be rendered as literate Haskell source: see [Literate Haskell
179 support](#literate-haskell-support), below. Markdown syntax extensions can
180 be individually enabled or disabled by appending `+EXTENSION` or
181 `-EXTENSION` to the format name, as described above under `-f`.
183`-o` *FILE*, `--output=`*FILE*
184: Write output to *FILE* instead of *stdout*. If *FILE* is
185 `-`, output will go to *stdout*. (Exception: if the output
186 format is `odt`, `docx`, `epub`, or `epub3`, output to stdout is disabled.)
188`--data-dir=`*DIRECTORY*
189: Specify the user data directory to search for pandoc data files.
190 If this option is not specified, the default user data directory
191 will be used:
193 $HOME/.pandoc
195 in unix and
197 C:\Documents And Settings\USERNAME\Application Data\pandoc
199 in Windows. A `reference.odt`, `reference.docx`, `default.csl`,
200 `epub.css`, `templates`, `slidy`, `slideous`, or `s5` directory
201 placed in this directory will override pandoc's normal defaults.
203`-v`, `--version`
204: Print version.
206`-h`, `--help`
207: Show usage message.
209Reader options
210--------------
212`-R`, `--parse-raw`
213: Parse untranslatable HTML codes and LaTeX environments as raw HTML
214 or LaTeX, instead of ignoring them. Affects only HTML and LaTeX
215 input. Raw HTML can be printed in markdown, reStructuredText, HTML,
216 Slidy, Slideous,
217 DZSlides, and S5 output; raw LaTeX can be printed in markdown,
218 reStructuredText, LaTeX, and ConTeXt output. The default is for the
219 readers to omit untranslatable HTML codes and LaTeX environments.
220 (The LaTeX reader does pass through untranslatable LaTeX *commands*,
221 even if `-R` is not specified.)
223`-S`, `--smart`
224: Produce typographically correct output, converting straight quotes
225 to curly quotes, `---` to em-dashes, `--` to en-dashes, and
226 `...` to ellipses. Nonbreaking spaces are inserted after certain
227 abbreviations, such as "Mr." (Note: This option is significant only when
228 the input format is `markdown`, `markdown_strict`, or `textile`. It
229 is selected automatically when the input format is `textile` or the
230 output format is `latex` or `context`, unless `--no-tex-ligatures`
231 is used.)
233`--old-dashes`
234: Selects the pandoc <= 1.8.2.1 behavior for parsing smart dashes: `-` before
235 a numeral is an en-dash, and `--` is an em-dash. This option is selected
236 automatically for `textile` input.
238`--base-header-level=`*NUMBER*
239: Specify the base level for headers (defaults to 1).
241`--indented-code-classes=`*CLASSES*
242: Specify classes to use for indented code blocks--for example,
243 `perl,numberLines` or `haskell`. Multiple classes may be separated
244 by spaces or commas.
246`--normalize`
247: Normalize the document after reading: merge adjacent
248 `Str` or `Emph` elements, for example, and remove repeated `Space`s.
250`-p`, `--preserve-tabs`
251: Preserve tabs instead of converting them to spaces (the default).
252 Note that this will only affect tabs in literal code spans and code
253 blocks; tabs in regular text will be treated as spaces.
255`--tab-stop=`*NUMBER*
256: Specify the number of spaces per tab (default is 4).
258General writer options
259----------------------
261`-s`, `--standalone`
262: Produce output with an appropriate header and footer (e.g. a
263 standalone HTML, LaTeX, or RTF file, not a fragment). This option
264 is set automatically for `pdf`, `epub`, `epub3`, `fb2`, `docx`, and `odt`
265 output.
267`--template=`*FILE*
268: Use *FILE* as a custom template for the generated document. Implies
269 `--standalone`. See [Templates](#templates) below for a description
270 of template syntax. If no extension is specified, an extension
271 corresponding to the writer will be added, so that `--template=special`
272 looks for `special.html` for HTML output. If the template is not
273 found, pandoc will search for it in the user data directory
274 (see `--data-dir`). If this option is not used, a default
275 template appropriate for the output format will be used (see
276 `-D/--print-default-template`).
278`-V` *KEY[=VAL]*, `--variable=`*KEY[:VAL]*
279: Set the template variable *KEY* to the value *VAL* when rendering the
280 document in standalone mode. This is generally only useful when the
281 `--template` option is used to specify a custom template, since
282 pandoc automatically sets the variables used in the default
283 templates. If no *VAL* is specified, the key will be given the
284 value `true`.
286`-D` *FORMAT*, `--print-default-template=`*FORMAT*
287: Print the default template for an output *FORMAT*. (See `-t`
288 for a list of possible *FORMAT*s.)
290`--no-wrap`
291: Disable text wrapping in output. By default, text is wrapped
292 appropriately for the output format.
294`--columns`=*NUMBER*
295: Specify length of lines in characters (for text wrapping).
297`--toc`, `--table-of-contents`
298: Include an automatically generated table of contents (or, in
299 the case of `latex`, `context`, and `rst`, an instruction to create
300 one) in the output document. This option has no effect on `man`,
301 `docbook`, `slidy`, `slideous`, or `s5` output.
303`--toc-depth=`*NUMBER*
304: Specify the number of section levels to include in the table
305 of contents. The default is 3 (which means that level 1, 2, and 3
306 headers will be listed in the contents). Implies `--toc`.
308`--no-highlight`
309: Disables syntax highlighting for code blocks and inlines, even when
310 a language attribute is given.
312`--highlight-style`=*STYLE*
313: Specifies the coloring style to be used in highlighted source code.
314 Options are `pygments` (the default), `kate`, `monochrome`,
315 `espresso`, `zenburn`, `haddock`, and `tango`.
317`-H` *FILE*, `--include-in-header=`*FILE*
318: Include contents of *FILE*, verbatim, at the end of the header.
319 This can be used, for example, to include special
320 CSS or javascript in HTML documents. This option can be used
321 repeatedly to include multiple files in the header. They will be
322 included in the order specified. Implies `--standalone`.
324`-B` *FILE*, `--include-before-body=`*FILE*
325: Include contents of *FILE*, verbatim, at the beginning of the
326 document body (e.g. after the `<body>` tag in HTML, or the
327 `\begin{document}` command in LaTeX). This can be used to include
328 navigation bars or banners in HTML documents. This option can be
329 used repeatedly to include multiple files. They will be included in
330 the order specified. Implies `--standalone`.
332`-A` *FILE*, `--include-after-body=`*FILE*
333: Include contents of *FILE*, verbatim, at the end of the document
334 body (before the `</body>` tag in HTML, or the
335 `\end{document}` command in LaTeX). This option can be be used
336 repeatedly to include multiple files. They will be included in the
337 order specified. Implies `--standalone`.
339Options affecting specific writers
340----------------------------------
342`--self-contained`
343: Produce a standalone HTML file with no external dependencies, using
344 `data:` URIs to incorporate the contents of linked scripts, stylesheets,
345 images, and videos. The resulting file should be "self-contained,"
346 in the sense that it needs no external files and no net access to be
347 displayed properly by a browser. This option works only with HTML output
348 formats, including `html`, `html5`, `html+lhs`, `html5+lhs`, `s5`,
349 `slidy`, `slideous`,
350 and `dzslides`. Scripts, images, and stylesheets at absolute URLs
351 will be downloaded; those at relative URLs will be sought first relative
352 to the working directory, then relative to the user data directory (see
353 `--data-dir`), and finally relative to pandoc's default data directory.
355`--offline`
356: Deprecated synonym for `--self-contained`.
358`-5`, `--html5`
359: Produce HTML5 instead of HTML4. This option has no effect for writers
360 other than `html`. (*Deprecated:* Use the `html5` output format instead.)
362`--html-q-tags`
363: Use `<q>` tags for quotes in HTML.
365`--ascii`
366: Use only ascii characters in output. Currently supported only
367 for HTML output (which uses numerical entities instead of
368 UTF-8 when this option is selected).
370`--reference-links`
371: Use reference-style links, rather than inline links, in writing markdown
372 or reStructuredText. By default inline links are used.
374`--atx-headers`
375: Use ATX style headers in markdown output. The default is to use
376 setext-style headers for levels 1-2, and then ATX headers.
378`--chapters`
379: Treat top-level headers as chapters in LaTeX, ConTeXt, and DocBook
380 output. When the LaTeX template uses the report, book, or
381 memoir class, this option is implied. If `--beamer` is used,
382 top-level headers will become `\part{..}`.
384`-N`, `--number-sections`
385: Number section headings in LaTeX, ConTeXt, or HTML output.
386 By default, sections are not numbered.
388`--no-tex-ligatures`
389: Do not convert quotation marks, apostrophes, and dashes to
390 the TeX ligatures when writing LaTeX or ConTeXt. Instead, just
391 use literal unicode characters. This is needed for using advanced
392 OpenType features with XeLaTeX and LuaLaTeX. Note: normally
393 `--smart` is selected automatically for LaTeX and ConTeXt
394 output, but it must be specified explicitly if `--no-tex-ligatures`
395 is selected. If you use literal curly quotes, dashes, and ellipses
396 in your source, then you may want to use `--no-tex-ligatures`
397 without `--smart`.
399`--listings`
400: Use listings package for LaTeX code blocks
402`-i`, `--incremental`
403: Make list items in slide shows display incrementally (one by one).
404 The default is for lists to be displayed all at once.
406`--slide-level`=*NUMBER*
407: Specifies that headers with the specified level create
408 slides (for `beamer`, `s5`, `slidy`, `slideous`, `dzslides`). Headers
409 above this level in the hierarchy are used to divide the
410 slide show into sections; headers below this level create
411 subheads within a slide. The default is to set the slide level
412 based on the contents of the document; see
413 [Structuring the slide show](#structuring-the-slide-show), below.
415`--section-divs`
416: Wrap sections in `<div>` tags (or `<section>` tags in HTML5),
417 and attach identifiers to the enclosing `<div>` (or `<section>`)
418 rather than the header itself.
419 See [Section identifiers](#header-identifiers-in-html-latex-and-context), below.
421`--email-obfuscation=`*none|javascript|references*
422: Specify a method for obfuscating `mailto:` links in HTML documents.
423 *none* leaves `mailto:` links as they are. *javascript* obfuscates
424 them using javascript. *references* obfuscates them by printing their
425 letters as decimal or hexadecimal character references.
427`--id-prefix`=*STRING*
428: Specify a prefix to be added to all automatically generated identifiers
429 in HTML and DocBook output, and to footnote numbers in markdown output.
430 This is useful for preventing duplicate identifiers when generating
431 fragments to be included in other pages.
433`-T` *STRING*, `--title-prefix=`*STRING*
434: Specify *STRING* as a prefix at the beginning of the title
435 that appears in the HTML header (but not in the title as it
436 appears at the beginning of the HTML body). Implies
437 `--standalone`.
439`-c` *URL*, `--css=`*URL*
440: Link to a CSS style sheet. This option can be be used repeatedly to
441 include multiple files. They will be included in the order specified.
443`--reference-odt=`*FILE*
444: Use the specified file as a style reference in producing an ODT.
445 For best results, the reference ODT should be a modified version
446 of an ODT produced using pandoc. The contents of the reference ODT
447 are ignored, but its stylesheets are used in the new ODT. If no
448 reference ODT is specified on the command line, pandoc will look
449 for a file `reference.odt` in the user data directory (see
450 `--data-dir`). If this is not found either, sensible defaults will be
451 used.
453`--reference-docx=`*FILE*
454: Use the specified file as a style reference in producing a docx file.
455 For best results, the reference docx should be a modified version
456 of a docx file produced using pandoc. The contents of the reference docx
457 are ignored, but its stylesheets are used in the new docx. If no
458 reference docx is specified on the command line, pandoc will look
459 for a file `reference.docx` in the user data directory (see
460 `--data-dir`). If this is not found either, sensible defaults will be
461 used. The following styles are used by pandoc: [paragraph]
462 Normal, Title, Authors, Date, Heading 1, Heading 2, Heading 3,
463 Heading 4, Heading 5, Block Quote, Definition Term, Definition,
464 Body Text, Table Caption, Image Caption; [character] Default
465 Paragraph Font, Body Text Char, Verbatim Char, Footnote Reference,
466 Hyperlink.
468`--epub-stylesheet=`*FILE*
469: Use the specified CSS file to style the EPUB. If no stylesheet
470 is specified, pandoc will look for a file `epub.css` in the
471 user data directory (see `--data-dir`). If it is not
472 found there, sensible defaults will be used.
474`--epub-cover-image=`*FILE*
475: Use the specified image as the EPUB cover. It is recommended
476 that the image be less than 1000px in width and height.
478`--epub-metadata=`*FILE*
479: Look in the specified XML file for metadata for the EPUB.
480 The file should contain a series of Dublin Core elements,
481 as documented at <http://dublincore.org/documents/dces/>.
482 For example:
484 <dc:rights>Creative Commons</dc:rights>
485 <dc:language>es-AR</dc:language>
487 By default, pandoc will include the following metadata elements:
488 `<dc:title>` (from the document title), `<dc:creator>` (from the
489 document authors), `<dc:date>` (from the document date, which should
490 be in [ISO 8601 format]), `<dc:language>` (from the `lang`
491 variable, or, if is not set, the locale), and `<dc:identifier
492 id="BookId">` (a randomly generated UUID). Any of these may be
493 overridden by elements in the metadata file.
495`--epub-embed-font=`*FILE*
496: Embed the specified font in the EPUB. This option can be repeated
497 to embed multiple fonts. To use embedded fonts, you
498 will need to add declarations like the following to your CSS (see
499 `--epub-stylesheet`):
501 @font-face {
502 font-family: DejaVuSans;
503 font-style: normal;
504 font-weight: normal;
505 src:url("DejaVuSans-Regular.ttf");
506 }
507 @font-face {
508 font-family: DejaVuSans;
509 font-style: normal;
510 font-weight: bold;
511 src:url("DejaVuSans-Bold.ttf");
512 }
513 @font-face {
514 font-family: DejaVuSans;
515 font-style: italic;
516 font-weight: normal;
517 src:url("DejaVuSans-Oblique.ttf");
518 }
519 @font-face {
520 font-family: DejaVuSans;
521 font-style: italic;
522 font-weight: bold;
523 src:url("DejaVuSans-BoldOblique.ttf");
524 }
525 body { font-family: "DejaVuSans"; }
527`--epub-chapter-level=`*NUMBER*
528: Specify the header level at which to split the EPUB into separate
529 "chapter" files. The default is to split into chapters at level 1
530 headers. This option only affects the internal composition of the
531 EPUB, not the way chapters and sections are displayed to users. Some
532 readers may be slow if the chapter files are too large, so for large
533 documents with few level 1 headers, one might want to use a chapter
534 level of 2 or 3.
536`--latex-engine=`*pdflatex|lualatex|xelatex*
537: Use the specified LaTeX engine when producing PDF output.
538 The default is `pdflatex`. If the engine is not in your PATH,
539 the full path of the engine may be specified here.
541Citation rendering
542------------------
544`--bibliography=`*FILE*
545: Specify bibliography database to be used in resolving
546 citations. The database type will be determined from the
547 extension of *FILE*, which may be `.mods` (MODS format),
548 `.bib` (BibLaTeX format, which will normally work for BibTeX
549 files as well), `.bibtex` (BibTeX format),
550 `.ris` (RIS format), `.enl` (EndNote format),
551 `.xml` (EndNote XML format), `.wos` (ISI format),
552 `.medline` (MEDLINE format), `.copac` (Copac format),
553 or `.json` (citeproc JSON). If you want to use multiple
554 bibliographies, just use this option repeatedly.
556`--csl=`*FILE*
557: Specify [CSL] style to be used in formatting citations and
558 the bibliography. If *FILE* is not found, pandoc will look
559 for it in
561 $HOME/.csl
563 in unix and
565 C:\Documents And Settings\USERNAME\Application Data\csl
567 in Windows. If the `--csl` option is not specified, pandoc
568 will use a default style: either `default.csl` in the
569 user data directory (see `--data-dir`), or, if that is
570 not present, the Chicago author-date style.
572`--citation-abbreviations=`*FILE*
573: Specify a file containing abbreviations for journal titles and
574 other bibliographic fields (indicated by setting `form="short"`
575 in the CSL node for the field). The format is described at
576 <http://citationstylist.org/2011/10/19/abbreviations-for-zotero-test-release/>.
577 Here is a short example:
579 { "default": {
580 "container-title": {
581 "Lloyd's Law Reports": "Lloyd's Rep",
582 "Estates Gazette": "EG",
583 "Scots Law Times": "SLT"
584 }
585 }
586 }
588`--natbib`
589: Use natbib for citations in LaTeX output.
591`--biblatex`
592: Use biblatex for citations in LaTeX output.
594Math rendering in HTML
595----------------------
597`-m` [*URL*], `--latexmathml`[=*URL*]
598: Use the [LaTeXMathML] script to display embedded TeX math in HTML output.
599 To insert a link to a local copy of the `LaTeXMathML.js` script,
600 provide a *URL*. If no *URL* is provided, the contents of the
601 script will be inserted directly into the HTML header, preserving
602 portability at the price of efficiency. If you plan to use math on
603 several pages, it is much better to link to a copy of the script,
604 so it can be cached.
606`--mathml`[=*URL*]
607: Convert TeX math to MathML (in `docbook` as well as `html` and `html5`).
608 In standalone `html` output, a small javascript (or a link to such a
609 script if a *URL* is supplied) will be inserted that allows the MathML to
610 be viewed on some browsers.
612`--jsmath`[=*URL*]
613: Use [jsMath] to display embedded TeX math in HTML output.
614 The *URL* should point to the jsMath load script (e.g.
615 `jsMath/easy/load.js`); if provided, it will be linked to in
616 the header of standalone HTML documents. If a *URL* is not provided,
617 no link to the jsMath load script will be inserted; it is then
618 up to the author to provide such a link in the HTML template.
620`--mathjax`[=*URL*]
621: Use [MathJax] to display embedded TeX math in HTML output.
622 The *URL* should point to the `MathJax.js` load script.
623 If a *URL* is not provided, a link to the MathJax CDN will
624 be inserted.
626`--gladtex`
627: Enclose TeX math in `<eq>` tags in HTML output. These can then
628 be processed by [gladTeX] to produce links to images of the typeset
629 formulas.
631`--mimetex`[=*URL*]
632: Render TeX math using the [mimeTeX] CGI script. If *URL* is not
633 specified, it is assumed that the script is at `/cgi-bin/mimetex.cgi`.
635`--webtex`[=*URL*]
636: Render TeX formulas using an external script that converts TeX
637 formulas to images. The formula will be concatenated with the URL
638 provided. If *URL* is not specified, the Google Chart API will be used.
640Options for wrapper scripts
641---------------------------
643`--dump-args`
644: Print information about command-line arguments to *stdout*, then exit.
645 This option is intended primarily for use in wrapper scripts.
646 The first line of output contains the name of the output file specified
647 with the `-o` option, or `-` (for *stdout*) if no output file was
648 specified. The remaining lines contain the command-line arguments,
649 one per line, in the order they appear. These do not include regular
650 Pandoc options and their arguments, but do include any options appearing
651 after a `--` separator at the end of the line.
653`--ignore-args`
654: Ignore command-line arguments (for use in wrapper scripts).
655 Regular Pandoc options are not ignored. Thus, for example,
657 pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1
659 is equivalent to
661 pandoc -o foo.html -s
663[LaTeXMathML]: http://math.etsu.edu/LaTeXMathML/
664[jsMath]: http://www.math.union.edu/~dpvc/jsmath/
665[MathJax]: http://www.mathjax.org/
666[gladTeX]: http://ans.hsh.no/home/mgg/gladtex/
667[mimeTeX]: http://www.forkosh.com/mimetex.html
668[CSL]: http://CitationStyles.org
670Templates
671=========
673When the `-s/--standalone` option is used, pandoc uses a template to
674add header and footer material that is needed for a self-standing
675document. To see the default template that is used, just type
677 pandoc -D FORMAT
679where `FORMAT` is the name of the output format. A custom template
680can be specified using the `--template` option. You can also override
681the system default templates for a given output format `FORMAT`
682by putting a file `templates/default.FORMAT` in the user data
683directory (see `--data-dir`, above). *Exceptions:* For `odt` output,
684customize the `default.opendocument` template. For `pdf` output,
685customize the `default.latex` template.
687Templates may contain *variables*. Variable names are sequences of
688alphanumerics, `-`, and `_`, starting with a letter. A variable name
689surrounded by `$` signs will be replaced by its value. For example,
690the string `$title$` in
692 <title>$title$</title>
694will be replaced by the document title.
696To write a literal `$` in a template, use `$$`.
698Some variables are set automatically by pandoc. These vary somewhat
699depending on the output format, but include:
701`header-includes`
702: contents specified by `-H/--include-in-header` (may have multiple
703 values)
704`toc`
705: non-null value if `--toc/--table-of-contents` was specified
706`include-before`
707: contents specified by `-B/--include-before-body` (may have
708 multiple values)
709`include-after`
710: contents specified by `-A/--include-after-body` (may have
711 multiple values)
712`body`
713: body of document
714`title`
715: title of document, as specified in title block
716`author`
717: author of document, as specified in title block (may have
718 multiple values)
719`date`
720: date of document, as specified in title block
721`lang`
722: language code for HTML or LaTeX documents
723`slidy-url`
724: base URL for Slidy documents (defaults to
725 `http://www.w3.org/Talks/Tools/Slidy2`)
726`slideous-url`
727: base URL for Slideous documents (defaults to `default`)
728`s5-url`
729: base URL for S5 documents (defaults to `ui/default`)
730`fontsize`
731: font size (10pt, 11pt, 12pt) for LaTeX documents
732`documentclass`
733: document class for LaTeX documents
734`geometry`
735: options for LaTeX `geometry` class, e.g. `margin=1in`;
736 may be repeated for multiple options
737`mainfont`, `sansfont`, `monofont`, `mathfont`
738: fonts for LaTeX documents (works only with xelatex
739 and lualatex)
740`theme`
741: theme for LaTeX beamer documents
742`colortheme`
743: colortheme for LaTeX beamer documents
744`linkcolor`
745: color for internal links in LaTeX documents (`red`, `green`,
746 `magenta`, `cyan`, `blue`, `black`)
747`urlcolor`
748: color for external links in LaTeX documents
749`links-as-notes`
750: causes links to be printed as footnotes in LaTeX documents
752Variables may be set at the command line using the `-V/--variable`
753option. This allows users to include custom variables in their
754templates.
756Templates may contain conditionals. The syntax is as follows:
758 $if(variable)$
759 X
760 $else$
761 Y
762 $endif$
764This will include `X` in the template if `variable` has a non-null
765value; otherwise it will include `Y`. `X` and `Y` are placeholders for
766any valid template text, and may include interpolated variables or other
767conditionals. The `$else$` section may be omitted.
769When variables can have multiple values (for example, `author` in
770a multi-author document), you can use the `$for$` keyword:
772 $for(author)$
773 <meta name="author" content="$author$" />
774 $endfor$
776You can optionally specify a separator to be used between
777consecutive items:
779 $for(author)$$author$$sep$, $endfor$
781If you use custom templates, you may need to revise them as pandoc
782changes. We recommend tracking the changes in the default templates,
783and modifying your custom templates accordingly. An easy way to do this
784is to fork the pandoc-templates repository
785(<http://github.com/jgm/pandoc-templates>) and merge in changes after each
786pandoc release.
788Pandoc's markdown
789=================
791Pandoc understands an extended and slightly revised version of
792John Gruber's [markdown] syntax. This document explains the syntax,
793noting differences from standard markdown. Except where noted, these
794differences can be suppressed by using the `markdown_strict` format instead
795of `markdown`. An extensions can be enabled by adding `+EXTENSION`
796to the format name and disabled by adding `-EXTENSION`. For example,
797`markdown_strict+footnotes` is strict markdown with footnotes
798enabled, while `markdown-footnotes-pipe_tables` is pandoc's
799markdown without footnotes or pipe tables.
801Philosophy
802----------
804Markdown is designed to be easy to write, and, even more importantly,
805easy to read:
807> A Markdown-formatted document should be publishable as-is, as plain
808> text, without looking like it's been marked up with tags or formatting
809> instructions.
810> -- [John Gruber](http://daringfireball.net/projects/markdown/syntax#philosophy)
812This principle has guided pandoc's decisions in finding syntax for
813tables, footnotes, and other extensions.
815There is, however, one respect in which pandoc's aims are different
816from the original aims of markdown. Whereas markdown was originally
817designed with HTML generation in mind, pandoc is designed for multiple
818output formats. Thus, while pandoc allows the embedding of raw HTML,
819it discourages it, and provides other, non-HTMLish ways of representing
820important document elements like definition lists, tables, mathematics, and
821footnotes.
823Paragraphs
824----------
826A paragraph is one or more lines of text followed by one or more blank line.
827Newlines are treated as spaces, so you can reflow your paragraphs as you like.
828If you need a hard line break, put two or more spaces at the end of a line.
830**Extension: `escaped_line_breaks`**
832A backslash followed by a newline is also a hard line break.
834Headers
835-------
837There are two kinds of headers, Setext and atx.
839### Setext-style headers ###
841A setext-style header is a line of text "underlined" with a row of `=` signs
842(for a level one header) of `-` signs (for a level two header):
844 A level-one header
845 ==================
847 A level-two header
848 ------------------
850The header text can contain inline formatting, such as emphasis (see
851[Inline formatting](#inline-formatting), below).
854### Atx-style headers ###
856An Atx-style header consists of one to six `#` signs and a line of
857text, optionally followed by any number of `#` signs. The number of
858`#` signs at the beginning of the line is the header level:
860 ## A level-two header
862 ### A level-three header ###
864As with setext-style headers, the header text can contain formatting:
866 # A level-one header with a [link](/url) and *emphasis*
868**Extension: `blank_before_header`**
870Standard markdown syntax does not require a blank line before a header.
871Pandoc does require this (except, of course, at the beginning of the
872document). The reason for the requirement is that it is all too easy for a
873`#` to end up at the beginning of a line by accident (perhaps through line
874wrapping). Consider, for example:
876 I like several of their flavors of ice cream:
877 #22, for example, and #5.
880### Header identifiers in HTML, LaTeX, and ConTeXt ###
882**Extension: `header_attributes`**
884Headers can be assigned attributes using this syntax at the end
885of the line containing the header text:
887 {#identifier .class .class key=value key=value}
889Although this syntax allows assignment of classes and key/value attributes,
890only identifiers currently have any affect in the writers (and only in some
891writers: HTML, LaTeX, ConTeXt, Textile, AsciiDoc). Thus, for example,
892the following headers will all be assigned the identifier `foo`:
894 # My header {#foo}
896 ## My header ## {#foo}
898 My other header {#foo}
899 ---------------
901(This syntax is compatible with [PHP Markdown Extra].)
903**Extension: `auto_identifiers`**
905A header without an explicitly specified identifier will be
906automatically assigned a unique identifier based on the header text.
907To derive the identifier from the header text,
909 - Remove all formatting, links, etc.
910 - Remove all punctuation, except underscores, hyphens, and periods.
911 - Replace all spaces and newlines with hyphens.
912 - Convert all alphabetic characters to lowercase.
913 - Remove everything up to the first letter (identifiers may
914 not begin with a number or punctuation mark).
915 - If nothing is left after this, use the identifier `section`.
917Thus, for example,
919 Header Identifier
920 ------------------------------- ----------------------------
921 Header identifiers in HTML `header-identifiers-in-html`
922 *Dogs*?--in *my* house? `dogs--in-my-house`
923 [HTML], [S5], or [RTF]? `html-s5-or-rtf`
924 3. Applications `applications`
925 33 `section`
927These rules should, in most cases, allow one to determine the identifier
928from the header text. The exception is when several headers have the
929same text; in this case, the first will get an identifier as described
930above; the second will get the same identifier with `-1` appended; the
931third with `-2`; and so on.
933These identifiers are used to provide link targets in the table of
934contents generated by the `--toc|--table-of-contents` option. They
935also make it easy to provide links from one section of a document to
936another. A link to this section, for example, might look like this:
938 See the section on
939 [header identifiers](#header-identifiers-in-html).
941Note, however, that this method of providing links to sections works
942only in HTML, LaTeX, and ConTeXt formats.
944If the `--section-divs` option is specified, then each section will
945be wrapped in a `div` (or a `section`, if `--html5` was specified),
946and the identifier will be attached to the enclosing `<div>`
947(or `<section>`) tag rather than the header itself. This allows entire
948sections to be manipulated using javascript or treated differently in
949CSS.
951**Extension: `implicit_header_references`**
953Pandoc behaves as if reference links have been defined for each header.
954So, instead of
956 [header identifiers](#header-identifiers-in-html)
958you can simply write
960 [header identifiers]
962or
964 [header identifiers][]
966or
968 [the section on header identifiers][header identifiers]
970If there are multiple headers with identical text, the corresponding
971reference will link to the first one only, and you will need to use explicit
972links to link to the others, as described above.
974Unlike regular reference links, these references are case-sensitive.
976Note: if you have defined an explicit identifier for a header,
977then implicit references to it will not work.
979Block quotations
980----------------
982Markdown uses email conventions for quoting blocks of text.
983A block quotation is one or more paragraphs or other block elements
984(such as lists or headers), with each line preceded by a `>` character
985and a space. (The `>` need not start at the left margin, but it should
986not be indented more than three spaces.)
988 > This is a block quote. This
989 > paragraph has two lines.
990 >
991 > 1. This is a list inside a block quote.
992 > 2. Second item.
994A "lazy" form, which requires the `>` character only on the first
995line of each block, is also allowed:
997 > This is a block quote. This
998 paragraph has two lines.
1000 > 1. This is a list inside a block quote.
1001 2. Second item.
1003Among the block elements that can be contained in a block quote are
1004other block quotes. That is, block quotes can be nested:
1006 > This is a block quote.
1008 > > A block quote within a block quote.
1010**Extension: `blank_line_before_blockquote`**
1012Standard markdown syntax does not require a blank line before a block
1013quote. Pandoc does require this (except, of course, at the beginning of the
1014document). The reason for the requirement is that it is all too easy for a
1015`>` to end up at the beginning of a line by accident (perhaps through line
1016wrapping). So, unless the `markdown_strict` format is used, the following does
1017not produce a nested block quote in pandoc:
1019 > This is a block quote.
1020 >> Nested.
1023Verbatim (code) blocks
1024----------------------
1026### Indented code blocks ###
1028A block of text indented four spaces (or one tab) is treated as verbatim
1029text: that is, special characters do not trigger special formatting,
1030and all spaces and line breaks are preserved. For example,
1032 if (a > 3) {
1033 moveShip(5 * gravity, DOWN);
1036The initial (four space or one tab) indentation is not considered part
1037of the verbatim text, and is removed in the output.
1039Note: blank lines in the verbatim text need not begin with four spaces.
1042### Fenced code blocks ###
1044**Extension: `fenced_code_blocks`**
1046In addition to standard indented code blocks, Pandoc supports
1047*fenced* code blocks. These begin with a row of three or more
1048tildes (`~`) or backticks (`` ` ``) and end with a row of tildes or
1049backticks that must be at least as long as the starting row. Everything
1050between these lines is treated as code. No indentation is necessary:
1052 ~~~~~~~
1053 if (a > 3) {
1054 moveShip(5 * gravity, DOWN);
1056 ~~~~~~~
1058Like regular code blocks, fenced code blocks must be separated
1059from surrounding text by blank lines.
1061If the code itself contains a row of tildes or backticks, just use a longer
1062row of tildes or backticks at the start and end:
1064 ~~~~~~~~~~~~~~~~
1065 ~~~~~~~~~~
1066 code including tildes
1067 ~~~~~~~~~~
1068 ~~~~~~~~~~~~~~~~
1070Optionally, you may attach attributes to the code block using
1071this syntax:
1073 ~~~~ {#mycode .haskell .numberLines startFrom="100"}
1074 qsort [] = []
1075 qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
1076 qsort (filter (>= x) xs)
1077 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1079Here `mycode` is an identifier, `haskell` and `numberLines` are classes, and
1080`startFrom` is an attribute with value `100`. Some output formats can use this
1081information to do syntax highlighting. Currently, the only output formats
1082that uses this information are HTML and LaTeX. If highlighting is supported
1083for your output format and language, then the code block above will appear
1084highlighted, with numbered lines. (To see which languages are supported, do
1085`pandoc --version`.) Otherwise, the code block above will appear as follows:
1087 <pre id="mycode" class="haskell numberLines" startFrom="100">
1088 <code>
1089 ...
1090 </code>
1091 </pre>
1093A shortcut form can also be used for specifying the language of
1094the code block:
1096 ```haskell
1097 qsort [] = []
1098 ```
1100This is equivalent to:
1102 ``` {.haskell}
1103 qsort [] = []
1104 ```
1106To prevent all highlighting, use the `--no-highlight` flag.
1107To set the highlighting style, use `--highlight-style`.
1109Line blocks
1110-----------
1112**Extension: `line_blocks`**
1114A line block is a sequence of lines beginning with a vertical bar (`|`)
1115followed by a space. The division into lines will be preserved in
1116the output, as will any leading spaces; otherwise, the lines will
1117be formatted as markdown. This is useful for verse and addresses:
1119 | The limerick packs laughs anatomical
1120 | In space that is quite economical.
1121 | But the good ones I've seen
1122 | So seldom are clean
1123 | And the clean ones so seldom are comical
1125 | 200 Main St.
1126 | Berkeley, CA 94718
1128The lines can be hard-wrapped if needed, but the continuation
1129line must begin with a space.
1131 | The Right Honorable Most Venerable and Righteous Samuel L.
1132 Constable, Jr.
1133 | 200 Main St.
1134 | Berkeley, CA 94718
1136This syntax is borrowed from [reStructuredText].
1138Lists
1139-----
1141### Bullet lists ###
1143A bullet list is a list of bulleted list items. A bulleted list
1144item begins with a bullet (`*`, `+`, or `-`). Here is a simple
1145example:
1147 * one
1148 * two
1149 * three
1151This will produce a "compact" list. If you want a "loose" list, in which
1152each item is formatted as a paragraph, put spaces between the items:
1154 * one
1156 * two
1158 * three
1160The bullets need not be flush with the left margin; they may be
1161indented one, two, or three spaces. The bullet must be followed
1162by whitespace.
1164List items look best if subsequent lines are flush with the first
1165line (after the bullet):
1167 * here is my first
1168 list item.
1169 * and my second.
1171But markdown also allows a "lazy" format:
1173 * here is my first
1174 list item.
1175 * and my second.
1177### The four-space rule ###
1179A list item may contain multiple paragraphs and other block-level
1180content. However, subsequent paragraphs must be preceded by a blank line
1181and indented four spaces or a tab. The list will look better if the first
1182paragraph is aligned with the rest:
1184 * First paragraph.
1186 Continued.
1188 * Second paragraph. With a code block, which must be indented
1189 eight spaces:
1191 { code }
1193List items may include other lists. In this case the preceding blank
1194line is optional. The nested list must be indented four spaces or
1195one tab:
1197 * fruits
1198 + apples
1199 - macintosh
1200 - red delicious
1201 + pears
1202 + peaches
1203 * vegetables
1204 + brocolli
1205 + chard
1207As noted above, markdown allows you to write list items "lazily," instead of
1208indenting continuation lines. However, if there are multiple paragraphs or
1209other blocks in a list item, the first line of each must be indented.
1211 + A lazy, lazy, list
1212 item.
1214 + Another one; this looks
1215 bad but is legal.
1217 Second paragraph of second
1218 list item.
1220**Note:** Although the four-space rule for continuation paragraphs
1221comes from the official [markdown syntax guide], the reference implementation,
1222`Markdown.pl`, does not follow it. So pandoc will give different results than
1223`Markdown.pl` when authors have indented continuation paragraphs fewer than
1224four spaces.
1226The [markdown syntax guide] is not explicit whether the four-space
1227rule applies to *all* block-level content in a list item; it only
1228mentions paragraphs and code blocks. But it implies that the rule
1229applies to all block-level content (including nested lists), and
1230pandoc interprets it that way.
1232 [markdown syntax guide]:
1233 http://daringfireball.net/projects/markdown/syntax#list
1235### Ordered lists ###
1237Ordered lists work just like bulleted lists, except that the items
1238begin with enumerators rather than bullets.
1240In standard markdown, enumerators are decimal numbers followed
1241by a period and a space. The numbers themselves are ignored, so
1242there is no difference between this list:
1244 1. one
1245 2. two
1246 3. three
1248and this one:
1250 5. one
1251 7. two
1252 1. three
1254**Extension: `fancy_lists`**
1256Unlike standard markdown, Pandoc allows ordered list items to be marked
1257with uppercase and lowercase letters and roman numerals, in addition to
1258arabic numerals. List markers may be enclosed in parentheses or followed by a
1259single right-parentheses or period. They must be separated from the
1260text that follows by at least one space, and, if the list marker is a
1261capital letter with a period, by at least two spaces.[^2]
1263[^2]: The point of this rule is to ensure that normal paragraphs
1264 starting with people's initials, like
1266 B. Russell was an English philosopher.
1268 do not get treated as list items.
1270 This rule will not prevent
1272 (C) 2007 Joe Smith
1274 from being interpreted as a list item. In this case, a backslash
1275 escape can be used:
1277 (C\) 2007 Joe Smith
1279**Extension: `startnum`**
1281Pandoc also pays attention to the type of list marker used, and to the
1282starting number, and both of these are preserved where possible in the
1283output format. Thus, the following yields a list with numbers followed
1284by a single parenthesis, starting with 9, and a sublist with lowercase
1285roman numerals:
1287 9) Ninth
1288 10) Tenth
1289 11) Eleventh
1290 i. subone
1291 ii. subtwo
1292 iii. subthree
1294Pandoc will start a new list each time a different type of list
1295marker is used. So, the following will create three lists:
1297 (2) Two
1298 (5) Three
1299 1. Four
1300 * Five
1302If default list markers are desired, use `#.`:
1304 #. one
1305 #. two
1306 #. three
1309### Definition lists ###
1311**Extension: `definition_lists`**
1313Pandoc supports definition lists, using a syntax inspired by
1314[PHP Markdown Extra] and [reStructuredText]:[^3]
1316 Term 1
1318 : Definition 1
1320 Term 2 with *inline markup*
1322 : Definition 2
1324 { some code, part of Definition 2 }
1326 Third paragraph of definition 2.
1328Each term must fit on one line, which may optionally be followed by
1329a blank line, and must be followed by one or more definitions.
1330A definition begins with a colon or tilde, which may be indented one
1331or two spaces. The body of the definition (including the first line,
1332aside from the colon or tilde) should be indented four spaces. A term may have
1333multiple definitions, and each definition may consist of one or more block
1334elements (paragraph, code block, list, etc.), each indented four spaces or one
1335tab stop.
1337If you leave space after the definition (as in the example above),
1338the blocks of the definitions will be considered paragraphs. In some
1339output formats, this will mean greater spacing between term/definition
1340pairs. For a compact definition list, do not leave space between the
1341definition and the next term:
1343 Term 1
1344 ~ Definition 1
1345 Term 2
1346 ~ Definition 2a
1347 ~ Definition 2b
1349[^3]: I have also been influenced by the suggestions of [David Wheeler](http://www.justatheory.com/computers/markup/modest-markdown-proposal.html).
1351[PHP Markdown Extra]: http://www.michelf.com/projects/php-markdown/extra/
1354### Numbered example lists ###
1356**Extension: `example_lists`**
1358The special list marker `@` can be used for sequentially numbered
1359examples. The first list item with a `@` marker will be numbered '1',
1360the next '2', and so on, throughout the document. The numbered examples
1361need not occur in a single list; each new list using `@` will take up
1362where the last stopped. So, for example:
1364 (@) My first example will be numbered (1).
1365 (@) My second example will be numbered (2).
1367 Explanation of examples.
1369 (@) My third example will be numbered (3).
1371Numbered examples can be labeled and referred to elsewhere in the
1372document:
1374 (@good) This is a good example.
1376 As (@good) illustrates, ...
1378The label can be any string of alphanumeric characters, underscores,
1379or hyphens.
1382### Compact and loose lists ###
1384Pandoc behaves differently from `Markdown.pl` on some "edge
1385cases" involving lists. Consider this source:
1387 + First
1388 + Second:
1389 - Fee
1390 - Fie
1391 - Foe
1393 + Third
1395Pandoc transforms this into a "compact list" (with no `<p>` tags around
1396"First", "Second", or "Third"), while markdown puts `<p>` tags around
1397"Second" and "Third" (but not "First"), because of the blank space
1398around "Third". Pandoc follows a simple rule: if the text is followed by
1399a blank line, it is treated as a paragraph. Since "Second" is followed
1400by a list, and not a blank line, it isn't treated as a paragraph. The
1401fact that the list is followed by a blank line is irrelevant. (Note:
1402Pandoc works this way even when the `markdown_strict` format is specified. This
1403behavior is consistent with the official markdown syntax description,
1404even though it is different from that of `Markdown.pl`.)
1407### Ending a list ###
1409What if you want to put an indented code block after a list?
1411 - item one
1412 - item two
1414 { my code block }
1416Trouble! Here pandoc (like other markdown implementations) will treat
1417`{ my code block }` as the second paragraph of item two, and not as
1418a code block.
1420To "cut off" the list after item two, you can insert some non-indented
1421content, like an HTML comment, which won't produce visible output in
1422any format:
1424 - item one
1425 - item two
1427 <!-- end of list -->
1429 { my code block }
1431You can use the same trick if you want two consecutive lists instead
1432of one big list:
1434 1. one
1435 2. two
1436 3. three
1438 <!-- -->
1440 1. uno
1441 2. dos
1442 3. tres
1444Horizontal rules
1445----------------
1447A line containing a row of three or more `*`, `-`, or `_` characters
1448(optionally separated by spaces) produces a horizontal rule:
1450 * * * *
1452 ---------------
1455Tables
1456------
1458**Extension: `simple_tables`, `multiline_tables`, `grid_tables`,
1459`pipe_tables`, `table_captions`**
1461Four kinds of tables may be used. The first three kinds presuppose the use of
1462a fixed-width font, such as Courier. The fourth kind can be used with
1463proportionally spaced fonts, as it does not require lining up columns.
1465### Simple tables
1467Simple tables look like this:
1469 Right Left Center Default
1470 ------- ------ ---------- -------
1471 12 12 12 12
1472 123 123 123 123
1473 1 1 1 1
1475 Table: Demonstration of simple table syntax.
1477The headers and table rows must each fit on one line. Column
1478alignments are determined by the position of the header text relative
1479to the dashed line below it:[^4]
1481 - If the dashed line is flush with the header text on the right side
1482 but extends beyond it on the left, the column is right-aligned.
1483 - If the dashed line is flush with the header text on the left side
1484 but extends beyond it on the right, the column is left-aligned.
1485 - If the dashed line extends beyond the header text on both sides,
1486 the column is centered.
1487 - If the dashed line is flush with the header text on both sides,
1488 the default alignment is used (in most cases, this will be left).
1490[^4]: This scheme is due to Michel Fortin, who proposed it on the
1491 [Markdown discussion list](http://six.pairlist.net/pipermail/markdown-discuss/2005-March/001097.html).
1493The table must end with a blank line, or a line of dashes followed by
1494a blank line. A caption may optionally be provided (as illustrated in
1495the example above). A caption is a paragraph beginning with the string
1496`Table:` (or just `:`), which will be stripped off. It may appear either
1497before or after the table.
1499The column headers may be omitted, provided a dashed line is used
1500to end the table. For example:
1502 ------- ------ ---------- -------
1503 12 12 12 12
1504 123 123 123 123
1505 1 1 1 1
1506 ------- ------ ---------- -------
1508When headers are omitted, column alignments are determined on the basis
1509of the first line of the table body. So, in the tables above, the columns
1510would be right, left, center, and right aligned, respectively.
1512### Multiline tables
1514Multiline tables allow headers and table rows to span multiple lines
1515of text (but cells that span multiple columns or rows of the table are
1516not supported). Here is an example:
1518 -------------------------------------------------------------
1519 Centered Default Right Left
1520 Header Aligned Aligned Aligned
1521 ----------- ------- --------------- -------------------------
1522 First row 12.0 Example of a row that
1523 spans multiple lines.
1525 Second row 5.0 Here's another one. Note
1526 the blank line between
1527 rows.
1528 -------------------------------------------------------------
1530 Table: Here's the caption. It, too, may span
1531 multiple lines.
1533These work like simple tables, but with the following differences:
1535 - They must begin with a row of dashes, before the header text
1536 (unless the headers are omitted).
1537 - They must end with a row of dashes, then a blank line.
1538 - The rows must be separated by blank lines.
1540In multiline tables, the table parser pays attention to the widths of
1541the columns, and the writers try to reproduce these relative widths in
1542the output. So, if you find that one of the columns is too narrow in the
1543output, try widening it in the markdown source.
1545Headers may be omitted in multiline tables as well as simple tables:
1547 ----------- ------- --------------- -------------------------
1548 First row 12.0 Example of a row that
1549 spans multiple lines.
1551 Second row 5.0 Here's another one. Note
1552 the blank line between
1553 rows.
1554 ----------- ------- --------------- -------------------------
1556 : Here's a multiline table without headers.
1558It is possible for a multiline table to have just one row, but the row
1559should be followed by a blank line (and then the row of dashes that ends
1560the table), or the table may be interpreted as a simple table.
1562### Grid tables
1564Grid tables look like this:
1566 : Sample grid table.
1568 +---------------+---------------+--------------------+
1569 | Fruit | Price | Advantages |
1570 +===============+===============+====================+
1571 | Bananas | $1.34 | - built-in wrapper |
1572 | | | - bright color |
1573 +---------------+---------------+--------------------+
1574 | Oranges | $2.10 | - cures scurvy |
1575 | | | - tasty |
1576 +---------------+---------------+--------------------+
1578The row of `=`s separates the header from the table body, and can be
1579omitted for a headerless table. The cells of grid tables may contain
1580arbitrary block elements (multiple paragraphs, code blocks, lists,
1581etc.). Alignments are not supported, nor are cells that span multiple
1582columns or rows. Grid tables can be created easily using [Emacs table mode].
1584 [Emacs table mode]: http://table.sourceforge.net/
1586### Pipe tables
1588Pipe tables look like this:
1590 | Right | Left | Default | Center |
1591 |------:|:-----|---------|:------:|
1592 | 12 | 12 | 12 | 12 |
1593 | 123 | 123 | 123 | 123 |
1594 | 1 | 1 | 1 | 1 |
1596 : Demonstration of simple table syntax.
1598The syntax is [the same as in PHP markdown extra]. The beginning and
1599ending pipe characters are optional, but pipes are required between all
1600columns. The colons indicate column alignment as shown. The header
1601can be omitted, but the horizontal line must still be included, as
1602it defines column alignments.
1604Since the pipes indicate column boundaries, columns need not be vertically
1605aligned, as they are in the above example. So, this is a perfectly
1606legal (though ugly) pipe table:
1608 fruit| price
1609 -----|-----:
1610 apple|2.05
1611 pear|1.37
1612 orange|3.09
1614The cells of pipe tables cannot contain block elements like paragraphs
1615and lists, and cannot span multiple lines.
1617 [the same as in PHP markdown extra]:
1618 http://michelf.ca/projects/php-markdown/extra/#table
1620Note: Pandoc also recognizes pipe tables of the following
1621form, as can produced by Emacs' orgtbl-mode:
1623 | One | Two |
1624 |-----+-------|
1625 | my | table |
1626 | is | nice |
1628The difference is that `+` is used instead of `|`. Other orgtbl features
1629are not supported. In particular, to get non-default column alignment,
1630you'll need to add colons as above.
1632Title block
1633-----------
1635**Extension: `pandoc_title_block`**
1637If the file begins with a title block
1639 % title
1640 % author(s) (separated by semicolons)
1641 % date
1643it will be parsed as bibliographic information, not regular text. (It
1644will be used, for example, in the title of standalone LaTeX or HTML
1645output.) The block may contain just a title, a title and an author,
1646or all three elements. If you want to include an author but no
1647title, or a title and a date but no author, you need a blank line:
1650 % Author
1652 % My title
1654 % June 15, 2006
1656The title may occupy multiple lines, but continuation lines must
1657begin with leading space, thus:
1659 % My title
1660 on multiple lines
1662If a document has multiple authors, the authors may be put on
1663separate lines with leading space, or separated by semicolons, or
1664both. So, all of the following are equivalent:
1666 % Author One
1667 Author Two
1669 % Author One; Author Two
1671 % Author One;
1672 Author Two
1674The date must fit on one line.
1676All three metadata fields may contain standard inline formatting
1677(italics, links, footnotes, etc.).
1679Title blocks will always be parsed, but they will affect the output only
1680when the `--standalone` (`-s`) option is chosen. In HTML output, titles
1681will appear twice: once in the document head -- this is the title that
1682will appear at the top of the window in a browser -- and once at the
1683beginning of the document body. The title in the document head can have
1684an optional prefix attached (`--title-prefix` or `-T` option). The title
1685in the body appears as an H1 element with class "title", so it can be
1686suppressed or reformatted with CSS. If a title prefix is specified with
1687`-T` and no title block appears in the document, the title prefix will
1688be used by itself as the HTML title.
1690The man page writer extracts a title, man page section number, and
1691other header and footer information from the title line. The title
1692is assumed to be the first word on the title line, which may optionally
1693end with a (single-digit) section number in parentheses. (There should
1694be no space between the title and the parentheses.) Anything after
1695this is assumed to be additional footer and header text. A single pipe
1696character (`|`) should be used to separate the footer text from the header
1697text. Thus,
1699 % PANDOC(1)
1701will yield a man page with the title `PANDOC` and section 1.
1703 % PANDOC(1) Pandoc User Manuals
1705will also have "Pandoc User Manuals" in the footer.
1707 % PANDOC(1) Pandoc User Manuals | Version 4.0
1709will also have "Version 4.0" in the header.
1712Backslash escapes
1713-----------------
1715**Extension: `all_symbols_escapable`**
1717Except inside a code block or inline code, any punctuation or space
1718character preceded by a backslash will be treated literally, even if it
1719would normally indicate formatting. Thus, for example, if one writes
1721 *\*hello\**
1723one will get
1725 <em>*hello*</em>
1727instead of
1729 <strong>hello</strong>
1731This rule is easier to remember than standard markdown's rule,
1732which allows only the following characters to be backslash-escaped:
1734 \`*_{}[]()>#+-.!
1736(However, if the `markdown_strict` format is used, the standard markdown rule
1737will be used.)
1739A backslash-escaped space is parsed as a nonbreaking space. It will
1740appear in TeX output as `~` and in HTML and XML as `\&#160;` or
1741`\&nbsp;`.
1743A backslash-escaped newline (i.e. a backslash occurring at the end of
1744a line) is parsed as a hard line break. It will appear in TeX output as
1745`\\` and in HTML as `<br />`. This is a nice alternative to
1746markdown's "invisible" way of indicating hard line breaks using
1747two trailing spaces on a line.
1749Backslash escapes do not work in verbatim contexts.
1751Smart punctuation
1752-----------------
1754**Extension**
1756If the `--smart` option is specified, pandoc will produce typographically
1757correct output, converting straight quotes to curly quotes, `---` to
1758em-dashes, `--` to en-dashes, and `...` to ellipses. Nonbreaking spaces
1759are inserted after certain abbreviations, such as "Mr."
1761Note: if your LaTeX template uses the `csquotes` package, pandoc will
1762detect automatically this and use `\enquote{...}` for quoted text.
1764Inline formatting
1765-----------------
1767### Emphasis ###
1769To *emphasize* some text, surround it with `*`s or `_`, like this:
1771 This text is _emphasized with underscores_, and this
1772 is *emphasized with asterisks*.
1774Double `*` or `_` produces **strong emphasis**:
1776 This is **strong emphasis** and __with underscores__.
1778A `*` or `_` character surrounded by spaces, or backslash-escaped,
1779will not trigger emphasis:
1781 This is * not emphasized *, and \*neither is this\*.
1783**Extension: `intraword_underscores`**
1785Because `_` is sometimes used inside words and identifiers,
1786pandoc does not interpret a `_` surrounded by alphanumeric
1787characters as an emphasis marker. If you want to emphasize
1788just part of a word, use `*`:
1790 feas*ible*, not feas*able*.
1793### Strikeout ###
1795**Extension: `strikeout`**
1797To strikeout a section of text with a horizontal line, begin and end it
1798with `~~`. Thus, for example,
1800 This ~~is deleted text.~~
1803### Superscripts and subscripts ###
1805**Extension: `superscript`, `subscript`**
1807Superscripts may be written by surrounding the superscripted text by `^`
1808characters; subscripts may be written by surrounding the subscripted
1809text by `~` characters. Thus, for example,
1811 H~2~O is a liquid. 2^10^ is 1024.
1813If the superscripted or subscripted text contains spaces, these spaces
1814must be escaped with backslashes. (This is to prevent accidental
1815superscripting and subscripting through the ordinary use of `~` and `^`.)
1816Thus, if you want the letter P with 'a cat' in subscripts, use
1817`P~a\ cat~`, not `P~a cat~`.
1820### Verbatim ###
1822To make a short span of text verbatim, put it inside backticks:
1824 What is the difference between `>>=` and `>>`?
1826If the verbatim text includes a backtick, use double backticks:
1828 Here is a literal backtick `` ` ``.
1830(The spaces after the opening backticks and before the closing
1831backticks will be ignored.)
1833The general rule is that a verbatim span starts with a string
1834of consecutive backticks (optionally followed by a space)
1835and ends with a string of the same number of backticks (optionally
1836preceded by a space).
1838Note that backslash-escapes (and other markdown constructs) do not
1839work in verbatim contexts:
1841 This is a backslash followed by an asterisk: `\*`.
1843**Extension: `inline_code_attributes`**
1845Attributes can be attached to verbatim text, just as with
1846[fenced code blocks](#fenced-code-blocks):
1848 `<$>`{.haskell}
1850Math
1851----
1853**Extension: `tex_math_dollars`**
1855Anything between two `$` characters will be treated as TeX math. The
1856opening `$` must have a character immediately to its right, while the
1857closing `$` must have a character immediately to its left. Thus,
1858`$20,000 and $30,000` won't parse as math. If for some reason
1859you need to enclose text in literal `$` characters, backslash-escape
1860them and they won't be treated as math delimiters.
1862TeX math will be printed in all output formats. How it is rendered
1863depends on the output format:
1865Markdown, LaTeX, Org-Mode, ConTeXt
1866 ~ It will appear verbatim between `$` characters.
1868reStructuredText
1869 ~ It will be rendered using an interpreted text role `:math:`, as described
1870 [here](http://www.american.edu/econ/itex2mml/mathhack.rst).
1872AsciiDoc
1873 ~ It will be rendered as `latexmath:[...]`.
1875Texinfo
1876 ~ It will be rendered inside a `@math` command.
1878groff man
1879 ~ It will be rendered verbatim without `$`'s.
1881MediaWiki
1882 ~ It will be rendered inside `<math>` tags.
1884Textile
1885 ~ It will be rendered inside `<span class="math">` tags.
1887RTF, OpenDocument, ODT
1888 ~ It will be rendered, if possible, using unicode characters,
1889 and will otherwise appear verbatim.
1891Docbook
1892 ~ If the `--mathml` flag is used, it will be rendered using mathml
1893 in an `inlineequation` or `informalequation` tag. Otherwise it
1894 will be rendered, if possible, using unicode characters.
1896Docx
1897 ~ It will be rendered using OMML math markup.
1899FictionBook2
1900 ~ If the `--webtex` option is used, formulas are rendered as images
1901 using Google Charts or other compatible web service, downloaded
1902 and embedded in the e-book. Otherwise, they will appear verbatim.
1904HTML, Slidy, DZSlides, S5, EPUB
1905 ~ The way math is rendered in HTML will depend on the
1906 command-line options selected:
1908 1. The default is to render TeX math as far as possible using unicode
1909 characters, as with RTF, DocBook, and OpenDocument output. Formulas
1910 are put inside a `span` with `class="math"`, so that they may be
1911 styled differently from the surrounding text if needed.
1913 2. If the `--latexmathml` option is used, TeX math will be displayed
1914 between `$` or `$$` characters and put in `<span>` tags with class `LaTeX`.
1915 The [LaTeXMathML] script will be used to render it as formulas.
1916 (This trick does not work in all browsers, but it works in Firefox.
1917 In browsers that do not support LaTeXMathML, TeX math will appear
1918 verbatim between `$` characters.)
1920 3. If the `--jsmath` option is used, TeX math will be put inside
1921 `<span>` tags (for inline math) or `<div>` tags (for display math)
1922 with class `math`. The [jsMath] script will be used to render
1923 it.
1925 4. If the `--mimetex` option is used, the [mimeTeX] CGI script will
1926 be called to generate images for each TeX formula. This should
1927 work in all browsers. The `--mimetex` option takes an optional URL
1928 as argument. If no URL is specified, it will be assumed that the
1929 mimeTeX CGI script is at `/cgi-bin/mimetex.cgi`.
1931 5. If the `--gladtex` option is used, TeX formulas will be enclosed
1932 in `<eq>` tags in the HTML output. The resulting `htex` file may then
1933 be processed by [gladTeX], which will produce image files for each
1934 formula and an `html` file with links to these images. So, the
1935 procedure is:
1937 pandoc -s --gladtex myfile.txt -o myfile.htex
1938 gladtex -d myfile-images myfile.htex
1939 # produces myfile.html and images in myfile-images
1941 6. If the `--webtex` option is used, TeX formulas will be converted
1942 to `<img>` tags that link to an external script that converts
1943 formulas to images. The formula will be URL-encoded and concatenated
1944 with the URL provided. If no URL is specified, the Google Chart
1945 API will be used (`http://chart.apis.google.com/chart?cht=tx&chl=`).
1947 7. If the `--mathjax` option is used, TeX math will be displayed
1948 between `\(...\)` (for inline math) or `\[...\]` (for display
1949 math) and put in `<span>` tags with class `math`.
1950 The [MathJax] script will be used to render it as formulas.
1952Raw HTML
1953--------
1955**Extension: `raw_html`**
1957Markdown allows you to insert raw HTML (or DocBook) anywhere in a document
1958(except verbatim contexts, where `<`, `>`, and `&` are interpreted
1959literally). (Techncially this is not an extension, since standard
1960markdown allows it, but it has been made an extension so that it can
1961be disabled if desired.)
1963The raw HTML is passed through unchanged in HTML, S5, Slidy, Slideous,
1964DZSlides, EPUB, Markdown, and Textile output, and suppressed in other
1965formats.
1967**Extension: `markdown_in_html_blocks`**
1969Standard markdown allows you to include HTML "blocks": blocks
1970of HTML between balanced tags that are separated from the surrounding text
1971with blank lines, and start and end at the left margin. Within
1972these blocks, everything is interpreted as HTML, not markdown;
1973so (for example), `*` does not signify emphasis.
1975Pandoc behaves this way when the `markdown_strict` format is used; but
1976by default, pandoc interprets material between HTML block tags as markdown.
1977Thus, for example, Pandoc will turn
1979 <table>
1980 <tr>
1981 <td>*one*</td>
1982 <td>[a link](http://google.com)</td>
1983 </tr>
1984 </table>
1986into
1988 <table>
1989 <tr>
1990 <td><em>one</em></td>
1991 <td><a href="http://google.com">a link</a></td>
1992 </tr>
1993 </table>
1995whereas `Markdown.pl` will preserve it as is.
1997There is one exception to this rule: text between `<script>` and
1998`<style>` tags is not interpreted as markdown.
2000This departure from standard markdown should make it easier to mix
2001markdown with HTML block elements. For example, one can surround
2002a block of markdown text with `<div>` tags without preventing it
2003from being interpreted as markdown.
2005Raw TeX
2006-------
2008**Extension: `raw_tex`**
2010In addition to raw HTML, pandoc allows raw LaTeX, TeX, and ConTeXt to be
2011included in a document. Inline TeX commands will be preserved and passed
2012unchanged to the LaTeX and ConTeXt writers. Thus, for example, you can use
2013LaTeX to include BibTeX citations:
2015 This result was proved in \cite{jones.1967}.
2017Note that in LaTeX environments, like
2019 \begin{tabular}{|l|l|}\hline
2020 Age & Frequency \\ \hline
2021 18--25 & 15 \\
2022 26--35 & 33 \\
2023 36--45 & 22 \\ \hline
2024 \end{tabular}
2026the material between the begin and end tags will be interpreted as raw
2027LaTeX, not as markdown.
2029Inline LaTeX is ignored in output formats other than Markdown, LaTeX,
2030and ConTeXt.
2032LaTeX macros
2033------------
2035**Extension: `latex_macros`**
2037For output formats other than LaTeX, pandoc will parse LaTeX `\newcommand` and
2038`\renewcommand` definitions and apply the resulting macros to all LaTeX
2039math. So, for example, the following will work in all output formats,
2040not just LaTeX:
2042 \newcommand{\tuple}[1]{\langle #1 \rangle}
2044 $\tuple{a, b, c}$
2046In LaTeX output, the `\newcommand` definition will simply be passed
2047unchanged to the output.
2050Links
2051-----
2053Markdown allows links to be specified in several ways.
2055### Automatic links ###
2057If you enclose a URL or email address in pointy brackets, it
2058will become a link:
2060 <http://google.com>
2061 <sam@green.eggs.ham>
2063### Inline links ###
2065An inline link consists of the link text in square brackets,
2066followed by the URL in parentheses. (Optionally, the URL can
2067be followed by a link title, in quotes.)
2069 This is an [inline link](/url), and here's [one with
2070 a title](http://fsf.org "click here for a good time!").
2072There can be no space between the bracketed part and the parenthesized part.
2073The link text can contain formatting (such as emphasis), but the title cannot.
2076### Reference links ###
2078An *explicit* reference link has two parts, the link itself and the link
2079definition, which may occur elsewhere in the document (either
2080before or after the link).
2082The link consists of link text in square brackets, followed by a label in
2083square brackets. (There can be space between the two.) The link definition
2084consists of the bracketed label, followed by a colon and a space, followed by
2085the URL, and optionally (after a space) a link title either in quotes or in
2086parentheses.
2088Here are some examples:
2090 [my label 1]: /foo/bar.html "My title, optional"
2091 [my label 2]: /foo
2092 [my label 3]: http://fsf.org (The free software foundation)
2093 [my label 4]: /bar#special 'A title in single quotes'
2095The URL may optionally be surrounded by angle brackets:
2097 [my label 5]: <http://foo.bar.baz>
2099The title may go on the next line:
2101 [my label 3]: http://fsf.org
2102 "The free software foundation"
2104Note that link labels are not case sensitive. So, this will work:
2106 Here is [my link][FOO]
2108 [Foo]: /bar/baz
2110In an *implicit* reference link, the second pair of brackets is
2111empty, or omitted entirely:
2113 See [my website][], or [my website].
2115 [my website]: http://foo.bar.baz
2117Note: In `Markdown.pl` and most other markdown implementations,
2118reference link definitions cannot occur in nested constructions
2119such as list items or block quotes. Pandoc lifts this arbitrary
2120seeming restriction. So the following is fine in pandoc, though
2121not in most other implementations:
2123 > My block [quote].
2125 > [quote]: /foo
2127### Internal links
2129To link to another section of the same document, use the automatically
2130generated identifier (see [Header identifiers in HTML, LaTeX, and
2131ConTeXt](#header-identifiers-in-html-latex-and-context), below).
2132For example:
2134 See the [Introduction](#introduction).
2138 See the [Introduction].
2140 [Introduction]: #introduction
2142Internal links are currently supported for HTML formats (including
2143HTML slide shows and EPUB), LaTeX, and ConTeXt.
2145Images
2146------
2148A link immediately preceded by a `!` will be treated as an image.
2149The link text will be used as the image's alt text:
2151 ![la lune](lalune.jpg "Voyage to the moon")
2153 ![movie reel]
2155 [movie reel]: movie.gif
2157### Pictures with captions ###
2159**Extension: `implicit_figures`**
2161An image occurring by itself in a paragraph will be rendered as
2162a figure with a caption.[^5] (In LaTeX, a figure environment will be
2163used; in HTML, the image will be placed in a `div` with class
2164`figure`, together with a caption in a `p` with class `caption`.)
2165The image's alt text will be used as the caption.
2167 ![This is the caption](/url/of/image.png)
2169[^5]: This feature is not yet implemented for RTF, OpenDocument, or
2170 ODT. In those formats, you'll just get an image in a paragraph by
2171 itself, with no caption.
2173If you just want a regular inline image, just make sure it is not
2174the only thing in the paragraph. One way to do this is to insert a
2175nonbreaking space after the image:
2177 ![This image won't be a figure](/url/of/image.png)\
2180Footnotes
2181---------
2183**Extension: `footnotes`**
2185Pandoc's markdown allows footnotes, using the following syntax:
2187 Here is a footnote reference,[^1] and another.[^longnote]
2189 [^1]: Here is the footnote.
2191 [^longnote]: Here's one with multiple blocks.
2193 Subsequent paragraphs are indented to show that they
2194 belong to the previous footnote.
2196 { some.code }
2198 The whole paragraph can be indented, or just the first
2199 line. In this way, multi-paragraph footnotes work like
2200 multi-paragraph list items.
2202 This paragraph won't be part of the note, because it
2203 isn't indented.
2205The identifiers in footnote references may not contain spaces, tabs,
2206or newlines. These identifiers are used only to correlate the
2207footnote reference with the note itself; in the output, footnotes
2208will be numbered sequentially.
2210The footnotes themselves need not be placed at the end of the
2211document. They may appear anywhere except inside other block elements
2212(lists, block quotes, tables, etc.).
2214**Extension: `inline_notes`**
2216Inline footnotes are also allowed (though, unlike regular notes,
2217they cannot contain multiple paragraphs). The syntax is as follows:
2219 Here is an inline note.^[Inlines notes are easier to write, since
2220 you don't have to pick an identifier and move down to type the
2221 note.]
2223Inline and regular footnotes may be mixed freely.
2226Citations
2227---------
2229**Extension: `citations`**
2231Pandoc can automatically generate citations and a bibliography in a number of
2232styles (using Andrea Rossato's `hs-citeproc`). In order to use this feature,
2233you will need a bibliographic database in one of the following formats:
2235 Format File extension
2236 ------------ --------------
2237 MODS .mods
2238 BibLaTeX .bib
2239 BibTeX .bibtex
2240 RIS .ris
2241 EndNote .enl
2242 EndNote XML .xml
2243 ISI .wos
2244 MEDLINE .medline
2245 Copac .copac
2246 JSON citeproc .json
2248Note that `.bib` can generally be used with both BibTeX and BibLaTeX
2249files, but you can use `.bibtex` to force BibTeX.
2251You will need to specify the bibliography file using the `--bibliography`
2252command-line option (which may be repeated if you have several
2253bibliographies).
2255By default, pandoc will use a Chicago author-date format for citations
2256and references. To use another style, you will need to use the
2257`--csl` option to specify a [CSL] 1.0 style file. A primer on
2258creating and modifying CSL styles can be found at
2259<http://citationstyles.org/downloads/primer.html>.
2260A repository of CSL styles can be found at
2261<https://github.com/citation-style-language/styles>.
2262See also <http://zotero.org/styles> for easy browsing.
2264Citations go inside square brackets and are separated by semicolons.
2265Each citation must have a key, composed of '@' + the citation
2266identifier from the database, and may optionally have a prefix,
2267a locator, and a suffix. Here are some examples:
2269 Blah blah [see @doe99, pp. 33-35; also @smith04, ch. 1].
2271 Blah blah [@doe99, pp. 33-35, 38-39 and *passim*].
2273 Blah blah [@smith04; @doe99].
2275A minus sign (`-`) before the `@` will suppress mention of
2276the author in the citation. This can be useful when the
2277author is already mentioned in the text:
2279 Smith says blah [-@smith04].
2281You can also write an in-text citation, as follows:
2283 @smith04 says blah.
2285 @smith04 [p. 33] says blah.
2287If the style calls for a list of works cited, it will be placed
2288at the end of the document. Normally, you will want to end your
2289document with an appropriate header:
2291 last paragraph...
2293 # References
2295The bibliography will be inserted after this header.
2297Non-pandoc extensions
2298=====================
2300The following markdown syntax extensions are not enabled by default
2301in pandoc, but may be enabled by adding `+EXTENSION` to the format
2302name, where `EXTENSION` is the name of the extension. Thus, for
2303example, `markdown+hard_line_breaks` is markdown with hard line breaks.
2305**Extension: `hard_line_breaks`**\
2306Causes all newlines within a paragraph to be interpreted as hard line
2307breaks instead of spaces.
2309**Extension: `tex_math_single_backslash`**\
2310Causes anything between `\(` and `\)` to be interpreted as inline
2311TeX math, and anything between `\[` and `\]` to be interpreted
2312as display TeX math. Note: a drawback of this extension is that
2313it precludes escaping `(` and `[`.
2315**Extension: `tex_math_double_backslash`**\
2316Causes anything between `\\(` and `\\)` to be interpreted as inline
2317TeX math, and anything between `\\[` and `\\]` to be interpreted
2318as display TeX math.
2320**Extension: `markdown_attribute`**\
2321By default, pandoc interprets material inside block-level tags as markdown.
2322This extension changes the behavior so that markdown is only parsed
2323inside block-level tags if the tags have the attribute `markdown=1`.
2325**Extension: `mmd_title_block`**\
2326Enables a [MultiMarkdown] style title block at the top of
2327the document, for example:
2329 Title: My title
2330 Author: John Doe
2331 Date: September 1, 2008
2332 Comment: This is a sample mmd title block, with
2333 a field spanning multiple lines.
2335See the MultiMarkdown documentation for details. Note that only title,
2336author, and date are recognized; other fields are simply ignored by
2337pandoc. If `pandoc_title_block` is enabled, it will take precedence over
2338`mmd_title_block`.
2340 [MultiMarkdown]: http://fletcherpenney.net/multimarkdown/
2342**Extension: `abbrevations`**\
2343Parses PHP Markdown Extra abbreviation keys, like
2345 *[HTML]: Hyper Text Markup Language
2347Note that the pandoc document model does not support
2348abbreviations, so if this extension is enabled, abbreviation keys are
2349simply skipped (as opposed to being parsed as paragraphs).
2351**Extension: `autolink_bare_uris`**\
2352Makes all absolute URIs into links, even when not surrounded by
2353pointy braces `<...>`.
2355**Extension: `link_attributes`**\
2356Parses multimarkdown style key-value attributes on link and image references.
2357Note that pandoc's internal document model provides nowhere to put
2358these, so they are presently just ignored.
2360**Extension: `mmd_header_identifiers`**\
2361Parses multimarkdown style header identifiers (in square brackets,
2362after the header but before any trailing `#`s in an ATX header).
2364Producing slide shows with Pandoc
2365=================================
2367You can use Pandoc to produce an HTML + javascript slide presentation
2368that can be viewed via a web browser. There are four ways to do this,
2369using [S5], [DZSlides], [Slidy], or [Slideous]. You can also produce a
2370PDF slide show using LaTeX [beamer].
2372Here's the markdown source for a simple slide show, `habits.txt`:
2374 % Habits
2375 % John Doe
2376 % March 22, 2005
2378 # In the morning
2380 ## Getting up
2382 - Turn off alarm
2383 - Get out of bed
2385 ## Breakfast
2387 - Eat eggs
2388 - Drink coffee
2390 # In the evening
2392 ## Dinner
2394 - Eat spaghetti
2395 - Drink wine
2397 ------------------
2399 ![picture of spaghetti](images/spaghetti.jpg)
2401 ## Going to sleep
2403 - Get in bed
2404 - Count sheep
2406To produce the slide show, simply type
2408 pandoc -t s5 -s habits.txt -o habits.html
2410for S5,
2412 pandoc -t slidy -s habits.txt -o habits.html
2414for Slidy,
2416 pandoc -t slideous -s habits.txt -o habits.html
2418for Slideous,
2420 pandoc -t dzslides -s habits.txt -o habits.html
2422for DZSlides, or
2424 pandoc -t beamer habits.txt -o habits.pdf
2426for beamer.
2428With all HTML slide formats, the `--self-contained` option can be used to
2429produce a single file that contains all of the data necessary to display the
2430slide show, including linked scripts, stylesheets, images, and videos.
2432Structuring the slide show
2433--------------------------
2435By default, the *slide level* is the highest header level in
2436the hierarchy that is followed immediately by content, and not another
2437header, somewhere in the document. In the example above, level 1 headers
2438are always followed by level 2 headers, which are followed by content,
2439so 2 is the slide level. This default can be overridden using
2440the `--slide-level` option.
2442The document is carved up into slides according to the following
2443rules:
2445 * A horizontal rule always starts a new slide.
2447 * A header at the slide level always starts a new slide.
2449 * Headers *below* the slide level in the hierarchy create
2450 headers *within* a slide.
2452 * Headers *above* the slide level in the hierarchy create
2453 "title slides," which just contain the section title
2454 and help to break the slide show into sections.
2456 * A title page is constructed automatically from the document's title
2457 block, if present. (In the case of beamer, this can be disabled
2458 by commenting out some lines in the default template.)
2460These rules are designed to support many different styles of slide show. If
2461you don't care about structuring your slides into sections and subsections,
2462you can just use level 1 headers for all each slide. (In that case, level 1
2463will be the slide level.) But you can also structure the slide show into
2464sections, as in the example above.
2466For Slidy, Slideous and S5, the file produced by pandoc with the
2467`-s/--standalone`
2468option embeds a link to javascripts and CSS files, which are assumed to
2469be available at the relative path `s5/default` (for S5) or `slideous`
2470(for Slideous), or at the Slidy
2471website at `w3.org` (for Slidy). (These paths can be changed by setting
2472the `slidy-url`, `slideous-url` or `s5-url` variables; see `--variable`,
2473above.) For DZSlides,
2474the (relatively short) javascript and css are included in the file by default.
2476Incremental lists
2477-----------------
2479By default, these writers produces lists that display "all at once."
2480If you want your lists to display incrementally (one item at a time),
2481use the `-i` option. If you want a particular list to depart from the
2482default (that is, to display incrementally without the `-i` option and
2483all at once with the `-i` option), put it in a block quote:
2485 > - Eat spaghetti
2486 > - Drink wine
2488In this way incremental and nonincremental lists can be mixed in
2489a single document.
2491Styling the slides
2492------------------
2494You can change the style of HTML slides by putting customized CSS files
2495in `$DATADIR/s5/default` (for S5), `$DATADIR/slidy` (for Slidy),
2496or `$DATADIR/slideous` (for Slideous),
2497where `$DATADIR` is the user data directory (see `--data-dir`, above).
2498The originals may be found in pandoc's system data directory (generally
2499`$CABALDIR/pandoc-VERSION/s5/default`). Pandoc will look there for any
2500files it does not find in the user data directory.
2502For dzslides, the CSS is included in the HTML file itself, and may
2503be modified there.
2505To style beamer slides, you can specify a beamer "theme" or "colortheme"
2506using the `-V` option:
2508 pandoc -t beamer habits.txt -V theme:Warsaw -o habits.pdf
2510Literate Haskell support
2511========================
2513If you append `+lhs` (or `+literate_haskell`) to an appropriate input or output
2514format (`markdown`, `mardkown_strict`, `rst`, or `latex` for input or output;
2515`beamer`, `html` or `html5` for output only), pandoc will treat the document as
2516literate Haskell source. This means that
2518 - In markdown input, "bird track" sections will be parsed as Haskell
2519 code rather than block quotations. Text between `\begin{code}`
2520 and `\end{code}` will also be treated as Haskell code.
2522 - In markdown output, code blocks with classes `haskell` and `literate`
2523 will be rendered using bird tracks, and block quotations will be
2524 indented one space, so they will not be treated as Haskell code.
2525 In addition, headers will be rendered setext-style (with underlines)
2526 rather than atx-style (with '#' characters). (This is because ghc
2527 treats '#' characters in column 1 as introducing line numbers.)
2529 - In restructured text input, "bird track" sections will be parsed
2530 as Haskell code.
2532 - In restructured text output, code blocks with class `haskell` will
2533 be rendered using bird tracks.
2535 - In LaTeX input, text in `code` environments will be parsed as
2536 Haskell code.
2538 - In LaTeX output, code blocks with class `haskell` will be rendered
2539 inside `code` environments.
2541 - In HTML output, code blocks with class `haskell` will be rendered
2542 with class `literatehaskell` and bird tracks.
2544Examples:
2546 pandoc -f markdown+lhs -t html
2548reads literate Haskell source formatted with markdown conventions and writes
2549ordinary HTML (without bird tracks).
2551 pandoc -f markdown+lhs -t html+lhs
2553writes HTML with the Haskell code in bird tracks, so it can be copied
2554and pasted as literate Haskell source.
2556Authors
2557=======
2559© 2006-2011 John MacFarlane (jgm at berkeley dot edu). Released under the
2560[GPL], version 2 or greater. This software carries no warranty of
2561any kind. (See COPYRIGHT for full copyright and warranty notices.)
2562Other contributors include Recai Oktaş, Paulo Tanimoto, Peter Wang,
2563Andrea Rossato, Eric Kow, infinity0x, Luke Plant, shreevatsa.public,
2564Puneeth Chaganti, Paul Rivier, rodja.trappe, Bradley Kuhn, thsutton,
2565Nathan Gass, Jonathan Daugherty, Jérémy Bobbio, Justin Bogner, qerub,
2566Christopher Sawicki, Kelsey Hightower, Masayoshi Takahashi, Antoine
2567Latter, Ralf Stephan, Eric Seidel, B. Scott Michel, Gavin Beatty,
2568Sergey Astanin, Arlo O'Keeffe, Denis Laxalde, Brent Yorgey.
2570[markdown]: http://daringfireball.net/projects/markdown/
2571[reStructuredText]: http://docutils.sourceforge.net/docs/ref/rst/introduction.html
2572[S5]: http://meyerweb.com/eric/tools/s5/
2573[Slidy]: http://www.w3.org/Talks/Tools/Slidy/
2574[Slideous]: http://goessner.net/articles/slideous/
2575[HTML]: http://www.w3.org/TR/html40/
2576[HTML 5]: http://www.w3.org/TR/html5/
2577[XHTML]: http://www.w3.org/TR/xhtml1/
2578[LaTeX]: http://www.latex-project.org/
2579[beamer]: http://www.tex.ac.uk/CTAN/macros/latex/contrib/beamer
2580[ConTeXt]: http://www.pragma-ade.nl/
2581[RTF]: http://en.wikipedia.org/wiki/Rich_Text_Format
2582[DocBook XML]: http://www.docbook.org/
2583[OpenDocument XML]: http://opendocument.xml.org/
2584[ODT]: http://en.wikipedia.org/wiki/OpenDocument
2585[Textile]: http://redcloth.org/textile
2586[MediaWiki markup]: http://www.mediawiki.org/wiki/Help:Formatting
2587[groff man]: http://developer.apple.com/DOCUMENTATION/Darwin/Reference/ManPages/man7/groff_man.7.html
2588[Haskell]: http://www.haskell.org/
2589[GNU Texinfo]: http://www.gnu.org/software/texinfo/
2590[Emacs Org-Mode]: http://orgmode.org
2591[AsciiDoc]: http://www.methods.co.nz/asciidoc/
2592[EPUB]: http://www.idpf.org/
2593[GPL]: http://www.gnu.org/copyleft/gpl.html "GNU General Public License"
2594[DZSlides]: http://paulrouget.com/dzslides/
2595[ISO 8601 format]: http://www.w3.org/TR/NOTE-datetime
2596[Word docx]: http://www.microsoft.com/interop/openup/openxml/default.aspx
2597[PDF]: http://www.adobe.com/pdf/
2598[FictionBook2]: http://www.fictionbook.org/index.php/Eng:XML_Schema_Fictionbook_2.1