Markdown Cheat Sheet

Complete syntax reference with copy-paste examples

Headings

# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6

Always put a space after the #. Most Markdown processors require it.

Alternative syntax for H1 and H2:

Heading 1
=========

Heading 2
---------

Text Formatting

**Bold text**
*Italic text*
***Bold and italic***
~~Strikethrough~~
Syntax Result
**bold** bold
*italic* italic
***both*** both
~~strike~~ strike

You can also use underscores: _italic_ and __bold__. Asterisks are more common and work in more contexts (mid-word emphasis).

Links

[Link text](https://example.com)
[Link with title](https://example.com "Hover text")
<https://example.com>

Reference-style links for cleaner source:

[Link text][ref]

[ref]: https://example.com "Optional title"

Images

![Alt text](image.png)
![Alt text](image.png "Optional title")

To resize images, you need HTML:

<img src="image.png" alt="Alt text" width="400">

Lists

Unordered:

- Item one
- Item two
  - Nested item
  - Another nested
- Item three

Ordered:

1. First
2. Second
3. Third

Ordered lists auto-number — you can use 1. for every item and the renderer will count correctly.

Task lists (GitHub Flavored):

- [x] Done
- [ ] Not done
- [ ] Also not done

Blockquotes

> This is a blockquote.
>
> It can span multiple lines.
>
> > Nested blockquotes work too.

Code

Inline code:

Use `backticks` for inline code.

Code blocks with syntax highlighting:

```javascript
function greet(name) {
    return `Hello, ${name}!`;
}
```

Common language identifiers: javascript, python, bash, json, html, css, swift, go, rust, sql, yaml, markdown.

Code block without highlighting:

```
Plain code block
No highlighting
```

Tables

| Header 1 | Header 2 | Header 3 |
|----------|----------|----------|
| Cell 1   | Cell 2   | Cell 3   |
| Cell 4   | Cell 5   | Cell 6   |

Alignment:

| Left     | Center   | Right    |
|:---------|:--------:|---------:|
| text     | text     | 123      |

For a deep dive, see our full guide: Markdown Table Syntax.

Horizontal Rules

---
***
___

All three produce a horizontal line. Use --- — it’s the most common convention.

Line Breaks

End a line with two spaces to create a line break (soft return):

First line
Second line (same paragraph)

Or use a blank line for a new paragraph:

First paragraph.

Second paragraph.

Escaping Characters

Use a backslash to display literal Markdown characters:

\* Not italic \*
\# Not a heading
\[Not a link\]
\| Not a table pipe

Characters you can escape: \ ` * _ {} [] () # + - . ! |

GitHub Flavored Markdown (GFM) Extras

These features are supported by GitHub, GitLab, and most modern Markdown apps:

Autolinked URLs:

https://example.com

Renders as a clickable link without bracket syntax.

Footnotes:

Here is a statement[^1].

[^1]: This is the footnote text.

Emoji (GitHub):

:thumbsup: :rocket: :warning:

Alerts (GitHub, new):

> [!NOTE]
> Useful information.

> [!WARNING]
> Important warning.

Extended Syntax

Some Markdown renderers support additional features beyond GFM:

Mermaid diagrams:

```mermaid
graph TD
    A[Start] --> B{Decision}
    B -->|Yes| C[Do thing]
    B -->|No| D[Don't]
```

Supported by GitHub, GitLab, Obsidian, and MDViewer.

Math (KaTeX/LaTeX):

Inline: $E = mc^2$

Display:
$$
\sum_{i=1}^{n} x_i = x_1 + x_2 + \cdots + x_n
$$

Supported by GitHub, Obsidian, Jupyter, and MDViewer.

Definition lists:

Term
: Definition text

Supported by some processors (PHP Markdown Extra, Pandoc). Not standard GFM.

Quick Reference Table

Element Syntax
Heading # H1 to ###### H6
Bold **text**
Italic *text*
Link [text](url)
Image ![alt](url)
Inline code `code`
Code block ``` + language
List - item or 1. item
Task list - [x] done
Blockquote > text
Table | H | H |
Horizontal rule ---
Line break Two trailing spaces

Previewing Your Markdown

Writing Markdown is easy. Seeing how it renders without pushing to GitHub or opening a heavy editor — that’s where a dedicated viewer helps.

MDViewer is a native macOS app that renders GitHub Flavored Markdown including tables, code blocks with syntax highlighting, Mermaid diagrams, and KaTeX math. Double-click any .md file in Finder to see it rendered instantly. Currently free for early adopters.

You can also use our free online Markdown viewer at getmd.ma/viewer — drop a file in your browser, no install needed.

Try MDViewer

MDViewer is currently free for early adopters — all features included. Download it and see if it fits your workflow.

Download MDViewer

Requires macOS 13.0 or later. Intel and Apple Silicon.