DevKits
46 snippets · 13 sections

Markdown Cheat Sheet

Every Markdown syntax element on one page, with copyable snippets. Covers both CommonMark (the modern standard) and GFM (GitHub Flavored) extras — task lists, strikethrough, tables, footnotes.

Jump to a section, copy the exact snippet you need, and paste it into your README, issue tracker, or docs. For a live preview and conversion, try the Markdown to HTML tool. Building a table by hand? Use the Markdown Table Generator instead.

Headings

Two syntaxes. ATX (# style) is the modern default. Setext (=== / ---) is legacy but supported.

H1 – H6 (ATX)

# H1
## H2
### H3
#### H4
##### H5
###### H6

Setext H1 and H2

Alt-H1
======

Alt-H2
------

Only H1 and H2 have setext forms.

Closing hashes (optional)

## Also valid ##

Emphasis

Italic, bold, and combined bold-italic.

Italic

*italic* or _italic_

Bold

**bold** or __bold__

Bold + italic

***bold italic*** or ___bold italic___

Strikethrough (GFM)

~~struck through~~

GitHub Flavored Markdown. Not in the original CommonMark.

Lists

Unordered lists use -, *, or +. Ordered lists use 1., 2., etc. Nesting uses 2- or 4-space indent (depends on renderer).

Unordered

- Apple
- Banana
- Cherry

Ordered

1. First
2. Second
3. Third

Ordered starting from N

5. Five
6. Six
7. Seven

Most renderers respect the starting number but auto-increment after.

Nested lists

- Parent
  - Child
    - Grandchild

Task list (GFM)

- [x] Done
- [ ] To-do
- [ ] Another

GitHub-flavored Markdown. Renders as checkbox in GitHub UI.

Images

Same syntax as links, prefixed with !. The 'alt' text is required for accessibility.

Inline image

![Alt text](https://example.com/img.png "Optional title")

Reference image

![Alt][logo]

[logo]: https://example.com/img.png

HTML for size / attributes

<img src="pic.png" alt="Pic" width="200" />

Pure Markdown has no width / height syntax — drop to inline HTML.

Code

Inline with backticks; fenced blocks with ``` and an optional language for syntax highlighting.

Inline

Use `printf` for formatted output.

Fenced code block

```js
const answer = 42;
console.log(answer);
```

Indented code block

    // 4 spaces of indent
    def hello():
        return 'world'

Legacy. Prefer fenced.

Inline with backticks inside

``Use `code` inside``

Use double backticks (or more) to include literal backticks.

Blockquotes

Start each line with >. Nest with additional >.

Single-level

> A quoted line.

Multi-paragraph

> First paragraph.
>
> Second paragraph.

Nested

> Outer
> > Inner
> > > Deeper

Tables (GFM)

Pipe-separated. First divider row uses --- with optional :--- / :---: / ---: for alignment.

Basic table

| Name | Age | City |
|------|-----|------|
| Alice | 30 | NYC |
| Bob | 25 | LA |

Alignment

| Left | Center | Right |
|:-----|:------:|------:|
| a | b | c |

:--- left, :---: center, ---: right.

Escape pipes

| Column | Value |
|--------|-------|
| pipe | a \| b |

Escape a literal | with \| inside cells.

Horizontal rule

Three or more hyphens, asterisks, or underscores on their own line.

Hyphens

---

Asterisks

***

Underscores

___

Escape sequences

Backslash-escape any Markdown special character to make it literal.

Literal characters

\*not italic\* \[not a link\] \`not code\`

All escapable characters

\ ` * _ { } [ ] ( ) # + - . ! |

Inline HTML

Any HTML is passed through as-is (in most renderers). Use it for anything Markdown can't express.

Inline element

This word is <em>emphasized</em> via HTML.

Details / summary (collapsible)

<details>
<summary>Click to expand</summary>

Hidden content.

</details>

GitHub renders this as a collapsible section. Very useful for READMEs.

Line break

Line 1<br />
Line 2

Alternative to two-space line ending. More explicit but less idiomatic.

GitHub Flavored (GFM) extras

Features from GFM that aren't in the original CommonMark. Widely supported by GitHub, GitLab, Bitbucket, and most static-site generators.

Strikethrough

~~struck~~

Task list

- [x] Done
- [ ] Not yet

Tables

| a | b |
|---|---|
| 1 | 2 |

Autolink

www.example.com and https://example.com

GFM auto-links bare URLs. CommonMark requires <url> or explicit [text](url).

Emoji shortcode (GitHub)

:smile: :rocket: :+1:

GitHub-specific. Not universally supported.

Footnotes

Here is a claim[^1].

[^1]: With a footnote.

GFM 2021+. Supported by most modern renderers.

Line breaks

Markdown collapses single newlines into spaces by default. For a hard line break, end a line with two spaces OR use <br />.

Paragraph break

Paragraph one.

Paragraph two.

Hard break (two-space ending)

Line 1  
Line 2

Two trailing spaces before the newline. Invisible → error-prone. Prefer <br />.

Hard break (HTML)

Line 1<br />
Line 2

Try Markdown live

Paste any of these snippets into a live tool to see the rendered result and copy the resulting HTML.