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
Headings
# H1
## H2
### H3
#### H4
##### H5
###### H6
Alternate syntax for H1 and H2:
Heading 1
=========
Heading 2
---------
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
- Item one
- Item two
- Nested item (indent 2 spaces)
- Another nested
- Item three
Use -, *, or + interchangeably (pick one and stay consistent).
Ordered
1. First
2. Second
3. Third
1. Lazy numbering (all 1.)
1. Markdown increments automatically
1. So this works too
Task Lists (GFM)
- [x] Completed task
- [ ] Open task
- [ ] Another open task
Links
[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
Images


[](https://link.com)
[Reference image][img-ref]
[img-ref]: https://example.com/image.png "Title"
Code
Inline
Use `code` for inline code.
Fenced Blocks
```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)
This is a code block
indented with 4 spaces
Tables (GFM)
| Column 1 | Column 2 | Column 3 |
|---|---|---|
| Cell 1 | Cell 2 | Cell 3 |
| Cell 4 | Cell 5 | Cell 6 |
Alignment with colons:
| Left | Center | Right |
|:---|:---:|---:|
| text | text | text |
Blockquotes
> Single level quote
> First level
>> Nested quote
>>> Triple nested
> **Tip:** You can include *emphasis* and `code` in blockquotes.
Horizontal Rules
---
***
___
All three produce a horizontal rule. Leave blank lines before and after.
Escaping Special Characters
Backslash-escape these characters: \ * _ { } [ ] ( ) # + - . !
\*literal asterisks\*
\[not a link\]
HTML in Markdown
Most Markdown processors allow inline HTML:
<details>
<summary>Click to expand</summary>
Hidden content here.
</details>
<kbd>Ctrl</kbd>+<kbd>C</kbd>
GFM Extras (GitHub Flavored Markdown)
Footnotes
Here is a sentence with a footnote.[^1]
[^1]: This is the footnote text.
Strikethrough
~~deleted text~~
Autolinks
Visit https://github.com directly (no brackets needed in GFM).
Mention and Issue References (GitHub only)
@username
#123
org/repo#456
commit SHA: abc1234
MDX Extras (for .mdx files)
MDX allows importing and using React components inside Markdown:
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)
---
title: My Page
date: '2026-01-01'
tags: ['markdown', 'mdx']
draft: false
---
Expressions
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) |
GitHub Flavored Markdown (GFM) Alerts
GitHub and modern markdown parsers natively render blockquote alerts with dedicated color styling:
> [!NOTE]
> Useful information that users should know, even when skimming content.
> [!TIP]
> Helpful advice for doing things better, faster, or more efficiently.
> [!IMPORTANT]
> Key information users need to know to achieve their goal.
> [!WARNING]
> Urgent info that needs immediate user attention to avoid problems.
> [!CAUTION]
> Advises about risks, destructive actions, or negative outcomes.
Collapsible Accordion Sections (HTML Details)
Use native HTML <details> and <summary> tags to hide large logs, stack traces, or optional walkthroughs:
<details>
<summary>Click to expand configuration file</summary>
```json
{
"name": "production-service",
"port": 8080,
"env": "production"
}
```
</details>
Mathematical Notation (LaTeX / KaTeX)
Standard mathematical notation rendered using double dollar signs for block equations and single dollar signs for inline math:
Inline equation: $E = mc^2$
Block equation:
$$
\sigma(z) = \frac{1}{1 + e^{-z}}
$$
Matrices and systems of equations:
$$
\begin{bmatrix}
a & b \\
c & d
\end{bmatrix}
\begin{bmatrix}
x \\
y
\end{bmatrix}
=
\begin{bmatrix}
ax + by \\
cx + dy
\end{bmatrix}
$$
Diagramming with Mermaid
Modern Markdown engines (like GitHub, GitLab, and documentation portals) render diagrams directly from code:
```mermaid
graph TD
A[Client Request] --> B{Edge Middleware}
B -->|Authenticated| C[Next.js SSR Origin]
B -->|Unauthorized| D[Redirect to Login]
C --> E[(PostgreSQL)]