Every markdown element, on one page.
Last updated: July 2026
This markdown cheat sheet covers everything from basic formatting to GitHub Flavored Markdown, LaTeX math, Mermaid diagrams, and inline HTML. Every example is copy-ready — paste it into Markdown Viewer to see it rendered live.
Headings, emphasis, lists, tables, task lists, and code blocks.
LaTeX expressions via KaTeX and Mermaid flowcharts, ready to paste.
The editor ships with this exact syntax guide as its sample document.
Headings
| Element | Markdown syntax |
|---|---|
| Heading 1 | # H1 |
| Heading 2 | ## H2 |
| Heading 3 | ### H3 |
| Heading 4–6 | #### to ###### |
Use one # per level with a space before the title. Keep a single H1 per document and don't skip levels — clean heading structure helps readers, HTML conversion, and SEO alike.
Text formatting
| Element | Markdown syntax |
|---|---|
| Bold | **bold text** |
| Italic | *italic text* |
| Bold + italic | ***bold and italic*** |
| Strikethrough | ~~strikethrough~~ |
| Inline code | `code` |
Underscores work too (__bold__, _italic_), but asterisks behave more predictably in the middle of words. Strikethrough is a GitHub Flavored Markdown extension.
Links and images
[Link text](https://example.com "Optional title")

Auto-linked URL: https://markdownviewer.org
[Reference-style link][1]
[1]: https://example.comImage syntax is link syntax with a leading !. Bare URLs become clickable automatically in GFM. Always write meaningful alt text — it matters for accessibility and image SEO.
Lists
Ordered and unordered lists
1. First item
2. Second item
1. Indented item
2. Another indented item
- Apple
- Banana
- Yellow banana
- Green bananaIndent nested items with four spaces (or one tab). Ordered lists renumber themselves, so 1. on every line also works.
Task lists (GFM)
- [x] Write the documentation
- [x] Add syntax highlighting
- [ ] Review pull request
- [ ] Deploy to productionTask lists render as checkboxes on GitHub and in this site's Markdown Viewer — where clicking a checkbox updates the markdown source.
Blockquotes
> "The best way to predict the future is to invent it." - Alan Kay
> First level
> > Second level
> > > Third levelPrefix each line with >. Stack them for nested quotes, and put other markdown (lists, code, headings) inside freely.
Tables
| Feature | Supported | Notes |
|:---------------|:---------:|-------------:|
| GFM Tables | Yes | Full support |
| Left aligned | Yes | Use :--- |
| Center aligned | Yes | Use :---: |
| Right aligned | Yes | Use ---: |The pipes don't need to line up — renderers only care about structure. Control column alignment with colons in the divider row: :--- left, :---: center, ---: right. Escape a literal pipe inside a cell as \|.
Code blocks
```javascript
function greet(name) {
const message = `Hello, ${name}!`;
return message;
}
```
```python
def fibonacci(n):
a, b = 0, 1
for _ in range(n):
yield a
a, b = b, a + b
```Fence code with triple backticks and add a language hint (javascript, python, json, rust, sql…) for syntax highlighting — this site's editor recognizes 190+ languages. Use indentation-free fences instead of the old four-space style; they survive copy-paste better.
Mathematical expressions (LaTeX)
Inline math: $E = mc^2$ and $\alpha + \beta = \gamma$
Display equations:
$$\frac{\partial f}{\partial x} = \lim_{h \to 0} \frac{f(x+h) - f(x)}{h}$$
$$\sum_{i=1}^{n} i^2 = \frac{n(n+1)(2n+1)}{6}$$Wrap inline math in single dollar signs and display math in double dollar signs. Common constructs: fractions \frac{a}{b}, roots \sqrt{x}, sums \sum_{i=1}^{n}, integrals \int_a^b, and Greek letters \alpha, \beta. Rendering is powered by KaTeX in this site's Markdown Viewer.
Mermaid diagrams
```mermaid
flowchart LR
A[Start] --> B{Is it working?}
B -->|Yes| C[Great!]
B -->|No| D[Debug]
D --> B
```
```mermaid
sequenceDiagram
User->>Editor: Type markdown
Editor->>Preview: Render content
Preview-->>User: Live preview
```Mermaid turns text into flowcharts, sequence diagrams, Gantt charts, and more. Write the diagram in a fenced block tagged mermaid — GitHub, GitLab, Notion, and Obsidian all render it natively. Paste the examples into Markdown Viewer to see them rendered with fullscreen zoom and PNG/SVG export.
HTML elements in markdown
| Element | Markdown syntax |
|---|---|
| Superscript | x<sup>2</sup> |
| Subscript | H<sub>2</sub>O |
| Keyboard key | <kbd>Ctrl</kbd> + <kbd>S</kbd> |
| Abbreviation | <abbr title="HyperText Markup Language">HTML</abbr> |
| Highlight | <mark>highlighted text</mark> |
Markdown allows raw HTML for the few things it has no syntax for. Note that some platforms (like GitHub comments) strip certain tags; the ones above are widely supported.
Horizontal rules
---
***
___Three or more hyphens, asterisks, or underscores on their own line all produce a horizontal rule. Leave a blank line above --- so it isn't parsed as a heading underline.
Escaping characters
\*Not italic\* and \*\*not bold\*\*
\# Not a heading
\- Not a list itemPut a backslash before a character markdown would otherwise interpret: \* \_ \` \# \[ \] \( \) \| \\.
Platform differences to know
- GitHub — full GFM plus Mermaid, math, footnotes, and alerts (
> [!NOTE]). - Discord — bold, italic, strikethrough, code, and spoilers (
||text||); no tables or headings in normal messages. - Reddit — basic syntax plus tables and superscript (
^text); fenced code blocks work in newer editors. - Slack — uses its own "mrkdwn": single asterisks for bold, underscores for italic; standard markdown links don't work.
Test any syntax live: open the Markdown Viewer — its built-in sample document contains every example on this page, and you can export the result as HTML or PDF.