REFERENCE

MARKDOWN
CHEATSHEET

Complete syntax reference for Markdown and GitHub Flavored Markdown (GFM). Every element with examples you can copy directly.

HEADINGS

ElementSyntaxNotes
Heading 1# Heading 1Largest heading, maps to <h1>
Heading 2## Heading 2Maps to <h2>
Heading 3### Heading 3Maps to <h3>
Heading 4#### Heading 4Maps to <h4>
Heading 5##### Heading 5Maps to <h5>
Heading 6###### Heading 6Smallest heading, maps to <h6>
Setext H1
Heading
======
Underline-style, H1
Setext H2
Heading
------
Underline-style, H2

EMPHASIS

ElementSyntaxNotes
Bold**bold text**Also __bold text__
Italic*italic text*Also _italic text_
Bold + Italic***bold italic***Also ___bold italic___
Strikethrough~~strikethrough~~GFM only
Highlight==highlighted==Some parsers only (not standard GFM)

LINKS

ElementSyntaxNotes
Inline link[link text](https://example.com)Basic inline link
Link with title[link text](https://example.com "Title")Title shown on hover
Reference link[link text][ref-id]Definition placed elsewhere in document
Reference definition[ref-id]: https://example.comCan be placed anywhere in the document
Auto-link<https://example.com>URL becomes a clickable link
Auto-link (email)<user@example.com>Email becomes mailto link
Bare URL (GFM)https://example.comGFM auto-links bare URLs without angle brackets

IMAGES

ElementSyntaxNotes
Inline image![alt text](image.png)Basic inline image; alt text required for accessibility
Image with title![alt text](image.png "Title")Title shown on hover (tooltip)
Reference image![alt text][img-ref]Defined as [img-ref]: image.png
Linked image[![alt](image.png)](https://example.com)Image that functions as a link

LISTS

ElementSyntaxNotes
Unordered (dash)- ItemCan also use * or +
Unordered (asterisk)* ItemInterchangeable with -
Ordered1. ItemNumbers auto-increment in most renderers
Ordered (any number)
1. First
1. Second
1. Third
All 1. still renders as 1, 2, 3
Nested list
- Item
  - Nested
Indent with 2 or 4 spaces
Nested ordered
1. Item
   1. Nested
3 spaces for ordered nesting
Task list (GFM)- [ ] UncheckedCheckbox list item (space between brackets)
Task list checked (GFM)- [x] CheckedLowercase x marks as complete

BLOCKQUOTES

ElementSyntaxNotes
Single> Quoted textRenders as a blockquote element
Nested quote>> Nested quoteQuote inside a quote
Multi-line
> Line 1
> Line 2
Each line prefixed with >
Multi-paragraph
> Para 1
>
> Para 2
Blank > line separates paragraphs
With elements
> ## Heading
>
> Paragraph
Blockquotes can contain any block element

CODE

ElementSyntaxNotes
Inline code`code`Single backticks
Inline with backtick`` `code with `backtick` `` Use double backticks to wrap code containing a backtick
Fenced block
```
code here
```
Triple backticks; blank line before and after recommended
Fenced with language
```javascript
const x = 1
```
Enables syntax highlighting
Indented block code4 spaces indent (or 1 tab); must be preceded by blank line
Common languagesjavascripttypescriptpythonbashcsshtmljsonyamlLanguage identifiers for fenced blocks

TABLES GFM only

ElementSyntaxNotes
Basic table
| Header | Header |
|--------|--------|
| Cell   | Cell   |
Pipes on both sides
Left-align|:-------|Colon on left side of dashes (default)
Center-align|:------:|Colons on both sides
Right-align|-------:|Colon on right side of dashes
Outer pipes optional
Header | Header
-------|-------
Cell   | Cell
Leading and trailing pipes are optional

TASK LISTS GFM only

ElementSyntaxNotes
Unchecked- [ ] Task to doSpace between the brackets
Checked- [x] Completed taskLowercase x marks item as complete
Checked (uppercase)- [X] Also worksUppercase X is also valid in most renderers
Nested tasks
- [ ] Parent task
  - [x] Sub-task done
  - [ ] Sub-task todo
Indent with 2 spaces

HORIZONTAL RULES

ElementSyntaxNotes
Dashes---Three or more hyphens
Asterisks***Three or more asterisks
Underscores___Three or more underscores
Spaced dashes- - -Spaces between characters are allowed
ImportantMust be preceded by a blank line. Without one, a line of dashes after text is parsed as a Setext H2 heading.

HTML IN MARKDOWN

ElementSyntaxNotes
Keyboard keys<kbd>Ctrl</kbd>+<kbd>C</kbd>Renders styled key names
SubscriptH<sub>2</sub>OSubscript text
SuperscriptE=mc<sup>2</sup>Superscript text
Inline span<span class="highlight">text</span>Inline styled text
Block-level
<div>

# Markdown here

</div>
Blank lines required for markdown inside block HTML
Details/Summary
<details>
<summary>Click to expand</summary>
Hidden content here
</details>
Collapsible section; widely supported

ESCAPING CHARACTERS

ElementSyntaxNotes
Escape asterisk\*not italic\*Backslash prevents markdown parsing
Escape underscore\_not italic\_Renders as literal underscore
Escape backtick\`not code\`Renders as literal backtick
Escape hash\# Not a headingRenders as literal hash character
Escapable characters\\\*\_\{\}\[\]\(\)\#\+\-\.\!\`\|Full list of characters that can be escaped with backslash

FRONTMATTER YAML

ElementSyntaxNotes
Opening delimiter---Triple dashes; must be the very first line of the file
String fieldtitle: My PostUnquoted strings work for most values
Quoted stringtitle: "Post: With Colon"Quote when value contains special YAML characters
Datedate: 2024-01-15ISO 8601 date format
Booleandraft: falsetrue or false, no quotes
Array (inline)tags: [markdown, writing]Flow sequence syntax
Array (block)
tags:
  - markdown
  - writing
Block sequence syntax; 2-space indent
Numberweight: 10Integers and floats without quotes
Closing delimiter---Triple dashes close the frontmatter block
Full example
---
title: "Getting Started with Markdown"
date: 2024-01-15
draft: false
tags:
  - markdown
  - writing
weight: 1
---

TRY IT LIVE

Paste any of these examples into the online markdown editor to see them rendered instantly.