Markdown is a lightweight markup language created by John Gruber in 2004. The idea: plain text that already looks readable in an email client compiles to clean HTML. CommonMark (2014) standardised the core; GitHub Flavored Markdown (GFM) adds tables, task lists, and autolinks. This guide pulls the syntax you'll actually use from both.
Headings
# H1 (page title — exactly one per page)
## H2 (section)
### H3 (subsection)
#### H4
##### H5
###### H6There's a Setext alternative — === below text for H1, --- for H2 — but every modern tool supports atx (#), so prefer that.
Inline styling
**bold** or __bold__
*italic* or _italic_
~~strikethrough~~
`inline code`
==highlight== (some processors only)Putting i*tal*ic in the middle of a word trips some parsers. Split with spaces or apply only to whole words.
Lists
- unordered (-, *, + all work)
- second item
- nest with 2 spaces of indent
- deeper
1. ordered
2. auto-numbered
3. write any number — renumbered from 1
1. nest with 3 spaces (or a tab)For nesting, use 2 or 4 spaces. Tabs behave differently across parsers.
Links and images
[label](https://example.com)
[label](https://example.com "tooltip")
Autolink: <https://example.com>
Reference style:
This is a [Markdown][1] document.
[1]: https://daringfireball.net/projects/markdown/
Image: 
Image + link: [](https://example.com)Reference style keeps the prose clean — long URLs don't interrupt sentences. Reuse a single ID for repeated links.
Code blocks
Inline `code` uses single backticks.
```
Fenced block. No language.
```
```javascript
// language hint — syntax highlighting
const x = 42;
```
Or use 4-space indent:
function foo() {
return 42;
}To include backticks inside a fence, use four backticks for the outer fence or switch to ~~~ (tildes).
Blockquotes
> A single-line quote.
>
> Blank `>` separates paragraphs.
>
> > Nested quote.
> Use **bold**, *italic*, `code` inside quotes.
> Lists work too:
>
> - item 1
> - item 2Tables (GFM)
| Left | Center | Right |
|:---|:---:|---:|
| A | B | C |
| 1 | 2 | 3 |The colons in the separator row set alignment — :--- left, :---: center, ---: right. Aligning the pipes visually helps readability but parsers don't require it.
For line breaks inside a cell, use <br>. A real newline breaks the table. For anything complex, drop to raw HTML <table>.
Task lists (GFM)
- [ ] unchecked
- [x] checked
- [ ] nestable
- [x] sub-item checkedHeavily used in GitHub Issues, PRs, and READMEs. [ ] / [x] inside a list.
Footnotes (extension)
Footnotes[^1] live at the bottom of the page.
[^1]: The footnote body. Aggregated automatically.Not part of CommonMark, but supported by GFM, Pandoc, MkDocs, and others. Handy for citations.
Horizontal rule
--- (three dashes)
*** (three asterisks)
___ (three underscores)All equivalent; --- is the convention.
Line breaks and paragraphs
The classic Markdown gotcha — a blank line separates paragraphs; plain newlines are squashed.
First line.
Same paragraph (newline ignored).
A blank line = new paragraph.
Two trailing spaces at end of line
=> hard line break (<br>)Trailing spaces are invisible and easy to lose. Some parsers also accept \ (backslash + newline) as a hard break.
Embedded HTML
Most Markdown processors pass HTML through.
<details>
<summary>Collapsible section</summary>
You can still use **Markdown** inside.
</details>
<sub>subscript</sub> or <sup>superscript</sup>Some sandboxed environments (GitHub README) strip out script and iframe tags for security.
Escaping
Prefix a special character with \ to render it literally.
\* literal asterisk
\# avoid a heading
\_ literal underscore
\` literal backtickEmoji and mentions (GFM)
:rocket: :tada: :white_check_mark:
@username ← mention (GitHub etc.)
#123 ← issue referenceConversion tools
Iterating with a live preview is the fastest way to learn — Markdown Preview renders as you type and sanitizes with DOMPurify against XSS. Moving an existing HTML page to Markdown? HTML → Markdown converts headings, lists, links, code, and tables automatically.
Common gotchas
- Merged lists — two adjacent lists without a blank line between them combine. Separate with one blank line.
- Pipes inside table cells — escape as
\|. - List indentation — 2 spaces work in some parsers but fail in others. 4 spaces is the safest.
- Triple backticks inside a code block — use a four-backtick fence or switch to ~~~.
Summary
- Headings
#, bold**, italic*, code`. - Lists with
-/1.; nest by indenting (2 or 4 spaces). - Links
[text](url), images. - Fenced code blocks with ``` plus a language hint. Tables and task lists are GFM extras.
- Two newlines = new paragraph. Single newlines are ignored.