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], [groff man] pages, and [S5] HTML slide shows.
10Pandoc's version of markdown contains some enhancements, like footnotes
13In contrast to existing tools for converting markdown to HTML, which
14use regex substitutions, Pandoc has a modular design: it consists of a
15set of readers, which parse text in a given format and produce a native
16representation of the document, and a set of writers, which convert
17this native representation into a target format. Thus, adding an input
18or output format requires only adding a reader or writer.
20[markdown]: http://daringfireball.net/projects/markdown/
21[reStructuredText]: http://docutils.sourceforge.net/docs/ref/rst/introduction.html
22[S5]: http://meyerweb.com/eric/tools/s5/
23[HTML]: http://www.w3.org/TR/html40/
24[LaTeX]: http://www.latex-project.org/
25[ConTeXt]: http://www.pragma-ade.nl/
26[RTF]: http://en.wikipedia.org/wiki/Rich_Text_Format
27[DocBook XML]: http://www.docbook.org/
28[groff man]: http://developer.apple.com/DOCUMENTATION/Darwin/Reference/ManPages/man7/groff_man.7.html
29[Haskell]: http://www.haskell.org/
31© 2006-7 John MacFarlane (jgm at berkeley dot edu). Released under the
32[GPL], version 2 or greater. This software carries no warranty of
33any kind. (See COPYRIGHT for full copyright and warranty notices.)
34Recai Oktaş (roktas at debian dot org) deserves credit for the build
35system, the debian package, and the robust wrapper scripts.
37[GPL]: http://www.gnu.org/copyleft/gpl.html "GNU General Public License"
42The `pandoc` program itself does not depend on any external libraries
45The wrapper script `html2markdown` requires
47 - `pandoc` (which must be in the PATH)
48 - a POSIX-compliant shell (installed by default on all linux and unix
49 systems, including Mac OS X, and in [Cygwin] for Windows),
51 - `iconv` (for character encoding conversion). (If `iconv` is absent,
52 `html2markdown` will still work, but it will treat everything as UTF-8.)
54The wrapper script `markdown2pdf` requires
56 - `pandoc` (which must be in the PATH)
57 - a POSIX-compliant shell
58 - `pdflatex`, which should be part of any [LaTeX] distribution
59 - the following LaTeX packages (available from [CTAN], if they
60 are not already included in your LaTeX distribution):
62 + `fancyhdr` (if you have verbatim text in footnotes)
63 + `graphicx` (if you use images)
64 + `array` (if you use tables)
65 + `ulem` (if you use strikeout text)
67The wrapper script `hsmarkdown` requires only a POSIX-compliant shell.
69[Cygwin]: http://www.cygwin.com/
70[HTML Tidy]: http://tidy.sourceforge.net/
71[`iconv`]: http://www.gnu.org/software/libiconv/
72[CTAN]: http://www.ctan.org "Comprehensive TeX Archive Network"
77If you run `pandoc` without arguments, it will accept input from
78STDIN. If you run it with file names as arguments, it will take input
79from those files. By default, `pandoc` writes its output to STDOUT.
80If you want to write to a file, use the `-o` option:
82 pandoc -o hello.html hello.txt
84Note that you can specify multiple input files on the command line.
85`pandoc` will concatenate them all (with blank lines between them)
88 pandoc -s ch1.txt ch2.txt refs.txt > book.html
90(The `-s` option here tells `pandoc` to produce a standalone HTML file,
91with a proper header, rather than a fragment. For more details on this
92and many other command-line options, see below.)
94The format of the input and output can be specified explicitly using
95command-line options. The input format can be specified using the
96`-r/--read` or `-f/--from` options, the output format using the
97`-w/--write` or `-t/--to` options. Thus, to convert `hello.txt` from
98markdown to LaTeX, you could type:
100 pandoc -f markdown -t latex hello.txt
102To convert `hello.html` from html to markdown:
104 pandoc -f html -t markdown hello.html
106Supported output formats include `markdown`, `latex`, `context`
107(ConTeXt), `html`, `rtf` (rich text format), `rst` (reStructuredText),
108`docbook` (DocBook XML), `man` (groff man), and `s5` (which produces an
109HTML file that acts like powerpoint). Supported input formats include
110`markdown`, `html`, `latex`, and `rst`. Note that the `rst` reader only
111parses a subset of reStructuredText syntax. For example, it doesn't
112handle tables, option lists, or footnotes. But for simple documents it
113should be adequate. The `latex` and `html` readers are also limited in
114what they can do. Because the `html` reader is picky about the HTML it
115parses, it is recommended that you pipe HTML through [HTML Tidy] before
116sending it to `pandoc`, or use the `html2markdown` script described
119If you don't specify a reader or writer explicitly, `pandoc` will
120try to determine the input and output format from the extensions of
121the input and output filenames. Thus, for example,
123 pandoc -o hello.tex hello.txt
125will convert `hello.txt` from markdown to LaTeX. If no output file
126is specified (so that output goes to STDOUT), or if the output file's
127extension is unknown, the output format will default to HTML.
128If no input file is specified (so that input comes from STDIN), or
129if the input files' extensions are unknown, the input format will
130be assumed to be markdown unless explicitly specified.
135All input is assumed to be in the UTF-8 encoding, and all output
136is in UTF-8. If your local character encoding is not UTF-8 and you use
137accented or foreign characters, you should pipe the input and output
138through [`iconv`]. For example,
140 iconv -t utf-8 source.txt | pandoc | iconv -f utf-8 > output.html
142will convert `source.txt` from the local encoding to UTF-8, then
143convert it to HTML, then convert back to the local encoding,
144putting the output in `output.html`.
146The shell scripts (described below) automatically convert the input
147from the local encoding to UTF-8 before running them through `pandoc`,
148then convert the output back to the local encoding.
153Three shell scripts, `markdown2pdf`, `html2markdown`, and `hsmarkdown`,
154are included in the standard Pandoc installation. (They are not included
155in the Windows binary package, as they require a POSIX shell, but they
156may be used in Windows under Cygwin.)
1581. `markdown2pdf` produces a PDF file from markdown-formatted
159 text, using `pandoc` and `pdflatex`. The default
160 behavior of `markdown2pdf` is to create a file with the same
161 base name as the first argument and the extension `pdf`; thus,
164 markdown2pdf sample.txt endnotes.txt
166 will produce `sample.pdf`. (If `sample.pdf` exists already,
167 it will be backed up before being overwritten.) An output file
168 name can be specified explicitly using the `-o` option:
170 markdown2pdf -o book.pdf chap1 chap2
172 If no input file is specified, input will be taken from STDIN.
173 All of `pandoc`'s options will work with `markdown2pdf` as well.
1752. `html2markdown` grabs a web page from a file or URL and converts
176 it to markdown-formatted text, using `tidy` and `pandoc`.
178 All of `pandoc`'s options will work with `html2markdown` as well.
179 In addition, the following special options may be used.
180 The special options must be separated from the `html2markdown`
181 command and any regular Pandoc options by the delimiter `--`:
183 html2markdown -o out.txt -- -e latin1 -g curl google.com
185 The `-e` or `--encoding` option specifies the character encoding
186 of the HTML input. If this option is not specified, and input
187 is not from STDIN, `html2markdown` will attempt to determine the
188 page's character encoding from the "Content-type" meta tag.
189 If this is not present, UTF-8 is assumed.
191 The `-g` or `--grabber` option specifies the command to be used to
192 fetch the contents of a URL:
194 html2markdown -g 'curl --user foo:bar' www.mysite.com
196 If this option is not specified, `html2markdown` searches for an
197 available program (`wget`, `curl`, or a text-mode browser) to fetch
198 the contents of a URL.
2003. `hsmarkdown` is designed to be used as a drop-in replacement for
201 `Markdown.pl`. It forces `pandoc` to convert from markdown to
202 HTML, and to use the `--strict` flag for maximal compliance with
203 official markdown syntax. (All of Pandoc's syntax extensions and
204 variants, described below, are disabled.) No other command-line
205 options are allowed. (In fact, options will be interpreted as
208 As an alternative to using the `hsmarkdown` shell script, the
209 user may create a symbolic link to `pandoc` called `hsmarkdown`.
210 When invoked under the name `hsmarkdown`, `pandoc` will behave
211 as if the `--strict` flag had been selected, and no command-line
212 options will be recognized. However, this approach does not work
213 under Cygwin, due to problems with its simulation of symbolic
219Various command-line options can be used to customize the output.
220For further documentation, see the `pandoc(1)` man page.
222`-f`, `--from`, `-r`, or `--read` *format*
223: specifies the input format (the format Pandoc will be converting
224 *from*). *format* can be `native`, `markdown`, `rst`, `html`, or
227`-t`, `--to`, `-w`, or `--write` *format*
228: specifies the output format -- the format Pandoc will
229 be converting *to*. *format* can be `native`, `html`, `s5`,
230 `docbook`, `latex`, `context`, `markdown`, `man`, `rst`, and `rtf`.
232`-s` or `--standalone`
233: indicates that a standalone document is to be produced (with
234 appropriate headers and footers), rather than a fragment.
236`-o` or `--output` *filename*
237: sends output to *filename*. If this option is not specified,
238 or if its argument is `-`, output will be sent to STDOUT.
240`-p` or `--preserve-tabs`
241: causes tabs in the source text to be preserved, rather than converted
242 to spaces (the default).
245: sets the number of spaces per tab to *tabstop* (defaults to 4).
248: specifies that strict markdown syntax is to be used, without
249 pandoc's usual extensions and variants (described below). When the
250 input format is HTML, this means that constructs that have no
251 equivalents in standard markdown (e.g. definition lists or strikeout
252 text) will be parsed as raw HTML.
255: causes reference-style links to be used in markdown
256 and reStructuredText output. By default inline links are used.
259: causes the HTML and LaTeX readers to parse HTML codes and LaTeX
260 environments that it can't translate as raw HTML or LaTeX. Raw HTML can
261 be printed in markdown, reStructuredText, HTML, and S5 output; raw LaTeX
262 can be printed in markdown, reStructuredText, LaTeX, and ConTeXt output.
263 The default is for the readers to omit untranslatable HTML codes and
264 LaTeX environments. (The LaTeX reader does pass through untranslatable
265 LaTeX *commands*, even if `-R` is not specified.)
267`-C` or `--custom-header` *filename*
268: can be used to specify a custom document header. To see the headers
269 used by default, use the `-D` option: for example, `pandoc -D html`
270 prints the default HTML header.
272`--toc` or `--table-of-contents`
273: includes an automatically generated table of contents (or, in the
274 case of `latex`, `context`, and `rst`, an instruction to create
275 one) in the output document. This option has no effect with `man`,
276 `docbook`, or `s5` output formats.
278`-c` or `--css` *filename*
279: allows the user to specify a custom stylesheet that will be linked to
280 in HTML and S5 output. This option can be used repeatedly to include
281 multiple stylesheets. They will be included in the order specified.
283`-H` or `--include-in-header` *filename*
284: includes the contents of *filename* (verbatim) at the end of the
285 document header. This can be used, for example, to include special
286 CSS or javascript in HTML documents. This option can be used
287 repeatedly to include multiple files in the header. They will be
288 included in the order specified.
290`-B` or `--include-before-body` *filename*
291: includes the contents of *filename* (verbatim) at the beginning of
292 the document body (e.g. after the `<body>` tag in HTML, or the
293 `\begin{document}` command in LaTeX). This can be used to include
294 navigation bars or banners in HTML documents. This option can be
295 used repeatedly to include multiple files. They will be included in
298`-A` or `--include-after-body` *filename*
299: includes the contents of *filename* (verbatim) at the end of
300 the document body (before the `</body>` tag in HTML, or the
301 `\end{document}` command in LaTeX). This option can be be used
302 repeatedly to include multiple files. They will be included in the
305`-T` or `--title-prefix` *string*
306: includes *string* as a prefix at the beginning of the title that
307 appears in the HTML header (but not in the title as it appears at
308 the beginning of the HTML body). (See below on
309 [Title Blocks](#title-blocks).)
312: causes `pandoc` to produce typographically correct output, along the
313 lines of John Gruber's [Smartypants]. Straight quotes are converted
314 to curly quotes, `---` to dashes, and `...` to ellipses. (Note: This
315 option is only significant when the input format is `markdown`.
316 It is selected automatically when the output format is `latex` or
319`-m`*[url]* or `--asciimathml`*[=url]*
320: causes `pandoc` to use Peter Jipsen's [ASCIIMathML] script to display
321 TeX math in HTML or S5. If a local copy of `ASCIIMathML.js` is
322 available on the webserver where the page will be viewed, provide a
323 *url* and a link will be inserted in the generated HTML or S5. If
324 no *url* is provided, the contents of the script will be inserted
325 directly; this provides portability at the price of efficiency. If
326 you plan to use math on several pages, it is much better to link to
327 a copy of `ASCIIMathML.js`, which can be cached. (See `--gladtex`
328 and `--mimetex` for alternative ways of dealing with math in HTML.)
331: causes TeX formulas to be enclosed in `<eq>` tags in HTML or S5 output.
332 This output can then be processed by [gladTeX] to produce links to
333 images with the typeset formulas. (See `--asciimathml` and
334 `--mimetex` for alternative ways of dealing with math in HTML.)
337: causes TeX formulas to be replaced by `<img>` tags linking to the
338 [mimeTeX] CGI script, which will produce images with the typeset
339 formulas. (See `--asciimathml` and `--mimetex` for alternative
340 ways of dealing with math in HTML.)
342`-i` or `--incremental`
343: causes all lists in S5 output to be displayed incrementally by
344 default (one item at a time). The normal default is for lists to be
345 displayed all at once.
347`-N` or `--number-sections`
348: causes sections to be numbered in LaTeX or ConTeXt output. By default,
349 sections are not numbered.
352: disables text-wrapping in output. By default, text is wrapped
353 appropriately for the output format.
356: sanitizes HTML (in markdown or HTML input) using a whitelist.
357 Unsafe tags are replaced by HTML comments; unsafe attributes
361: is intended to make it easier to create wrapper scripts that use
362 Pandoc. It causes Pandoc to dump information about the arguments
363 with which it was called to STDOUT, then exit. The first line
364 printed is the name of the output file specified using the `-o`
365 or `--output` option, or `-` if output would go to STDOUT. The
366 remaining lines, if any, list command-line arguments. These will
367 include the names of input files and any special options passed
368 after ` -- ` on the command line. So, for example,
370: pandoc --dump-args -o foo.html -s foo.txt \
371 appendix.txt -- -e latin1
373: will cause the following to be printed to STDOUT:
375: foo.html foo.txt appendix.txt -e latin1
378: causes Pandoc to ignore all command-line arguments.
379 Regular Pandoc options are not ignored. Thus, for example,
381: pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1
385: pandoc -o foo.html -s
388: prints the version number to STDERR.
391: prints a usage message to STDERR.
393[Smartypants]: http://daringfireball.net/projects/smartypants/
394[ASCIIMathML]: http://www1.chapman.edu/~jipsen/mathml/asciimath.html
395[gladTeX]: http://www.math.uio.no/~martingu/gladtex/index.html
396[mimeTeX]: http://www.forkosh.com/mimetex.html
398Pandoc's markdown vs. standard markdown
399=======================================
401In parsing markdown, Pandoc departs from and extends [standard markdown]
402in a few respects. (To run Pandoc on the official markdown test suite,
403type `make test-markdown`.) Except where noted, these differences can
404be suppressed by specifying the `--strict` command-line option or by
405using the `hsmarkdown` wrapper.
407[standard markdown]: http://daringfireball.net/projects/markdown/syntax
408 "Markdown syntax description"
413Except inside a code block or inline code, any punctuation or space
414character preceded by a backslash will be treated literally, even if it
415would normally indicate formatting. Thus, for example, if one writes
425 <strong>hello</strong>
427This rule is easier to remember than standard markdown's rule,
428which allows only the following characters to be backslash-escaped:
432Subscripts and superscripts
433---------------------------
435Superscripts may be written by surrounding the superscripted text by `^`
436characters; subscripts may be written by surrounding the subscripted
437text by `~` characters. Thus, for example,
439 H~2~O is a liquid. 2^10^ is 1024.
441If the superscripted or subscripted text contains spaces, these spaces
442must be escaped with backslashes. (This is to prevent accidental
443superscripting and subscripting through the ordinary use of `~` and `^`.)
444Thus, if you want the letter P with 'a cat' in subscripts, use
445`P~a\ cat~`, not `P~a cat~`.
450To strikeout a section of text with a horizontal line, begin and end it
451with `~~`. Thus, for example,
453 This ~~is deleted text.~~
458Pandoc behaves differently from standard markdown on some "edge
459cases" involving lists. Consider this source:
469Pandoc transforms this into a "compact list" (with no `<p>` tags around
470"First", "Second", or "Third"), while markdown puts `<p>` tags around
471"Second" and "Third" (but not "First"), because of the blank space
472around "Third". Pandoc follows a simple rule: if the text is followed by
473a blank line, it is treated as a paragraph. Since "Second" is followed
474by a list, and not a blank line, it isn't treated as a paragraph. The
475fact that the list is followed by a blank line is irrelevant. (Note:
476Pandoc works this way even when the `--strict` option is specified. This
477behavior is consistent with the official markdown syntax description,
478even though it is different from that of `Markdown.pl`.)
480Unlike standard markdown, Pandoc allows ordered list items to be marked
481with uppercase and lowercase letters and roman numerals, in addition to
482arabic numerals. (This behavior can be turned off using the `--strict`
483option.) List markers may be enclosed in parentheses or followed by a
484single right-parentheses or period. They must be separated from the
485text that follows by at least one space, and, if the list marker is a
486capital letter with a period, by at least two spaces.[^2]
488[^2]: The point of this rule is to ensure that normal paragraphs
489 starting with people's initials, like
491 B. Russell was an English philosopher.
493 do not get treated as list items.
495 This rule will not prevent
499 from being interpreted as a list item. In this case, a backslash
504Pandoc also pays attention to the type of list marker used, and to the
505starting number, and both of these are preserved where possible in the
506output format. Thus, the following yields a list with numbers followed
507by a single parenthesis, starting with 9, and a sublist with lowercase
517Note that Pandoc pays attention only to the *starting* number in a list.
518So, the following yields a list numbered sequentially starting from 2:
524If default list markers are desired, use '`#.`':
530If you change list style in mid-list, Pandoc will notice and assume you
531are starting a sublist. So,
539gets treated as if it were
551Pandoc supports definition lists, using a syntax inspired by
552[PHP Markdown Extra] and [reStructuredText]:
554 [PHP Markdown Extra]: http://www.michelf.com/projects/php-markdown/extra/
562 : Second paragraph of definition 2.
564Each term must fit on one line. The definition must begin on the line
565after the term. The definition consists of one or more block elements
566(paragraph, code block, list, etc.), each beginning with a colon and
567(aside from the colon) indented one tab stop.
569 Term *with inline markup*
570 : Here is the definition. It may contain multiple blocks.
575 : Here is the third paragraph of this definition.
577If you leave space after the definition (as in the first example above),
578the definitions will be considered paragraphs. In some output formats,
579this will mean greater spacing between term/definition pairs. For a
580compact definition list, do not leave space between the definition and
591Pandoc allows implicit reference links with just a single set of
592brackets. So, the following links are equivalent:
595 2. Here's my [link][]
599(Note: Pandoc works this way even if `--strict` is specified, because
600`Markdown.pl` 1.0.2b7 allows single-bracket links.)
605Pandoc's markdown allows footnotes, using the following syntax:
607 Here is a footnote reference,[^1] and another.[^longnote]
609 [^1]: Here is the footnote.
611 [^longnote]: Here's one with multiple blocks.
613 Subsequent paragraphs are indented to show that they
614 belong to the previous footnote.
618 The whole paragraph can be indented, or just the first
619 line. In this way, multi-paragraph footnotes work like
620 multi-paragraph list items.
622 This paragraph won't be part of the note, because it isn't indented.
624The identifiers in footnote references may not contain spaces, tabs,
625or newlines. These identifiers are used only to correlate the
626footnote reference with the note itself; in the output, footnotes
627will be numbered sequentially.
629The footnotes themselves need not be placed at the end of the
630document. They may appear anywhere except inside other block elements
631(lists, block quotes, tables, etc.).
633Inline footnotes are also allowed (though, unlike regular notes,
634they cannot contain multiple paragraphs). The syntax is as follows:
636 Here is an inline note.^[Inlines notes are easier to write, since
637 you don't have to pick an identifier and move down to type the
640Inline and regular footnotes may be mixed freely.
645Two kinds of tables may be used. Both kinds presuppose the use of
646a fixed-width font, such as Courier.
648Simple tables look like this:
650 Right Left Center Default
651 ------- ------ ---------- -------
656 Table: Demonstration of simple table syntax.
658The headers and table rows must each fit on one line. Column
659alignments are determined by the position of the header text relative
660to the dashed line below it:[^1]
662 - If the dashed line is flush with the header text on the right side
663 but extends beyond it on the left, the column is right-aligned.
664 - If the dashed line is flush with the header text on the left side
665 but extends beyond it on the right, the column is left-aligned.
666 - If the dashed line extends beyond the header text on both sides,
667 the column is centered.
668 - If the dashed line is flush with the header text on both sides,
669 the default alignment is used (in most cases, this will be left).
671[^1]: This scheme is due to Michel Fortin, who proposed it on the
672 Markdown discussion list:
673 <http://six.pairlist.net/pipermail/markdown-discuss/2005-March/001097.html>.
675The table must end with a blank line. Optionally, a caption may be
676provided (as illustrated in the example above). A caption is a paragraph
677beginning with the string `Table:`, which will be stripped off.
679The table parser pays attention to the widths of the columns, and
680the writers try to reproduce these relative widths in the output.
681So, if you find that one of the columns is too narrow in the output,
682try widening it in the markdown source.
684Multiline tables allow headers and table rows to span multiple lines
685of text. Here is an example:
687 -------------------------------------------------------------
688 Centered Default Right Left
689 Header Aligned Aligned Aligned
690 ----------- ------- --------------- -------------------------
691 First row 12.0 Example of a row that
692 spans multiple lines.
694 Second row 5.0 Here's another one. Note
695 the blank line between
697 -------------------------------------------------------------
699 Table: Here's the caption. It, too, may span
702These work like simple tables, but with the following differences:
704 - They must begin with a row of dashes, before the header text.
705 - They must end with a row of dashes, then a blank line.
706 - The rows must be separated by blank lines.
711If the file begins with a title block
714 % author(s) (separated by commas)
717it will be parsed as bibliographic information, not regular text. (It
718will be used, for example, in the title of standalone LaTeX or HTML
719output.) The block may contain just a title, a title and an author,
720or all three lines. Each must begin with a % and fit on one line.
721The title may contain standard inline formatting. If you want to
722include an author but no title, or a title and a date but no author,
723you need a blank line:
729Titles will be written only when the `--standalone` (`-s`) option is
730chosen. In HTML output, titles will appear twice: once in the
731document head -- this is the title that will appear at the top of the
732window in a browser -- and once at the beginning of the document body.
733The title in the document head can have an optional prefix attached
734(`--title-prefix` or `-T` option). The title in the body appears as
735an H1 element with class "title", so it can be suppressed or
736reformatted with CSS. If a title prefix is specified with `-T` and no
737title block appears in the document, the title prefix will be used by
738itself as the HTML title.
740The man page writer extracts a title, man page section number, and
741other header and footer information from the title line. The title
742is assumed to be the first word on the title line, which may optionally
743end with a (single-digit) section number in parentheses. (There should
744be no space between the title and the parentheses.) Anything after
745this is assumed to be additional footer and header text. A single pipe
746character (`|`) should be used to separate the footer text from the header
751will yield a man page with the title `PANDOC` and section 1.
753 % PANDOC(1) Pandoc User Manuals
755will also have "Pandoc User Manuals" in the footer.
757 % PANDOC(1) Pandoc User Manuals | Version 4.0
759will also have "Version 4.0" in the header.
761Markdown in HTML blocks
762-----------------------
764While standard markdown leaves HTML blocks exactly as they are, Pandoc
765treats text between HTML tags as markdown. Thus, for example, Pandoc
771 <td>[a link](http://google.com)</td>
779 <td><em>one</em></td>
780 <td><a href="http://google.com">a link</a></td>
784whereas `Markdown.pl` will preserve it as is.
786There is one exception to this rule: text between `<script>` and
787`</script>` tags is not interpreted as markdown.
789This departure from standard markdown should make it easier to mix
790markdown with HTML block elements. For example, one can surround
791a block of markdown text with `<div>` tags without preventing it
792from being interpreted as markdown.
794Header identifiers in HTML
795--------------------------
797Each header element in pandoc's HTML output is given a unique
798identifier. This identifier is based on the text of the header. To
799derive the identifier from the header text,
801 - Remove all formatting, links, etc.
802 - Remove all punctuation, except dashes and hyphens.
803 - Replace all spaces, dashes, newlines, and hyphens with hyphens.
804 - Convert all alphabetic characters to lowercase.
805 - Remove everything up to the first letter (identifiers may
806 not begin with a number or punctuation mark).
807 - If nothing is left after this, use the identifier `section`.
812 ------------------------------------- ---------------------------
813 Header identifiers in HTML `header-identifiers-in-html`
814 *Dogs*?--in *my* house? `dogs--in-my-house`
815 [HTML], [S5], or [RTF]? `html-s5-or-rtf`
816 3. Applications `applications`
819These rules should, in most cases, allow one to determine the identifier
820from the header text. The exception is when several headers have the
821same text; in this case, the first will get an identifier as described
822above; the second will get the same identifier with `-1` appended; the
823third with `-2`; and so on.
825These identifiers are used to provide link targets in the table of
826contents generated by the `--toc|--table-of-contents` option. They
827also make it easy to provide links from one section of a document to
828another. A link to this section, for example, might look like this:
830 See the section on [header identifiers](#header-identifiers-in-html).
832Note, however, that this method of providing links to sections works
835Blank lines before headers and blockquotes
836------------------------------------------
838Standard markdown syntax does not require a blank line before a header
839or blockquote. Pandoc does require this (except, of course, at the
840beginning of the document). The reason for the requirement is that
841it is all too easy for a `>` or `#` to end up at the beginning of a
842line by accident (perhaps through line wrapping). Consider, for
845 I like several of their flavors of ice cream: #22, for example, and
851Anything between two $ characters will be treated as TeX math. The
852opening $ must have a character immediately to its right, while the
853closing $ must have a character immediately to its left. Thus,
854`$20,000 and $30,000` won't parse as math. If for some reason
855you need to enclose text in literal $ characters, backslash-escape
856them and they won't be treated as math delimiters.
858TeX math will be printed in all output formats. In Markdown,
859reStructuredText, LaTeX, and ConTeXt output, it will appear verbatim
862In reStructuredText output, it will be rendered using an interpreted
863text role `:math:`, as described
864[here](http://www.american.edu/econ/itex2mml/mathhack.rst).
866In groff man output, it will be rendered verbatim without $'s.
868In RTF and Docbook output, it will be rendered, as far as possible,
869using unicode characters, and will otherwise appear verbatim. Unknown
870commands and symbols, and commands that cannot be dealt with this way
871(like `\frac`), will be rendered verbatim. So the results may be a mix
872of raw TeX code and properly rendered unicode math.
874In HTML and S5 output, the way math is rendered will depend on the
875command-line options selected:
8771. The default is to render TeX math as far as possible using unicode
878 characters, as with RTF and Docbook output. Formulas are put inside
879 a `span` with `class="math"`, so that they may be styled differently
880 from the surrounding text if needed.
8822. If the `--asciimathml` option is used, TeX math will be displayed
883 between $ characters, as in LaTeX, and the [ASCIIMathML] script will
884 be used to render it as formulas. (This trick does not work in all
885 browsers, but it works in Firefox. In browsers that do not support
886 ASCIIMathML, TeX math will appear verbatim between $ characters.)
8883. If the `--mimetex` option is used, the [mimeTeX] CGI script will
889 be called to generate images for each TeX formula. This should
890 work in all browsers. The `--mimetex` option takes an optional URL
891 as argument. If no URL is specified, it will be assumed that the
892 mimeTeX CGI script is at `/cgi-bin/mimetex.cgi`.
8944. If the `--gladtex` option is used, TeX formulas will be enclosed
895 in `<eq>` tags in the HTML output. The resulting `htex` file may then
896 be processed by [gladTeX], which will produce image files for each
897 formula and an `html` file with links to these images. So, the
900 pandoc -s --gladtex myfile.txt -o myfile.htex
901 gladtex -d myfile-images myfile.htex # produces myfile.html
902 # and images in myfile-images
907Inline TeX commands will be preserved and passed unchanged to the
908LaTeX and ConTeXt writers. Thus, for example, you can use LaTeX to
909include BibTeX citations:
911 This result was proved in \cite{jones.1967}.
913Note that in LaTeX environments, like
915 \begin{tabular}{|l|l|}\hline
916 Age & Frequency \\ \hline
919 36--45 & 22 \\ \hline
922the material between the begin and end tags will be interpreted as raw
923LaTeX, not as markdown.
925Inline LaTeX is ignored in output formats other than Markdown, LaTeX,
931When run with the "standalone" option (`-s`), `pandoc` creates a
932standalone file, complete with an appropriate header. To see the
933default headers used for html and latex, use the following commands:
939If you want to use a different header, just create a file containing
940it and specify it on the command line as follows:
942 pandoc --header=MyHeaderFile
944Producing S5 with Pandoc
945========================
947Producing an [S5] web-based slide show with Pandoc is easy. A title
948page is constructed automatically from the document's title block (see
949above). Each section (with a level-one header) produces a single slide.
950(Note that if the section is too big, the slide will not fit on the page;
951S5 is not smart enough to produce multiple pages.)
953Here's the markdown source for a simple slide show, `eating.txt`:
969To produce the slide show, simply type
971 pandoc -w s5 -s eating.txt > eating.html
973and open up `eating.html` in a browser. The HTML file embeds
974all the required javascript and CSS, so no other files are necessary.
976Note that by default, the S5 writer produces lists that display
977"all at once." If you want your lists to display incrementally
978(one item at a time), use the `-i` option. If you want a
979particular list to depart from the default (that is, to display
980incrementally without the `-i` option and all at once with the
981`-i` option), put it in a block quote:
986In this way incremental and nonincremental lists can be mixed in
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