Markdown cheatsheet

The syntax on the left, what it becomes on the right. Copy any snippet. Everything here is CommonMark plus the GitHub extensions most tools support.

Headings

# Heading 1

Heading 1

## Heading 2

Heading 2

### Heading 3

Heading 3

Heading 1
=========
Setext style, H1 only

Heading 1

Heading 2
---------
Setext style, H2 only

Heading 2

Emphasis

*italic* or _italic_

italic or italic

**bold** or __bold__

bold or bold

***bold italic***

bold italic

~~strikethrough~~
GFM

strikethrough

Inline `code` span

Inline code span

Escape \*literal asterisks\*

Escape *literal asterisks*

Lists

- Item
- Item
  - Nested item
Also * or +
  • Item
  • Item
    • Nested item
1. First
2. Second
3. Third
  1. First
  2. Second
  3. Third
1. First
1. Second
1. Third
Numbers are normalised
  1. First
  2. Second
  3. Third
- [x] Done
- [ ] To do
Task list, GFM
  • Done
  • To do

Code

```js
const x = 1;
```
Fenced block with a language
const x = 1;
    indented four spaces
Indented block
indented four spaces
``code with a ` backtick``

code with a ` backtick

Tables

| Left | Centre | Right |
|:-----|:------:|------:|
| a    |   b    |     c |
Colons set alignment
Left Centre Right
a b c
Name | Qty
--- | ---
Pi | 1
Outer pipes are optional
Name Qty
Pi 1

Quotes, rules and breaks

> A quotation
>
> > Nested

A quotation

Nested

---
Horizontal rule; also *** or ___

Line one  
Line two
Two trailing spaces break the line

Line one
Line two

Line one\
Line two
A backslash also works

Line one
Line two

Extras

Footnote reference[^1]

[^1]: The footnote text.

Footnote reference[1]


  1. The footnote text. ↩︎

<details>
<summary>Click</summary>

Hidden content

</details>
Inline HTML where it is allowed
Click

Hidden content

<!-- a comment -->
Not rendered
---
title: Front matter
---
YAML front matter, used by most static site tools
---
title: Front matter
---