Skip to content

Markdown cheat sheet

CommonMark basics plus the GitHub Flavored Markdown (GFM) extensions you use in READMEs, issues and docs.

21 entries

Text

# H1
## H2
### H3

Headings: one to six #, followed by a space.

**bold**  *italic*  ***both***

Emphasis (underscores work too).

~~strikethrough~~

Strikethrough (GFM).

`inline code`

Inline code span.

> A quote
>
> continues here

Blockquote.

Line one  
Line two

Two trailing spaces (or a backslash) force a line break.

---

Horizontal rule.

Lists

- Apples
- Pears
  - Nested (2 spaces)

Unordered list (-, * or +).

1. First
2. Second
3. Third

Ordered list; numbers can all be 1.

- [x] Write docs
- [ ] Ship it

Task list (GFM).

Code

```python
print("hello")
```

Fenced code block with language for syntax highlighting.

    indented four spaces

Indented code block.

Tables (GFM)

| Name | Qty |
|:-----|----:|
| Pen  |   2 |
| Ink  |  10 |

Colons in the divider row align columns left/right/center.

GitHub extras

> [!NOTE]
> Useful information.

Alerts: NOTE, TIP, IMPORTANT, WARNING, CAUTION.

<details>
<summary>Click to expand</summary>

Hidden content.
</details>

Collapsible section via HTML.

Footnote[^1].

[^1]: The note.

Footnotes.

@username  #123

Mentions and issue references.

Frequently asked questions

What is GitHub Flavored Markdown?

GFM is GitHub’s superset of CommonMark. It adds tables, task lists, strikethrough, autolinks, footnotes and alert blocks.

How do I add a line break in Markdown?

End the line with two spaces or a backslash, or leave a blank line to start a new paragraph.

How do I escape Markdown characters?

Put a backslash before the character, for example \* to show a literal asterisk.

Related cheat sheets