Markdown Cheatsheet
Complete Markdown and GFM cheatsheet covering headings, emphasis, lists, links, tables, code blocks, task lists, footnotes, and MDX extras.
Updated September 15, 2026
markdownmdxgfmdocumentationwriting
Headings
markdown
# H1
## H2
### H3
#### H4
##### H5
###### H6
Alternate syntax for H1 and H2:
markdown
Heading 1
=========
Heading 2
---------
Advertisement
Emphasis
| Syntax | Result |
|---|---|
**bold** or __bold__ | bold |
*italic* or _italic_ | italic |
***bold italic*** | bold italic |
~~strikethrough~~ | |
`inline code` | inline code |
<mark>highlight</mark> | highlight (HTML) |
<sub>subscript</sub> | subscript (HTML) |
<sup>superscript</sup> | superscript (HTML) |
Lists
Unordered
markdown
- Item one
- Item two
- Nested item (indent 2 spaces)
- Another nested
- Item three
Use -, *, or + interchangeably (pick one and stay consistent).
Ordered
markdown
1. First
2. Second
3. Third
1. Lazy numbering (all 1.)
1. Markdown increments automatically
1. So this works too
Task Lists (GFM)
markdown
- [x] Completed task
- [ ] Open task
- [ ] Another open task
Links
markdown
[Link text](https://example.com)
[Link with title](https://example.com "Hover title")
<https://example.com> (autolink)
<email@example.com> (email autolink)
[Reference link][ref-id]
[ref-id]: https://example.com "Optional title"
[Implicit reference][]
[Implicit reference]: https://example.com
Advertisement
Images
markdown


[](https://link.com)
[Reference image][img-ref]
[img-ref]: https://example.com/image.png "Title"
Code
Inline
markdown
Use `code` for inline code.
Fenced Blocks
markdown
```python
def hello():
print("Hello, world!")
```
Common language identifiers: python, typescript, javascript, bash, sh, sql, json, yaml, dockerfile, rust, go, html, css, markdown.
Indented Code (4 spaces)
markdown
This is a code block
indented with 4 spaces
Tables (GFM)
markdown
| Column 1 | Column 2 | Column 3 |
|---|---|---|
| Cell 1 | Cell 2 | Cell 3 |
| Cell 4 | Cell 5 | Cell 6 |
Alignment with colons:
markdown
| Left | Center | Right |
|:---|:---:|---:|
| text | text | text |
Blockquotes
markdown
> Single level quote
> First level
>> Nested quote
>>> Triple nested
> **Tip:** You can include *emphasis* and `code` in blockquotes.
Horizontal Rules
markdown
---
***
___
All three produce a horizontal rule. Leave blank lines before and after.
Escaping Special Characters
Backslash-escape these characters: \ * _ { } [ ] ( ) # + - . !
markdown
\*literal asterisks\*
\[not a link\]
HTML in Markdown
Most Markdown processors allow inline HTML:
markdown
<details>
<summary>Click to expand</summary>
Hidden content here.
</details>
<kbd>Ctrl</kbd>+<kbd>C</kbd>
GFM Extras (GitHub Flavored Markdown)
Footnotes
markdown
Here is a sentence with a footnote.[^1]
[^1]: This is the footnote text.
Strikethrough
markdown
~~deleted text~~
Autolinks
markdown
Visit https://github.com directly (no brackets needed in GFM).
Mention and Issue References (GitHub only)
markdown
@username
#123
org/repo#456
commit SHA: abc1234
MDX Extras (for .mdx files)
MDX allows importing and using React components inside Markdown:
mdx
import { Chart } from './Chart'
# My Document
Regular markdown content.
<Chart data={[1, 2, 3]} title="My Chart" />
More markdown after the component.
Frontmatter (YAML, parsed by most static site generators)
yaml
---
title: My Page
date: '2026-01-01'
tags: ['markdown', 'mdx']
draft: false
---
Expressions
mdx
The current year is {new Date().getFullYear()}.
Markdown Flavors Comparison
| Feature | Standard | GFM | MDX |
|---|---|---|---|
| Tables | No | Yes | Yes |
| Task lists | No | Yes | Yes |
| Strikethrough | No | Yes | Yes |
| Footnotes | No | Yes | Yes |
| Autolinks | No | Yes | Yes |
| JSX components | No | No | Yes |
Expressions {} | No | No | Yes |
| Frontmatter | No | No | Yes (via plugin) |