Reference

The complete markdown cheatsheet.

Every syntax rule that works in Markdown Writer, grouped by flavor — CommonMark, GitHub Flavored Markdown, extensions for math, diagrams and alert callouts, and the HTML fallbacks for what markdown can't do on its own. Each rule shows the syntax, the rendered result, the gotchas, and which platforms support it.

CommonMark

Universal

The standardised baseline. Works in every markdown processor and is the foundation every other flavor builds on.

Headings

One # per level. Use one H1 per document.

markdown
# Heading 1
## Heading 2
### Heading 3
#### Heading 4

Heading 2

Heading 3

Heading 4

Bold & italic

Wrap text in asterisks. Combine for both.

markdown
*italic* and _italic_
**bold** and __bold__
***both*** and ___both___

italic and italic
bold and bold
both and both

Line breaks and new lines

A single newline is ignored. Force a break with two trailing spaces or a backslash.

markdown
First line ends with two spaces  
and this is a new line, same paragraph.

First line ends with a backslash\
and this is also a new line.

A blank line starts a new paragraph.

First line ends with two spaces
and this is a new line, same paragraph.

First line ends with a backslash
and this is also a new line.

A blank line starts a new paragraph.

  • Two trailing spaces is the original method, but the spaces are invisible and most editors strip trailing whitespace on save — which silently removes the break.
  • CommonMark also accepts a trailing backslash. It survives auto-formatting and you can see it, which makes it the safer choice in files other tools will touch.
  • A blank line is not a line break. It ends the paragraph and starts a new one, which usually renders with more vertical space.
  • <br> works anywhere raw HTML is allowed, and is the only option inside a table cell.
Works inGitHubGitLabObsidianNotionRedditDiscordSlack

Images

Same as links, with a leading exclamation mark.

markdown
![alt text](image.png)
![alt text](image.png "caption")
image.png

Lists

Hyphens or asterisks for bullets. Numbers for ordered.

markdown
- First
- Second
  - Nested
  - Nested

1. One
2. Two
  • First
  • Second
    • Nested
    • Nested
  1. One
  2. Two

Blockquotes and quote blocks

Prefix lines with a greater-than sign.

markdown
> The clouds were doing
> that thing where they
> look painted on.
The clouds were doing that thing where they look painted on.

Inline code

Wrap with single backticks.

markdown
Run `pnpm install` to get started.

Run pnpm install to get started.

Fenced code blocks

Triple backticks. Optional language hint after the opener.

markdown
```
plain code
no highlighting
```
plain code
no highlighting

Horizontal rules and dividers

Three or more hyphens, asterisks, or underscores on a line.

markdown
Above the line.

---

Below the line.

Above the line.


Below the line.

  • Three is the minimum; more makes no difference. Spaces between the characters are allowed, so - - - is also a rule.
  • Putting --- directly beneath a line of text turns that text into an H2 instead of drawing a rule — it's the old setext heading syntax. Leave a blank line above the rule to avoid it.
  • Use *** between two paragraphs if you want to sidestep the setext trap entirely.
Works inGitHubGitLabDiscordSlackObsidianNotionReddit

Escaping characters

Prefix a markdown character with a backslash to render it literally.

markdown
\*not italic\* and \_not italic\_
\# not a heading
\[not a link\](not a url)

*not italic* and _not italic_

# not a heading

[not a link](not a url)

  • Escapable characters are backslash, backtick, * _ { } [ ] ( ) # + - . ! and |. A backslash before anything else renders as a literal backslash.
  • No escaping is needed inside code spans or fenced code blocks — everything there is already literal.
  • A pipe inside a table must be escaped even within a code span, because the row is split into cells before cell contents are parsed.
Works inGitHubGitLabDiscordSlackObsidianNotionReddit

GitHub Flavored

GFM

GitHub's superset. Markdown Writer supports the full GFM spec — tables, task lists, footnotes, autolinks, strikethrough.

Tables

Pipe-separated columns. The dash row sets alignment with optional colons.

markdown
| Feature      | Status | Notes        |
| ------------ | :----: | -----------: |
| Tables       |   ✓    |     GFM      |
| Task lists   |   ✓    |     GFM      |
| Math         |   ✓    |    KaTeX     |
FeatureStatusNotes
Tables✓GFM
Task lists✓GFM
Math✓KaTeX

Task lists and checkboxes

Bullets with bracketed checkboxes. Use x for checked.

markdown
- [x] Ship cheatsheet page
- [x] Add FAQ schema
- [ ] Submit to Product Hunt
  - [ ] Nested subtask
- [ ] Land on page one
  • Ship cheatsheet page
  • Add FAQ schema
  • Submit to Product Hunt
  • Nested subtask
  • Land on page one
  • The space between the brackets is required. [ ] with nothing inside is literal text, not a checkbox.
  • The item must be a list item — a bare [ ] on its own line renders as brackets.
  • On GitHub, task lists in issues, pull requests and discussions are interactive: clicking a box edits the underlying markdown. In a README they render as static checkboxes.
  • Nest by indenting two spaces. Checking a parent does not check its children, and GitHub's progress counter only counts top-level items.
  • Either x or X works for a checked box.
Works inGitHubGitLabObsidianNotionRedditDiscordSlack

Strikethrough

Wrap with two tildes.

markdown
~~deprecated~~ replaced by the new API.

deprecated replaced by the new API.

  • GFM extension, not CommonMark — a renderer without GFM shows the tildes literally.
  • Some renderers also accept a single tilde. Slack uses single tildes and treats ~~text~~ as a literal tilde around struck text.
Works inGitHubGitLabDiscordObsidianNotionRedditSlack

Highlight

