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 [markdown], [reStructuredText], [HTML], [LaTeX], [ConTeXt],
9[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-8 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.)
43Contributors: Recai Oktaş (build system, debian package, wrapper
44scripts), Peter Wang (Texinfo writer), Andrea Rossato (OpenDocument writer).
46[GPL]: http://www.gnu.org/copyleft/gpl.html "GNU General Public License"
51If you run `pandoc` without arguments, it will accept input from
52stdin. If you run it with file names as arguments, it will take input
53from those files. By default, `pandoc` writes its output to stdout.[^1]
54If you want to write to a file, use the `-o` option:
56 pandoc -o hello.html hello.txt
58[^1]: The exception is for non-text output formats, such as `odt`.
59 For output in `odt` format, an output file must be specified
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.)
72The format of the input and output can be specified explicitly using
73command-line options. The input format can be specified using the
74`-r/--read` or `-f/--from` options, the output format using the
75`-w/--write` or `-t/--to` options. Thus, to convert `hello.txt` from
76markdown to LaTeX, you could type:
78 pandoc -f markdown -t latex hello.txt
80To convert `hello.html` from html to markdown:
82 pandoc -f html -t markdown hello.html
84Supported output formats include `markdown`, `latex`, `context`
85(ConTeXt), `html`, `rtf` (rich text format), `rst` (reStructuredText),
86`docbook` (DocBook XML), `opendocument` (OpenDocument XML), `odt`
87(OpenOffice text document), `texinfo`, (GNU Texinfo), `mediawiki`
88(MediaWiki markup), `man` (groff man), and `s5` (which produces an
89HTML file that acts like powerpoint).
91Supported input formats include `markdown`, `html`, `latex`, and `rst`.
92Note that the `rst` reader only parses a subset of reStructuredText
93syntax. For example, it doesn't handle tables, option lists, or
94footnotes. But for simple documents it should be adequate. The `latex`
95and `html` readers are also limited in what they can do. Because the
96`html` reader is picky about the HTML it parses, it is recommended that
97you pipe HTML through [HTML Tidy] before sending it to `pandoc`, or use
98the `html2markdown` script described below.
100If you don't specify a reader or writer explicitly, `pandoc` will
101try to determine the input and output format from the extensions of
102the input and output filenames. Thus, for example,
104 pandoc -o hello.tex hello.txt
106will convert `hello.txt` from markdown to LaTeX. If no output file
107is specified (so that output goes to stdout), or if the output file's
108extension is unknown, the output format will default to HTML.
109If no input file is specified (so that input comes from stdin), or
110if the input files' extensions are unknown, the input format will
111be assumed to be markdown unless explicitly specified.
116All input is assumed to be in the UTF-8 encoding, and all output
117is in UTF-8. If your local character encoding is not UTF-8 and you use
118accented or foreign characters, you should pipe the input and output
119through [`iconv`]. For example,
121 iconv -t utf-8 source.txt | pandoc | iconv -f utf-8 > output.html
123will convert `source.txt` from the local encoding to UTF-8, then
124convert it to HTML, then convert back to the local encoding,
125putting the output in `output.html`.
127The shell scripts (described below) automatically convert the input
128from the local encoding to UTF-8 before running them through `pandoc`,
129then convert the output back to the local encoding.
134Three shell scripts, `markdown2pdf`, `html2markdown`, and
135`hsmarkdown`, are included in the standard Pandoc installation. (They
136are not included in the Windows binary package, as they require a POSIX
137shell, but they may be used in Windows under Cygwin.)
1391. `markdown2pdf` produces a PDF file from markdown-formatted
140 text, using `pandoc` and `pdflatex`. The default
141 behavior of `markdown2pdf` is to create a file with the same
142 base name as the first argument and the extension `pdf`; thus,
145 markdown2pdf sample.txt endnotes.txt
147 will produce `sample.pdf`. (If `sample.pdf` exists already,
148 it will be backed up before being overwritten.) An output file
149 name can be specified explicitly using the `-o` option:
151 markdown2pdf -o book.pdf chap1 chap2
153 If no input file is specified, input will be taken from stdin.
154 All of `pandoc`'s options will work with `markdown2pdf` as well.
156 `markdown2pdf` assumes that `pdflatex` is in the path. It also
157 assumes that the following LaTeX packages are available:
158 `unicode`, `fancyhdr` (if you have verbatim text in footnotes),
159 `graphicx` (if you use images), `array` (if you use tables),
160 and `ulem` (if you use strikeout text). If they are not already
161 included in your LaTeX distribution, you can get them from
1642. `html2markdown` grabs a web page from a file or URL and converts
165 it to markdown-formatted text, using `tidy` and `pandoc`.
167 All of `pandoc`'s options will work with `html2markdown` as well.
168 In addition, the following special options may be used.
169 The special options must be separated from the `html2markdown`
170 command and any regular Pandoc options by the delimiter `--`:
172 html2markdown -o out.txt -- -e latin1 -g curl google.com
174 The `-e` or `--encoding` option specifies the character encoding
175 of the HTML input. If this option is not specified, and input
176 is not from stdin, `html2markdown` will attempt to determine the
177 page's character encoding from the "Content-type" meta tag.
178 If this is not present, UTF-8 is assumed.
180 The `-g` or `--grabber` option specifies the command to be used to
181 fetch the contents of a URL:
183 html2markdown -g 'curl --user foo:bar' www.mysite.com
185 If this option is not specified, `html2markdown` searches for an
186 available program (`wget`, `curl`, or a text-mode browser) to fetch
187 the contents of a URL.
189 `html2markdown` requires [HTML Tidy], which must be in the path.
190 It uses [`iconv`] for character encoding conversions; if `iconv`
191 is absent, it will still work, but it will treat everything as UTF-8.
1933. `hsmarkdown` is designed to be used as a drop-in replacement for
194 `Markdown.pl`. It forces `pandoc` to convert from markdown to
195 HTML, and to use the `--strict` flag for maximal compliance with
196 official markdown syntax. (All of Pandoc's syntax extensions and
197 variants, described below, are disabled.) No other command-line
198 options are allowed. (In fact, options will be interpreted as
201 As an alternative to using the `hsmarkdown` shell script, the
202 user may create a symbolic link to `pandoc` called `hsmarkdown`.
203 When invoked under the name `hsmarkdown`, `pandoc` will behave
204 as if the `--strict` flag had been selected, and no command-line
205 options will be recognized. However, this approach does not work
206 under Cygwin, due to problems with its simulation of symbolic
209[Cygwin]: http://www.cygwin.com/
210[HTML Tidy]: http://tidy.sourceforge.net/
211[`iconv`]: http://www.gnu.org/software/libiconv/
212[CTAN]: http://www.ctan.org "Comprehensive TeX Archive Network"
217Various command-line options can be used to customize the output.
218For further documentation, see the `pandoc(1)` man page.
220`-f`, `--from`, `-r`, or `--read` *format*
221: specifies the input format (the format Pandoc will be converting
222 *from*). *format* can be `native`, `markdown`, `rst`, `html`, or
225`-t`, `--to`, `-w`, or `--write` *format*
226: specifies the output format -- the format Pandoc will
227 be converting *to*. *format* can be `native`, `html`, `s5`,
228 `docbook`, `opendocument`, `latex`, `context`, `markdown`, `man`,
231`-s` or `--standalone`
232: indicates that a standalone document is to be produced (with
233 appropriate headers and footers), rather than a fragment.
235`-o` or `--output` *filename*
236: sends output to *filename*. If this option is not specified,
237 or if its argument is `-`, output will be sent to stdout.
238 (Exception: if the output format is `odt`, output to stdout
241`-p` or `--preserve-tabs`
242: causes tabs in the source text to be preserved, rather than converted
243 to spaces (the default).
246: sets the number of spaces per tab to *tabstop* (defaults to 4).
249: specifies that strict markdown syntax is to be used, without
250 pandoc's usual extensions and variants (described below). When the
251 input format is HTML, this means that constructs that have no
252 equivalents in standard markdown (e.g. definition lists or strikeout
253 text) will be parsed as raw HTML.
256: causes reference-style links to be used in markdown
257 and reStructuredText output. By default inline links are used.
260: causes the HTML and LaTeX readers to parse HTML codes and LaTeX
261 environments that it can't translate as raw HTML or LaTeX. Raw HTML can
262 be printed in markdown, reStructuredText, HTML, and S5 output; raw LaTeX
263 can be printed in markdown, reStructuredText, LaTeX, and ConTeXt output.
264 The default is for the readers to omit untranslatable HTML codes and
265 LaTeX environments. (The LaTeX reader does pass through untranslatable
266 LaTeX *commands*, even if `-R` is not specified.)
268`-C` or `--custom-header` *filename*
269: can be used to specify a custom document header. To see the headers
270 used by default, use the `-D` option: for example, `pandoc -D html`
271 prints the default HTML header.
273`--toc` or `--table-of-contents`
274: includes an automatically generated table of contents (or, in the
275 case of `latex`, `context`, and `rst`, an instruction to create
276 one) in the output document. This option has no effect with `man`,
277 `docbook`, or `s5` output formats.
279`-c` or `--css` *filename*
280: allows the user to specify a custom stylesheet that will be linked to
281 in HTML and S5 output. This option can be used repeatedly to include
282 multiple stylesheets. They will be included in the order specified.
284`-H` or `--include-in-header` *filename*
285: includes the contents of *filename* (verbatim) at the end of the
286 document header. This can be used, for example, to include special
287 CSS or javascript in HTML documents. This option can be used
288 repeatedly to include multiple files in the header. They will be
289 included in the order specified.
291`-B` or `--include-before-body` *filename*
292: includes the contents of *filename* (verbatim) at the beginning of
293 the document body (e.g. after the `<body>` tag in HTML, or the
294 `\begin{document}` command in LaTeX). This can be used to include
295 navigation bars or banners in HTML documents. This option can be
296 used repeatedly to include multiple files. They will be included in
299`-A` or `--include-after-body` *filename*
300: includes the contents of *filename* (verbatim) at the end of
301 the document body (before the `</body>` tag in HTML, or the
302 `\end{document}` command in LaTeX). This option can be be used
303 repeatedly to include multiple files. They will be included in the
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).)
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 `--asciimathml`*[=url]*
322: causes `pandoc` to use Peter Jipsen's [ASCIIMathML] script to display
323 TeX math in HTML or S5. If a local copy of `ASCIIMathML.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 `ASCIIMathML.js`, which can be cached. (See `--gladtex`
330 and `--mimetex` for alternative ways of dealing with math in HTML.)
333: causes TeX formulas to be enclosed in `<eq>` tags in HTML or S5 output.
334 This output can then be processed by [gladTeX] to produce links to
335 images with the typeset formulas. (See `--asciimathml` and
336 `--mimetex` for alternative ways of dealing with math in HTML.)
339: causes TeX formulas to be replaced by `<img>` tags linking to the
340 [mimeTeX] CGI script, which will produce images with the typeset
341 formulas. (See `--asciimathml` and `--mimetex` for alternative
342 ways of dealing with math in HTML.)
344`-i` or `--incremental`
345: causes all lists in S5 output to be displayed incrementally by
346 default (one item at a time). The normal default is for lists to be
347 displayed all at once.
349`-N` or `--number-sections`
350: causes sections to be numbered in LaTeX or ConTeXt output. By default,
351 sections are not numbered.
354: disables text-wrapping in output. By default, text is wrapped
355 appropriately for the output format.
358: sanitizes HTML (in markdown or HTML input) using a whitelist.
359 Unsafe tags are replaced by HTML comments; unsafe attributes
360 are omitted. URIs in links and images are also checked against a
361 whitelist of URI schemes.
364: is intended to make it easier to create wrapper scripts that use
365 Pandoc. It causes Pandoc to dump information about the arguments
366 with which it was called to stdout, then exit. The first line
367 printed is the name of the output file specified using the `-o`
368 or `--output` option, or `-` if output would go to stdout. The
369 remaining lines, if any, list command-line arguments. These will
370 include the names of input files and any special options passed
371 after ` -- ` on the command line. So, for example,
373: pandoc --dump-args -o foo.html -s foo.txt \
374 appendix.txt -- -e latin1
376: will cause the following to be printed to stdout:
378: foo.html foo.txt appendix.txt -e latin1
381: causes Pandoc to ignore all command-line arguments.
382 Regular Pandoc options are not ignored. Thus, for example,
384: pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1
388: pandoc -o foo.html -s
391: prints the version number to STDERR.
394: prints a usage message to STDERR.
396[Smartypants]: http://daringfireball.net/projects/smartypants/
397[ASCIIMathML]: http://www1.chapman.edu/~jipsen/mathml/asciimath.html
398[gladTeX]: http://www.math.uio.no/~martingu/gladtex/index.html
399[mimeTeX]: http://www.forkosh.com/mimetex.html
401Pandoc's markdown vs. standard markdown
402=======================================
404In parsing markdown, Pandoc departs from and extends [standard markdown]
405in a few respects. (To run Pandoc on the official markdown test suite,
406type `make test-markdown`.) Except where noted, these differences can
407be suppressed by specifying the `--strict` command-line option or by
408using the `hsmarkdown` wrapper.
410[standard markdown]: http://daringfireball.net/projects/markdown/syntax
411 "Markdown syntax description"
416Except inside a code block or inline code, any punctuation or space
417character preceded by a backslash will be treated literally, even if it
418would normally indicate formatting. Thus, for example, if one writes
428 <strong>hello</strong>
430This rule is easier to remember than standard markdown's rule,
431which allows only the following characters to be backslash-escaped:
435A backslash-escaped space is parsed as a nonbreaking space. It will
436appear in TeX output as '~' and in HTML and XML as '\ ' or '\ '.
438Subscripts and superscripts
439---------------------------
441Superscripts may be written by surrounding the superscripted text by `^`
442characters; subscripts may be written by surrounding the subscripted
443text by `~` characters. Thus, for example,
445 H~2~O is a liquid. 2^10^ is 1024.
447If the superscripted or subscripted text contains spaces, these spaces
448must be escaped with backslashes. (This is to prevent accidental
449superscripting and subscripting through the ordinary use of `~` and `^`.)
450Thus, if you want the letter P with 'a cat' in subscripts, use
451`P~a\ cat~`, not `P~a cat~`.
456To strikeout a section of text with a horizontal line, begin and end it
457with `~~`. Thus, for example,
459 This ~~is deleted text.~~
464Pandoc behaves differently from standard markdown on some "edge
465cases" involving lists. Consider this source:
475Pandoc transforms this into a "compact list" (with no `<p>` tags around
476"First", "Second", or "Third"), while markdown puts `<p>` tags around
477"Second" and "Third" (but not "First"), because of the blank space
478around "Third". Pandoc follows a simple rule: if the text is followed by
479a blank line, it is treated as a paragraph. Since "Second" is followed
480by a list, and not a blank line, it isn't treated as a paragraph. The
481fact that the list is followed by a blank line is irrelevant. (Note:
482Pandoc works this way even when the `--strict` option is specified. This
483behavior is consistent with the official markdown syntax description,
484even though it is different from that of `Markdown.pl`.)
489Unlike standard markdown, Pandoc allows ordered list items to be marked
490with uppercase and lowercase letters and roman numerals, in addition to
491arabic numerals. (This behavior can be turned off using the `--strict`
492option.) List markers may be enclosed in parentheses or followed by a
493single right-parentheses or period. They must be separated from the
494text that follows by at least one space, and, if the list marker is a
495capital letter with a period, by at least two spaces.[^2]
497[^2]: The point of this rule is to ensure that normal paragraphs
498 starting with people's initials, like
500 B. Russell was an English philosopher.
502 do not get treated as list items.
504 This rule will not prevent
508 from being interpreted as a list item. In this case, a backslash
513Pandoc also pays attention to the type of list marker used, and to the
514starting number, and both of these are preserved where possible in the
515output format. Thus, the following yields a list with numbers followed
516by a single parenthesis, starting with 9, and a sublist with lowercase
526Note that Pandoc pays attention only to the *starting* number in a list.
527So, the following yields a list numbered sequentially starting from 2:
533If default list markers are desired, use '`#.`':
539If you change list style in mid-list, Pandoc will notice and assume you
540are starting a sublist. So,
548gets treated as if it were
560Pandoc supports definition lists, using a syntax inspired by
561[PHP Markdown Extra] and [reStructuredText]:
563 [PHP Markdown Extra]: http://www.michelf.com/projects/php-markdown/extra/
571 : Second paragraph of definition 2.
573Each term must fit on one line. The definition must begin on the line
574after the term. The definition consists of one or more block elements
575(paragraph, code block, list, etc.), each beginning with a colon and
576(aside from the colon) indented one tab stop.
578 Term *with inline markup*
579 : Here is the definition. It may contain multiple blocks.
584 : Here is the third paragraph of this definition.
586If you leave space after the definition (as in the first example above),
587the definitions will be considered paragraphs. In some output formats,
588this will mean greater spacing between term/definition pairs. For a
589compact definition list, do not leave space between the definition and
600Pandoc allows implicit reference links with just a single set of
601brackets. So, the following links are equivalent:
604 2. Here's my [link][]
608(Note: Pandoc works this way even if `--strict` is specified, because
609`Markdown.pl` 1.0.2b7 allows single-bracket links.)
614Pandoc's markdown allows footnotes, using the following syntax:
616 Here is a footnote reference,[^1] and another.[^longnote]
618 [^1]: Here is the footnote.
620 [^longnote]: Here's one with multiple blocks.
622 Subsequent paragraphs are indented to show that they
623 belong to the previous footnote.
627 The whole paragraph can be indented, or just the first
628 line. In this way, multi-paragraph footnotes work like
629 multi-paragraph list items.
631 This paragraph won't be part of the note, because it isn't indented.
633The identifiers in footnote references may not contain spaces, tabs,
634or newlines. These identifiers are used only to correlate the
635footnote reference with the note itself; in the output, footnotes
636will be numbered sequentially.
638The footnotes themselves need not be placed at the end of the
639document. They may appear anywhere except inside other block elements
640(lists, block quotes, tables, etc.).
642Inline footnotes are also allowed (though, unlike regular notes,
643they cannot contain multiple paragraphs). The syntax is as follows:
645 Here is an inline note.^[Inlines notes are easier to write, since
646 you don't have to pick an identifier and move down to type the
649Inline and regular footnotes may be mixed freely.
654Two kinds of tables may be used. Both kinds presuppose the use of
655a fixed-width font, such as Courier.
657Simple tables look like this:
659 Right Left Center Default
660 ------- ------ ---------- -------
665 Table: Demonstration of simple table syntax.
667The headers and table rows must each fit on one line. Column
668alignments are determined by the position of the header text relative
669to the dashed line below it:[^3]
671 - If the dashed line is flush with the header text on the right side
672 but extends beyond it on the left, the column is right-aligned.
673 - If the dashed line is flush with the header text on the left side
674 but extends beyond it on the right, the column is left-aligned.
675 - If the dashed line extends beyond the header text on both sides,
676 the column is centered.
677 - If the dashed line is flush with the header text on both sides,
678 the default alignment is used (in most cases, this will be left).
680[^3]: This scheme is due to Michel Fortin, who proposed it on the
681 [Markdown discussion list](http://six.pairlist.net/pipermail/markdown-discuss/2005-March/001097.html).
683The table must end with a blank line. Optionally, a caption may be
684provided (as illustrated in the example above). A caption is a paragraph
685beginning with the string `Table:`, which will be stripped off.
687The table parser pays attention to the widths of the columns, and
688the writers try to reproduce these relative widths in the output.
689So, if you find that one of the columns is too narrow in the output,
690try widening it in the markdown source.
692Multiline tables allow headers and table rows to span multiple lines
693of text. Here is an example:
695 -------------------------------------------------------------
696 Centered Default Right Left
697 Header Aligned Aligned Aligned
698 ----------- ------- --------------- -------------------------
699 First row 12.0 Example of a row that
700 spans multiple lines.
702 Second row 5.0 Here's another one. Note
703 the blank line between
705 -------------------------------------------------------------
707 Table: Here's the caption. It, too, may span
710These work like simple tables, but with the following differences:
712 - They must begin with a row of dashes, before the header text.
713 - They must end with a row of dashes, then a blank line.
714 - The rows must be separated by blank lines.
719In addition to standard indented code blocks, Pandoc supports
720*delimited* code blocks. These begin with a row of three or more
721tildes (`~`) and end with a row of tildes that must be at least
722as long as the starting row. Everything between the tilde-lines
723is treated as code. No indentation is necessary:
729If the code itself contains a row of tildes, just use a longer
730row of tildes at the start and end:
734 code including tildes
738Optionally, you may specify the language of the code block using
741 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.haskell .numberLines}
743 qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
744 qsort (filter (>= x) xs)
745 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
747Some output formats can use this information to do syntax highlighting.
748Currently, the only output format that uses this information is HTML.
750If pandoc has been compiled with syntax highlighting support, then the
751code block above will appear highlighted, with numbered lines. (To see
752which languages are supported, do `pandoc --version`.)
754If pandoc has not been compiled with syntax highlighting support, the
755code block above will appear as follows:
757 <pre class="haskell">
766If the file begins with a title block
769 % author(s) (separated by commas)
772it will be parsed as bibliographic information, not regular text. (It
773will be used, for example, in the title of standalone LaTeX or HTML
774output.) The block may contain just a title, a title and an author,
775or all three lines. Each must begin with a % and fit on one line.
776The title may contain standard inline formatting. If you want to
777include an author but no title, or a title and a date but no author,
778you need a blank line:
784Titles will be written only when the `--standalone` (`-s`) option is
785chosen. In HTML output, titles will appear twice: once in the
786document head -- this is the title that will appear at the top of the
787window in a browser -- and once at the beginning of the document body.
788The title in the document head can have an optional prefix attached
789(`--title-prefix` or `-T` option). The title in the body appears as
790an H1 element with class "title", so it can be suppressed or
791reformatted with CSS. If a title prefix is specified with `-T` and no
792title block appears in the document, the title prefix will be used by
793itself as the HTML title.
795The man page writer extracts a title, man page section number, and
796other header and footer information from the title line. The title
797is assumed to be the first word on the title line, which may optionally
798end with a (single-digit) section number in parentheses. (There should
799be no space between the title and the parentheses.) Anything after
800this is assumed to be additional footer and header text. A single pipe
801character (`|`) should be used to separate the footer text from the header
806will yield a man page with the title `PANDOC` and section 1.
808 % PANDOC(1) Pandoc User Manuals
810will also have "Pandoc User Manuals" in the footer.
812 % PANDOC(1) Pandoc User Manuals | Version 4.0
814will also have "Version 4.0" in the header.
816Markdown in HTML blocks
817-----------------------
819While standard markdown leaves HTML blocks exactly as they are, Pandoc
820treats text between HTML tags as markdown. Thus, for example, Pandoc
826 <td>[a link](http://google.com)</td>
834 <td><em>one</em></td>
835 <td><a href="http://google.com">a link</a></td>
839whereas `Markdown.pl` will preserve it as is.
841There is one exception to this rule: text between `<script>` and
842`</script>` tags is not interpreted as markdown.
844This departure from standard markdown should make it easier to mix
845markdown with HTML block elements. For example, one can surround
846a block of markdown text with `<div>` tags without preventing it
847from being interpreted as markdown.
849Header identifiers in HTML
850--------------------------
852Each header element in pandoc's HTML output is given a unique
853identifier. This identifier is based on the text of the header. To
854derive the identifier from the header text,
856 - Remove all formatting, links, etc.
857 - Remove all punctuation, except dashes and hyphens.
858 - Replace all spaces, dashes, newlines, and hyphens with hyphens.
859 - Convert all alphabetic characters to lowercase.
860 - Remove everything up to the first letter (identifiers may
861 not begin with a number or punctuation mark).
862 - If nothing is left after this, use the identifier `section`.
867 ------------------------------------- ---------------------------
868 Header identifiers in HTML `header-identifiers-in-html`
869 *Dogs*?--in *my* house? `dogs--in-my-house`
870 [HTML], [S5], or [RTF]? `html-s5-or-rtf`
871 3. Applications `applications`
874These rules should, in most cases, allow one to determine the identifier
875from the header text. The exception is when several headers have the
876same text; in this case, the first will get an identifier as described
877above; the second will get the same identifier with `-1` appended; the
878third with `-2`; and so on.
880These identifiers are used to provide link targets in the table of
881contents generated by the `--toc|--table-of-contents` option. They
882also make it easy to provide links from one section of a document to
883another. A link to this section, for example, might look like this:
885 See the section on [header identifiers](#header-identifiers-in-html).
887Note, however, that this method of providing links to sections works
890Blank lines before headers and blockquotes
891------------------------------------------
893Standard markdown syntax does not require a blank line before a header
894or blockquote. Pandoc does require this (except, of course, at the
895beginning of the document). The reason for the requirement is that
896it is all too easy for a `>` or `#` to end up at the beginning of a
897line by accident (perhaps through line wrapping). Consider, for
900 I like several of their flavors of ice cream: #22, for example, and
906Anything between two $ characters will be treated as TeX math. The
907opening $ must have a character immediately to its right, while the
908closing $ must have a character immediately to its left. Thus,
909`$20,000 and $30,000` won't parse as math. If for some reason
910you need to enclose text in literal $ characters, backslash-escape
911them and they won't be treated as math delimiters.
913TeX math will be printed in all output formats. In Markdown,
914reStructuredText, LaTeX, and ConTeXt output, it will appear verbatim
917In reStructuredText output, it will be rendered using an interpreted
918text role `:math:`, as described
919[here](http://www.american.edu/econ/itex2mml/mathhack.rst).
921In Texinfo output, it will be rendered inside a `@math` command.
923In groff man output, it will be rendered verbatim without $'s.
925In MediaWiki output, it will be rendered inside `<math>` tags.
927In RTF, Docbook, and OpenDocument output, it will be rendered, as far as
928possible, using unicode characters, and will otherwise appear verbatim.
929Unknown commands and symbols, and commands that cannot be dealt with
930this way (like `\frac`), will be rendered verbatim. So the results may
931be a mix of raw TeX code and properly rendered unicode math.
933In HTML and S5 output, the way math is rendered will depend on the
934command-line options selected:
9361. The default is to render TeX math as far as possible using unicode
937 characters, as with RTF, Docbook, and OpenDocument output. Formulas
938 are put inside a `span` with `class="math"`, so that they may be
939 styled differently from the surrounding text if needed.
9412. If the `--asciimathml` option is used, TeX math will be displayed
942 between $ characters, as in LaTeX, and the [ASCIIMathML] script will
943 be used to render it as formulas. (This trick does not work in all
944 browsers, but it works in Firefox. In browsers that do not support
945 ASCIIMathML, TeX math will appear verbatim between $ characters.)
9473. If the `--mimetex` option is used, the [mimeTeX] CGI script will
948 be called to generate images for each TeX formula. This should
949 work in all browsers. The `--mimetex` option takes an optional URL
950 as argument. If no URL is specified, it will be assumed that the
951 mimeTeX CGI script is at `/cgi-bin/mimetex.cgi`.
9534. If the `--gladtex` option is used, TeX formulas will be enclosed
954 in `<eq>` tags in the HTML output. The resulting `htex` file may then
955 be processed by [gladTeX], which will produce image files for each
956 formula and an `html` file with links to these images. So, the
959 pandoc -s --gladtex myfile.txt -o myfile.htex
960 gladtex -d myfile-images myfile.htex # produces myfile.html
961 # and images in myfile-images
966Inline TeX commands will be preserved and passed unchanged to the
967LaTeX and ConTeXt writers. Thus, for example, you can use LaTeX to
968include BibTeX citations:
970 This result was proved in \cite{jones.1967}.
972Note that in LaTeX environments, like
974 \begin{tabular}{|l|l|}\hline
975 Age & Frequency \\ \hline
978 36--45 & 22 \\ \hline
981the material between the begin and end tags will be interpreted as raw
982LaTeX, not as markdown.
984Inline LaTeX is ignored in output formats other than Markdown, LaTeX,
990When run with the "standalone" option (`-s`), `pandoc` creates a
991standalone file, complete with an appropriate header. To see the
992default headers used for html and latex, use the following commands:
998If you want to use a different header, just create a file containing
999it and specify it on the command line as follows:
1001 pandoc --header=MyHeaderFile
1003Producing S5 with Pandoc
1004========================
1006Producing an [S5] web-based slide show with Pandoc is easy. A title
1007page is constructed automatically from the document's title block (see
1008above). Each section (with a level-one header) produces a single slide.
1009(Note that if the section is too big, the slide will not fit on the page;
1010S5 is not smart enough to produce multiple pages.)
1012Here's the markdown source for a simple slide show, `eating.txt`:
1028To produce the slide show, simply type
1030 pandoc -w s5 -s eating.txt > eating.html
1032and open up `eating.html` in a browser.
1034Note that by default, the S5 writer produces lists that display
1035"all at once." If you want your lists to display incrementally
1036(one item at a time), use the `-i` option. If you want a
1037particular list to depart from the default (that is, to display
1038incrementally without the `-i` option and all at once with the
1039`-i` option), put it in a block quote:
1044In this way incremental and nonincremental lists can be mixed in
1047Note: the S5 file produced by pandoc with the `-s/--standalone` option
1048embeds the javascript and CSS required to show the slides. Thus it
1049does not depend on any additional files: you can send the HTML file to
1050others, and they will be able to view the slide show just by opening
1051it. However, if you intend to produce several S5 slide shows, and you
1052are displaying them on your own website, it is better to keep the S5
1053javascript and CSS files separate from the slide shows themselves, so
1054that they may be cached. The best approach in this case is to use pandoc
1055without the `-s` option to produce the body of the S5 document, which
1056can then be inserted into an HTML template that links to the javascript
1057and CSS files required by S5. (See the instructions on the S5 website.)
1058Alternatively, you may use `-s` together with the `-H/--custom-header`
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