One neat trick which you can use in Markdown to distinguish between different types of images is to add a #hash value to the end of the source URL, and then target images containing the hash with special styling.
which is styled with...
img[src$="#full"] {
max-width: 100vw;
}
This creates full-bleed images in the Casper theme, which stretch beyond their usual boundaries right up to the edge of the window. Every theme handles these types of things slightly differently, but it's a great trick to play with if you want to have a variety of image sizes and styles.
Another way to insert links in markdown is using reference lists. You might want to use this style of linking to cite reference material in a Wikipedia-style. All of the links are listed at the end of the document, so you can maintain full separation between content and its source or reference.
Please use code folding, with the default set to hide.
Data frame printing
If you have to display a large data table, it would be nice to allow your readers the chance to page and scroll through it. Use the Paged Printing option by setting df_print: paged in YAML.
---
title: "My document"
output:
html_document:
df_print: paged
---
[I'm an inline-style link](https://www.google.com)
[I'm an inline-style link with title](https://www.google.com "Google's Homepage")
[I'm a reference-style link][Arbitrary case-insensitive reference text]
[I'm a relative reference to a repository file](../blob/master/LICENSE)
[You can use numbers for reference-style link definitions][1]
Or leave it empty and use the [link text itself].
URLs and URLs in angle brackets will automatically get turned into links.
http://www.example.com or <http://www.example.com> and sometimes
example.com (but not on Github, for example).
Some text to show that the reference links can follow later.
[arbitrary case-insensitive reference text]: https://www.mozilla.org
[1]: http://slashdot.org
[link text itself]: http://www.reddit.com
Sometimes your document doesn’t flow exactly how you want it when printing or exporting to PDF. You can force a page break in iA Writer using three plus marks (+) on a line by themselves:
After reading the templates I understand how this was designed to be the expected behaviour in the sense that --toc tells pandoc to populate a variable and toc: true is the conditional check to add the html nav or not, however it took me a while and close inspection of the templates to figure this out.
Use the specified file as a custom template for the generated document. Implies --standalone.
-VKEY[=VAL], --variable=KEY[:VAL]
Set the template variable KEY to the value VAL when rendering the document in standalone mode. This is generally only useful when the --template option is used to specify a custom template, since pandoc automatically sets the variables used in the default templates. If no VAL is specified, the key will be given the value true.
-MKEY[=VAL], --metadata=KEY[:VAL]
Set the metadata field KEY to the value VAL. A value specified on the command line overrides a value specified in the document using YAML metadata blocks. Values will be parsed as YAML boolean or string values. If no value is specified, the value will be treated as Boolean true. Like --variable, --metadata causes template variables to be set. But unlike --variable, --metadata affects the metadata of the underlying document (which is accessible from filters and may be printed in some output formats) and metadata values will be escaped when inserted into the template.
Think of markdown as a nicer syntax for HTML – it's only the content, no styling. (Centering would be styling.) You cannot center text in HTML either. But you can add classes, then style them with CSS (in your Hakyll theme).
Pandoc markdown currently supports attributes on images:
{.myClass}
but not paragraphs, however you can wrap stuff in divs:
# my markdown header
<div class="myClass">
one paragraph
second paragraph, **strong**
</div>
If you want to nest slides to level 2, you cannot put content under a level 1 header. This limitation is by design. According to developer John MacFarlane, as of June 2015:
Pandoc has a method of carving content into slides (described in the User's Guide) that works the same for all slide formats, so you can use the same source for reveal.js and beamer. That is what motivated the present system, though I'm open to a better way, as long as it works uniformly with all formats.
Slide show formats behavior change: content under headers less than slide level is no longer ignored, but included in the title slide (for HTML slide shows) or in a slide after the title slide (for beamer). This change makes possible 2D reveal.js slideshows with content in the top slide on each stack (#4317, #5237).
Set the metadata field KEY to the value VAL. A value specified on the command line overrides a value specified in the document using YAML metadata blocks.
pandoc -f html -t markdown --request-header User-Agent:"Mozilla/5.0" \
http://www.fsf.org
Generate a bash completion script. To enable bash completion with pandoc, add this to your .bashrc:
eval "$(pandoc --bash-completion)"
A “lazy” form, which requires the > character only on the first line of each block, is also allowed:
> This is a block quote. This
paragraph has two lines.
Indented code blocks
A block of text indented four spaces (or one tab) is treated as verbatim text: that is, special characters do not trigger special formatting, and all spaces and line breaks are preserved. For example,
if (a > 3) {
moveShip(5 * gravity, DOWN);
}
Like regular code blocks, fenced code blocks must be separated from surrounding text by blank lines.
Extension: fenced_code_attributes
Optionally, you may attach attributes to fenced or backtick code block using this syntax:
A line block is a sequence of lines beginning with a vertical bar (|) followed by a space. The division into lines will be preserved in the output, as will any leading spaces; otherwise, the lines will be formatted as Markdown. This is useful for verse and addresses:
| The limerick packs laughs anatomical
| In space that is quite economical.
| But the good ones I've seen
| So seldom are clean
| And the clean ones so seldom are comical
| 200 Main St.
| Berkeley, CA 94718
A bulleted list item begins with a bullet (*, +, or -)
This will produce a “compact” list. If you want a “loose” list, in which each item is formatted as a paragraph, put spaces between the items:
A list item may contain multiple paragraphs and other block-level content. However, subsequent paragraphs must be preceded by a blank line and indented to line up with the first non-space content after the list marker.
* First paragraph.
Continued.
* Second paragraph. With a code block, which must be indented
eight spaces:
{ code }
- [ ] an unchecked task list item
- [x] checked item
To “cut off” the list after item two, you can insert some non-indented content, like an HTML comment, which won’t produce visible output in any format:
- item one
- item two
<!-- end of list -->
{ my code block }
You can use the same trick if you want two consecutive lists instead of one big list:
1. one
2. two
3. three
<!-- -->
1. uno
2. dos
3. tres
A line containing a row of three or more *, -, or _ characters (optionally separated by spaces) produces a horizontal rule:
To make a short span of text verbatim, put it inside backticks:
What is the difference between `>>=` and `>>`?
If the verbatim text includes a backtick, use double backticks:
Here is a literal backtick `` ` ``.
Attributes can be attached to verbatim text, just as with fenced code blocks:
`<$>`{.haskell}
Extension: implicit_figures
An image with nonempty alt text, occurring by itself in a paragraph, will be rendered as a figure with a caption. The image’s alt text will be used as the caption.

Extension: link_attributes
Attributes can be set on links and images:
An inline {#id .class width=30 height=20px}
and a reference ![image][ref] with attributes.
An extension can be enabled by adding +EXTENSION to the format name and disabled by adding -EXTENSION. For example, --from markdown_strict+footnotes is strict Markdown with footnotes enabled, while --from markdown-footnotes-pipe_tables is pandoc’s Markdown without footnotes or pipe tables.
The markdown reader and writer make by far the most use of extensions. Extensions only used by them are therefore covered in the section Pandoc’s Markdown below (See Markdown variants for commonmark and gfm.) In the following, extensions that also work for other formats are covered.
For those coming from R (e.g. using rmarkdown, bookdown, blogdown and so on), this is the syntax you want.
For those not using R, you may need to enable the extension in the call to pandoc with +link_attributes
Note: This is different than the kramdown parser's support, which is one the accepted answers above. In particular, note that kramdown differs from pandoc since it requires a colon -- : -- at the start of the curly brackets -- {}, e.g.
e.g. you have a long markdown file in GitHub and want to have a TOC, you can use pandoc -t markdown_github --toc -o example-with-toc.md example.md
This a useful workaround to update the TOC of very long documents, but —beware!— if you use this trick for writing over the input file, you'll end stacking TOCs — each new Table of Contents being generated above the previously built ones, and indexing them too. This technique is useful when working with different source and output files.
Also, you can add a title to the TOC using the toc-title variable, but only if you use a markdown template — as explained ahead.
Pandoc allows ordered lists to have different numbering styles and delimiters; these are recorded and reproduced, where possible, in the output format.
(a) My list
(b) Lowercase letters
i. Roman sublist
ii. Next
Superscript
Pandoc supports superscripts: mc^2^.
Subscript
Pandoc supports subscripts: H~2~O.
Multiline table:
----------- ------- --------------- -------------------------
First row 12.0 Example of a row that
spans multiple lines.
Second row 5.0 Here's another one. Note
the blank line between
rows.
-------------------------------------------------------------
| Format | Tag example |
| -------- | ----------- |
| Headings | =heading1=<br>==heading2==<br>===heading3=== |
| New paragraph | A blank line starts a new paragraph |
| Source code block | // all on one line<br> {{{ if (foo) bar else baz }}} |
|Tables|Are|Cool||-------------|:-------------:|-----:|| col 3is| right-aligned | $1600 || col 2is| centered | $12 || zebra stripes | are neat | $1 ||<ul><li>item1</li><li>item2</li></ul>|See the list |from the first column|