git.iko.soy/typeable/pandoc
on ea3eaaa help sign in
2530 lines 90 kB history raw
1% Pandoc User's Guide
2% John MacFarlane
3% January 27, 2012
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 `textile` (Textile), `rst` (reStructuredText), `html` (HTML),
144 `docbook` (DocBook XML), `mediawiki` (MediaWiki markup),
145 or `latex` (LaTeX). If `+lhs` is appended to `markdown`, `rst`,
146 `latex`, the input will be treated as literate Haskell source:
147 see [Literate Haskell support](#literate-haskell-support), below.
148 Markdown syntax extensions can be individually enabled or disabled
149 by appending `+EXTENSION` or `-EXTENSION` to the format name.
150 So, for example, `markdown_strict+footnotes+definition_lists`
151 is strict markdown with footnotes and definition lists enabled,
152 and `markdown-pipe_tables+hard_line_breaks` is pandoc's markdown
153 without pipe tables and with hard line breaks. See [Pandoc's
154 markdown](#pandocs-markdown), below, for a list of extensions and
155 their names.
157`-t` *FORMAT*, `-w` *FORMAT*, `--to=`*FORMAT*, `--write=`*FORMAT*
158: Specify output format. *FORMAT* can be `native` (native Haskell),
159 `json` (JSON version of native AST), `plain` (plain text),
160 `markdown` (pandoc's extended markdown), `markdown_strict` (original
161 unextended markdown), `rst` (reStructuredText), `html` (XHTML
162 1), `html5` (HTML 5), `latex` (LaTeX), `beamer` (LaTeX beamer slide show),
163 `context` (ConTeXt), `man` (groff man), `mediawiki` (MediaWiki markup),
164 `textile` (Textile), `org` (Emacs Org-Mode), `texinfo` (GNU Texinfo),
165 `docbook` (DocBook XML), `opendocument` (OpenDocument XML), `odt`
166 (OpenOffice text document), `docx` (Word docx), `epub` (EPUB book), `epub3`
167 (EPUB v3), `fb2` (FictionBook2 e-book), `asciidoc` (AsciiDoc), `slidy`
168 (Slidy HTML and javascript slide show), `slideous` (Slideous HTML and
169 javascript slide show), `dzslides` (HTML5 + javascript slide show), `s5`
170 (S5 HTML and javascript slide show), or `rtf` (rich text format). Note that
171 `odt`, `epub`, and `epub3` output will not be directed to *stdout*; an output
172 filename must be specified using the `-o/--output` option. If `+lhs` is
173 appended to `markdown`, `rst`, `latex`, `beamer`, `html`, or `html5`, the
174 output will be rendered as literate Haskell source: see [Literate Haskell
175 support](#literate-haskell-support), below. Markdown syntax extensions can
176 be individually enabled or disabled by appending `+EXTENSION` or
177 `-EXTENSION` to the format name, as described above under `-f`.
179`-o` *FILE*, `--output=`*FILE*
180: Write output to *FILE* instead of *stdout*. If *FILE* is
181 `-`, output will go to *stdout*. (Exception: if the output
182 format is `odt`, `docx`, `epub`, or `epub3`, output to stdout is disabled.)
184`--data-dir=`*DIRECTORY*
185: Specify the user data directory to search for pandoc data files.
186 If this option is not specified, the default user data directory
187 will be used:
189 $HOME/.pandoc
191 in unix and
193 C:\Documents And Settings\USERNAME\Application Data\pandoc
195 in Windows. A `reference.odt`, `reference.docx`, `default.csl`,
196 `epub.css`, `templates`, `slidy`, `slideous`, or `s5` directory
197 placed in this directory will override pandoc's normal defaults.
199`-v`, `--version`
200: Print version.
202`-h`, `--help`
203: Show usage message.
205Reader options
206--------------
208`-R`, `--parse-raw`
209: Parse untranslatable HTML codes and LaTeX environments as raw HTML
210 or LaTeX, instead of ignoring them. Affects only HTML and LaTeX
211 input. Raw HTML can be printed in markdown, reStructuredText, HTML,
212 Slidy, Slideous,
213 DZSlides, and S5 output; raw LaTeX can be printed in markdown,
214 reStructuredText, LaTeX, and ConTeXt output. The default is for the
215 readers to omit untranslatable HTML codes and LaTeX environments.
216 (The LaTeX reader does pass through untranslatable LaTeX *commands*,
217 even if `-R` is not specified.)
219`-S`, `--smart`
220: Produce typographically correct output, converting straight quotes
221 to curly quotes, `---` to em-dashes, `--` to en-dashes, and
222 `...` to ellipses. Nonbreaking spaces are inserted after certain
223 abbreviations, such as "Mr." (Note: This option is significant only when
224 the input format is `markdown`, `markdown_strict`, or `textile`. It
225 is selected automatically when the input format is `textile` or the
226 output format is `latex` or `context`, unless `--no-tex-ligatures`
227 is used.)
229`--old-dashes`
230: Selects the pandoc <= 1.8.2.1 behavior for parsing smart dashes: `-` before
231 a numeral is an en-dash, and `--` is an em-dash. This option is selected
232 automatically for `textile` input.
234`--base-header-level=`*NUMBER*
235: Specify the base level for headers (defaults to 1).
237`--indented-code-classes=`*CLASSES*
238: Specify classes to use for indented code blocks--for example,
239 `perl,numberLines` or `haskell`. Multiple classes may be separated
240 by spaces or commas.
242`--normalize`
243: Normalize the document after reading: merge adjacent
244 `Str` or `Emph` elements, for example, and remove repeated `Space`s.
246`-p`, `--preserve-tabs`
247: Preserve tabs instead of converting them to spaces (the default).
248 Note that this will only affect tabs in literal code spans and code
249 blocks; tabs in regular text will be treated as spaces.
251`--tab-stop=`*NUMBER*
252: Specify the number of spaces per tab (default is 4).
254General writer options
255----------------------
257`-s`, `--standalone`
258: Produce output with an appropriate header and footer (e.g. a
259 standalone HTML, LaTeX, or RTF file, not a fragment). This option
260 is set automatically for `pdf`, `epub`, `epub3`, `fb2`, `docx`, and `odt`
261 output.
263`--template=`*FILE*
264: Use *FILE* as a custom template for the generated document. Implies
265 `--standalone`. See [Templates](#templates) below for a description
266 of template syntax. If no extension is specified, an extension
267 corresponding to the writer will be added, so that `--template=special`
268 looks for `special.html` for HTML output. If the template is not
269 found, pandoc will search for it in the user data directory
270 (see `--data-dir`). If this option is not used, a default
271 template appropriate for the output format will be used (see
272 `-D/--print-default-template`).
274`-V` *KEY[=VAL]*, `--variable=`*KEY[:VAL]*
275: Set the template variable *KEY* to the value *VAL* when rendering the
276 document in standalone mode. This is generally only useful when the
277 `--template` option is used to specify a custom template, since
278 pandoc automatically sets the variables used in the default
279 templates. If no *VAL* is specified, the key will be given the
280 value `true`.
282`-D` *FORMAT*, `--print-default-template=`*FORMAT*
283: Print the default template for an output *FORMAT*. (See `-t`
284 for a list of possible *FORMAT*s.)
286`--no-wrap`
287: Disable text wrapping in output. By default, text is wrapped
288 appropriately for the output format.
290`--columns`=*NUMBER*
291: Specify length of lines in characters (for text wrapping).
293`--toc`, `--table-of-contents`
294: Include an automatically generated table of contents (or, in
295 the case of `latex`, `context`, and `rst`, an instruction to create
296 one) in the output document. This option has no effect on `man`,
297 `docbook`, `slidy`, `slideous`, or `s5` output.
299`--toc-depth=`*NUMBER*
300: Specify the number of section levels to include in the table
301 of contents. The default is 3 (which means that level 1, 2, and 3
302 headers will be listed in the contents). Implies `--toc`.
304`--no-highlight`
305: Disables syntax highlighting for code blocks and inlines, even when
306 a language attribute is given.
308`--highlight-style`=*STYLE*
309: Specifies the coloring style to be used in highlighted source code.
310 Options are `pygments` (the default), `kate`, `monochrome`,
311 `espresso`, `zenburn`, `haddock`, and `tango`.
313`-H` *FILE*, `--include-in-header=`*FILE*
314: Include contents of *FILE*, verbatim, at the end of the header.
315 This can be used, for example, to include special
316 CSS or javascript in HTML documents. This option can be used
317 repeatedly to include multiple files in the header. They will be
318 included in the order specified. Implies `--standalone`.
320`-B` *FILE*, `--include-before-body=`*FILE*
321: Include contents of *FILE*, verbatim, at the beginning of the
322 document body (e.g. after the `<body>` tag in HTML, or the
323 `\begin{document}` command in LaTeX). This can be used to include
324 navigation bars or banners in HTML documents. This option can be
325 used repeatedly to include multiple files. They will be included in
326 the order specified. Implies `--standalone`.
328`-A` *FILE*, `--include-after-body=`*FILE*
329: Include contents of *FILE*, verbatim, at the end of the document
330 body (before the `</body>` tag in HTML, or the
331 `\end{document}` command in LaTeX). This option can be be used
332 repeatedly to include multiple files. They will be included in the
333 order specified. Implies `--standalone`.
335Options affecting specific writers
336----------------------------------
338`--self-contained`
339: Produce a standalone HTML file with no external dependencies, using
340 `data:` URIs to incorporate the contents of linked scripts, stylesheets,
341 images, and videos. The resulting file should be "self-contained,"
342 in the sense that it needs no external files and no net access to be
343 displayed properly by a browser. This option works only with HTML output
344 formats, including `html`, `html5`, `html+lhs`, `html5+lhs`, `s5`,
345 `slidy`, `slideous`,
346 and `dzslides`. Scripts, images, and stylesheets at absolute URLs
347 will be downloaded; those at relative URLs will be sought first relative
348 to the working directory, then relative to the user data directory (see
349 `--data-dir`), and finally relative to pandoc's default data directory.
351`--offline`
352: Deprecated synonym for `--self-contained`.
354`-5`, `--html5`
355: Produce HTML5 instead of HTML4. This option has no effect for writers
356 other than `html`. (*Deprecated:* Use the `html5` output format instead.)
358`--ascii`
359: Use only ascii characters in output. Currently supported only
360 for HTML output (which uses numerical entities instead of
361 UTF-8 when this option is selected).
363`--reference-links`
364: Use reference-style links, rather than inline links, in writing markdown
365 or reStructuredText. By default inline links are used.
367`--atx-headers`
368: Use ATX style headers in markdown output. The default is to use
369 setext-style headers for levels 1-2, and then ATX headers.
371`--chapters`
372: Treat top-level headers as chapters in LaTeX, ConTeXt, and DocBook
373 output. When the LaTeX template uses the report, book, or
374 memoir class, this option is implied. If `--beamer` is used,
375 top-level headers will become `\part{..}`.
377`-N`, `--number-sections`
378: Number section headings in LaTeX, ConTeXt, or HTML output.
379 By default, sections are not numbered.
381`--no-tex-ligatures`
382: Do not convert quotation marks, apostrophes, and dashes to
383 the TeX ligatures when writing LaTeX or ConTeXt. Instead, just
384 use literal unicode characters. This is needed for using advanced
385 OpenType features with XeLaTeX and LuaLaTeX. Note: normally
386 `--smart` is selected automatically for LaTeX and ConTeXt
387 output, but it must be specified explicitly if `--no-tex-ligatures`
388 is selected. If you use literal curly quotes, dashes, and ellipses
389 in your source, then you may want to use `--no-tex-ligatures`
390 without `--smart`.
392`--listings`
393: Use listings package for LaTeX code blocks
395`-i`, `--incremental`
396: Make list items in slide shows display incrementally (one by one).
397 The default is for lists to be displayed all at once.
399`--slide-level`=*NUMBER*
400: Specifies that headers with the specified level create
401 slides (for `beamer`, `s5`, `slidy`, `slideous`, `dzslides`). Headers
402 above this level in the hierarchy are used to divide the
403 slide show into sections; headers below this level create
404 subheads within a slide. The default is to set the slide level
405 based on the contents of the document; see
406 [Structuring the slide show](#structuring-the-slide-show), below.
408`--section-divs`
409: Wrap sections in `<div>` tags (or `<section>` tags in HTML5),
410 and attach identifiers to the enclosing `<div>` (or `<section>`)
411 rather than the header itself.
412 See [Section identifiers](#header-identifiers-in-html-latex-and-context), below.
414`--email-obfuscation=`*none|javascript|references*
415: Specify a method for obfuscating `mailto:` links in HTML documents.
416 *none* leaves `mailto:` links as they are. *javascript* obfuscates
417 them using javascript. *references* obfuscates them by printing their
418 letters as decimal or hexadecimal character references.
420`--id-prefix`=*STRING*
421: Specify a prefix to be added to all automatically generated identifiers
422 in HTML and DocBook output, and to footnote numbers in markdown output.
423 This is useful for preventing duplicate identifiers when generating
424 fragments to be included in other pages.
426`-T` *STRING*, `--title-prefix=`*STRING*
427: Specify *STRING* as a prefix at the beginning of the title
428 that appears in the HTML header (but not in the title as it
429 appears at the beginning of the HTML body). Implies
430 `--standalone`.
432`-c` *URL*, `--css=`*URL*
433: Link to a CSS style sheet. This option can be be used repeatedly to
434 include multiple files. They will be included in the order specified.
436`--reference-odt=`*FILE*
437: Use the specified file as a style reference in producing an ODT.
438 For best results, the reference ODT should be a modified version
439 of an ODT produced using pandoc. The contents of the reference ODT
440 are ignored, but its stylesheets are used in the new ODT. If no
441 reference ODT is specified on the command line, pandoc will look
442 for a file `reference.odt` in the user data directory (see
443 `--data-dir`). If this is not found either, sensible defaults will be
444 used.
446`--reference-docx=`*FILE*
447: Use the specified file as a style reference in producing a docx file.
448 For best results, the reference docx should be a modified version
449 of a docx file produced using pandoc. The contents of the reference docx
450 are ignored, but its stylesheets are used in the new docx. If no
451 reference docx is specified on the command line, pandoc will look
452 for a file `reference.docx` in the user data directory (see
453 `--data-dir`). If this is not found either, sensible defaults will be
454 used. The following styles are used by pandoc: [paragraph]
455 Normal, Title, Authors, Date, Heading 1, Heading 2, Heading 3,
456 Heading 4, Heading 5, Block Quote, Definition Term, Definition,
457 Body Text, Table Caption, Picture Caption; [character] Default
458 Paragraph Font, Body Text Char, Verbatim Char, Footnote Reference,
459 Hyperlink.
461`--epub-stylesheet=`*FILE*
462: Use the specified CSS file to style the EPUB. If no stylesheet
463 is specified, pandoc will look for a file `epub.css` in the
464 user data directory (see `--data-dir`). If it is not
465 found there, sensible defaults will be used.
467`--epub-cover-image=`*FILE*
468: Use the specified image as the EPUB cover. It is recommended
469 that the image be less than 1000px in width and height.
471`--epub-metadata=`*FILE*
472: Look in the specified XML file for metadata for the EPUB.
473 The file should contain a series of Dublin Core elements,
474 as documented at <http://dublincore.org/documents/dces/>.
475 For example:
477 <dc:rights>Creative Commons</dc:rights>
478 <dc:language>es-AR</dc:language>
480 By default, pandoc will include the following metadata elements:
481 `<dc:title>` (from the document title), `<dc:creator>` (from the
482 document authors), `<dc:date>` (from the document date, which should
483 be in [ISO 8601 format]), `<dc:language>` (from the `lang`
484 variable, or, if is not set, the locale), and `<dc:identifier
485 id="BookId">` (a randomly generated UUID). Any of these may be
486 overridden by elements in the metadata file.
488`--epub-embed-font=`*FILE*
489: Embed the specified font in the EPUB. This option can be repeated
490 to embed multiple fonts. To use embedded fonts, you
491 will need to add declarations like the following to your CSS (see
492 `--epub-stylesheet`):
494 @font-face {
495 font-family: DejaVuSans;
496 font-style: normal;
497 font-weight: normal;
498 src:url("DejaVuSans-Regular.ttf");
499 }
500 @font-face {
501 font-family: DejaVuSans;
502 font-style: normal;
503 font-weight: bold;
504 src:url("DejaVuSans-Bold.ttf");
505 }
506 @font-face {
507 font-family: DejaVuSans;
508 font-style: italic;
509 font-weight: normal;
510 src:url("DejaVuSans-Oblique.ttf");
511 }
512 @font-face {
513 font-family: DejaVuSans;
514 font-style: italic;
515 font-weight: bold;
516 src:url("DejaVuSans-BoldOblique.ttf");
517 }
518 body { font-family: "DejaVuSans"; }
520`--epub-chapter-level=`*NUMBER*
521: Specify the header level at which to split the EPUB into separate
522 "chapter" files. The default is to split into chapters at level 1
523 headers. This option only affects the internal composition of the
524 EPUB, not the way chapters and sections are displayed to users. Some
525 readers may be slow if the chapter files are too large, so for large
526 documents with few level 1 headers, one might want to use a chapter
527 level of 2 or 3.
529`--latex-engine=`*pdflatex|lualatex|xelatex*
530: Use the specified LaTeX engine when producing PDF output.
531 The default is `pdflatex`. If the engine is not in your PATH,
532 the full path of the engine may be specified here.
534Citation rendering
535------------------
537`--bibliography=`*FILE*
538: Specify bibliography database to be used in resolving
539 citations. The database type will be determined from the
540 extension of *FILE*, which may be `.mods` (MODS format),
541 `.bib` (BibLaTeX format, which will normally work for BibTeX
542 files as well), `.bibtex` (BibTeX format),
543 `.ris` (RIS format), `.enl` (EndNote format),
544 `.xml` (EndNote XML format), `.wos` (ISI format),
545 `.medline` (MEDLINE format), `.copac` (Copac format),
546 or `.json` (citeproc JSON). If you want to use multiple
547 bibliographies, just use this option repeatedly.
549`--csl=`*FILE*
550: Specify [CSL] style to be used in formatting citations and
551 the bibliography. If *FILE* is not found, pandoc will look
552 for it in
554 $HOME/.csl
556 in unix and
558 C:\Documents And Settings\USERNAME\Application Data\csl
560 in Windows. If the `--csl` option is not specified, pandoc
561 will use a default style: either `default.csl` in the
562 user data directory (see `--data-dir`), or, if that is
563 not present, the Chicago author-date style.
565`--citation-abbreviations=`*FILE*
566: Specify a file containing abbreviations for journal titles and
567 other bibliographic fields (indicated by setting `form="short"`
568 in the CSL node for the field). The format is described at
569 <http://citationstylist.org/2011/10/19/abbreviations-for-zotero-test-release/>.
570 Here is a short example:
572 { "default": {
573 "container-title": {
574 "Lloyd's Law Reports": "Lloyd's Rep",
575 "Estates Gazette": "EG",
576 "Scots Law Times": "SLT"
577 }
578 }
579 }
581`--natbib`
582: Use natbib for citations in LaTeX output.
584`--biblatex`
585: Use biblatex for citations in LaTeX output.
587Math rendering in HTML
588----------------------
590`-m` [*URL*], `--latexmathml`[=*URL*]
591: Use the [LaTeXMathML] script to display embedded TeX math in HTML output.
592 To insert a link to a local copy of the `LaTeXMathML.js` script,
593 provide a *URL*. If no *URL* is provided, the contents of the
594 script will be inserted directly into the HTML header, preserving
595 portability at the price of efficiency. If you plan to use math on
596 several pages, it is much better to link to a copy of the script,
597 so it can be cached.
599`--mathml`[=*URL*]
600: Convert TeX math to MathML (in `docbook` as well as `html` and `html5`).
601 In standalone `html` output, a small javascript (or a link to such a
602 script if a *URL* is supplied) will be inserted that allows the MathML to
603 be viewed on some browsers.
605`--jsmath`[=*URL*]
606: Use [jsMath] to display embedded TeX math in HTML output.
607 The *URL* should point to the jsMath load script (e.g.
608 `jsMath/easy/load.js`); if provided, it will be linked to in
609 the header of standalone HTML documents. If a *URL* is not provided,
610 no link to the jsMath load script will be inserted; it is then
611 up to the author to provide such a link in the HTML template.
613`--mathjax`[=*URL*]
614: Use [MathJax] to display embedded TeX math in HTML output.
615 The *URL* should point to the `MathJax.js` load script.
616 If a *URL* is not provided, a link to the MathJax CDN will
617 be inserted.
619`--gladtex`
620: Enclose TeX math in `<eq>` tags in HTML output. These can then
621 be processed by [gladTeX] to produce links to images of the typeset
622 formulas.
624`--mimetex`[=*URL*]
625: Render TeX math using the [mimeTeX] CGI script. If *URL* is not
626 specified, it is assumed that the script is at `/cgi-bin/mimetex.cgi`.
628`--webtex`[=*URL*]
629: Render TeX formulas using an external script that converts TeX
630 formulas to images. The formula will be concatenated with the URL
631 provided. If *URL* is not specified, the Google Chart API will be used.
633Options for wrapper scripts
634---------------------------
636`--dump-args`
637: Print information about command-line arguments to *stdout*, then exit.
638 This option is intended primarily for use in wrapper scripts.
639 The first line of output contains the name of the output file specified
640 with the `-o` option, or `-` (for *stdout*) if no output file was
641 specified. The remaining lines contain the command-line arguments,
642 one per line, in the order they appear. These do not include regular
643 Pandoc options and their arguments, but do include any options appearing
644 after a `--` separator at the end of the line.
646`--ignore-args`
647: Ignore command-line arguments (for use in wrapper scripts).
648 Regular Pandoc options are not ignored. Thus, for example,
650 pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1
652 is equivalent to
654 pandoc -o foo.html -s
656[LaTeXMathML]: http://math.etsu.edu/LaTeXMathML/
657[jsMath]: http://www.math.union.edu/~dpvc/jsmath/
658[MathJax]: http://www.mathjax.org/
659[gladTeX]: http://ans.hsh.no/home/mgg/gladtex/
660[mimeTeX]: http://www.forkosh.com/mimetex.html
661[CSL]: http://CitationStyles.org
663Templates
664=========
666When the `-s/--standalone` option is used, pandoc uses a template to
667add header and footer material that is needed for a self-standing
668document. To see the default template that is used, just type
670 pandoc -D FORMAT
672where `FORMAT` is the name of the output format. A custom template
673can be specified using the `--template` option. You can also override
674the system default templates for a given output format `FORMAT`
675by putting a file `templates/default.FORMAT` in the user data
676directory (see `--data-dir`, above). *Exceptions:* For `odt` output,
677customize the `default.opendocument` template. For `pdf` output,
678customize the `default.latex` template.
680Templates may contain *variables*. Variable names are sequences of
681alphanumerics, `-`, and `_`, starting with a letter. A variable name
682surrounded by `$` signs will be replaced by its value. For example,
683the string `$title$` in
685 <title>$title$</title>
687will be replaced by the document title.
689To write a literal `$` in a template, use `$$`.
691Some variables are set automatically by pandoc. These vary somewhat
692depending on the output format, but include:
694`header-includes`
695: contents specified by `-H/--include-in-header` (may have multiple
696 values)
697`toc`
698: non-null value if `--toc/--table-of-contents` was specified
699`include-before`
700: contents specified by `-B/--include-before-body` (may have
701 multiple values)
702`include-after`
703: contents specified by `-A/--include-after-body` (may have
704 multiple values)
705`body`
706: body of document
707`title`
708: title of document, as specified in title block
709`author`
710: author of document, as specified in title block (may have
711 multiple values)
712`date`
713: date of document, as specified in title block
714`lang`
715: language code for HTML or LaTeX documents
716`slidy-url`
717: base URL for Slidy documents (defaults to
718 `http://www.w3.org/Talks/Tools/Slidy2`)
719`slideous-url`
720: base URL for Slideous documents (defaults to `default`)
721`s5-url`
722: base URL for S5 documents (defaults to `ui/default`)
723`fontsize`
724: font size (10pt, 11pt, 12pt) for LaTeX documents
725`documentclass`
726: document class for LaTeX documents
727`geometry`
728: options for LaTeX `geometry` class, e.g. `margin=1in`;
729 may be repeated for multiple options
730`mainfont`, `sansfont`, `monofont`, `mathfont`
731: fonts for LaTeX documents (works only with xelatex
732 and lualatex)
733`theme`
734: theme for LaTeX beamer documents
735`colortheme`
736: colortheme for LaTeX beamer documents
737`linkcolor`
738: color for internal links in LaTeX documents (`red`, `green`,
739 `magenta`, `cyan`, `blue`, `black`)
740`urlcolor`
741: color for external links in LaTeX documents
742`links-as-notes`
743: causes links to be printed as footnotes in LaTeX documents
745Variables may be set at the command line using the `-V/--variable`
746option. This allows users to include custom variables in their
747templates.
749Templates may contain conditionals. The syntax is as follows:
751 $if(variable)$
752 X
753 $else$
754 Y
755 $endif$
757This will include `X` in the template if `variable` has a non-null
758value; otherwise it will include `Y`. `X` and `Y` are placeholders for
759any valid template text, and may include interpolated variables or other
760conditionals. The `$else$` section may be omitted.
762When variables can have multiple values (for example, `author` in
763a multi-author document), you can use the `$for$` keyword:
765 $for(author)$
766 <meta name="author" content="$author$" />
767 $endfor$
769You can optionally specify a separator to be used between
770consecutive items:
772 $for(author)$$author$$sep$, $endfor$
774If you use custom templates, you may need to revise them as pandoc
775changes. We recommend tracking the changes in the default templates,
776and modifying your custom templates accordingly. An easy way to do this
777is to fork the pandoc-templates repository
778(<http://github.com/jgm/pandoc-templates>) and merge in changes after each
779pandoc release.
781Pandoc's markdown
782=================
784Pandoc understands an extended and slightly revised version of
785John Gruber's [markdown] syntax. This document explains the syntax,
786noting differences from standard markdown. Except where noted, these
787differences can be suppressed by using the `markdown_strict` format instead
788of `markdown`. An extensions can be enabled by adding `+EXTENSION`
789to the format name and disabled by adding `-EXTENSION`. For example,
790`markdown_strict+footnotes` is strict markdown with footnotes
791enabled, while `markdown-footnotes-pipe_tables` is pandoc's
792markdown without footnotes or pipe tables.
794Philosophy
795----------
797Markdown is designed to be easy to write, and, even more importantly,
798easy to read:
800> A Markdown-formatted document should be publishable as-is, as plain
801> text, without looking like it's been marked up with tags or formatting
802> instructions.
803> -- [John Gruber](http://daringfireball.net/projects/markdown/syntax#philosophy)
805This principle has guided pandoc's decisions in finding syntax for
806tables, footnotes, and other extensions.
808There is, however, one respect in which pandoc's aims are different
809from the original aims of markdown. Whereas markdown was originally
810designed with HTML generation in mind, pandoc is designed for multiple
811output formats. Thus, while pandoc allows the embedding of raw HTML,
812it discourages it, and provides other, non-HTMLish ways of representing
813important document elements like definition lists, tables, mathematics, and
814footnotes.
816Paragraphs
817----------
819A paragraph is one or more lines of text followed by one or more blank line.
820Newlines are treated as spaces, so you can reflow your paragraphs as you like.
821If you need a hard line break, put two or more spaces at the end of a line.
823**Extension: `escaped_line_breaks`**
825A backslash followed by a newline is also a hard line break.
827Headers
828-------
830There are two kinds of headers, Setext and atx.
832### Setext-style headers ###
834A setext-style header is a line of text "underlined" with a row of `=` signs
835(for a level one header) of `-` signs (for a level two header):
837 A level-one header
838 ==================
840 A level-two header
841 ------------------
843The header text can contain inline formatting, such as emphasis (see
844[Inline formatting](#inline-formatting), below).
847### Atx-style headers ###
849An Atx-style header consists of one to six `#` signs and a line of
850text, optionally followed by any number of `#` signs. The number of
851`#` signs at the beginning of the line is the header level:
853 ## A level-two header
855 ### A level-three header ###
857As with setext-style headers, the header text can contain formatting:
859 # A level-one header with a [link](/url) and *emphasis*
861**Extension: `blank_before_header`**
863Standard markdown syntax does not require a blank line before a header.
864Pandoc does require this (except, of course, at the beginning of the
865document). The reason for the requirement is that it is all too easy for a
866`#` to end up at the beginning of a line by accident (perhaps through line
867wrapping). Consider, for example:
869 I like several of their flavors of ice cream:
870 #22, for example, and #5.
873### Header identifiers in HTML, LaTeX, and ConTeXt ###
875**Extension: `header_identifiers`**
877Each header element in pandoc's HTML and ConTeXt output is given a
878unique identifier. This identifier is based on the text of the header.
879To derive the identifier from the header text,
881 - Remove all formatting, links, etc.
882 - Remove all punctuation, except underscores, hyphens, and periods.
883 - Replace all spaces and newlines with hyphens.
884 - Convert all alphabetic characters to lowercase.
885 - Remove everything up to the first letter (identifiers may
886 not begin with a number or punctuation mark).
887 - If nothing is left after this, use the identifier `section`.
889Thus, for example,
891 Header Identifier
892 ------------------------------- ----------------------------
893 Header identifiers in HTML `header-identifiers-in-html`
894 *Dogs*?--in *my* house? `dogs--in-my-house`
895 [HTML], [S5], or [RTF]? `html-s5-or-rtf`
896 3. Applications `applications`
897 33 `section`
899These rules should, in most cases, allow one to determine the identifier
900from the header text. The exception is when several headers have the
901same text; in this case, the first will get an identifier as described
902above; the second will get the same identifier with `-1` appended; the
903third with `-2`; and so on.
905These identifiers are used to provide link targets in the table of
906contents generated by the `--toc|--table-of-contents` option. They
907also make it easy to provide links from one section of a document to
908another. A link to this section, for example, might look like this:
910 See the section on
911 [header identifiers](#header-identifiers-in-html).
913Note, however, that this method of providing links to sections works
914only in HTML, LaTeX, and ConTeXt formats.
916If the `--section-divs` option is specified, then each section will
917be wrapped in a `div` (or a `section`, if `--html5` was specified),
918and the identifier will be attached to the enclosing `<div>`
919(or `<section>`) tag rather than the header itself. This allows entire
920sections to be manipulated using javascript or treated differently in
921CSS.
923**Extension: `implicit_header_references`**
925Pandoc behaves as if reference links have been defined for each header.
926So, instead of
928 [header identifiers](#header-identifiers-in-html)
930you can simply write
932 [header identifiers]
934or
936 [header identifiers][]
938or
940 [the section on header identifiers][header identifiers]
942If there are multiple headers with identical text, the corresponding
943reference will link to the first one only, and you will need to use explicit
944links to link to the others, as described above.
946Unlike regular reference links, these references are case-sensitive.
948Block quotations
949----------------
951Markdown uses email conventions for quoting blocks of text.
952A block quotation is one or more paragraphs or other block elements
953(such as lists or headers), with each line preceded by a `>` character
954and a space. (The `>` need not start at the left margin, but it should
955not be indented more than three spaces.)
957 > This is a block quote. This
958 > paragraph has two lines.
959 >
960 > 1. This is a list inside a block quote.
961 > 2. Second item.
963A "lazy" form, which requires the `>` character only on the first
964line of each block, is also allowed:
966 > This is a block quote. This
967 paragraph has two lines.
969 > 1. This is a list inside a block quote.
970 2. Second item.
972Among the block elements that can be contained in a block quote are
973other block quotes. That is, block quotes can be nested:
975 > This is a block quote.
976 >
977 > > A block quote within a block quote.
979**Extension: `blank_line_before_blockquote`**
981Standard markdown syntax does not require a blank line before a block
982quote. Pandoc does require this (except, of course, at the beginning of the
983document). The reason for the requirement is that it is all too easy for a
984`>` to end up at the beginning of a line by accident (perhaps through line
985wrapping). So, unless the `markdown_strict` format is used, the following does
986not produce a nested block quote in pandoc:
988 > This is a block quote.
989 >> Nested.
992Verbatim (code) blocks
993----------------------
995### Indented code blocks ###
997A block of text indented four spaces (or one tab) is treated as verbatim
998text: that is, special characters do not trigger special formatting,
999and all spaces and line breaks are preserved. For example,
1001 if (a > 3) {
1002 moveShip(5 * gravity, DOWN);
1005The initial (four space or one tab) indentation is not considered part
1006of the verbatim text, and is removed in the output.
1008Note: blank lines in the verbatim text need not begin with four spaces.
1011### Fenced code blocks ###
1013**Extension: `fenced_code_blocks`**
1015In addition to standard indented code blocks, Pandoc supports
1016*fenced* code blocks. These begin with a row of three or more
1017tildes (`~`) or backticks (`` ` ``) and end with a row of tildes or
1018backticks that must be at least as long as the starting row. Everything
1019between these lines is treated as code. No indentation is necessary:
1021 ~~~~~~~
1022 if (a > 3) {
1023 moveShip(5 * gravity, DOWN);
1025 ~~~~~~~
1027Like regular code blocks, fenced code blocks must be separated
1028from surrounding text by blank lines.
1030If the code itself contains a row of tildes or backticks, just use a longer
1031row of tildes or backticks at the start and end:
1033 ~~~~~~~~~~~~~~~~
1034 ~~~~~~~~~~
1035 code including tildes
1036 ~~~~~~~~~~
1037 ~~~~~~~~~~~~~~~~
1039Optionally, you may attach attributes to the code block using
1040this syntax:
1042 ~~~~ {#mycode .haskell .numberLines startFrom="100"}
1043 qsort [] = []
1044 qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
1045 qsort (filter (>= x) xs)
1046 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1048Here `mycode` is an identifier, `haskell` and `numberLines` are classes, and
1049`startFrom` is an attribute with value `100`. Some output formats can use this
1050information to do syntax highlighting. Currently, the only output formats
1051that uses this information are HTML and LaTeX. If highlighting is supported
1052for your output format and language, then the code block above will appear
1053highlighted, with numbered lines. (To see which languages are supported, do
1054`pandoc --version`.) Otherwise, the code block above will appear as follows:
1056 <pre id="mycode" class="haskell numberLines" startFrom="100">
1057 <code>
1058 ...
1059 </code>
1060 </pre>
1062A shortcut form can also be used for specifying the language of
1063the code block:
1065 ```haskell
1066 qsort [] = []
1067 ```
1069This is equivalent to:
1071 ``` {.haskell}
1072 qsort [] = []
1073 ```
1075To prevent all highlighting, use the `--no-highlight` flag.
1076To set the highlighting style, use `--highlight-style`.
1078Lists
1079-----
1081### Bullet lists ###
1083A bullet list is a list of bulleted list items. A bulleted list
1084item begins with a bullet (`*`, `+`, or `-`). Here is a simple
1085example:
1087 * one
1088 * two
1089 * three
1091This will produce a "compact" list. If you want a "loose" list, in which
1092each item is formatted as a paragraph, put spaces between the items:
1094 * one
1096 * two
1098 * three
1100The bullets need not be flush with the left margin; they may be
1101indented one, two, or three spaces. The bullet must be followed
1102by whitespace.
1104List items look best if subsequent lines are flush with the first
1105line (after the bullet):
1107 * here is my first
1108 list item.
1109 * and my second.
1111But markdown also allows a "lazy" format:
1113 * here is my first
1114 list item.
1115 * and my second.
1117### The four-space rule ###
1119A list item may contain multiple paragraphs and other block-level
1120content. However, subsequent paragraphs must be preceded by a blank line
1121and indented four spaces or a tab. The list will look better if the first
1122paragraph is aligned with the rest:
1124 * First paragraph.
1126 Continued.
1128 * Second paragraph. With a code block, which must be indented
1129 eight spaces:
1131 { code }
1133List items may include other lists. In this case the preceding blank
1134line is optional. The nested list must be indented four spaces or
1135one tab:
1137 * fruits
1138 + apples
1139 - macintosh
1140 - red delicious
1141 + pears
1142 + peaches
1143 * vegetables
1144 + brocolli
1145 + chard
1147As noted above, markdown allows you to write list items "lazily," instead of
1148indenting continuation lines. However, if there are multiple paragraphs or
1149other blocks in a list item, the first line of each must be indented.
1151 + A lazy, lazy, list
1152 item.
1154 + Another one; this looks
1155 bad but is legal.
1157 Second paragraph of second
1158 list item.
1160**Note:** Although the four-space rule for continuation paragraphs
1161comes from the official [markdown syntax guide], the reference implementation,
1162`Markdown.pl`, does not follow it. So pandoc will give different results than
1163`Markdown.pl` when authors have indented continuation paragraphs fewer than
1164four spaces.
1166The [markdown syntax guide] is not explicit whether the four-space
1167rule applies to *all* block-level content in a list item; it only
1168mentions paragraphs and code blocks. But it implies that the rule
1169applies to all block-level content (including nested lists), and
1170pandoc interprets it that way.
1172 [markdown syntax guide]:
1173 http://daringfireball.net/projects/markdown/syntax#list
1175### Ordered lists ###
1177Ordered lists work just like bulleted lists, except that the items
1178begin with enumerators rather than bullets.
1180In standard markdown, enumerators are decimal numbers followed
1181by a period and a space. The numbers themselves are ignored, so
1182there is no difference between this list:
1184 1. one
1185 2. two
1186 3. three
1188and this one:
1190 5. one
1191 7. two
1192 1. three
1194**Extension: `fancy_lists`**
1196Unlike standard markdown, Pandoc allows ordered list items to be marked
1197with uppercase and lowercase letters and roman numerals, in addition to
1198arabic numerals. List markers may be enclosed in parentheses or followed by a
1199single right-parentheses or period. They must be separated from the
1200text that follows by at least one space, and, if the list marker is a
1201capital letter with a period, by at least two spaces.[^2]
1203[^2]: The point of this rule is to ensure that normal paragraphs
1204 starting with people's initials, like
1206 B. Russell was an English philosopher.
1208 do not get treated as list items.
1210 This rule will not prevent
1212 (C) 2007 Joe Smith
1214 from being interpreted as a list item. In this case, a backslash
1215 escape can be used:
1217 (C\) 2007 Joe Smith
1219**Extension: `startnum`**
1221Pandoc also pays attention to the type of list marker used, and to the
1222starting number, and both of these are preserved where possible in the
1223output format. Thus, the following yields a list with numbers followed
1224by a single parenthesis, starting with 9, and a sublist with lowercase
1225roman numerals:
1227 9) Ninth
1228 10) Tenth
1229 11) Eleventh
1230 i. subone
1231 ii. subtwo
1232 iii. subthree
1234Pandoc will start a new list each time a different type of list
1235marker is used. So, the following will create three lists:
1237 (2) Two
1238 (5) Three
1239 1. Four
1240 * Five
1242If default list markers are desired, use `#.`:
1244 #. one
1245 #. two
1246 #. three
1249### Definition lists ###
1251**Extension: `definition_lists`**
1253Pandoc supports definition lists, using a syntax inspired by
1254[PHP Markdown Extra] and [reStructuredText]:[^3]
1256 Term 1
1258 : Definition 1
1260 Term 2 with *inline markup*
1262 : Definition 2
1264 { some code, part of Definition 2 }
1266 Third paragraph of definition 2.
1268Each term must fit on one line, which may optionally be followed by
1269a blank line, and must be followed by one or more definitions.
1270A definition begins with a colon or tilde, which may be indented one
1271or two spaces. The body of the definition (including the first line,
1272aside from the colon or tilde) should be indented four spaces. A term may have
1273multiple definitions, and each definition may consist of one or more block
1274elements (paragraph, code block, list, etc.), each indented four spaces or one
1275tab stop.
1277If you leave space after the definition (as in the example above),
1278the blocks of the definitions will be considered paragraphs. In some
1279output formats, this will mean greater spacing between term/definition
1280pairs. For a compact definition list, do not leave space between the
1281definition and the next term:
1283 Term 1
1284 ~ Definition 1
1285 Term 2
1286 ~ Definition 2a
1287 ~ Definition 2b
1289[^3]: I have also been influenced by the suggestions of [David Wheeler](http://www.justatheory.com/computers/markup/modest-markdown-proposal.html).
1291[PHP Markdown Extra]: http://www.michelf.com/projects/php-markdown/extra/
1294### Numbered example lists ###
1296**Extension: `example_lists`**
1298The special list marker `@` can be used for sequentially numbered
1299examples. The first list item with a `@` marker will be numbered '1',
1300the next '2', and so on, throughout the document. The numbered examples
1301need not occur in a single list; each new list using `@` will take up
1302where the last stopped. So, for example:
1304 (@) My first example will be numbered (1).
1305 (@) My second example will be numbered (2).
1307 Explanation of examples.
1309 (@) My third example will be numbered (3).
1311Numbered examples can be labeled and referred to elsewhere in the
1312document:
1314 (@good) This is a good example.
1316 As (@good) illustrates, ...
1318The label can be any string of alphanumeric characters, underscores,
1319or hyphens.
1322### Compact and loose lists ###
1324Pandoc behaves differently from `Markdown.pl` on some "edge
1325cases" involving lists. Consider this source:
1327 + First
1328 + Second:
1329 - Fee
1330 - Fie
1331 - Foe
1333 + Third
1335Pandoc transforms this into a "compact list" (with no `<p>` tags around
1336"First", "Second", or "Third"), while markdown puts `<p>` tags around
1337"Second" and "Third" (but not "First"), because of the blank space
1338around "Third". Pandoc follows a simple rule: if the text is followed by
1339a blank line, it is treated as a paragraph. Since "Second" is followed
1340by a list, and not a blank line, it isn't treated as a paragraph. The
1341fact that the list is followed by a blank line is irrelevant. (Note:
1342Pandoc works this way even when the `markdown_strict` format is specified. This
1343behavior is consistent with the official markdown syntax description,
1344even though it is different from that of `Markdown.pl`.)
1347### Ending a list ###
1349What if you want to put an indented code block after a list?
1351 - item one
1352 - item two
1354 { my code block }
1356Trouble! Here pandoc (like other markdown implementations) will treat
1357`{ my code block }` as the second paragraph of item two, and not as
1358a code block.
1360To "cut off" the list after item two, you can insert some non-indented
1361content, like an HTML comment, which won't produce visible output in
1362any format:
1364 - item one
1365 - item two
1367 <!-- end of list -->
1369 { my code block }
1371You can use the same trick if you want two consecutive lists instead
1372of one big list:
1374 1. one
1375 2. two
1376 3. three
1378 <!-- -->
1380 1. uno
1381 2. dos
1382 3. tres
1384Horizontal rules
1385----------------
1387A line containing a row of three or more `*`, `-`, or `_` characters
1388(optionally separated by spaces) produces a horizontal rule:
1390 * * * *
1392 ---------------
1395Tables
1396------
1398**Extension: `simple_tables`, `multiline_tables`, `grid_tables`,
1399`pipe_tables`, `table_captions`**
1401Four kinds of tables may be used. The first three kinds presuppose the use of
1402a fixed-width font, such as Courier. The fourth kind can be used with
1403proportionally spaced fonts, as it does not require lining up columns.
1405### Simple tables
1407Simple tables look like this:
1409 Right Left Center Default
1410 ------- ------ ---------- -------
1411 12 12 12 12
1412 123 123 123 123
1413 1 1 1 1
1415 Table: Demonstration of simple table syntax.
1417The headers and table rows must each fit on one line. Column
1418alignments are determined by the position of the header text relative
1419to the dashed line below it:[^4]
1421 - If the dashed line is flush with the header text on the right side
1422 but extends beyond it on the left, the column is right-aligned.
1423 - If the dashed line is flush with the header text on the left side
1424 but extends beyond it on the right, the column is left-aligned.
1425 - If the dashed line extends beyond the header text on both sides,
1426 the column is centered.
1427 - If the dashed line is flush with the header text on both sides,
1428 the default alignment is used (in most cases, this will be left).
1430[^4]: This scheme is due to Michel Fortin, who proposed it on the
1431 [Markdown discussion list](http://six.pairlist.net/pipermail/markdown-discuss/2005-March/001097.html).
1433The table must end with a blank line, or a line of dashes followed by
1434a blank line. A caption may optionally be provided (as illustrated in
1435the example above). A caption is a paragraph beginning with the string
1436`Table:` (or just `:`), which will be stripped off. It may appear either
1437before or after the table.
1439The column headers may be omitted, provided a dashed line is used
1440to end the table. For example:
1442 ------- ------ ---------- -------
1443 12 12 12 12
1444 123 123 123 123
1445 1 1 1 1
1446 ------- ------ ---------- -------
1448When headers are omitted, column alignments are determined on the basis
1449of the first line of the table body. So, in the tables above, the columns
1450would be right, left, center, and right aligned, respectively.
1452### Multiline tables
1454Multiline tables allow headers and table rows to span multiple lines
1455of text (but cells that span multiple columns or rows of the table are
1456not supported). Here is an example:
1458 -------------------------------------------------------------
1459 Centered Default Right Left
1460 Header Aligned Aligned Aligned
1461 ----------- ------- --------------- -------------------------
1462 First row 12.0 Example of a row that
1463 spans multiple lines.
1465 Second row 5.0 Here's another one. Note
1466 the blank line between
1467 rows.
1468 -------------------------------------------------------------
1470 Table: Here's the caption. It, too, may span
1471 multiple lines.
1473These work like simple tables, but with the following differences:
1475 - They must begin with a row of dashes, before the header text
1476 (unless the headers are omitted).
1477 - They must end with a row of dashes, then a blank line.
1478 - The rows must be separated by blank lines.
1480In multiline tables, the table parser pays attention to the widths of
1481the columns, and the writers try to reproduce these relative widths in
1482the output. So, if you find that one of the columns is too narrow in the
1483output, try widening it in the markdown source.
1485Headers may be omitted in multiline tables as well as simple tables:
1487 ----------- ------- --------------- -------------------------
1488 First row 12.0 Example of a row that
1489 spans multiple lines.
1491 Second row 5.0 Here's another one. Note
1492 the blank line between
1493 rows.
1494 -------------------------------------------------------------
1496 : Here's a multiline table without headers.
1498It is possible for a multiline table to have just one row, but the row
1499should be followed by a blank line (and then the row of dashes that ends
1500the table), or the table may be interpreted as a simple table.
1502### Grid tables
1504Grid tables look like this:
1506 : Sample grid table.
1508 +---------------+---------------+--------------------+
1509 | Fruit | Price | Advantages |
1510 +===============+===============+====================+
1511 | Bananas | $1.34 | - built-in wrapper |
1512 | | | - bright color |
1513 +---------------+---------------+--------------------+
1514 | Oranges | $2.10 | - cures scurvy |
1515 | | | - tasty |
1516 +---------------+---------------+--------------------+
1518The row of `=`s separates the header from the table body, and can be
1519omitted for a headerless table. The cells of grid tables may contain
1520arbitrary block elements (multiple paragraphs, code blocks, lists,
1521etc.). Alignments are not supported, nor are cells that span multiple
1522columns or rows. Grid tables can be created easily using [Emacs table mode].
1524 [Emacs table mode]: http://table.sourceforge.net/
1526### Pipe tables
1528Pipe tables look like this:
1530 | Right | Left | Default | Center |
1531 |------:|:-----|---------|:------:|
1532 | 12 | 12 | 12 | 12 |
1533 | 123 | 123 | 123 | 123 |
1534 | 1 | 1 | 1 | 1 |
1536 : Demonstration of simple table syntax.
1538The syntax is [the same as in PHP markdown extra]. The beginning and
1539ending pipe characters are optional, but pipes are required between all
1540columns. The colons indicate column alignment as shown. The header
1541can be omitted, but the horizontal line must still be included, as
1542it defines column alignments.
1544Since the pipes indicate column boundaries, columns need not be vertically
1545aligned, as they are in the above example. So, this is a perfectly
1546legal (though ugly) pipe table:
1548 fruit| price
1549 -----|-----:
1550 apple|2.05
1551 pear|1.37
1552 orange|3.09
1554The cells of pipe tables cannot contain block elements like paragraphs
1555and lists, and cannot span multiple lines.
1557 [the same as in PHP markdown extra]:
1558 http://michelf.ca/projects/php-markdown/extra/#table
1560Note: Pandoc also recognizes pipe tables of the following
1561form, as can produced by Emacs' orgtbl-mode:
1563 | One | Two |
1564 |-----+-------|
1565 | my | table |
1566 | is | nice |
1568The difference is that `+` is used instead of `|`. Other orgtbl features
1569are not supported. In particular, to get non-default column alignment,
1570you'll need to add colons as above.
1572Title block
1573-----------
1575**Extension: `pandoc_title_block`**
1577If the file begins with a title block
1579 % title
1580 % author(s) (separated by semicolons)
1581 % date
1583it will be parsed as bibliographic information, not regular text. (It
1584will be used, for example, in the title of standalone LaTeX or HTML
1585output.) The block may contain just a title, a title and an author,
1586or all three elements. If you want to include an author but no
1587title, or a title and a date but no author, you need a blank line:
1590 % Author
1592 % My title
1594 % June 15, 2006
1596The title may occupy multiple lines, but continuation lines must
1597begin with leading space, thus:
1599 % My title
1600 on multiple lines
1602If a document has multiple authors, the authors may be put on
1603separate lines with leading space, or separated by semicolons, or
1604both. So, all of the following are equivalent:
1606 % Author One
1607 Author Two
1609 % Author One; Author Two
1611 % Author One;
1612 Author Two
1614The date must fit on one line.
1616All three metadata fields may contain standard inline formatting
1617(italics, links, footnotes, etc.).
1619Title blocks will always be parsed, but they will affect the output only
1620when the `--standalone` (`-s`) option is chosen. In HTML output, titles
1621will appear twice: once in the document head -- this is the title that
1622will appear at the top of the window in a browser -- and once at the
1623beginning of the document body. The title in the document head can have
1624an optional prefix attached (`--title-prefix` or `-T` option). The title
1625in the body appears as an H1 element with class "title", so it can be
1626suppressed or reformatted with CSS. If a title prefix is specified with
1627`-T` and no title block appears in the document, the title prefix will
1628be used by itself as the HTML title.
1630The man page writer extracts a title, man page section number, and
1631other header and footer information from the title line. The title
1632is assumed to be the first word on the title line, which may optionally
1633end with a (single-digit) section number in parentheses. (There should
1634be no space between the title and the parentheses.) Anything after
1635this is assumed to be additional footer and header text. A single pipe
1636character (`|`) should be used to separate the footer text from the header
1637text. Thus,
1639 % PANDOC(1)
1641will yield a man page with the title `PANDOC` and section 1.
1643 % PANDOC(1) Pandoc User Manuals
1645will also have "Pandoc User Manuals" in the footer.
1647 % PANDOC(1) Pandoc User Manuals | Version 4.0
1649will also have "Version 4.0" in the header.
1652Backslash escapes
1653-----------------
1655**Extension: `all_symbols_escapable`**
1657Except inside a code block or inline code, any punctuation or space
1658character preceded by a backslash will be treated literally, even if it
1659would normally indicate formatting. Thus, for example, if one writes
1661 *\*hello\**
1663one will get
1665 <em>*hello*</em>
1667instead of
1669 <strong>hello</strong>
1671This rule is easier to remember than standard markdown's rule,
1672which allows only the following characters to be backslash-escaped:
1674 \`*_{}[]()>#+-.!
1676(However, if the `markdown_strict` format is used, the standard markdown rule
1677will be used.)
1679A backslash-escaped space is parsed as a nonbreaking space. It will
1680appear in TeX output as `~` and in HTML and XML as `\&#160;` or
1681`\&nbsp;`.
1683A backslash-escaped newline (i.e. a backslash occurring at the end of
1684a line) is parsed as a hard line break. It will appear in TeX output as
1685`\\` and in HTML as `<br />`. This is a nice alternative to
1686markdown's "invisible" way of indicating hard line breaks using
1687two trailing spaces on a line.
1689Backslash escapes do not work in verbatim contexts.
1691Smart punctuation
1692-----------------
1694**Extension**
1696If the `--smart` option is specified, pandoc will produce typographically
1697correct output, converting straight quotes to curly quotes, `---` to
1698em-dashes, `--` to en-dashes, and `...` to ellipses. Nonbreaking spaces
1699are inserted after certain abbreviations, such as "Mr."
1701Note: if your LaTeX template uses the `csquotes` package, pandoc will
1702detect automatically this and use `\enquote{...}` for quoted text.
1704Inline formatting
1705-----------------
1707### Emphasis ###
1709To *emphasize* some text, surround it with `*`s or `_`, like this:
1711 This text is _emphasized with underscores_, and this
1712 is *emphasized with asterisks*.
1714Double `*` or `_` produces **strong emphasis**:
1716 This is **strong emphasis** and __with underscores__.
1718A `*` or `_` character surrounded by spaces, or backslash-escaped,
1719will not trigger emphasis:
1721 This is * not emphasized *, and \*neither is this\*.
1723**Extension: `intraword_underscores`**
1725Because `_` is sometimes used inside words and identifiers,
1726pandoc does not interpret a `_` surrounded by alphanumeric
1727characters as an emphasis marker. If you want to emphasize
1728just part of a word, use `*`:
1730 feas*ible*, not feas*able*.
1733### Strikeout ###
1735**Extension: `strikeout`**
1737To strikeout a section of text with a horizontal line, begin and end it
1738with `~~`. Thus, for example,
1740 This ~~is deleted text.~~
1743### Superscripts and subscripts ###
1745**Extension: `superscript`, `subscript`**
1747Superscripts may be written by surrounding the superscripted text by `^`
1748characters; subscripts may be written by surrounding the subscripted
1749text by `~` characters. Thus, for example,
1751 H~2~O is a liquid. 2^10^ is 1024.
1753If the superscripted or subscripted text contains spaces, these spaces
1754must be escaped with backslashes. (This is to prevent accidental
1755superscripting and subscripting through the ordinary use of `~` and `^`.)
1756Thus, if you want the letter P with 'a cat' in subscripts, use
1757`P~a\ cat~`, not `P~a cat~`.
1760### Verbatim ###
1762To make a short span of text verbatim, put it inside backticks:
1764 What is the difference between `>>=` and `>>`?
1766If the verbatim text includes a backtick, use double backticks:
1768 Here is a literal backtick `` ` ``.
1770(The spaces after the opening backticks and before the closing
1771backticks will be ignored.)
1773The general rule is that a verbatim span starts with a string
1774of consecutive backticks (optionally followed by a space)
1775and ends with a string of the same number of backticks (optionally
1776preceded by a space).
1778Note that backslash-escapes (and other markdown constructs) do not
1779work in verbatim contexts:
1781 This is a backslash followed by an asterisk: `\*`.
1783**Extension: `inline_code_attributes`**
1785Attributes can be attached to verbatim text, just as with
1786[fenced code blocks](#fenced-code-blocks):
1788 `<$>`{.haskell}
1790Math
1791----
1793**Extension: `tex_math_dollars`**
1795Anything between two `$` characters will be treated as TeX math. The
1796opening `$` must have a character immediately to its right, while the
1797closing `$` must have a character immediately to its left. Thus,
1798`$20,000 and $30,000` won't parse as math. If for some reason
1799you need to enclose text in literal `$` characters, backslash-escape
1800them and they won't be treated as math delimiters.
1802TeX math will be printed in all output formats. How it is rendered
1803depends on the output format:
1805Markdown, LaTeX, Org-Mode, ConTeXt
1806 ~ It will appear verbatim between `$` characters.
1808reStructuredText
1809 ~ It will be rendered using an interpreted text role `:math:`, as described
1810 [here](http://www.american.edu/econ/itex2mml/mathhack.rst).
1812AsciiDoc
1813 ~ It will be rendered as `latexmath:[...]`.
1815Texinfo
1816 ~ It will be rendered inside a `@math` command.
1818groff man
1819 ~ It will be rendered verbatim without `$`'s.
1821MediaWiki
1822 ~ It will be rendered inside `<math>` tags.
1824Textile
1825 ~ It will be rendered inside `<span class="math">` tags.
1827RTF, OpenDocument, ODT
1828 ~ It will be rendered, if possible, using unicode characters,
1829 and will otherwise appear verbatim.
1831Docbook
1832 ~ If the `--mathml` flag is used, it will be rendered using mathml
1833 in an `inlineequation` or `informalequation` tag. Otherwise it
1834 will be rendered, if possible, using unicode characters.
1836Docx
1837 ~ It will be rendered using OMML math markup.
1839FictionBook2
1840 ~ If the `--webtex` option is used, formulas are rendered as images
1841 using Google Charts or other compatible web service, downloaded
1842 and embedded in the e-book. Otherwise, they will appear verbatim.
1844HTML, Slidy, DZSlides, S5, EPUB
1845 ~ The way math is rendered in HTML will depend on the
1846 command-line options selected:
1848 1. The default is to render TeX math as far as possible using unicode
1849 characters, as with RTF, DocBook, and OpenDocument output. Formulas
1850 are put inside a `span` with `class="math"`, so that they may be
1851 styled differently from the surrounding text if needed.
1853 2. If the `--latexmathml` option is used, TeX math will be displayed
1854 between `$` or `$$` characters and put in `<span>` tags with class `LaTeX`.
1855 The [LaTeXMathML] script will be used to render it as formulas.
1856 (This trick does not work in all browsers, but it works in Firefox.
1857 In browsers that do not support LaTeXMathML, TeX math will appear
1858 verbatim between `$` characters.)
1860 3. If the `--jsmath` option is used, TeX math will be put inside
1861 `<span>` tags (for inline math) or `<div>` tags (for display math)
1862 with class `math`. The [jsMath] script will be used to render
1863 it.
1865 4. If the `--mimetex` option is used, the [mimeTeX] CGI script will
1866 be called to generate images for each TeX formula. This should
1867 work in all browsers. The `--mimetex` option takes an optional URL
1868 as argument. If no URL is specified, it will be assumed that the
1869 mimeTeX CGI script is at `/cgi-bin/mimetex.cgi`.
1871 5. If the `--gladtex` option is used, TeX formulas will be enclosed
1872 in `<eq>` tags in the HTML output. The resulting `htex` file may then
1873 be processed by [gladTeX], which will produce image files for each
1874 formula and an `html` file with links to these images. So, the
1875 procedure is:
1877 pandoc -s --gladtex myfile.txt -o myfile.htex
1878 gladtex -d myfile-images myfile.htex
1879 # produces myfile.html and images in myfile-images
1881 6. If the `--webtex` option is used, TeX formulas will be converted
1882 to `<img>` tags that link to an external script that converts
1883 formulas to images. The formula will be URL-encoded and concatenated
1884 with the URL provided. If no URL is specified, the Google Chart
1885 API will be used (`http://chart.apis.google.com/chart?cht=tx&chl=`).
1887 7. If the `--mathjax` option is used, TeX math will be displayed
1888 between `\(...\)` (for inline math) or `\[...\]` (for display
1889 math) and put in `<span>` tags with class `math`.
1890 The [MathJax] script will be used to render it as formulas.
1892Raw HTML
1893--------
1895**Extension: `raw_html`**
1897Markdown allows you to insert raw HTML (or DocBook) anywhere in a document
1898(except verbatim contexts, where `<`, `>`, and `&` are interpreted
1899literally). (Techncially this is not an extension, since standard
1900markdown allows it, but it has been made an extension so that it can
1901be disabled if desired.)
1903The raw HTML is passed through unchanged in HTML, S5, Slidy, Slideous,
1904DZSlides, EPUB, Markdown, and Textile output, and suppressed in other
1905formats.
1907**Extension: `markdown_in_html_blocks`**
1909Standard markdown allows you to include HTML "blocks": blocks
1910of HTML between balanced tags that are separated from the surrounding text
1911with blank lines, and start and end at the left margin. Within
1912these blocks, everything is interpreted as HTML, not markdown;
1913so (for example), `*` does not signify emphasis.
1915Pandoc behaves this way when the `markdown_strict` format is used; but
1916by default, pandoc interprets material between HTML block tags as markdown.
1917Thus, for example, Pandoc will turn
1919 <table>
1920 <tr>
1921 <td>*one*</td>
1922 <td>[a link](http://google.com)</td>
1923 </tr>
1924 </table>
1926into
1928 <table>
1929 <tr>
1930 <td><em>one</em></td>
1931 <td><a href="http://google.com">a link</a></td>
1932 </tr>
1933 </table>
1935whereas `Markdown.pl` will preserve it as is.
1937There is one exception to this rule: text between `<script>` and
1938`<style>` tags is not interpreted as markdown.
1940This departure from standard markdown should make it easier to mix
1941markdown with HTML block elements. For example, one can surround
1942a block of markdown text with `<div>` tags without preventing it
1943from being interpreted as markdown.
1945Raw TeX
1946-------
1948**Extension: `raw_tex`**
1950In addition to raw HTML, pandoc allows raw LaTeX, TeX, and ConTeXt to be
1951included in a document. Inline TeX commands will be preserved and passed
1952unchanged to the LaTeX and ConTeXt writers. Thus, for example, you can use
1953LaTeX to include BibTeX citations:
1955 This result was proved in \cite{jones.1967}.
1957Note that in LaTeX environments, like
1959 \begin{tabular}{|l|l|}\hline
1960 Age & Frequency \\ \hline
1961 18--25 & 15 \\
1962 26--35 & 33 \\
1963 36--45 & 22 \\ \hline
1964 \end{tabular}
1966the material between the begin and end tags will be interpreted as raw
1967LaTeX, not as markdown.
1969Inline LaTeX is ignored in output formats other than Markdown, LaTeX,
1970and ConTeXt.
1972LaTeX macros
1973------------
1975**Extension: `latex_macros`**
1977For output formats other than LaTeX, pandoc will parse LaTeX `\newcommand` and
1978`\renewcommand` definitions and apply the resulting macros to all LaTeX
1979math. So, for example, the following will work in all output formats,
1980not just LaTeX:
1982 \newcommand{\tuple}[1]{\langle #1 \rangle}
1984 $\tuple{a, b, c}$
1986In LaTeX output, the `\newcommand` definition will simply be passed
1987unchanged to the output.
1990Links
1991-----
1993Markdown allows links to be specified in several ways.
1995### Automatic links ###
1997If you enclose a URL or email address in pointy brackets, it
1998will become a link:
2000 <http://google.com>
2001 <sam@green.eggs.ham>
2003### Inline links ###
2005An inline link consists of the link text in square brackets,
2006followed by the URL in parentheses. (Optionally, the URL can
2007be followed by a link title, in quotes.)
2009 This is an [inline link](/url), and here's [one with
2010 a title](http://fsf.org "click here for a good time!").
2012There can be no space between the bracketed part and the parenthesized part.
2013The link text can contain formatting (such as emphasis), but the title cannot.
2016### Reference links ###
2018An *explicit* reference link has two parts, the link itself and the link
2019definition, which may occur elsewhere in the document (either
2020before or after the link).
2022The link consists of link text in square brackets, followed by a label in
2023square brackets. (There can be space between the two.) The link definition
2024consists of the bracketed label, followed by a colon and a space, followed by
2025the URL, and optionally (after a space) a link title either in quotes or in
2026parentheses.
2028Here are some examples:
2030 [my label 1]: /foo/bar.html "My title, optional"
2031 [my label 2]: /foo
2032 [my label 3]: http://fsf.org (The free software foundation)
2033 [my label 4]: /bar#special 'A title in single quotes'
2035The URL may optionally be surrounded by angle brackets:
2037 [my label 5]: <http://foo.bar.baz>
2039The title may go on the next line:
2041 [my label 3]: http://fsf.org
2042 "The free software foundation"
2044Note that link labels are not case sensitive. So, this will work:
2046 Here is [my link][FOO]
2048 [Foo]: /bar/baz
2050In an *implicit* reference link, the second pair of brackets is
2051empty, or omitted entirely:
2053 See [my website][], or [my website].
2055 [my website]: http://foo.bar.baz
2057Note: In `Markdown.pl` and most other markdown implementations,
2058reference link definitions cannot occur in nested constructions
2059such as list items or block quotes. Pandoc lifts this arbitrary
2060seeming restriction. So the following is fine in pandoc, though
2061not in most other implementations:
2063 > My block [quote].
2065 > [quote]: /foo
2067### Internal links
2069To link to another section of the same document, use the automatically
2070generated identifier (see [Header identifiers in HTML, LaTeX, and
2071ConTeXt](#header-identifiers-in-html-latex-and-context), below).
2072For example:
2074 See the [Introduction](#introduction).
2078 See the [Introduction].
2080 [Introduction]: #introduction
2082Internal links are currently supported for HTML formats (including
2083HTML slide shows and EPUB), LaTeX, and ConTeXt.
2085Images
2086------
2088A link immediately preceded by a `!` will be treated as an image.
2089The link text will be used as the image's alt text:
2091 ![la lune](lalune.jpg "Voyage to the moon")
2093 ![movie reel]
2095 [movie reel]: movie.gif
2097### Pictures with captions ###
2099**Extension**
2101An image occurring by itself in a paragraph will be rendered as
2102a figure with a caption.[^5] (In LaTeX, a figure environment will be
2103used; in HTML, the image will be placed in a `div` with class
2104`figure`, together with a caption in a `p` with class `caption`.)
2105The image's alt text will be used as the caption.
2107 ![This is the caption](/url/of/image.png)
2109[^5]: This feature is not yet implemented for RTF, OpenDocument, or
2110 ODT. In those formats, you'll just get an image in a paragraph by
2111 itself, with no caption.
2113If you just want a regular inline image, just make sure it is not
2114the only thing in the paragraph. One way to do this is to insert a
2115nonbreaking space after the image:
2117 ![This image won't be a figure](/url/of/image.png)\
2120Footnotes
2121---------
2123**Extension: `footnotes`**
2125Pandoc's markdown allows footnotes, using the following syntax:
2127 Here is a footnote reference,[^1] and another.[^longnote]
2129 [^1]: Here is the footnote.
2131 [^longnote]: Here's one with multiple blocks.
2133 Subsequent paragraphs are indented to show that they
2134 belong to the previous footnote.
2136 { some.code }
2138 The whole paragraph can be indented, or just the first
2139 line. In this way, multi-paragraph footnotes work like
2140 multi-paragraph list items.
2142 This paragraph won't be part of the note, because it
2143 isn't indented.
2145The identifiers in footnote references may not contain spaces, tabs,
2146or newlines. These identifiers are used only to correlate the
2147footnote reference with the note itself; in the output, footnotes
2148will be numbered sequentially.
2150The footnotes themselves need not be placed at the end of the
2151document. They may appear anywhere except inside other block elements
2152(lists, block quotes, tables, etc.).
2154**Extension: `inline_notes`**
2156Inline footnotes are also allowed (though, unlike regular notes,
2157they cannot contain multiple paragraphs). The syntax is as follows:
2159 Here is an inline note.^[Inlines notes are easier to write, since
2160 you don't have to pick an identifier and move down to type the
2161 note.]
2163Inline and regular footnotes may be mixed freely.
2166Citations
2167---------
2169**Extension: `citations`**
2171Pandoc can automatically generate citations and a bibliography in a number of
2172styles (using Andrea Rossato's `hs-citeproc`). In order to use this feature,
2173you will need a bibliographic database in one of the following formats:
2175 Format File extension
2176 ------------ --------------
2177 MODS .mods
2178 BibLaTeX .bib
2179 BibTeX .bibtex
2180 RIS .ris
2181 EndNote .enl
2182 EndNote XML .xml
2183 ISI .wos
2184 MEDLINE .medline
2185 Copac .copac
2186 JSON citeproc .json
2188Note that `.bib` can generally be used with both BibTeX and BibLaTeX
2189files, but you can use `.bibtex` to force BibTeX.
2191You will need to specify the bibliography file using the `--bibliography`
2192command-line option (which may be repeated if you have several
2193bibliographies).
2195By default, pandoc will use a Chicago author-date format for citations
2196and references. To use another style, you will need to use the
2197`--csl` option to specify a [CSL] 1.0 style file. A primer on
2198creating and modifying CSL styles can be found at
2199<http://citationstyles.org/downloads/primer.html>.
2200A repository of CSL styles can be found at
2201<https://github.com/citation-style-language/styles>.
2202See also <http://zotero.org/styles> for easy browsing.
2204Citations go inside square brackets and are separated by semicolons.
2205Each citation must have a key, composed of '@' + the citation
2206identifier from the database, and may optionally have a prefix,
2207a locator, and a suffix. Here are some examples:
2209 Blah blah [see @doe99, pp. 33-35; also @smith04, ch. 1].
2211 Blah blah [@doe99, pp. 33-35, 38-39 and *passim*].
2213 Blah blah [@smith04; @doe99].
2215A minus sign (`-`) before the `@` will suppress mention of
2216the author in the citation. This can be useful when the
2217author is already mentioned in the text:
2219 Smith says blah [-@smith04].
2221You can also write an in-text citation, as follows:
2223 @smith04 says blah.
2225 @smith04 [p. 33] says blah.
2227If the style calls for a list of works cited, it will be placed
2228at the end of the document. Normally, you will want to end your
2229document with an appropriate header:
2231 last paragraph...
2233 # References
2235The bibliography will be inserted after this header.
2237Non-pandoc extensions
2238=====================
2240The following markdown syntax extensions are not enabled by default
2241in pandoc, but may be enabled by adding `+EXTENSION` to the format
2242name, where `EXTENSION` is the name of the extension. Thus, for
2243example, `markdown+hard_line_breaks` is markdown with hard line breaks.
2245**Extension: `hard_line_breaks`**\
2246Causes all newlines within a paragraph to be interpreted as hard line
2247breaks instead of spaces.
2249**Extension: `tex_math_single_backslash`**\
2250Causes anything between `\(` and `\)` to be interpreted as inline
2251TeX math, and anything between `\[` and `\]` to be interpreted
2252as display TeX math. Note: a drawback of this extension is that
2253it precludes escaping `(` and `[`.
2255**Extension: `tex_math_double_backslash`**\
2256Causes anything between `\\(` and `\\)` to be interpreted as inline
2257TeX math, and anything between `\\[` and `\\]` to be interpreted
2258as display TeX math.
2260**Extension: `markdown_attribute`**\
2261Causes the attribute `markdown=1` to be added to all block-level
2262HTML tags that might contain markdown. In pandoc, material inside
2263block-level tags is interpreted a markdown by default, but in some
2264other implementations, the `markdown=1` tag is needed.
2266**Extension: `mmd_title_block`**\
2267Enables a [MultiMarkdown] style title block at the top of
2268the document, for example:
2270 Title: My title
2271 Author: John Doe
2272 Date: September 1, 2008
2273 Comment: This is a sample mmd title block, with
2274 a field spanning multiple lines.
2276See the MultiMarkdown documentation for details. Note that only title,
2277author, and date are recognized; other fields are simply ignored by
2278pandoc. If `pandoc_title_block` is enabled, it will take precedence over
2279`mmd_title_block`.
2281 [MultiMarkdown]: http://fletcherpenney.net/multimarkdown/
2283**Extension: `abbrevations`**\
2284Parses PHP Markdown Extra abbreviation keys, like
2286 *[HTML]: Hyper Text Markup Language
2288Note that the pandoc document model does not support
2289abbreviations, so if this extension is enabled, abbreviation keys are
2290simply skipped (as opposed to being parsed as paragraphs).
2292**Extension: `autolink_urls`**\
2293Makes all absolute URLs into links, even when not surrounded by
2294pointy braces `<...>`.
2296Producing slide shows with Pandoc
2297=================================
2299You can use Pandoc to produce an HTML + javascript slide presentation
2300that can be viewed via a web browser. There are four ways to do this,
2301using [S5], [DZSlides], [Slidy], or [Slideous]. You can also produce a
2302PDF slide show using LaTeX [beamer].
2304Here's the markdown source for a simple slide show, `habits.txt`:
2306 % Habits
2307 % John Doe
2308 % March 22, 2005
2310 # In the morning
2312 ## Getting up
2314 - Turn off alarm
2315 - Get out of bed
2317 ## Breakfast
2319 - Eat eggs
2320 - Drink coffee
2322 # In the evening
2324 ## Dinner
2326 - Eat spaghetti
2327 - Drink wine
2329 ------------------
2331 ![picture of spaghetti](images/spaghetti.jpg)
2333 ## Going to sleep
2335 - Get in bed
2336 - Count sheep
2338To produce the slide show, simply type
2340 pandoc -t s5 -s habits.txt -o habits.html
2342for S5,
2344 pandoc -t slidy -s habits.txt -o habits.html
2346for Slidy,
2348 pandoc -t slideous -s habits.txt -o habits.html
2350for Slideous,
2352 pandoc -t dzslides -s habits.txt -o habits.html
2354for DZSlides, or
2356 pandoc -t beamer habits.txt -o habits.pdf
2358for beamer.
2360With all HTML slide formats, the `--self-contained` option can be used to
2361produce a single file that contains all of the data necessary to display the
2362slide show, including linked scripts, stylesheets, images, and videos.
2364Structuring the slide show
2365--------------------------
2367By default, the *slide level* is the highest header level in
2368the hierarchy that is followed immediately by content, and not another
2369header, somewhere in the document. In the example above, level 1 headers
2370are always followed by level 2 headers, which are followed by content,
2371so 2 is the slide level. This default can be overridden using
2372the `--slide-level` option.
2374The document is carved up into slides according to the following
2375rules:
2377 * A horizontal rule always starts a new slide.
2379 * A header at the slide level always starts a new slide.
2381 * Headers *below* the slide level in the hierarchy create
2382 headers *within* a slide.
2384 * Headers *above* the slide level in the hierarchy create
2385 "title slides," which just contain the section title
2386 and help to break the slide show into sections.
2388 * A title page is constructed automatically from the document's title
2389 block, if present. (In the case of beamer, this can be disabled
2390 by commenting out some lines in the default template.)
2392These rules are designed to support many different styles of slide show. If
2393you don't care about structuring your slides into sections and subsections,
2394you can just use level 1 headers for all each slide. (In that case, level 1
2395will be the slide level.) But you can also structure the slide show into
2396sections, as in the example above.
2398For Slidy, Slideous and S5, the file produced by pandoc with the
2399`-s/--standalone`
2400option embeds a link to javascripts and CSS files, which are assumed to
2401be available at the relative path `s5/default` (for S5) or `slideous`
2402(for Slideous), or at the Slidy
2403website at `w3.org` (for Slidy). (These paths can be changed by setting
2404the `slidy-url`, `slideous-url` or `s5-url` variables; see `--variable`,
2405above.) For DZSlides,
2406the (relatively short) javascript and css are included in the file by default.
2408Incremental lists
2409-----------------
2411By default, these writers produces lists that display "all at once."
2412If you want your lists to display incrementally (one item at a time),
2413use the `-i` option. If you want a particular list to depart from the
2414default (that is, to display incrementally without the `-i` option and
2415all at once with the `-i` option), put it in a block quote:
2417 > - Eat spaghetti
2418 > - Drink wine
2420In this way incremental and nonincremental lists can be mixed in
2421a single document.
2423Styling the slides
2424------------------
2426You can change the style of HTML slides by putting customized CSS files
2427in `$DATADIR/s5/default` (for S5), `$DATADIR/slidy` (for Slidy),
2428or `$DATADIR/slideous` (for Slideous),
2429where `$DATADIR` is the user data directory (see `--data-dir`, above).
2430The originals may be found in pandoc's system data directory (generally
2431`$CABALDIR/pandoc-VERSION/s5/default`). Pandoc will look there for any
2432files it does not find in the user data directory.
2434For dzslides, the CSS is included in the HTML file itself, and may
2435be modified there.
2437To style beamer slides, you can specify a beamer "theme" or "colortheme"
2438using the `-V` option:
2440 pandoc -t beamer habits.txt -V theme:Warsaw -o habits.pdf
2442Literate Haskell support
2443========================
2445If you append `+lhs` to an appropriate input or output format (`markdown`,
2446`mardkown_strict`, `rst`, or `latex` for input or output; `beamer`,
2447`html` or `html5` for output only), pandoc will treat the document as
2448literate Haskell source. This means that
2450 - In markdown input, "bird track" sections will be parsed as Haskell
2451 code rather than block quotations. Text between `\begin{code}`
2452 and `\end{code}` will also be treated as Haskell code.
2454 - In markdown output, code blocks with classes `haskell` and `literate`
2455 will be rendered using bird tracks, and block quotations will be
2456 indented one space, so they will not be treated as Haskell code.
2457 In addition, headers will be rendered setext-style (with underlines)
2458 rather than atx-style (with '#' characters). (This is because ghc
2459 treats '#' characters in column 1 as introducing line numbers.)
2461 - In restructured text input, "bird track" sections will be parsed
2462 as Haskell code.
2464 - In restructured text output, code blocks with class `haskell` will
2465 be rendered using bird tracks.
2467 - In LaTeX input, text in `code` environments will be parsed as
2468 Haskell code.
2470 - In LaTeX output, code blocks with class `haskell` will be rendered
2471 inside `code` environments.
2473 - In HTML output, code blocks with class `haskell` will be rendered
2474 with class `literatehaskell` and bird tracks.
2476Examples:
2478 pandoc -f markdown+lhs -t html
2480reads literate Haskell source formatted with markdown conventions and writes
2481ordinary HTML (without bird tracks).
2483 pandoc -f markdown+lhs -t html+lhs
2485writes HTML with the Haskell code in bird tracks, so it can be copied
2486and pasted as literate Haskell source.
2488Authors
2489=======
2491© 2006-2011 John MacFarlane (jgm at berkeley dot edu). Released under the
2492[GPL], version 2 or greater. This software carries no warranty of
2493any kind. (See COPYRIGHT for full copyright and warranty notices.)
2494Other contributors include Recai Oktaş, Paulo Tanimoto, Peter Wang,
2495Andrea Rossato, Eric Kow, infinity0x, Luke Plant, shreevatsa.public,
2496Puneeth Chaganti, Paul Rivier, rodja.trappe, Bradley Kuhn, thsutton,
2497Nathan Gass, Jonathan Daugherty, Jérémy Bobbio, Justin Bogner, qerub,
2498Christopher Sawicki, Kelsey Hightower, Masayoshi Takahashi, Antoine
2499Latter, Ralf Stephan, Eric Seidel, B. Scott Michel, Gavin Beatty,
2500Sergey Astanin.
2502[markdown]: http://daringfireball.net/projects/markdown/
2503[reStructuredText]: http://docutils.sourceforge.net/docs/ref/rst/introduction.html
2504[S5]: http://meyerweb.com/eric/tools/s5/
2505[Slidy]: http://www.w3.org/Talks/Tools/Slidy/
2506[Slideous]: http://goessner.net/articles/slideous/
2507[HTML]: http://www.w3.org/TR/html40/
2508[HTML 5]: http://www.w3.org/TR/html5/
2509[XHTML]: http://www.w3.org/TR/xhtml1/
2510[LaTeX]: http://www.latex-project.org/
2511[beamer]: http://www.tex.ac.uk/CTAN/macros/latex/contrib/beamer
2512[ConTeXt]: http://www.pragma-ade.nl/
2513[RTF]: http://en.wikipedia.org/wiki/Rich_Text_Format
2514[DocBook XML]: http://www.docbook.org/
2515[OpenDocument XML]: http://opendocument.xml.org/
2516[ODT]: http://en.wikipedia.org/wiki/OpenDocument
2517[Textile]: http://redcloth.org/textile
2518[MediaWiki markup]: http://www.mediawiki.org/wiki/Help:Formatting
2519[groff man]: http://developer.apple.com/DOCUMENTATION/Darwin/Reference/ManPages/man7/groff_man.7.html
2520[Haskell]: http://www.haskell.org/
2521[GNU Texinfo]: http://www.gnu.org/software/texinfo/
2522[Emacs Org-Mode]: http://orgmode.org
2523[AsciiDoc]: http://www.methods.co.nz/asciidoc/
2524[EPUB]: http://www.idpf.org/
2525[GPL]: http://www.gnu.org/copyleft/gpl.html "GNU General Public License"
2526[DZSlides]: http://paulrouget.com/dzslides/
2527[ISO 8601 format]: http://www.w3.org/TR/NOTE-datetime
2528[Word docx]: http://www.microsoft.com/interop/openup/openxml/default.aspx
2529[PDF]: http://www.adobe.com/pdf/
2530[FictionBook2]: http://www.fictionbook.org/index.php/Eng:XML_Schema_Fictionbook_2.1