Wrap with two equals signs.

markdown
Remember to ==ship on Friday==.

Remember to ship on Friday.

  • Not part of CommonMark or GFM — GitHub shows the equals signs literally. Markdown Writer, Obsidian, and Pandoc (with the mark extension) render it as a <mark> element.
  • Same flanking rules as strikethrough: no space directly inside the markers. Escape with a backslash (\==) to write a literal pair.
Works inGitHubGitLabObsidianNotionRedditDiscordSlack

Highlighted code

Add a language hint after the opening fence.

markdown
```ts
const greet = (name: string) => `Hello, ${name}!`;
```
const greet = (name: string) => `Hello, ${name}!`;

Footnotes

Reference with [^id] in text and define elsewhere.

markdown
Markdown is portable[^1].

[^1]: Same source, every renderer.

Markdown is portable1.


  1. Same source, every renderer.

Extended

Markdown Writer

Extras Markdown Writer adds on top of GFM. Math, diagrams, and GitHub-style alert callouts — all rendered in the live preview.

Alert callouts

GitHub-style admonitions. Five types, all colour-coded.

markdown
> [!NOTE]
> Useful information users should know.

> [!TIP]
> Helpful advice for doing things better.

> [!WARNING]
> Critical content demanding immediate user attention.

Note

Useful information users should know.

Tip

Helpful advice for doing things better.

Warning

Critical content demanding immediate user attention.

Inline math

Wrap LaTeX in single dollar signs. Rendered with KaTeX.

markdown
Einstein's $E = mc^2$ holds in every frame.

Einstein's E = mc2 holds in every frame.

Block math

Double dollar signs surround a centered display equation.

markdown
$$
\int_0^\infty x^2 e^{-x} \,dx = 2
$$
∫0∞∞ x2 e-x dx = 2

Mermaid diagrams

Use a mermaid-tagged code fence. Renders as SVG.

markdown
```mermaid
graph LR
  A[Write] --> B[Preview]
  B --> C[Export]
```
WritePreviewExport

HTML in Markdown

Fallback

Markdown has no syntax for underline, alignment, superscript, or collapsible sections — the answer is inline HTML. Most renderers allow it, but sanitizers differ, so check the support row on each rule before you rely on it.

Underline text

There is no markdown syntax for underline. Use the <u> or <ins> tag.

markdown
<u>underlined text</u>

<ins>inserted text</ins> also renders underlined.

underlined text

inserted text also renders underlined.

  • CommonMark leaves underline out deliberately: on the web, underlined text reads as a hyperlink, and confusing the two is worse than not having the feature.
  • <u> is purely presentational. <ins> means 'inserted text' and carries meaning for screen readers, which is the better choice when you're marking an edit rather than decorating.
  • Discord uses __text__ for underline. In standard markdown that same syntax is bold, so text copied between the two renders differently.
  • Slack and Reddit strip HTML entirely — there is no way to underline in either.
Works inGitHubGitLabObsidianDiscordNotionSlackReddit

Center text and alignment

No markdown syntax for alignment. Use an align attribute on a block tag.

markdown
<p align="center">Centered paragraph</p>

<div align="center">

**Markdown works here** if you leave a blank line.

</div>

Centered paragraph

Markdown works here if you leave a blank line.

  • The align attribute is deprecated in HTML5 but still honored by GitHub — and it's the only option there, because GitHub's sanitizer strips style attributes, so style="text-align:center" silently does nothing.
  • Leave a blank line after the opening <div> or the markdown inside it renders as literal text.
  • Table columns are the one place markdown aligns natively: :--- , :---: and ---: in the delimiter row set left, center and right.
Works inGitHubGitLabObsidianNotionDiscordSlackReddit

Superscript and subscript

No markdown syntax. Use the <sup> and <sub> tags.

markdown
E = mc<sup>2</sup>

H<sub>2</sub>O

E = mc2

H2O

  • Neither CommonMark nor GFM defines a syntax, so the tags are the portable answer.
  • Some processors add their own: Pandoc and Obsidian accept ^text^ for superscript and ~text~ for subscript. Note that ~text~ collides with strikethrough in renderers that accept a single tilde.
  • Reddit uses ^text for superscript and has no subscript.
  • For anything mathematical, a math block is the better tool — it handles nesting, fractions and operators that tags cannot.
Works inGitHubGitLabObsidianNotionDiscordSlackReddit

Collapsible sections

Use <details> with a <summary> caption to create an expandable block.

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

Hidden content. Markdown is parsed here
as long as you leave the blank line above.

</details>
Click to expand

Hidden content. Markdown is parsed here as long as you leave the blank line above.

  • The blank line after </summary> is the part everyone misses. Without it the markdown inside renders as literal text.
  • Add the open attribute — <details open> — to render the section expanded by default.
  • They nest, which is useful for long READMEs, but each level needs its own blank lines.
  • Anchor links into a collapsed section won't scroll to it, since the content is hidden until opened.
Works inGitHubGitLabObsidianNotionDiscordSlackReddit

Comments

Hide notes from the rendered output with an HTML comment.

markdown
<!-- This note will not render. -->

[//]: # (This one is kept out of the HTML entirely.)

Nothing renders — both forms are invisible in the output.

  • HTML comments are the standard approach and work in every renderer that allows raw HTML.
  • They stay in the generated HTML source though, so anyone using View Source can read them. The link-label form keeps the text out of the output entirely.
  • Comments can't be nested — the first --> closes the comment.
Works inGitHubGitLabObsidianNotionDiscordSlackReddit

Try every syntax in the editor.

Live preview, syntax highlighting, math, diagrams, and PDF export — all in your browser, no sign-up.

Open the editor