Getting started
About
Markdown is a plain-text format for structured documents. This reference covers CommonMark and GFM syntax, from headings to tables and footnotes.
- CommonMark specification (spec.commonmark.org)
- GitHub Flavored Markdown specification (github.github.com)
- Basic writing and formatting syntax (docs.github.com)
Basic example
# Title
A paragraph with **bold**, *italic*, and `code`.
- First item
- Second item
[Link](https://commonmark.org)
See: Markdown reference
Headings
ATX headings
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6
One to six #s, then a space or end of line; seven or more stay literal.
## Heading 2 ##
Closing #s need a space before them.
See: ATX headings
Setext headings
Heading 1
=========
Heading 2
---------
Either underline can be any length. It must sit directly under the text; with a blank line between, --- becomes a thematic break.
See: Setext headings
Text
Emphasis and strikethrough
*italic* or _italic_
**bold** or __bold__
***bold italic***
~~strikethrough~~
_ does not emphasize inside words (foo_bar_baz); * does (foo*bar*baz).
Strikethrough is a GFM extension; one or two tildes, three or more stay literal.
See: Emphasis, Strikethrough
Escaping
\*not italic\*
\`not code\`
\# not a heading
A backslash escapes any ASCII punctuation; before anything else it stays literal.
See: Backslash escapes
Hard line breaks
First line
Second line
Next line\
also breaks
Line 1 ends in two spaces. Two or more spaces or a trailing backslash insert a <br>; a blank line starts a new paragraph.
See: Hard line breaks
Lists
Bullet lists
- Item
- Item
- Nested item
-, *, and + all work; changing the marker starts a new list. Nested items align to the parent's content column, and blank lines between items make the list loose (each item wrapped in <p>).
See: List items
Ordered lists
1. First
2. Second
3. Starts at three
4. Next
The first number sets start; later numbers are ignored. 1) also works; one to nine digits, and changing the delimiter starts a new list.
See: Lists
Task lists
- [ ] Open
- [x] Done
- [X] Nested done
A GFM extension; the marker must start the item's first paragraph.
See: Task list items
Links
Inline links
[text](https://example.com)
[text](https://example.com "Title")
[text](</my file.md>)
Angle brackets allow spaces in the destination.
See: Links
Reference links
[CommonMark][cm]
[CommonMark][]
[CommonMark]
[cm]: https://spec.commonmark.org/0.31.2/
[CommonMark]: https://commonmark.org/
Definitions may appear anywhere and are not rendered. [] reuses the label; no brackets is the shortcut form.
Autolinks
<https://example.com>
<me@example.com>
https://example.com
www.example.com
me@example.com
Angle forms are CommonMark; bare URLs, www. hosts and emails are the GFM extension. Trailing punctuation stays outside the link.
See: Autolinks, GFM autolinks
Footnotes
Here is a note.[^1]
[^1]: Footnote text.
A GitHub extension, absent from GFM 0.29 but rendered by GitHub and devhints. Notes appear at the bottom regardless of source position.
See: Footnotes
Images
Inline images


See: Images
Reference images
![Alt text][logo]
[logo]: /img/logo.png "Logo"
Data URIs
![Dot][dot]
[dot]: <data:image/png;base64,...>
Angle brackets are optional; use them when the URI has spaces or unbalanced parentheses.
Code
Inline code
`code`
`` `code` ``
A code span ends with a backtick run of the same length; one space inside each end is stripped.
See: Code spans
Fenced code
```js
const x = 1
```
The info string's first word is the language; a backtick info string cannot contain backticks.
See: Fenced code blocks
Nested code fences
````markdown
```js
const x = 1
```
````
A fence inside another needs a longer outer fence, or tildes. The closing fence must match the opening character and be at least as long.
Indented code
four spaces
make a code block
Four spaces indent a code block in CommonMark.
See: Indented code blocks
Blocks
Blockquotes
> A quote
> continues here.
>
> > Nested quote
> may be omitted on lazy paragraph continuation lines. A > on the blank line keeps one quote; without it they become two.
See: Block quotes
Horizontal rules
---
***
___
Three or more matching -, *, or _, optionally spaced. Directly under text, --- is a Setext H2 instead.
See: Thematic breaks
HTML
Press <kbd>Ctrl</kbd>+<kbd>C</kbd>.
<div class="note">
<p>Raw HTML block.</p>
</div>
Inline tags pass through. A <div> block runs to a blank line and its contents are not parsed as Markdown. GitHub filters <script>, <style> and similar tags.
See: Raw HTML, HTML blocks
Tables
Basic table
| Name | Value |
| ----- | ----- |
| Alpha | 1 |
| Beta | 2 |
Header and delimiter rows must match in cell count; body rows pad or truncate. Cells hold inline content; escape a pipe as \|.
See: Tables
Alignment
| Left | Center | Right |
| :--- | :----: | ----: |
| a | b | c |
See: Tables
0 Comments for this cheatsheet. Write yours!