Markdown Cheatsheet

Step 1 / 3 33%

Choose a Markdown topic

Start with one group of examples, then open the complete reference.

Essential Markdown syntax, grouped by category and shown with both the copy-ready source and the output of a real parser. It covers CommonMark basics (headings, lists, emphasis, links, images and fenced code) plus GitHub Flavored Markdown extensions (tables, task lists, strikethrough and bare URL autolinking). Keep it handy when you switch between GitHub, GitLab, Obsidian and static-site generators.

How to use the cheatsheet

  1. 1

    Browse by category

    Filter the full reference or choose one topic in the guided view.

  2. 2

    Compare source and result

    Each example shows the raw Markdown beside output from a real GFM parser.

  3. 3

    Copy the snippet

    Tap copy to grab the source for any example.

  4. 4

    Check the dialect badge

    Each example is marked as CommonMark or GitHub Flavored Markdown (GFM).

Headings

# H1 title
## H2 section
### H3 subsection

Use ATX-style (#) rather than Setext (=== under text). Every parser supports both, but ATX is easier to read in a diff.

Emphasis

*italic* or _italic_, **bold** or __bold__, ***bold italic***. GFM adds ~~strikethrough~~.

Lists

Unordered lists use -, * or + (pick one and stick with it):

- First
- Second
  - Nested

Ordered lists renumber automatically:

1. Item
1. Item
1. Item

Code

Inline: `code`. Fenced blocks with optional language tag:

```python
def hello(name):
    return f"Hello, {name}"
```

Indent with four spaces for a code block if you prefer the older syntax.

Links and images

[Link text](https://example.com)
[Link with title](https://example.com "Tooltip")
![Alt text](/path/to/image.png)

Reference-style keeps long URLs out of the paragraph:

See the [docs][1].

[1]: https://example.com/docs

Tables (GFM)

| Col A | Col B |
|-------|------:|
| a     |     1 |
| b     |    22 |

Alignment uses colons in the separator row: :--- left, :---: center, ---: right.

Task lists (GFM)

- [x] Done
- [ ] Todo

Common gotchas

  • Two trailing spaces insert a line break within a paragraph. One space just joins the lines.
  • Blank line required before most block elements (headings, lists, code blocks).
  • Nested-list indentation depends on the parent marker and content. Align the nested marker under the parent text instead of assuming a fixed number of spaces.
  • Escape with backslash for literal punctuation: \*not italic\*.
  • Smart quotes differ by renderer. GitHub leaves them alone; Pandoc converts.

Frequently Asked Questions

CommonMark defines the portable core, including headings, lists, links and fenced code with optional info strings. GFM (GitHub Flavored Markdown) adds tables, task lists, strikethrough and autolinking for bare URLs. Other editors may implement a subset or add their own extensions.

In a Markdown file, a single newline is normally a soft break. For a hard line break in CommonMark or GFM, end the first line with two spaces or a backslash.

CommonMark recognizes raw HTML, but the host decides whether to allow, sanitize or escape it. GitHub sanitizes rendered HTML, and this cheatsheet escapes HTML in previews for safety.

CommonMark has no built-in table-of-contents syntax. GitHub creates heading anchors and shows an outline for files with multiple headings. Other platforms have their own behavior: MkDocs can use [TOC] when its TOC extension is enabled, while Docusaurus derives a page TOC from headings.

The CommonMark examples and many GFM examples do. Obsidian also supports its own wikilinks ([[Page name]]), callouts and embeds; those extensions are outside this cheatsheet.

Related Tools