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

# H1
## H2
### H3
#### H4
##### H5
###### H6

Alternate syntax for H1 and H2:

Heading 1
=========

Heading 2
---------

Advertisement

Emphasis

SyntaxResult
**bold** or __bold__bold
*italic* or _italic_italic
***bold italic***bold italic
~~strikethrough~~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

[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

![Alt text](https://example.com/image.png)
![Alt text](./local.png "Optional title")

[![Clickable image](image.png)](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~~
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

FeatureStandardGFMMDX
TablesNoYesYes
Task listsNoYesYes
StrikethroughNoYesYes
FootnotesNoYesYes
AutolinksNoYesYes
JSX componentsNoNoYes
Expressions {}NoNoYes
FrontmatterNoNoYes (via plugin)