Markdown Cheat Sheet

Complete Markdown syntax reference. Headings, formatting, links, images, lists, tables, code blocks, and GitHub-flavored extensions.

Headings

MarkdownHTML Equivalent
# Heading 1<h1> — Page title
## Heading 2<h2> — Section
### Heading 3<h3> — Subsection
#### Heading 4<h4>
##### Heading 5<h5>
###### Heading 6<h6>
# Alternative syntax (underline style)
Heading 1
=========

Heading 2
---------

Text Formatting

MarkdownResult
**bold**bold
__bold__bold
*italic*italic
_italic_italic
***bold italic***bold italic
~~strikethrough~~strikethrough
`inline code`inline code
==highlight==highlight (some parsers)
H~2~OH2O (subscript, some parsers)
X^2^X2 (superscript, some parsers)

Lists

# Unordered list
- Item 1
- Item 2
  - Nested item
  - Nested item
- Item 3

# Ordered list
1. First
2. Second
3. Third

# Task list (GitHub)
- [x] Completed task
- [ ] Incomplete task
- [ ] Another task

# Definition list (some parsers)
Term
: Definition
Tip: You can use -, *, or + for unordered lists. For ordered lists, the actual numbers don't matter — Markdown auto-numbers them.

Code

MarkdownDescription
`code`Inline code
``code with `backtick` ``Inline code containing backticks
```languageFenced code block with syntax highlighting
4 spaces / 1 tab indentIndented code block
# Fenced code block with language
```javascript
function hello() {
  console.log("Hello, world!");
}
```

# Fenced code block with diff highlighting
```diff
- const old = "removed";
+ const new = "added";
```

Tables

| Left   | Center  | Right  |
|--------|:-------:|-------:|
| Cell 1 | Cell 2  | Cell 3 |
| Cell 4 | Cell 5  | Cell 6 |

# Alignment:
# :--- left (default)
# :---: center
# ---: right
Tip: Columns don't need to align in the source. This also works: |Left|Center|Right|

Blockquotes

> This is a blockquote.
>
> It can span multiple lines.

> Nested blockquotes:
> > Second level
> > > Third level

# GitHub-style alerts
> [!NOTE]
> Useful information that users should know.

> [!TIP]
> Helpful advice for doing things better.

> [!WARNING]
> Urgent info that needs immediate attention.

Horizontal Rules

# Any of these create a horizontal rule:
---
***
___

GitHub-Flavored Markdown

FeatureSyntaxDescription
Task lists- [x] DoneCheckbox lists in issues/PRs
Mentions@usernameMention a GitHub user
Issue refs#123Link to issue/PR by number
Commit refsabc1234Link to a commit by SHA
Strikethrough~~text~~Strikethrough text
Tables| a | b |GitHub supports tables natively
AutolinksPaste URL directlyURLs are auto-linked
Emoji:emoji_name:GitHub emoji shortcodes
Footnotes[^1]Add footnotes to text
Collapsed section<details>HTML collapsible section
Math (LaTeX)$E = mc^2$Inline math expressions
Math block$$...$$Block math expressions
Mermaid```mermaidDiagrams in code blocks
# Collapsible section
<details>
<summary>Click to expand</summary>

Hidden content goes here.

</details>

# Footnotes
Here is a sentence with a footnote.[^1]

[^1]: This is the footnote content.

Escaping Characters

Use backslash \ to escape Markdown formatting characters:

\*not italic\*   → *not italic*
\# not a heading  → # not a heading
\[not a link\]   → [not a link]

# Characters that can be escaped:
# \ ` * _ { } [ ] ( ) # + - . ! |