5Pandoc is a [Haskell] library for converting from one markup format to
6another, and a command-line tool that uses this library. It can read
7[markdown] and (subsets of) [reStructuredText], [HTML], and [LaTeX]; and
8it can write plain text, [markdown], [reStructuredText], [HTML], [LaTeX],
9[ConTeXt], [RTF], [DocBook XML], [OpenDocument XML], [ODT], [GNU Texinfo],
10[MediaWiki markup], [groff man] pages, and [S5] HTML slide shows.
11Pandoc's enhanced version of markdown includes syntax for footnotes,
12tables, flexible ordered lists, definition lists, delimited code blocks,
13superscript, subscript, strikeout, title blocks, automatic tables of
14contents, embedded LaTeX math, and markdown inside HTML block elements.
15(These enhancements can be disabled if a drop-in replacement for
16`Markdown.pl` is desired.)
18In contrast to most existing tools for converting markdown to HTML, which
19use regex substitutions, Pandoc has a modular design: it consists of a
20set of readers, which parse text in a given format and produce a native
21representation of the document, and a set of writers, which convert
22this native representation into a target format. Thus, adding an input
23or output format requires only adding a reader or writer.
25[markdown]: http://daringfireball.net/projects/markdown/
26[reStructuredText]: http://docutils.sourceforge.net/docs/ref/rst/introduction.html
27[S5]: http://meyerweb.com/eric/tools/s5/
28[HTML]: http://www.w3.org/TR/html40/
29[LaTeX]: http://www.latex-project.org/
30[ConTeXt]: http://www.pragma-ade.nl/
31[RTF]: http://en.wikipedia.org/wiki/Rich_Text_Format
32[DocBook XML]: http://www.docbook.org/
33[OpenDocument XML]: http://opendocument.xml.org/
34[ODT]: http://en.wikipedia.org/wiki/OpenDocument
35[MediaWiki markup]: http://www.mediawiki.org/wiki/Help:Formatting
36[groff man]: http://developer.apple.com/DOCUMENTATION/Darwin/Reference/ManPages/man7/groff_man.7.html
37[Haskell]: http://www.haskell.org/
38[GNU Texinfo]: http://www.gnu.org/software/texinfo/
40© 2006-2010 John MacFarlane (jgm at berkeley dot edu). Released under the
41[GPL], version 2 or greater. This software carries no warranty of
42any kind. (See COPYRIGHT for full copyright and warranty notices.)
43Other contributors include Recai Oktaş, Paulo Tanimoto, Peter Wang,
44Andrea Rossato, Eric Kow, infinity0x, Luke Plant, shreevatsa.public,
45rodja.trappe, Bradley Kuhn, thsutton, Justin Bogner.
47[GPL]: http://www.gnu.org/copyleft/gpl.html "GNU General Public License"
52If you run `pandoc` without arguments, it will accept input from
53stdin. If you run it with file names as arguments, it will take input
54from those files. By default, `pandoc` writes its output to stdout.[^1]
55If you want to write to a file, use the `-o` option:
57 pandoc -o hello.html hello.txt
59[^1]: The exception is for `odt`. Since this is a binary output format,
60 an output file must be specified explicitly.
62Note that you can specify multiple input files on the command line.
63`pandoc` will concatenate them all (with blank lines between them)
66 pandoc -s ch1.txt ch2.txt refs.txt > book.html
68(The `-s` option here tells `pandoc` to produce a standalone HTML file,
69with a proper header, rather than a fragment. For more details on this
70and many other command-line options, see below.)
72Instead of a filename, you can specify an absolute URI. In this
73case pandoc will attempt to download the content via HTTP:
75 pandoc -f html -t markdown http://www.fsf.org
77The format of the input and output can be specified explicitly using
78command-line options. The input format can be specified using the
79`-r/--read` or `-f/--from` options, the output format using the
80`-w/--write` or `-t/--to` options. Thus, to convert `hello.txt` from
81markdown to LaTeX, you could type:
83 pandoc -f markdown -t latex hello.txt
85To convert `hello.html` from html to markdown:
87 pandoc -f html -t markdown hello.html
89Supported output formats include `markdown`, `latex`, `context`
90(ConTeXt), `html`, `rtf` (rich text format), `rst`
91(reStructuredText), `docbook` (DocBook XML), `opendocument`
92(OpenDocument XML), `odt` (OpenOffice text document), `texinfo`, (GNU
93Texinfo), `mediawiki` (MediaWiki markup), `man` (groff man), and `s5`
94(which produces an HTML file that acts like powerpoint).
96Supported input formats include `markdown`, `html`, `latex`, and `rst`.
97Note that the `rst` reader only parses a subset of reStructuredText
98syntax. For example, it doesn't handle tables, option lists, or
99footnotes. But for simple documents it should be adequate. The `latex`
100and `html` readers are also limited in what they can do.
102If you don't specify a reader or writer explicitly, `pandoc` will
103try to determine the input and output format from the extensions of
104the input and output filenames. Thus, for example,
106 pandoc -o hello.tex hello.txt
108will convert `hello.txt` from markdown to LaTeX. If no output file
109is specified (so that output goes to stdout), or if the output file's
110extension is unknown, the output format will default to HTML.
111If no input file is specified (so that input comes from stdin), or
112if the input files' extensions are unknown, the input format will
113be assumed to be markdown unless explicitly specified.
118All input is assumed to be in the UTF-8 encoding, and all output
119is in UTF-8 (unless your version of pandoc was compiled using
120GHC 6.12 or higher, in which case the local encoding will be used).
121If your local character encoding is not UTF-8 and you use
122accented or foreign characters, you should pipe the input and output
123through [`iconv`]. For example,
125 iconv -t utf-8 source.txt | pandoc | iconv -f utf-8 > output.html
127will convert `source.txt` from the local encoding to UTF-8, then
128convert it to HTML, then convert back to the local encoding,
129putting the output in `output.html`.
137The standard Pandoc installation includes `markdown2pdf`, a wrapper
138around `pandoc` and `pdflatex` that produces PDFs directly from markdown
139sources. The default behavior of `markdown2pdf` is to create a file with
140the same base name as the first argument and the extension `pdf`; thus,
143 markdown2pdf sample.txt endnotes.txt
145will produce `sample.pdf`. (If `sample.pdf` exists already,
146it will be backed up before being overwritten.) An output file
147name can be specified explicitly using the `-o` option:
149 markdown2pdf -o book.pdf chap1 chap2
151If no input file is specified, input will be taken from stdin.
152All of `pandoc`'s options will work with `markdown2pdf` as well.
154`markdown2pdf` assumes that `pdflatex` is in the path. It also
155assumes that the following LaTeX packages are available:
156`unicode`, `fancyhdr` (if you have verbatim text in footnotes),
157`graphicx` (if you use images), `array` (if you use tables),
158and `ulem` (if you use strikeout text). If they are not already
159included in your LaTeX distribution, you can get them from
160[CTAN]. A full [TeX Live] or [MacTeX] distribution will have all of
166A user who wants a drop-in replacement for `Markdown.pl` may create
167a symbolic link to the `pandoc` executable called `hsmarkdown`. When
168invoked under the name `hsmarkdown`, `pandoc` will behave as if the
169`--strict` flag had been selected, and no command-line options will be
170recognized. However, this approach does not work under Cygwin, due to
171problems with its simulation of symbolic links.
173[Cygwin]: http://www.cygwin.com/
174[`iconv`]: http://www.gnu.org/software/libiconv/
175[CTAN]: http://www.ctan.org "Comprehensive TeX Archive Network"
176[TeX Live]: http://www.tug.org/texlive/
177[MacTeX]: http://www.tug.org/mactex/
182Various command-line options can be used to customize the output.
183For further documentation, see the `pandoc(1)` man page.
185`-f`, `--from`, `-r`, or `--read` *format*
186: specifies the input format (the format Pandoc will be converting
187 *from*). *format* can be `native`, `markdown`, `rst`, `html`, or
188 `latex`. (`+lhs` can be appended to indicate that the input should
189 be treated as literate Haskell source. See
190 [Literate Haskell support](#literate-haskell-support), below.)
192`-t`, `--to`, `-w`, or `--write` *format*
193: specifies the output format -- the format Pandoc will
194 be converting *to*. *format* can be `native`, `html`, `s5`,
195 `docbook`, `opendocument`, `latex`, `context`, `markdown`, `man`,
196 `plain`, `rst`, and `rtf`. (`+lhs` can be appended to indicate that
197 the output should be treated as literate Haskell source. See
198 [Literate Haskell support](#literate-haskell-support), below.)
200`-s` or `--standalone`
201: indicates that a standalone document is to be produced (with
202 appropriate headers and footers), rather than a fragment.
204`-o` or `--output` *filename*
205: sends output to *filename*. If this option is not specified,
206 or if its argument is `-`, output will be sent to stdout.
207 (Exception: if the output format is `odt`, output to stdout
210`-p` or `--preserve-tabs`
211: causes tabs in the source text to be preserved, rather than converted
212 to spaces (the default).
214`--tab-stop` *tabstop*
215: sets the number of spaces per tab to *tabstop* (defaults to 4).
218: specifies that strict markdown syntax is to be used, without
219 pandoc's usual extensions and variants (described below). When the
220 input format is HTML, this means that constructs that have no
221 equivalents in standard markdown (e.g. definition lists or strikeout
222 text) will be parsed as raw HTML.
225: causes reference-style links to be used in markdown
226 and reStructuredText output. By default inline links are used.
229: causes the HTML and LaTeX readers to parse HTML codes and LaTeX
230 environments that it can't translate as raw HTML or LaTeX. Raw HTML can
231 be printed in markdown, reStructuredText, HTML, and S5 output; raw LaTeX
232 can be printed in markdown, reStructuredText, LaTeX, and ConTeXt output.
233 The default is for the readers to omit untranslatable HTML codes and
234 LaTeX environments. (The LaTeX reader does pass through untranslatable
235 LaTeX *commands*, even if `-R` is not specified.)
237`-C` or `--custom-header` *filename*
238: can be used to specify a custom document header. Implies `--standalone`.
239 *Note: this option is deprecated. Use of `--template` is preferred.*
241`--toc` or `--table-of-contents`
242: includes an automatically generated table of contents (or, in the
243 case of `latex`, `context`, and `rst`, an instruction to create
244 one) in the output document. This option has no effect with `man`,
245 `docbook`, or `s5` output formats.
247`--base-header-level` *level*
248: specifies the base level for headers (defaults to 1).
251: uses *file* as a custom template for the generated document. Implies
252 `-s`. See [Templates](#templates) below for a description
253 of template syntax. If this option is not used, a default
254 template appropriate for the output format will be used. See also
255 `-D/--print-default-template`.
257`-V` *key=val*, `--variable=`*key:val*
258: sets the template variable *key* to the value *val* when rendering the
259 document in standalone mode. This is only useful when the
260 `--template` option is used to specify a custom template, since
261 pandoc automatically sets the variables used in the default
264`-c` or `--css` *filename*
265: allows the user to specify a custom stylesheet that will be linked to
266 in HTML and S5 output. This option can be used repeatedly to include
267 multiple stylesheets. They will be included in the order specified.
268 Implies `--standalone`.
270`-H` or `--include-in-header` *filename*
271: includes the contents of *filename* (verbatim) at the end of the
272 document header. This can be used, for example, to include special
273 CSS or javascript in HTML documents. This option can be used
274 repeatedly to include multiple files in the header. They will be
275 included in the order specified. Implies `--standalone`.
277`-B` or `--include-before-body` *filename*
278: includes the contents of *filename* (verbatim) at the beginning of
279 the document body (e.g. after the `<body>` tag in HTML, or the
280 `\begin{document}` command in LaTeX). This can be used to include
281 navigation bars or banners in HTML documents. This option can be
282 used repeatedly to include multiple files. They will be included in
283 the order specified. Implies `--standalone`.
285`-A` or `--include-after-body` *filename*
286: includes the contents of *filename* (verbatim) at the end of
287 the document body (before the `</body>` tag in HTML, or the
288 `\end{document}` command in LaTeX). This option can be be used
289 repeatedly to include multiple files. They will be included in the
290 order specified. Implies `--standalone`.
292`--reference-odt` *filename*
293: uses the specified file as a style reference in producing an ODT.
294 For best results, the reference ODT should be a modified version
295 of an ODT produced using pandoc. The contents of the reference ODT
296 are ignored, but its stylesheets are used in the new ODT. If no
297 reference ODT is specified on the command line, pandoc will look
298 for a file `reference.odt` in the user data directory (see
299 `--data-dir`, below). If it is not found there, sensible defaults
302`-D` or `--print-default-template` *format*
303: prints the default template for an output *format*. (See `-t`
304 for a list of possible *format*s.)
306`-T` or `--title-prefix` *string*
307: includes *string* as a prefix at the beginning of the title that
308 appears in the HTML header (but not in the title as it appears at
309 the beginning of the HTML body). (See below on
310 [Title Blocks](#title-blocks).) Implies `--standalone`.
313: causes `pandoc` to produce typographically correct output, along the
314 lines of John Gruber's [Smartypants]. Straight quotes are converted
315 to curly quotes, `---` to dashes, and `...` to ellipses. Nonbreaking
316 spaces are inserted after certain abbreviations, such as "Mr."
317 (Note: This option is only significant when the input format is
318 `markdown`. It is selected automatically when the output format is
319 `latex` or `context`.)
321`-m`*[url]* or `--latexmathml`*[=url]*
322: causes `pandoc` to use the [LaTeXMathML] script to display
323 TeX math in HTML or S5. If a local copy of `LaTeXMathML.js` is
324 available on the webserver where the page will be viewed, provide a
325 *url* and a link will be inserted in the generated HTML or S5. If
326 no *url* is provided, the contents of the script will be inserted
327 directly; this provides portability at the price of efficiency. If
328 you plan to use math on several pages, it is much better to link to
329 a copy of `LaTeXMathML.js`, which can be cached. (See `--jsmath`,
330 `--gladtex`, and `--mimetex` for alternative ways of dealing with
334: causes `pandoc` to convert all TeX math to MathML.
335 In standalone mode, a small javascript will be inserted that allows
336 the MathML to be viewed on some browsers.
339: causes `pandoc` to use the [jsMath] script to display
340 TeX math in HTML or S5. The *url* should point to the jsMath load
341 script (e.g. `jsMath/easy/load.js`). If it is provided, a link to it
342 will be included in the header of standalone HTML documents.
343 (See `--latexmathml`, `--mimetex`, and `--gladtex` for alternative
344 ways of dealing with math in HTML.)
347: causes TeX formulas to be enclosed in `<eq>` tags in HTML or S5 output.
348 This output can then be processed by [gladTeX] to produce links to
349 images with the typeset formulas. (See `--latexmathml`, `--jsmath`, and
350 `--mimetex` for alternative ways of dealing with math in HTML.)
353: causes TeX formulas to be replaced by `<img>` tags linking to the
354 [mimeTeX] CGI script, which will produce images with the typeset
355 formulas. (See `--latexmathml`, `--jsmath`, and `--gladtex` for alternative
356 ways of dealing with math in HTML.)
358`-i` or `--incremental`
359: causes all lists in S5 output to be displayed incrementally by
360 default (one item at a time). The normal default is for lists to be
361 displayed all at once.
364: creates LaTeX outut suitable for processing by XeTeX.
366`-N` or `--number-sections`
367: causes sections to be numbered in LaTeX, ConTeXt, or HTML output.
368 By default, sections are not numbered.
371: disables text-wrapping in output. By default, text is wrapped
372 appropriately for the output format.
375: sanitizes HTML (in markdown or HTML input) using a whitelist.
376 Unsafe tags are replaced by HTML comments; unsafe attributes
377 are omitted. URIs in links and images are also checked against a
378 whitelist of URI schemes.
380`--email-obfuscation`*=none|javascript|references*
381: specifies a method for obfuscating `mailto:` links in HTML documents.
382 *none* leaves `mailto:` links as they are. *javascript* obfuscates
383 them using javascript. *references* obfuscates them by printing their
384 letters as decimal or hexadecimal character references. If `--strict`
385 is specified, *references* is used regardless of the presence
388`--id-prefix`*=string*
389: specifies a prefix to be added to all automatically generated identifiers
390 in HTML output. This is useful for preventing duplicate identifiers
391 when generating fragments to be included in other pages.
393`--indented-code-classes`*=classes*
394: specifies classes to use for indented code blocks--for example,
395 `perl,numberLines` or `haskell`. Multiple classes may be separated
398`--data-dir`*=directory*
399: specifies the user data directory to search for pandoc data files.
400 If this option is not specified, the default user data directory
407 C:\Documents And Settings\USERNAME\Application Data\pandoc
409 in Windows. A reference ODT, `templates` directory, `s5` directory
410 placed in this directory will override pandoc's normal defaults.
413: is intended to make it easier to create wrapper scripts that use
414 Pandoc. It causes Pandoc to dump information about the arguments
415 with which it was called to stdout, then exit. The first line
416 printed is the name of the output file specified using the `-o`
417 or `--output` option, or `-` if output would go to stdout. The
418 remaining lines, if any, list command-line arguments. These will
419 include the names of input files and any special options passed
420 after ` -- ` on the command line. So, for example,
422 pandoc --dump-args -o foo.html -s foo.txt \
423 appendix.txt -- -e latin1
425 will cause the following to be printed to stdout:
427 foo.html foo.txt appendix.txt -e latin1
430: causes Pandoc to ignore all command-line arguments.
431 Regular Pandoc options are not ignored. Thus, for example,
433 pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1
437 pandoc -o foo.html -s
440: prints the version number to STDERR.
443: prints a usage message to STDERR.
445[Smartypants]: http://daringfireball.net/projects/smartypants/
446[LaTeXMathML]: http://math.etsu.edu/LaTeXMathML/
447[jsMath]: http://www.math.union.edu/~dpvc/jsmath/
448[gladTeX]: http://www.math.uio.no/~martingu/gladtex/index.html
449[mimeTeX]: http://www.forkosh.com/mimetex.html
454When the `-s/--standalone` option is used, pandoc uses a template to
455add header and footer material that is needed for a self-standing
456document. To see the default template that is used, just type
460where `FORMAT` is the name of the output format. A custom template
461can be specified using the `--template` option. You can also override
462the system default templates for a given output format `FORMAT`
463by putting a file `templates/FORMAT.template` in the user data
464directory (see `--data-dir`, above).
466Templates may contain *variables*. Variable names are sequences of
467alphanumerics, `-`, and `_`, starting with a letter. A variable name
468surrounded by `$` signs will be replaced by its value. For example,
469the string `$title$` in
471 <title>$title$</title>
473will be replaced by the document title.
475To write a literal `$` in a template, use `$$`.
477Some variables are set automatically by pandoc. These vary somewhat
478depending on the output format, but include:
481: contents specified by `-C/--custom-header`
483: contents specified by `-H/--include-in-header` (may have multiple
486: non-null value if `--toc/--table-of-contents` was specified
488: contents specified by `-B/--include-before-body` (may have
491: contents specified by `-A/--include-after-body` (may have
496: title of document, as specified in title block
498: author of document, as specified in title block (may have
501: date of document, as specified in title block
503Variables may be set at the command line using the `-V/--variable`
504option. This allows users to include custom variables in their
507Templates may contain conditionals. The syntax is as follows:
515This will include `X` in the template if `variable` has a non-null
516value; otherwise it will include `Y`. `X` and `Y` are placeholders for
517any valid template text, and may include interpolated variables or other
518conditionals. The `$else$` section may be omitted.
520When variables can have multiple values (for example, `author` in
521a multi-author document), you can use the `$for$` keyword:
524 <meta name="author" content="$author$" />
527You can optionally specify a separator to be used between
530 $for(author)$$author$$sep$, $endfor$
532Pandoc's markdown vs. standard markdown
533=======================================
535In parsing markdown, Pandoc departs from and extends [standard markdown]
536in a few respects. Except where noted, these differences can
537be suppressed by specifying the `--strict` command-line option.
539[standard markdown]: http://daringfireball.net/projects/markdown/syntax
540 "Markdown syntax description"
545Except inside a code block or inline code, any punctuation or space
546character preceded by a backslash will be treated literally, even if it
547would normally indicate formatting. Thus, for example, if one writes
557 <strong>hello</strong>
559This rule is easier to remember than standard markdown's rule,
560which allows only the following characters to be backslash-escaped:
564A backslash-escaped space is parsed as a nonbreaking space. It will
565appear in TeX output as '`~`' and in HTML and XML as '`\ `' or
568A backslash-escaped newline (i.e. a backslash occurring at the end of
569a line) is parsed as a hard line break. It will appear in TeX output as
570'`\\`' and in HTML as '`<br />`'. This is a nice alternative to
571markdown's "invisible" way of indicating hard line breaks using
572two trailing spaces on a line.
574Subscripts and superscripts
575---------------------------
577Superscripts may be written by surrounding the superscripted text by `^`
578characters; subscripts may be written by surrounding the subscripted
579text by `~` characters. Thus, for example,
581 H~2~O is a liquid. 2^10^ is 1024.
583If the superscripted or subscripted text contains spaces, these spaces
584must be escaped with backslashes. (This is to prevent accidental
585superscripting and subscripting through the ordinary use of `~` and `^`.)
586Thus, if you want the letter P with 'a cat' in subscripts, use
587`P~a\ cat~`, not `P~a cat~`.
592To strikeout a section of text with a horizontal line, begin and end it
593with `~~`. Thus, for example,
595 This ~~is deleted text.~~
600Pandoc behaves differently from standard markdown on some "edge
601cases" involving lists. Consider this source:
611Pandoc transforms this into a "compact list" (with no `<p>` tags around
612"First", "Second", or "Third"), while markdown puts `<p>` tags around
613"Second" and "Third" (but not "First"), because of the blank space
614around "Third". Pandoc follows a simple rule: if the text is followed by
615a blank line, it is treated as a paragraph. Since "Second" is followed
616by a list, and not a blank line, it isn't treated as a paragraph. The
617fact that the list is followed by a blank line is irrelevant. (Note:
618Pandoc works this way even when the `--strict` option is specified. This
619behavior is consistent with the official markdown syntax description,
620even though it is different from that of `Markdown.pl`.)
625Unlike standard markdown, Pandoc allows ordered list items to be marked
626with uppercase and lowercase letters and roman numerals, in addition to
627arabic numerals. (This behavior can be turned off using the `--strict`
628option.) List markers may be enclosed in parentheses or followed by a
629single right-parentheses or period. They must be separated from the
630text that follows by at least one space, and, if the list marker is a
631capital letter with a period, by at least two spaces.[^2]
633[^2]: The point of this rule is to ensure that normal paragraphs
634 starting with people's initials, like
636 B. Russell was an English philosopher.
638 do not get treated as list items.
640 This rule will not prevent
644 from being interpreted as a list item. In this case, a backslash
649Pandoc also pays attention to the type of list marker used, and to the
650starting number, and both of these are preserved where possible in the
651output format. Thus, the following yields a list with numbers followed
652by a single parenthesis, starting with 9, and a sublist with lowercase
662Note that Pandoc pays attention only to the *starting* marker in a list.
663So, the following yields a list numbered sequentially starting from 2:
670If default list markers are desired, use '`#.`':
679Pandoc supports definition lists, using a syntax inspired by
680[PHP Markdown Extra] and [reStructuredText]:[^3]
686 Term 2 with *inline markup*
690 { some code, part of Definition 2 }
692 Third paragraph of definition 2.
694Each term must fit on one line, which may optionally be followed by
695a blank line, and must be followed by one or more definitions.
696A definition begins with a colon or tilde, which may be indented one
697or two spaces. A term may have multiple definitions, and each definition
698may consist of one or more block elements (paragraph, code block, list,
699etc.), each indented four spaces or one tab stop.
701If you leave space after the definition (as in the example above),
702the blocks of the definitions will be considered paragraphs. In some
703output formats, this will mean greater spacing between term/definition
704pairs. For a compact definition list, do not leave space between the
705definition and the next term:
713[^3]: I have also been influenced by the suggestions of [David Wheeler](http://www.justatheory.com/computers/markup/modest-markdown-proposal.html).
715[PHP Markdown Extra]: http://www.michelf.com/projects/php-markdown/extra/
720Pandoc allows implicit reference links with just a single set of
721brackets. So, the following links are equivalent:
724 2. Here's my [link][]
728(Note: Pandoc works this way even if `--strict` is specified, because
729`Markdown.pl` 1.0.2b7 allows single-bracket links.)
734Pandoc's markdown allows footnotes, using the following syntax:
736 Here is a footnote reference,[^1] and another.[^longnote]
738 [^1]: Here is the footnote.
740 [^longnote]: Here's one with multiple blocks.
742 Subsequent paragraphs are indented to show that they
743 belong to the previous footnote.
747 The whole paragraph can be indented, or just the first
748 line. In this way, multi-paragraph footnotes work like
749 multi-paragraph list items.
751 This paragraph won't be part of the note, because it isn't indented.
753The identifiers in footnote references may not contain spaces, tabs,
754or newlines. These identifiers are used only to correlate the
755footnote reference with the note itself; in the output, footnotes
756will be numbered sequentially.
758The footnotes themselves need not be placed at the end of the
759document. They may appear anywhere except inside other block elements
760(lists, block quotes, tables, etc.).
762Inline footnotes are also allowed (though, unlike regular notes,
763they cannot contain multiple paragraphs). The syntax is as follows:
765 Here is an inline note.^[Inlines notes are easier to write, since
766 you don't have to pick an identifier and move down to type the
769Inline and regular footnotes may be mixed freely.
774Two kinds of tables may be used. Both kinds presuppose the use of
775a fixed-width font, such as Courier.
777Simple tables look like this:
779 Right Left Center Default
780 ------- ------ ---------- -------
785 Table: Demonstration of simple table syntax.
787The headers and table rows must each fit on one line. Column
788alignments are determined by the position of the header text relative
789to the dashed line below it:[^4]
791 - If the dashed line is flush with the header text on the right side
792 but extends beyond it on the left, the column is right-aligned.
793 - If the dashed line is flush with the header text on the left side
794 but extends beyond it on the right, the column is left-aligned.
795 - If the dashed line extends beyond the header text on both sides,
796 the column is centered.
797 - If the dashed line is flush with the header text on both sides,
798 the default alignment is used (in most cases, this will be left).
800[^4]: This scheme is due to Michel Fortin, who proposed it on the
801 [Markdown discussion list](http://six.pairlist.net/pipermail/markdown-discuss/2005-March/001097.html).
803The table must end with a blank line, or a line of dashes followed by
804a blank line. A caption may optionally be provided (as illustrated in
805the example above). A caption is a paragraph beginning with the string
806`Table:`, which will be stripped off.
808The column headers may be omitted, provided a dashed line is used
809to end the table. For example:
811 ------- ------ ---------- -------
815 ------- ------ ---------- -------
817When headers are omitted, column alignments are determined on the basis
818of the first line of the table body. So, in the tables above, the columns
819would be right, left, center, and right aligned, respectively.
821Multiline tables allow headers and table rows to span multiple lines
822of text. Here is an example:
824 -------------------------------------------------------------
825 Centered Default Right Left
826 Header Aligned Aligned Aligned
827 ----------- ------- --------------- -------------------------
828 First row 12.0 Example of a row that
829 spans multiple lines.
831 Second row 5.0 Here's another one. Note
832 the blank line between
834 -------------------------------------------------------------
836 Table: Here's the caption. It, too, may span
839These work like simple tables, but with the following differences:
841 - They must begin with a row of dashes, before the header text
842 (unless the headers are omitted).
843 - They must end with a row of dashes, then a blank line.
844 - The rows must be separated by blank lines.
846In multiline tables, the table parser pays attention to the widths of
847the columns, and the writers try to reproduce these relative widths in
848the output. So, if you find that one of the columns is too narrow in the
849output, try widening it in the markdown source.
851Headers may be omitted in multiline tables as well as simple tables:
853 ----------- ------- --------------- -------------------------
854 First row 12.0 Example of a row that
855 spans multiple lines.
857 Second row 5.0 Here's another one. Note
858 the blank line between
860 -------------------------------------------------------------
862 Table: Here's a multiline table without headers.
864It is possible for a multiline table to have just one row, but the row
865should be followed by a blank line (and then the row of dashes that ends
866the table), or the table may be interpreted as a simple table.
871In addition to standard indented code blocks, Pandoc supports
872*delimited* code blocks. These begin with a row of three or more
873tildes (`~`) and end with a row of tildes that must be at least
874as long as the starting row. Everything between the tilde-lines
875is treated as code. No indentation is necessary:
881Like regular code blocks, delimited code blocks must be separated
882from surrounding text by blank lines.
884If the code itself contains a row of tildes, just use a longer
885row of tildes at the start and end:
889 code including tildes
893Optionally, you may specify the language of the code block using
896 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.haskell .numberLines}
898 qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
899 qsort (filter (>= x) xs)
900 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
902Some output formats can use this information to do syntax highlighting.
903Currently, the only output format that uses this information is HTML.
905If pandoc has been compiled with syntax highlighting support, then the
906code block above will appear highlighted, with numbered lines. (To see
907which languages are supported, do `pandoc --version`.)
909If pandoc has not been compiled with syntax highlighting support, the
910code block above will appear as follows:
912 <pre class="haskell">
921An image occurring by itself in a paragraph will be rendered as
922a figure with a caption.[^5] (In LaTeX, a figure environment will be
923used; in HTML, the image will be placed in a `div` with class
924`figure`, together with a caption in a `p` with class `caption`.)
925The image's alt text will be used as the caption.
927 
929[^5]: This feature is not yet implemented for RTF, OpenDocument, or
930 ODT. In those formats, you'll just get an image in a paragraph by
931 itself, with no caption.
933If you just want a regular inline image, just make sure it is not
934the only thing in the paragraph. One way to do this is to insert a
935nonbreaking space after the image:
937 \
942If the file begins with a title block
945 % author(s) (separated by semicolons)
948it will be parsed as bibliographic information, not regular text. (It
949will be used, for example, in the title of standalone LaTeX or HTML
950output.) The block may contain just a title, a title and an author,
951or all three elements. If you want to include an author but no
952title, or a title and a date but no author, you need a blank line:
961The title may occupy multiple lines, but continuation lines must
962begin with leading space, thus:
967If a document has multiple authors, the authors may be put on
968separate lines with leading space, or separated by semicolons, or
969both. So, all of the following are equivalent:
974 % Author One; Author Two
979The date must fit on one line.
981All three metadata fields may contain standard inline formatting
982(italics, links, footnotes, etc.).
984Title blocks will always be parsed, but they will affect the output only
985when the `--standalone` (`-s`) option is chosen. In HTML output, titles
986will appear twice: once in the document head -- this is the title that
987will appear at the top of the window in a browser -- and once at the
988beginning of the document body. The title in the document head can have
989an optional prefix attached (`--title-prefix` or `-T` option). The title
990in the body appears as an H1 element with class "title", so it can be
991suppressed or reformatted with CSS. If a title prefix is specified with
992`-T` and no title block appears in the document, the title prefix will
993be used by itself as the HTML title.
995The man page writer extracts a title, man page section number, and
996other header and footer information from the title line. The title
997is assumed to be the first word on the title line, which may optionally
998end with a (single-digit) section number in parentheses. (There should
999be no space between the title and the parentheses.) Anything after
1000this is assumed to be additional footer and header text. A single pipe
1001character (`|`) should be used to separate the footer text from the header
1006will yield a man page with the title `PANDOC` and section 1.
1008 % PANDOC(1) Pandoc User Manuals
1010will also have "Pandoc User Manuals" in the footer.
1012 % PANDOC(1) Pandoc User Manuals | Version 4.0
1014will also have "Version 4.0" in the header.
1016Markdown in HTML blocks
1017-----------------------
1019While standard markdown leaves HTML blocks exactly as they are, Pandoc
1020treats text between HTML tags as markdown. Thus, for example, Pandoc
1026 <td>[a link](http://google.com)</td>
1034 <td><em>one</em></td>
1035 <td><a href="http://google.com">a link</a></td>
1039whereas `Markdown.pl` will preserve it as is.
1041There is one exception to this rule: text between `<script>` and
1042`</script>` tags is not interpreted as markdown.
1044This departure from standard markdown should make it easier to mix
1045markdown with HTML block elements. For example, one can surround
1046a block of markdown text with `<div>` tags without preventing it
1047from being interpreted as markdown.
1049Header identifiers in HTML
1050--------------------------
1052Each header element in pandoc's HTML output is given a unique
1053identifier. This identifier is based on the text of the header. To
1054derive the identifier from the header text,
1056 - Remove all formatting, links, etc.
1057 - Remove all punctuation, except underscores, hyphens, and periods.
1058 - Replace all spaces and newlines with hyphens.
1059 - Convert all alphabetic characters to lowercase.
1060 - Remove everything up to the first letter (identifiers may
1061 not begin with a number or punctuation mark).
1062 - If nothing is left after this, use the identifier `section`.
1067 ------------------------------------- ---------------------------
1068 Header identifiers in HTML `header-identifiers-in-html`
1069 *Dogs*?--in *my* house? `dogs--in-my-house`
1070 [HTML], [S5], or [RTF]? `html-s5-or-rtf`
1071 3. Applications `applications`
1074These rules should, in most cases, allow one to determine the identifier
1075from the header text. The exception is when several headers have the
1076same text; in this case, the first will get an identifier as described
1077above; the second will get the same identifier with `-1` appended; the
1078third with `-2`; and so on.
1080These identifiers are used to provide link targets in the table of
1081contents generated by the `--toc|--table-of-contents` option. They
1082also make it easy to provide links from one section of a document to
1083another. A link to this section, for example, might look like this:
1085 See the section on [header identifiers](#header-identifiers-in-html).
1087Note, however, that this method of providing links to sections works
1090Blank lines before headers and blockquotes
1091------------------------------------------
1093Standard markdown syntax does not require a blank line before a header
1094or blockquote. Pandoc does require this (except, of course, at the
1095beginning of the document). The reason for the requirement is that
1096it is all too easy for a `>` or `#` to end up at the beginning of a
1097line by accident (perhaps through line wrapping). Consider, for
1100 I like several of their flavors of ice cream: #22, for example, and
1106Anything between two $ characters will be treated as TeX math. The
1107opening $ must have a character immediately to its right, while the
1108closing $ must have a character immediately to its left. Thus,
1109`$20,000 and $30,000` won't parse as math. If for some reason
1110you need to enclose text in literal $ characters, backslash-escape
1111them and they won't be treated as math delimiters.
1113TeX math will be printed in all output formats. In Markdown,
1114reStructuredText, LaTeX, and ConTeXt output, it will appear verbatim
1115between $ characters.
1117In reStructuredText output, it will be rendered using an interpreted
1118text role `:math:`, as described
1119[here](http://www.american.edu/econ/itex2mml/mathhack.rst).
1121In Texinfo output, it will be rendered inside a `@math` command.
1123In groff man output, it will be rendered verbatim without $'s.
1125In MediaWiki output, it will be rendered inside `<math>` tags.
1127In RTF, Docbook, and OpenDocument output, it will be rendered, as far as
1128possible, using unicode characters, and will otherwise appear verbatim.
1129Unknown commands and symbols, and commands that cannot be dealt with
1130this way (like `\frac`), will be rendered verbatim. So the results may
1131be a mix of raw TeX code and properly rendered unicode math.
1133In HTML and S5 output, the way math is rendered will depend on the
1134command-line options selected:
11361. The default is to render TeX math as far as possible using unicode
1137 characters, as with RTF, Docbook, and OpenDocument output. Formulas
1138 are put inside a `span` with `class="math"`, so that they may be
1139 styled differently from the surrounding text if needed.
11412. If the `--latexmathml` option is used, TeX math will be displayed
1142 between $ or $$ characters and put in `<span>` tags with class `LaTeX`.
1143 The [LaTeXMathML] script will be used to render it as formulas.
1144 (This trick does not work in all browsers, but it works in Firefox.
1145 In browsers that do not support LaTeXMathML, TeX math will appear
1146 verbatim between $ characters.)
11483. If the `--jsmath` option is used, TeX math will be put inside
1149 `<span>` tags (for inline math) or `<div>` tags (for display math)
1150 with class `math`. The [jsMath] script will be used to render
11534. If the `--mimetex` option is used, the [mimeTeX] CGI script will
1154 be called to generate images for each TeX formula. This should
1155 work in all browsers. The `--mimetex` option takes an optional URL
1156 as argument. If no URL is specified, it will be assumed that the
1157 mimeTeX CGI script is at `/cgi-bin/mimetex.cgi`.
11595. If the `--gladtex` option is used, TeX formulas will be enclosed
1160 in `<eq>` tags in the HTML output. The resulting `htex` file may then
1161 be processed by [gladTeX], which will produce image files for each
1162 formula and an `html` file with links to these images. So, the
1165 pandoc -s --gladtex myfile.txt -o myfile.htex
1166 gladtex -d myfile-images myfile.htex
1167 # produces myfile.html and images in myfile-images
1172Inline TeX commands will be preserved and passed unchanged to the
1173LaTeX and ConTeXt writers. Thus, for example, you can use LaTeX to
1174include BibTeX citations:
1176 This result was proved in \cite{jones.1967}.
1178Note that in LaTeX environments, like
1180 \begin{tabular}{|l|l|}\hline
1181 Age & Frequency \\ \hline
1184 36--45 & 22 \\ \hline
1187the material between the begin and end tags will be interpreted as raw
1188LaTeX, not as markdown.
1190Inline LaTeX is ignored in output formats other than Markdown, LaTeX,
1193Producing S5 with Pandoc
1194========================
1196Producing an [S5] web-based slide show with Pandoc is easy. A title
1197page is constructed automatically from the document's title block (see
1198above). Each section (with a level-one header) produces a single slide.
1199(Note that if the section is too big, the slide will not fit on the page;
1200S5 is not smart enough to produce multiple pages.)
1202Here's the markdown source for a simple slide show, `eating.txt`:
1218To produce the slide show, simply type
1220 pandoc -w s5 -s eating.txt > eating.html
1222and open up `eating.html` in a browser.
1224Note that by default, the S5 writer produces lists that display
1225"all at once." If you want your lists to display incrementally
1226(one item at a time), use the `-i` option. If you want a
1227particular list to depart from the default (that is, to display
1228incrementally without the `-i` option and all at once with the
1229`-i` option), put it in a block quote:
1234In this way incremental and nonincremental lists can be mixed in
1237Note: the S5 file produced by pandoc with the `-s/--standalone` option
1238embeds the javascript and CSS required to show the slides. Thus it
1239does not depend on any additional files: you can send the HTML file to
1240others, and they will be able to view the slide show just by opening
1241it. However, if you intend to produce several S5 slide shows, and you
1242are displaying them on your own website, it is better to keep the S5
1243javascript and CSS files separate from the slide shows themselves, so
1244that they may be cached. The best approach in this case is to use pandoc
1245without the `-s` option to produce the body of the S5 document, which
1246can then be inserted into an HTML template that links to the javascript
1247and CSS files required by S5. (See the instructions on the S5 website.)
1248Alternatively, you may use `-s` together with the `--template`
1249option to specify a custom template.
1251You can change the style of the slides by putting customized CSS files
1252in `$DATADIR/s5/default`, where `$DATADIR` is the user data directory
1253(see `--data-dir`, above). The originals may be found in pandoc's system
1254data directory (generally `$CABALDIR/pandoc-VERSION/s5/default`). Pandoc
1255will look there for any files it does not find in the user data
1258Literate Haskell support
1259========================
1261If you append `+lhs` to an appropriate input or output format (`markdown`,
1262`rst`, or `latex` for input or output; `html` for output only), pandoc
1263will treat the document as literate Haskell source. This means that
1265 - In markdown input, "bird track" sections will be parsed as Haskell
1266 code rather than block quotations. Text between `\begin{code}`
1267 and `\end{code}` will also be treated as Haskell code.
1269 - In markdown output, code blocks with class `haskell` will be
1270 rendered using bird tracks, and block quotations will be
1271 indented one space, so they will not be treated as Haskell code.
1272 In addition, headers will be rendered setext-style (with underlines)
1273 rather than atx-style (with '#' characters). (This is because ghc
1274 treats '#' characters in column 1 as introducing line numbers.)
1276 - In restructured text input, "bird track" sections will be parsed
1279 - In restructured text output, code blocks with class `haskell` will
1280 be rendered using bird tracks.
1282 - In LaTeX input, text in `code` environments will be parsed as
1285 - In LaTeX output, code blocks with class `haskell` will be rendered
1286 inside `code` environments.
1288 - In HTML output, code blocks with class `haskell` will be rendered
1289 with class `literatehaskell` and bird tracks.
1293 pandoc -f markdown+lhs -t html
1295reads literate Haskell source formatted with markdown conventions and writes
1296ordinary HTML (without bird tracks).
1298 pandoc -f markdown+lhs -t html+lhs
1300writes HTML with the Haskell code in bird tracks, so it can be copied
1301and pasted as literate Haskell source.
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list