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], [GNU Texinfo], [MediaWiki markup],
10[groff man] pages, and [S5] HTML slide shows. Pandoc's version of
11markdown contains some enhancements, like footnotes and embedded LaTeX.
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[OpenDocument XML]: http://opendocument.xml.org/
29[MediaWiki markup]: http://www.mediawiki.org/wiki/Help:Formatting
30[groff man]: http://developer.apple.com/DOCUMENTATION/Darwin/Reference/ManPages/man7/groff_man.7.html
31[Haskell]: http://www.haskell.org/
32[GNU Texinfo]: http://www.gnu.org/software/texinfo/
34© 2006-8 John MacFarlane (jgm at berkeley dot edu). Released under the
35[GPL], version 2 or greater. This software carries no warranty of
36any kind. (See COPYRIGHT for full copyright and warranty notices.)
37Contributors: Recai Oktaş (build system, debian package, wrapper
38scripts), Peter Wang (Texinfo writer), Andrea Rossato (OpenDocument writer).
40[GPL]: http://www.gnu.org/copyleft/gpl.html "GNU General Public License"
45If you run `pandoc` without arguments, it will accept input from
46STDIN. If you run it with file names as arguments, it will take input
47from those files. By default, `pandoc` writes its output to STDOUT.
48If you want to write to a file, use the `-o` option:
50 pandoc -o hello.html hello.txt
52Note that you can specify multiple input files on the command line.
53`pandoc` will concatenate them all (with blank lines between them)
56 pandoc -s ch1.txt ch2.txt refs.txt > book.html
58(The `-s` option here tells `pandoc` to produce a standalone HTML file,
59with a proper header, rather than a fragment. For more details on this
60and many other command-line options, see below.)
62The format of the input and output can be specified explicitly using
63command-line options. The input format can be specified using the
64`-r/--read` or `-f/--from` options, the output format using the
65`-w/--write` or `-t/--to` options. Thus, to convert `hello.txt` from
66markdown to LaTeX, you could type:
68 pandoc -f markdown -t latex hello.txt
70To convert `hello.html` from html to markdown:
72 pandoc -f html -t markdown hello.html
74Supported output formats include `markdown`, `latex`, `context`
75(ConTeXt), `html`, `rtf` (rich text format), `rst` (reStructuredText),
76`docbook` (DocBook XML), `opendocument` (OpenDocument XML), `texinfo`,
77`mediawiki` (MediaWiki markup), `man` (groff man), and `s5` (which
78produces an HTML file that acts like powerpoint). Supported input
79formats include `markdown`, `html`, `latex`, and `rst`. Note that the
80`rst` reader only parses a subset of reStructuredText syntax. For
81example, it doesn't handle tables, option lists, or footnotes. But for
82simple documents it should be adequate. The `latex` and `html` readers
83are also limited in what they can do. Because the `html` reader is picky
84about the HTML it parses, it is recommended that you pipe HTML through
85[HTML Tidy] before sending it to `pandoc`, or use the `html2markdown`
86script described below.
88If you don't specify a reader or writer explicitly, `pandoc` will
89try to determine the input and output format from the extensions of
90the input and output filenames. Thus, for example,
92 pandoc -o hello.tex hello.txt
94will convert `hello.txt` from markdown to LaTeX. If no output file
95is specified (so that output goes to STDOUT), or if the output file's
96extension is unknown, the output format will default to HTML.
97If no input file is specified (so that input comes from STDIN), or
98if the input files' extensions are unknown, the input format will
99be assumed to be markdown unless explicitly specified.
104All input is assumed to be in the UTF-8 encoding, and all output
105is in UTF-8. If your local character encoding is not UTF-8 and you use
106accented or foreign characters, you should pipe the input and output
107through [`iconv`]. For example,
109 iconv -t utf-8 source.txt | pandoc | iconv -f utf-8 > output.html
111will convert `source.txt` from the local encoding to UTF-8, then
112convert it to HTML, then convert back to the local encoding,
113putting the output in `output.html`.
115The shell scripts (described below) automatically convert the input
116from the local encoding to UTF-8 before running them through `pandoc`,
117then convert the output back to the local encoding.
122Three shell scripts, `markdown2pdf`, `html2markdown`, and
123`hsmarkdown`, are included in the standard Pandoc installation. (They
124are not included in the Windows binary package, as they require a POSIX
125shell, but they may be used in Windows under Cygwin.)
1271. `markdown2pdf` produces a PDF file from markdown-formatted
128 text, using `pandoc` and `pdflatex`. The default
129 behavior of `markdown2pdf` is to create a file with the same
130 base name as the first argument and the extension `pdf`; thus,
133 markdown2pdf sample.txt endnotes.txt
135 will produce `sample.pdf`. (If `sample.pdf` exists already,
136 it will be backed up before being overwritten.) An output file
137 name can be specified explicitly using the `-o` option:
139 markdown2pdf -o book.pdf chap1 chap2
141 If no input file is specified, input will be taken from STDIN.
142 All of `pandoc`'s options will work with `markdown2pdf` as well.
144 `markdown2pdf` assumes that `pdflatex` is in the path. It also
145 assumes that the following LaTeX packages are available:
146 `unicode`, `fancyhdr` (if you have verbatim text in footnotes),
147 `graphicx` (if you use images), `array` (if you use tables),
148 and `ulem` (if you use strikeout text). If they are not already
149 included in your LaTeX distribution, you can get them from
1522. `html2markdown` grabs a web page from a file or URL and converts
153 it to markdown-formatted text, using `tidy` and `pandoc`.
155 All of `pandoc`'s options will work with `html2markdown` as well.
156 In addition, the following special options may be used.
157 The special options must be separated from the `html2markdown`
158 command and any regular Pandoc options by the delimiter `--`:
160 html2markdown -o out.txt -- -e latin1 -g curl google.com
162 The `-e` or `--encoding` option specifies the character encoding
163 of the HTML input. If this option is not specified, and input
164 is not from STDIN, `html2markdown` will attempt to determine the
165 page's character encoding from the "Content-type" meta tag.
166 If this is not present, UTF-8 is assumed.
168 The `-g` or `--grabber` option specifies the command to be used to
169 fetch the contents of a URL:
171 html2markdown -g 'curl --user foo:bar' www.mysite.com
173 If this option is not specified, `html2markdown` searches for an
174 available program (`wget`, `curl`, or a text-mode browser) to fetch
175 the contents of a URL.
177 `html2markdown` requires [HTML Tidy], which must be in the path.
178 It uses [`iconv`] for character encoding conversions; if `iconv`
179 is absent, it will still work, but it will treat everything as UTF-8.
1813. `hsmarkdown` is designed to be used as a drop-in replacement for
182 `Markdown.pl`. It forces `pandoc` to convert from markdown to
183 HTML, and to use the `--strict` flag for maximal compliance with
184 official markdown syntax. (All of Pandoc's syntax extensions and
185 variants, described below, are disabled.) No other command-line
186 options are allowed. (In fact, options will be interpreted as
189 As an alternative to using the `hsmarkdown` shell script, the
190 user may create a symbolic link to `pandoc` called `hsmarkdown`.
191 When invoked under the name `hsmarkdown`, `pandoc` will behave
192 as if the `--strict` flag had been selected, and no command-line
193 options will be recognized. However, this approach does not work
194 under Cygwin, due to problems with its simulation of symbolic
197[Cygwin]: http://www.cygwin.com/
198[HTML Tidy]: http://tidy.sourceforge.net/
199[`iconv`]: http://www.gnu.org/software/libiconv/
200[CTAN]: http://www.ctan.org "Comprehensive TeX Archive Network"
205Various command-line options can be used to customize the output.
206For further documentation, see the `pandoc(1)` man page.
208`-f`, `--from`, `-r`, or `--read` *format*
209: specifies the input format (the format Pandoc will be converting
210 *from*). *format* can be `native`, `markdown`, `rst`, `html`, or
213`-t`, `--to`, `-w`, or `--write` *format*
214: specifies the output format -- the format Pandoc will
215 be converting *to*. *format* can be `native`, `html`, `s5`,
216 `docbook`, `opendocument`, `latex`, `context`, `markdown`, `man`,
219`-s` or `--standalone`
220: indicates that a standalone document is to be produced (with
221 appropriate headers and footers), rather than a fragment.
223`-o` or `--output` *filename*
224: sends output to *filename*. If this option is not specified,
225 or if its argument is `-`, output will be sent to STDOUT.
227`-p` or `--preserve-tabs`
228: causes tabs in the source text to be preserved, rather than converted
229 to spaces (the default).
232: sets the number of spaces per tab to *tabstop* (defaults to 4).
235: specifies that strict markdown syntax is to be used, without
236 pandoc's usual extensions and variants (described below). When the
237 input format is HTML, this means that constructs that have no
238 equivalents in standard markdown (e.g. definition lists or strikeout
239 text) will be parsed as raw HTML.
242: causes reference-style links to be used in markdown
243 and reStructuredText output. By default inline links are used.
246: causes the HTML and LaTeX readers to parse HTML codes and LaTeX
247 environments that it can't translate as raw HTML or LaTeX. Raw HTML can
248 be printed in markdown, reStructuredText, HTML, and S5 output; raw LaTeX
249 can be printed in markdown, reStructuredText, LaTeX, and ConTeXt output.
250 The default is for the readers to omit untranslatable HTML codes and
251 LaTeX environments. (The LaTeX reader does pass through untranslatable
252 LaTeX *commands*, even if `-R` is not specified.)
254`-C` or `--custom-header` *filename*
255: can be used to specify a custom document header. To see the headers
256 used by default, use the `-D` option: for example, `pandoc -D html`
257 prints the default HTML header.
259`--toc` or `--table-of-contents`
260: includes an automatically generated table of contents (or, in the
261 case of `latex`, `context`, and `rst`, an instruction to create
262 one) in the output document. This option has no effect with `man`,
263 `docbook`, or `s5` output formats.
265`-c` or `--css` *filename*
266: allows the user to specify a custom stylesheet that will be linked to
267 in HTML and S5 output. This option can be used repeatedly to include
268 multiple stylesheets. They will be included in the order specified.
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.
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
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
292`-T` or `--title-prefix` *string*
293: includes *string* as a prefix at the beginning of the title that
294 appears in the HTML header (but not in the title as it appears at
295 the beginning of the HTML body). (See below on
296 [Title Blocks](#title-blocks).)
299: causes `pandoc` to produce typographically correct output, along the
300 lines of John Gruber's [Smartypants]. Straight quotes are converted
301 to curly quotes, `---` to dashes, and `...` to ellipses. Nonbreaking
302 spaces are inserted after certain abbreviations, such as "Mr."
303 (Note: This option is only significant when the input format is
304 `markdown`. It is selected automatically when the output format is
305 `latex` or `context`.)
307`-m`*[url]* or `--asciimathml`*[=url]*
308: causes `pandoc` to use Peter Jipsen's [ASCIIMathML] script to display
309 TeX math in HTML or S5. If a local copy of `ASCIIMathML.js` is
310 available on the webserver where the page will be viewed, provide a
311 *url* and a link will be inserted in the generated HTML or S5. If
312 no *url* is provided, the contents of the script will be inserted
313 directly; this provides portability at the price of efficiency. If
314 you plan to use math on several pages, it is much better to link to
315 a copy of `ASCIIMathML.js`, which can be cached. (See `--gladtex`
316 and `--mimetex` for alternative ways of dealing with math in HTML.)
319: causes TeX formulas to be enclosed in `<eq>` tags in HTML or S5 output.
320 This output can then be processed by [gladTeX] to produce links to
321 images with the typeset formulas. (See `--asciimathml` and
322 `--mimetex` for alternative ways of dealing with math in HTML.)
325: causes TeX formulas to be replaced by `<img>` tags linking to the
326 [mimeTeX] CGI script, which will produce images with the typeset
327 formulas. (See `--asciimathml` and `--mimetex` for alternative
328 ways of dealing with math in HTML.)
330`-i` or `--incremental`
331: causes all lists in S5 output to be displayed incrementally by
332 default (one item at a time). The normal default is for lists to be
333 displayed all at once.
335`-N` or `--number-sections`
336: causes sections to be numbered in LaTeX or ConTeXt output. By default,
337 sections are not numbered.
340: disables text-wrapping in output. By default, text is wrapped
341 appropriately for the output format.
344: sanitizes HTML (in markdown or HTML input) using a whitelist.
345 Unsafe tags are replaced by HTML comments; unsafe attributes
346 are omitted. URIs in links and images are also checked against a
347 whitelist of URI schemes.
350: is intended to make it easier to create wrapper scripts that use
351 Pandoc. It causes Pandoc to dump information about the arguments
352 with which it was called to STDOUT, then exit. The first line
353 printed is the name of the output file specified using the `-o`
354 or `--output` option, or `-` if output would go to STDOUT. The
355 remaining lines, if any, list command-line arguments. These will
356 include the names of input files and any special options passed
357 after ` -- ` on the command line. So, for example,
359: pandoc --dump-args -o foo.html -s foo.txt \
360 appendix.txt -- -e latin1
362: will cause the following to be printed to STDOUT:
364: foo.html foo.txt appendix.txt -e latin1
367: causes Pandoc to ignore all command-line arguments.
368 Regular Pandoc options are not ignored. Thus, for example,
370: pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1
374: pandoc -o foo.html -s
377: prints the version number to STDERR.
380: prints a usage message to STDERR.
382[Smartypants]: http://daringfireball.net/projects/smartypants/
383[ASCIIMathML]: http://www1.chapman.edu/~jipsen/mathml/asciimath.html
384[gladTeX]: http://www.math.uio.no/~martingu/gladtex/index.html
385[mimeTeX]: http://www.forkosh.com/mimetex.html
387Pandoc's markdown vs. standard markdown
388=======================================
390In parsing markdown, Pandoc departs from and extends [standard markdown]
391in a few respects. (To run Pandoc on the official markdown test suite,
392type `make test-markdown`.) Except where noted, these differences can
393be suppressed by specifying the `--strict` command-line option or by
394using the `hsmarkdown` wrapper.
396[standard markdown]: http://daringfireball.net/projects/markdown/syntax
397 "Markdown syntax description"
402Except inside a code block or inline code, any punctuation or space
403character preceded by a backslash will be treated literally, even if it
404would normally indicate formatting. Thus, for example, if one writes
414 <strong>hello</strong>
416This rule is easier to remember than standard markdown's rule,
417which allows only the following characters to be backslash-escaped:
421A backslash-escaped space is parsed as a nonbreaking space. It will
422appear in TeX output as '~' and in HTML and XML as '\ ' or '\ '.
424Subscripts and superscripts
425---------------------------
427Superscripts may be written by surrounding the superscripted text by `^`
428characters; subscripts may be written by surrounding the subscripted
429text by `~` characters. Thus, for example,
431 H~2~O is a liquid. 2^10^ is 1024.
433If the superscripted or subscripted text contains spaces, these spaces
434must be escaped with backslashes. (This is to prevent accidental
435superscripting and subscripting through the ordinary use of `~` and `^`.)
436Thus, if you want the letter P with 'a cat' in subscripts, use
437`P~a\ cat~`, not `P~a cat~`.
442To strikeout a section of text with a horizontal line, begin and end it
443with `~~`. Thus, for example,
445 This ~~is deleted text.~~
450Pandoc behaves differently from standard markdown on some "edge
451cases" involving lists. Consider this source:
461Pandoc transforms this into a "compact list" (with no `<p>` tags around
462"First", "Second", or "Third"), while markdown puts `<p>` tags around
463"Second" and "Third" (but not "First"), because of the blank space
464around "Third". Pandoc follows a simple rule: if the text is followed by
465a blank line, it is treated as a paragraph. Since "Second" is followed
466by a list, and not a blank line, it isn't treated as a paragraph. The
467fact that the list is followed by a blank line is irrelevant. (Note:
468Pandoc works this way even when the `--strict` option is specified. This
469behavior is consistent with the official markdown syntax description,
470even though it is different from that of `Markdown.pl`.)
475Unlike standard markdown, Pandoc allows ordered list items to be marked
476with uppercase and lowercase letters and roman numerals, in addition to
477arabic numerals. (This behavior can be turned off using the `--strict`
478option.) List markers may be enclosed in parentheses or followed by a
479single right-parentheses or period. They must be separated from the
480text that follows by at least one space, and, if the list marker is a
481capital letter with a period, by at least two spaces.[^2]
483[^2]: The point of this rule is to ensure that normal paragraphs
484 starting with people's initials, like
486 B. Russell was an English philosopher.
488 do not get treated as list items.
490 This rule will not prevent
494 from being interpreted as a list item. In this case, a backslash
499Pandoc also pays attention to the type of list marker used, and to the
500starting number, and both of these are preserved where possible in the
501output format. Thus, the following yields a list with numbers followed
502by a single parenthesis, starting with 9, and a sublist with lowercase
512Note that Pandoc pays attention only to the *starting* number in a list.
513So, the following yields a list numbered sequentially starting from 2:
519If default list markers are desired, use '`#.`':
525If you change list style in mid-list, Pandoc will notice and assume you
526are starting a sublist. So,
534gets treated as if it were
546Pandoc supports definition lists, using a syntax inspired by
547[PHP Markdown Extra] and [reStructuredText]:
549 [PHP Markdown Extra]: http://www.michelf.com/projects/php-markdown/extra/
557 : Second paragraph of definition 2.
559Each term must fit on one line. The definition must begin on the line
560after the term. The definition consists of one or more block elements
561(paragraph, code block, list, etc.), each beginning with a colon and
562(aside from the colon) indented one tab stop.
564 Term *with inline markup*
565 : Here is the definition. It may contain multiple blocks.
570 : Here is the third paragraph of this definition.
572If you leave space after the definition (as in the first example above),
573the definitions will be considered paragraphs. In some output formats,
574this will mean greater spacing between term/definition pairs. For a
575compact definition list, do not leave space between the definition and
586Pandoc allows implicit reference links with just a single set of
587brackets. So, the following links are equivalent:
590 2. Here's my [link][]
594(Note: Pandoc works this way even if `--strict` is specified, because
595`Markdown.pl` 1.0.2b7 allows single-bracket links.)
600Pandoc's markdown allows footnotes, using the following syntax:
602 Here is a footnote reference,[^1] and another.[^longnote]
604 [^1]: Here is the footnote.
606 [^longnote]: Here's one with multiple blocks.
608 Subsequent paragraphs are indented to show that they
609 belong to the previous footnote.
613 The whole paragraph can be indented, or just the first
614 line. In this way, multi-paragraph footnotes work like
615 multi-paragraph list items.
617 This paragraph won't be part of the note, because it isn't indented.
619The identifiers in footnote references may not contain spaces, tabs,
620or newlines. These identifiers are used only to correlate the
621footnote reference with the note itself; in the output, footnotes
622will be numbered sequentially.
624The footnotes themselves need not be placed at the end of the
625document. They may appear anywhere except inside other block elements
626(lists, block quotes, tables, etc.).
628Inline footnotes are also allowed (though, unlike regular notes,
629they cannot contain multiple paragraphs). The syntax is as follows:
631 Here is an inline note.^[Inlines notes are easier to write, since
632 you don't have to pick an identifier and move down to type the
635Inline and regular footnotes may be mixed freely.
640Two kinds of tables may be used. Both kinds presuppose the use of
641a fixed-width font, such as Courier.
643Simple tables look like this:
645 Right Left Center Default
646 ------- ------ ---------- -------
651 Table: Demonstration of simple table syntax.
653The headers and table rows must each fit on one line. Column
654alignments are determined by the position of the header text relative
655to the dashed line below it:[^1]
657 - If the dashed line is flush with the header text on the right side
658 but extends beyond it on the left, the column is right-aligned.
659 - If the dashed line is flush with the header text on the left side
660 but extends beyond it on the right, the column is left-aligned.
661 - If the dashed line extends beyond the header text on both sides,
662 the column is centered.
663 - If the dashed line is flush with the header text on both sides,
664 the default alignment is used (in most cases, this will be left).
666[^1]: This scheme is due to Michel Fortin, who proposed it on the
667 Markdown discussion list:
668 <http://six.pairlist.net/pipermail/markdown-discuss/2005-March/001097.html>.
670The table must end with a blank line. Optionally, a caption may be
671provided (as illustrated in the example above). A caption is a paragraph
672beginning with the string `Table:`, which will be stripped off.
674The table parser pays attention to the widths of the columns, and
675the writers try to reproduce these relative widths in the output.
676So, if you find that one of the columns is too narrow in the output,
677try widening it in the markdown source.
679Multiline tables allow headers and table rows to span multiple lines
680of text. Here is an example:
682 -------------------------------------------------------------
683 Centered Default Right Left
684 Header Aligned Aligned Aligned
685 ----------- ------- --------------- -------------------------
686 First row 12.0 Example of a row that
687 spans multiple lines.
689 Second row 5.0 Here's another one. Note
690 the blank line between
692 -------------------------------------------------------------
694 Table: Here's the caption. It, too, may span
697These work like simple tables, but with the following differences:
699 - They must begin with a row of dashes, before the header text.
700 - They must end with a row of dashes, then a blank line.
701 - The rows must be separated by blank lines.
706In addition to standard indented code blocks, Pandoc supports
707*delimited* code blocks. These begin with a row of three or more
708tildes (`~`) and end with a row of tildes that must be at least
709as long as the starting row. Everything between the tilde-lines
710is treated as code. No indentation is necessary:
716If the code itself contains a row of tildes, just use a longer
717row of tildes at the start and end:
721 code including tildes
725Optionally, you may specify the language of the code block using
728 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.haskell .numberLines}
730 qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
731 qsort (filter (>= x) xs)
732 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
734Some output formats can use this information to do syntax highlighting.
735Currently, the only output format that uses this information is HTML.
737If pandoc has been compiled with syntax highlighting support, then the
738code block above will appear highlighted, with numbered lines. (To see
739which languages are supported, do `pandoc --version`.)
741If pandoc has not been compiled with syntax highlighting support, the
742code block above will appear as follows:
744 <pre class="haskell">
753If the file begins with a title block
756 % author(s) (separated by commas)
759it will be parsed as bibliographic information, not regular text. (It
760will be used, for example, in the title of standalone LaTeX or HTML
761output.) The block may contain just a title, a title and an author,
762or all three lines. Each must begin with a % and fit on one line.
763The title may contain standard inline formatting. If you want to
764include an author but no title, or a title and a date but no author,
765you need a blank line:
771Titles will be written only when the `--standalone` (`-s`) option is
772chosen. In HTML output, titles will appear twice: once in the
773document head -- this is the title that will appear at the top of the
774window in a browser -- and once at the beginning of the document body.
775The title in the document head can have an optional prefix attached
776(`--title-prefix` or `-T` option). The title in the body appears as
777an H1 element with class "title", so it can be suppressed or
778reformatted with CSS. If a title prefix is specified with `-T` and no
779title block appears in the document, the title prefix will be used by
780itself as the HTML title.
782The man page writer extracts a title, man page section number, and
783other header and footer information from the title line. The title
784is assumed to be the first word on the title line, which may optionally
785end with a (single-digit) section number in parentheses. (There should
786be no space between the title and the parentheses.) Anything after
787this is assumed to be additional footer and header text. A single pipe
788character (`|`) should be used to separate the footer text from the header
793will yield a man page with the title `PANDOC` and section 1.
795 % PANDOC(1) Pandoc User Manuals
797will also have "Pandoc User Manuals" in the footer.
799 % PANDOC(1) Pandoc User Manuals | Version 4.0
801will also have "Version 4.0" in the header.
803Markdown in HTML blocks
804-----------------------
806While standard markdown leaves HTML blocks exactly as they are, Pandoc
807treats text between HTML tags as markdown. Thus, for example, Pandoc
813 <td>[a link](http://google.com)</td>
821 <td><em>one</em></td>
822 <td><a href="http://google.com">a link</a></td>
826whereas `Markdown.pl` will preserve it as is.
828There is one exception to this rule: text between `<script>` and
829`</script>` tags is not interpreted as markdown.
831This departure from standard markdown should make it easier to mix
832markdown with HTML block elements. For example, one can surround
833a block of markdown text with `<div>` tags without preventing it
834from being interpreted as markdown.
836Header identifiers in HTML
837--------------------------
839Each header element in pandoc's HTML output is given a unique
840identifier. This identifier is based on the text of the header. To
841derive the identifier from the header text,
843 - Remove all formatting, links, etc.
844 - Remove all punctuation, except dashes and hyphens.
845 - Replace all spaces, dashes, newlines, and hyphens with hyphens.
846 - Convert all alphabetic characters to lowercase.
847 - Remove everything up to the first letter (identifiers may
848 not begin with a number or punctuation mark).
849 - If nothing is left after this, use the identifier `section`.
854 ------------------------------------- ---------------------------
855 Header identifiers in HTML `header-identifiers-in-html`
856 *Dogs*?--in *my* house? `dogs--in-my-house`
857 [HTML], [S5], or [RTF]? `html-s5-or-rtf`
858 3. Applications `applications`
861These rules should, in most cases, allow one to determine the identifier
862from the header text. The exception is when several headers have the
863same text; in this case, the first will get an identifier as described
864above; the second will get the same identifier with `-1` appended; the
865third with `-2`; and so on.
867These identifiers are used to provide link targets in the table of
868contents generated by the `--toc|--table-of-contents` option. They
869also make it easy to provide links from one section of a document to
870another. A link to this section, for example, might look like this:
872 See the section on [header identifiers](#header-identifiers-in-html).
874Note, however, that this method of providing links to sections works
877Blank lines before headers and blockquotes
878------------------------------------------
880Standard markdown syntax does not require a blank line before a header
881or blockquote. Pandoc does require this (except, of course, at the
882beginning of the document). The reason for the requirement is that
883it is all too easy for a `>` or `#` to end up at the beginning of a
884line by accident (perhaps through line wrapping). Consider, for
887 I like several of their flavors of ice cream: #22, for example, and
893Anything between two $ characters will be treated as TeX math. The
894opening $ must have a character immediately to its right, while the
895closing $ must have a character immediately to its left. Thus,
896`$20,000 and $30,000` won't parse as math. If for some reason
897you need to enclose text in literal $ characters, backslash-escape
898them and they won't be treated as math delimiters.
900TeX math will be printed in all output formats. In Markdown,
901reStructuredText, LaTeX, and ConTeXt output, it will appear verbatim
904In reStructuredText output, it will be rendered using an interpreted
905text role `:math:`, as described
906[here](http://www.american.edu/econ/itex2mml/mathhack.rst).
908In Texinfo output, it will be rendered inside a `@math` command.
910In groff man output, it will be rendered verbatim without $'s.
912In MediaWiki output, it will be rendered inside `<math>` tags.
914In RTF, Docbook, and OpenDocument output, it will be rendered, as far as
915possible, using unicode characters, and will otherwise appear verbatim.
916Unknown commands and symbols, and commands that cannot be dealt with
917this way (like `\frac`), will be rendered verbatim. So the results may
918be a mix of raw TeX code and properly rendered unicode math.
920In HTML and S5 output, the way math is rendered will depend on the
921command-line options selected:
9231. The default is to render TeX math as far as possible using unicode
924 characters, as with RTF, Docbook, and OpenDocument output. Formulas
925 are put inside a `span` with `class="math"`, so that they may be
926 styled differently from the surrounding text if needed.
9282. If the `--asciimathml` option is used, TeX math will be displayed
929 between $ characters, as in LaTeX, and the [ASCIIMathML] script will
930 be used to render it as formulas. (This trick does not work in all
931 browsers, but it works in Firefox. In browsers that do not support
932 ASCIIMathML, TeX math will appear verbatim between $ characters.)
9343. If the `--mimetex` option is used, the [mimeTeX] CGI script will
935 be called to generate images for each TeX formula. This should
936 work in all browsers. The `--mimetex` option takes an optional URL
937 as argument. If no URL is specified, it will be assumed that the
938 mimeTeX CGI script is at `/cgi-bin/mimetex.cgi`.
9404. If the `--gladtex` option is used, TeX formulas will be enclosed
941 in `<eq>` tags in the HTML output. The resulting `htex` file may then
942 be processed by [gladTeX], which will produce image files for each
943 formula and an `html` file with links to these images. So, the
946 pandoc -s --gladtex myfile.txt -o myfile.htex
947 gladtex -d myfile-images myfile.htex # produces myfile.html
948 # and images in myfile-images
953Inline TeX commands will be preserved and passed unchanged to the
954LaTeX and ConTeXt writers. Thus, for example, you can use LaTeX to
955include BibTeX citations:
957 This result was proved in \cite{jones.1967}.
959Note that in LaTeX environments, like
961 \begin{tabular}{|l|l|}\hline
962 Age & Frequency \\ \hline
965 36--45 & 22 \\ \hline
968the material between the begin and end tags will be interpreted as raw
969LaTeX, not as markdown.
971Inline LaTeX is ignored in output formats other than Markdown, LaTeX,
977When run with the "standalone" option (`-s`), `pandoc` creates a
978standalone file, complete with an appropriate header. To see the
979default headers used for html and latex, use the following commands:
985If you want to use a different header, just create a file containing
986it and specify it on the command line as follows:
988 pandoc --header=MyHeaderFile
990Producing S5 with Pandoc
991========================
993Producing an [S5] web-based slide show with Pandoc is easy. A title
994page is constructed automatically from the document's title block (see
995above). Each section (with a level-one header) produces a single slide.
996(Note that if the section is too big, the slide will not fit on the page;
997S5 is not smart enough to produce multiple pages.)
999Here's the markdown source for a simple slide show, `eating.txt`:
1015To produce the slide show, simply type
1017 pandoc -w s5 -s eating.txt > eating.html
1019and open up `eating.html` in a browser.
1021Note that by default, the S5 writer produces lists that display
1022"all at once." If you want your lists to display incrementally
1023(one item at a time), use the `-i` option. If you want a
1024particular list to depart from the default (that is, to display
1025incrementally without the `-i` option and all at once with the
1026`-i` option), put it in a block quote:
1031In this way incremental and nonincremental lists can be mixed in
1034Note: the S5 file produced by pandoc with the `-s/--standalone` option
1035embeds the javascript and CSS required to show the slides. Thus it
1036does not depend on any additional files: you can send the HTML file to
1037others, and they will be able to view the slide show just by opening
1038it. However, if you intend to produce several S5 slide shows, and you
1039are displaying them on your own website, it is better to keep the S5
1040javascript and CSS files separate from the slide shows themselves, so
1041that they may be cached. The best approach in this case is to use pandoc
1042without the `-s` option to produce the body of the S5 document, which
1043can then be inserted into an HTML template that links to the javascript
1044and CSS files required by S5. (See the instructions on the S5 website.)
1045Alternatively, 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