MarkdownViewer
ViewerCheat SheetBlogAboutContact
Home/Cheat Sheet

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.

Basic + GFM

Headings, emphasis, lists, tables, task lists, and code blocks.

Math & diagrams

LaTeX expressions via KaTeX and Mermaid flowcharts, ready to paste.

Test it live

The editor ships with this exact syntax guide as its sample document.

01

Headings

ElementMarkdown 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.

02

Text formatting

ElementMarkdown 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.

03

Links and images

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

Auto-linked URL: https://markdownviewer.org

[Reference-style link][1]

[1]: https://example.com

Image 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.

04

Lists

Ordered and unordered lists

1. First item
2. Second item
    1. Indented item
    2. Another indented item

- Apple
- Banana
    - Yellow banana
    - Green banana

Indent 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 production

Task lists render as checkboxes on GitHub and in this site's Markdown Viewer — where clicking a checkbox updates the markdown source.

05

Blockquotes

> "The best way to predict the future is to invent it." - Alan Kay

> First level
> > Second level
> > > Third level

Prefix each line with >. Stack them for nested quotes, and put other markdown (lists, code, headings) inside freely.

06

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 \|.

07

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.

08

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.

09

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.

10

HTML elements in markdown

ElementMarkdown syntax
Superscriptx<sup>2</sup>
SubscriptH<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.

11

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.

12

Escaping characters

\*Not italic\* and \*\*not bold\*\*

\# Not a heading

\- Not a list item

Put a backslash before a character markdown would otherwise interpret: \* \_ \` \# \[ \] \( \) \| \\.

13

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.

MarkdownViewer

Free online markdown editor with live preview, math, diagrams, and export — your content never leaves your browser.

Explore

  • Markdown Viewer
  • Markdown Cheat Sheet
  • Features
  • FAQ

Company

  • Blog
  • About
  • Contact
  • Privacy Policy
  • Terms of Service
© 2026 Markdown Viewer · markdownviewer.orgFree, private, and open in your browser.