Skip to content

Latest commit

 

History

History
161 lines (93 loc) · 2.31 KB

index.md

File metadata and controls

161 lines (93 loc) · 2.31 KB

% title % author % date

Cheatsheet on Pandoc's markdown.

Front matter

Title block

Pandoc uses a limited front matter, called Title block in its documentation, that can only contain a few fields:

% title
% author
% date

TOC

To get a table linked of contents, use the --toc option this gives ids based on name to the headers (strips illegal chars, transforms spaces into hyphens).

Attributes {#attr .class1 .class2}

You can give explicit attributes to headers like this one.

Explicit IDs will override automatic ids that would be generated by toc.

Only the id has effect in LaTeX (becomes a label), other don't even show in HTML.

According to docs it should also be possible to add arbitrary attributes of type a=b, but this currently breaks the header.

Superscript

2^10^ is 1024. sup tag in HTML.

Subscript

H2O is a liquid. sub tag in HTML.

Strikeout

striked out

Tags

Named references, much like traditional Math equation references.

no tag

(@) no tag. a bit useless.

a paragraph

(@) no tag. a bit useless.

must be at start of line to work: (@)

tagged

(@tag1) text of tag1

Ref to tag1: (@tag1)

(@tag2) text of tag2

Ref to tag1: (@tag1)

(@tag1) <-- cannot start line directly with reference. It will be treated as a list item.

Ordered lists

Pandoc understands many ordered list formats. Insane.

. a

. a

  1. a
  2. a
  3. a

(1) a (2) a (3) a

Code blocks

Extra code block formats. Insane.

import os

def f(a):
    print a

f("abc")

Two backticks:

`` import os

def f(a): print a

f("abc") ``

Math

Inline: $x^2$

Display on a single line:

$$x^2$$

Firs chars after first dollar and before lats one must not be space: $ x^2$ $x^2 $ $ x^2 $

Multiline and align:

$$ \begin{aligned} a + b & = c \\ d & = e + f \\ \end{aligned} $$

Must use double dollars $$!

LaTeX

Raw LaTeX is ignored on HTML output.

Inline \LaTeX directive.

Block LaTeX directive:

\begin{equation} x^2 \end{equation}

Remove page number from a single page document: add the following line to the top:

% A pdf file without page numbers created from pandoc markdown
% sieste
% June 2013

\pagenumbering{gobble}

# First header

etc

HTML

Ignored for PDF output:

raw HTML

Markdown inside raw HTML

**markdown bold in raw HTML**