Markdown cheat sheet
On this page
Every Markdown syntax you’ll need, side by side with the rendered output. This page covers CommonMark (the standard) plus GitHub-Flavored Markdown (GFM) extensions — the same dialect rendered by GitHub, the viewer, and most modern Markdown processors.
For interactive testing, paste any of these examples into the viewer and watch them render.
Headings
# H1 — page title
## H2 — section
### H3 — subsection
#### H4
##### H5
###### H6
Use a single H1 per page. Skipping levels (H1 → H3) hurts readability and SEO; go through each level in order.
Don’t: add # characters with no space — #heading is a tag, not a heading.
Paragraphs and line breaks
First paragraph.
Second paragraph — a blank line separates them.
A line break in a single paragraph requires
two trailing spaces, or an explicit \ backslash.
In GFM (GitHub’s flavor), a single newline becomes a <br> automatically
— no trailing spaces needed. The viewer follows GFM behavior.
Emphasis
**bold** or __bold__
*italic* or _italic_
***bold italic***
~~strikethrough~~ (GFM)
Convention: use * and _ consistently. Some teams prefer **bold**
(asterisks) for bold and _italic_ (underscores) for italic to make the
distinction visually obvious.
Lists
Unordered
- Item one
- Item two
- Nested (2-space indent)
- Item three
Ordered
1. First
2. Second
3. Third
The numbers don’t have to be sequential — Markdown auto-numbers them. Many
authors write 1. for every line and let the renderer count.
Task lists (GFM)
- [x] Done
- [ ] Pending
- [ ] Also pending
Renders as checkboxes; usable as a TODO format in READMEs and issues.
Links
[Inline link](https://tooljo.com)
[Title attribute](https://tooljo.com "tooljo home")
<https://tooljo.com> ← autolink
https://tooljo.com ← autolink (GFM)
[Reference link][ref]
[Implicit reference][]
[ref]: https://tooljo.com
[Implicit reference]: https://tooljo.com
For long links repeated multiple times, reference-style keeps the prose clean. The reference definitions can go anywhere in the document.
Images


[](https://example.com)
Always include alt text — it’s the SEO and accessibility signal. Reference-style works for images too:
![Logo][logo]
[logo]: assets/logo.svg "Company logo"
Code
Inline
Use the `format` function — backticks make code spans.
Fenced blocks
```js
function greet(name) {
return `Hello, ${name}!`;
}
```
The language hint (js, python, rust, bash, etc.) enables syntax
highlighting in renderers that support it. GitHub recognizes 600+ languages;
most renderers know the popular dozen.
Indented blocks (legacy)
Indented 4 spaces.
Becomes a code block.
Avoid in new content — fenced blocks are clearer and let you specify a language.
Blockquotes
> A single-line quote.
> A multi-line quote.
> Continued on the next line.
>
> > Nested quote (use multiple `>`).
Tables (GFM)
| Column | Type | Notes |
|---|---|---|
| id | uuid | primary key |
| email | text | unique |
| Left | Center | Right |
|:-----|:------:|------:|
| L | C | R |
The : in the divider row sets alignment. Cells don’t have to line up
visually in the source — the renderer normalizes them.
Horizontal rule
---
***
___
Three of any of these on their own line. --- is most common.
Escaping
Use \ to escape a Markdown character:
\*not italic\*
\# not a heading
\[not a link\](nowhere)
Inside code spans and code blocks, no escaping needed — content is verbatim.
Footnotes (GFM)
Here's a claim[^1] and another[^longer-name].
[^1]: First footnote.
[^longer-name]: A footnote with a more readable identifier.
Renders as superscript references with a list at the bottom.
HTML embeds
Markdown lets you embed raw HTML. Common useful cases:
<details>
<summary>Click to expand</summary>
Hidden content here.
</details>
<kbd>Cmd</kbd>+<kbd>K</kbd>
<sub>subscript</sub> and <sup>superscript</sup>
The viewer sanitizes the rendered HTML, so embedded <script>
or event handlers are stripped — safe to render untrusted markdown.
Front matter (extension, not standard)
Many static-site generators (Jekyll, Hugo, Astro, Gatsby) support YAML or TOML front matter at the top of a Markdown file:
---
title: Hello
date: 2026-04-26
tags: [intro, demo]
---
# Hello world
This is not part of CommonMark or GFM. Renderers that don’t support
it show the front matter as a literal --- rule and a list. Strip it
before pasting into a generic Markdown viewer.
What’s NOT in standard Markdown
These are common requests that need extensions or a non-standard flavor:
| Feature | Where it works | Where it doesn’t |
|---|---|---|
| Underline | HTML <u> only | Markdown has no syntax |
| Color | HTML <span style> | Markdown has no syntax |
| Centered text | HTML <div align> | Standard Markdown |
| Math | KaTeX (extension) | CommonMark / GFM |
| Mermaid diagrams | GitHub, mdBook (extension) | CommonMark / GFM |
| Highlighting | ==text== in some flavors | CommonMark / GFM |
| Definition lists | Pandoc, MultiMarkdown | GFM |
| Abbreviations | Markdown Extra | GFM |
When you need these, either embed HTML directly or pick a flavor that supports them (Pandoc Markdown, MultiMarkdown, AsciiDoc).
Rendering targets
The same Markdown source renders slightly differently across:
- GitHub — GFM with their internal CSS. The de facto reference.
- GitLab — GFM-compatible, plus extras (math via KaTeX, Mermaid native).
- Reddit — a heavily restricted subset.
- Discord — GFM-ish with Discord-specific timestamps and mentions.
- VS Code — preview pane uses markdown-it; supports GFM by default.
- Static site generators (Hugo, Jekyll, Astro, Gatsby) — usually GFM via a parser like Goldmark or marked.
- md.tooljo.com ← this site, GFM via marked + DOMPurify.
If a snippet renders fine here but not on the target platform, the issue is almost always (a) a non-standard extension or (b) the platform’s sanitization stripping HTML.
Syntax to memorize first
If you only learn five things:
# H1,## H2for structure.**bold**,*italic*for emphasis.- itemfor lists.[text](url)for links.```(triple backticks) for code blocks.
Everything else, look up here as needed.
Try it
- Markdown viewer — paste any of these examples and watch them render
- Markdown → HTML — copy clean HTML output
- HTML → Markdown — reverse direction
- What is Markdown? — background