Markdown Cheat Sheet — Syntax With Live Preview

Every Markdown element with source and rendered preview, extended syntax (tables, task lists, footnotes, math, Mermaid, alerts), a 9-platform compatibility table and a live playground.

Last verified: 2026-10-18 against CommonMark 0.31.2, the GFM spec, and the GitHub, GitLab, Obsidian, Slack and Jira formatting docs. Sources: CommonMark spec 0.31.2, GitHub Flavored Markdown spec, GitHub writing and formatting docs, GitLab Flavored Markdown, Obsidian help, Slack message formatting, Jira text formatting notation.

32 elements

Basic syntax (works everywhere CommonMark does)

These elements are in the CommonMark specification, so they behave the same in GitHub, GitLab, VS Code, Obsidian, static-site generators and most documentation tools.

Headings#

One to six # followed by a space. Use one # heading per document and do not skip levels; screen readers and tables of contents rely on the order.

Markdown
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
Rendered
Heading 1
Heading 2
Heading 3
Heading 4
Underlined headings#

The older "setext" style; only levels 1 and 2. A line of --- under a paragraph makes it a heading, which surprises people expecting a horizontal rule: leave a blank line before ---.

Markdown
Heading 1
=========

Heading 2
---------
Rendered
Heading 1
Heading 2
Paragraphs#

A blank line separates paragraphs. A single line break inside a paragraph is joined into one line (except where noted under line breaks).

Markdown
First paragraph, which can wrap
across several source lines.

Second paragraph after a blank line.
Rendered

First paragraph, which can wrap across several source lines.

Second paragraph after a blank line.

Line breaks#

For a line break without a new paragraph, end the line with two spaces or a backslash. GitHub comments, Obsidian (by default), Slack and Discord treat every newline as a break instead.

Markdown
Two trailing spaces  
make a break.
A trailing backslash\
works too.<br>So does an HTML br.
Rendered

Two trailing spaces
make a break. A trailing backslash
works too.
So does an HTML br.

Bold and italic#

Asterisks work inside words; underscores do not (snake_case_names stay literal), which is why most style guides prefer *.

Markdown
**bold** or __bold__

*italic* or _italic_

***bold italic***

in**side**word works with *, not with _
Rendered

bold or bold

italic or italic

bold italic

insideword works with *, not with _

Blockquote#

Start each line with >. Quotes can contain any other Markdown, including lists and code.

Markdown
> Quoted text.
> Still quoted.
>
> > Nested quote.
Rendered

Quoted text. Still quoted.

Nested quote.

Bulleted list#

-, * or + all work; do not mix them in one list (a different marker starts a new list).

Markdown
- Item
- Item
  - Nested (indent 2 spaces)
- Item
Rendered
  • Item
  • Item
    • Nested (indent 2 spaces)
  • Item
Numbered list#

The first number sets the start; later numbers are ignored, so "1." on every line renumbers itself when you reorder items.

Markdown
1. First
1. Second
1. Third

3. Starts at three
4. Four
Rendered
  1. First

  2. Second

  3. Third

  4. Starts at three

  5. Four

Paragraphs and code inside lists#

Indent extra content to line up with the first character of the item text (3 spaces after "1. ").

Markdown
1. Install:

   ```sh
   npm install marked
   ```

2. Indent continuation lines
   to the item text.
Rendered
  1. Install:

    npm install marked
    
  2. Indent continuation lines to the item text.

Inline code#

Markdown inside backticks is not interpreted.

Markdown
Run `npm test` now.

Use ``double `backticks` `` when the code contains one.
Rendered

Run npm test now.

Use double `backticks` when the code contains one.

Code block#

Three backticks (or ~~~) on their own lines. The word after the fence names the language for syntax highlighting on GitHub, GitLab, Obsidian and Discord.

Markdown
```js
const answer = 42;
console.log(answer);
```
Rendered
const answer = 42;
console.log(answer);
Indented code block#

The original syntax. Fences are clearer and allow a language; indented code is the only form old Reddit understands.

Markdown
Paragraph.

    four spaces of indent
    make a code block
Rendered

Paragraph.

four spaces of indent
make a code block
Horizontal rule#

Three or more -, * or _ on a line of their own, with a blank line above.

Markdown
Above

---

Below (also *** or ___)
Rendered

Above


Below (also *** or ___)

Images#

Like a link with ! in front. The text in [ ] is the alt text: describe the image for people who cannot see it. Markdown has no size syntax; use HTML <img width="200"> where HTML is allowed.

Markdown
![Site logo](/brand/favicon.svg "Optional title")

[![Clickable image](/brand/favicon.svg)](/tools)
Rendered

Site logo

Clickable image

Escaping characters#

A backslash makes any ASCII punctuation literal: \ ` * _ { } [ ] ( ) # + - . ! |

Markdown
\*not italic\*  \# not a heading  1\. not a list
Rendered

*not italic* # not a heading 1. not a list

Inline HTML#

Allowed by CommonMark. GitHub and GitLab keep a safe subset (no script, style or event handlers); Slack, Discord, Reddit and Notion show it as text.

Markdown
Press <kbd>Ctrl</kbd> + <kbd>C</kbd>, H<sub>2</sub>O, x<sup>2</sup>.
Rendered

Press Ctrl + C, H2O, x2.

Hidden comments#

An HTML comment is kept in the source but not displayed wherever HTML is allowed.

Markdown
Visible.

<!-- Not rendered: notes for editors -->

Also visible.
Rendered

Visible.

Also visible.

Extended syntax (GFM and friends)

Not part of CommonMark. Support varies, so check the compatibility table before relying on these outside GitHub.

Tables#

The second line is required; colons set alignment. Columns need not line up in the source. Escape a literal pipe as \|. No merged cells or multi-line cells (use <br> inside a cell on GitHub).

Where: GFM, GitLab, Obsidian, Reddit; Notion on paste

Markdown
| Left | Centre | Right |
| :--- | :----: | ----: |
| a    |   b    |     1 |
| `c`  | **d**  |    22 |
Rendered
Left Centre Right
a b 1
c d 22
Task lists#

On GitHub and GitLab the boxes are clickable in issues and pull requests and update the source.

Where: GFM, GitLab, Obsidian; Notion via the [] shortcut

Markdown
- [x] Write the draft
- [ ] Review
- [ ] Publish
Rendered
  • Write the draft
  • Review
  • Publish
Strikethrough#

Two tildes everywhere; GitHub also accepts one. Slack uses ~single~ tildes, Jira -hyphens-.

Where: GFM, GitLab, Obsidian, Discord, Reddit, Notion

Markdown
~~no longer true~~
Rendered

no longer true

Footnotes#

The definition can go anywhere; footnotes are numbered in order of reference and listed at the end. Obsidian also has inline footnotes: ^[like this].

Where: GFM, GitLab, Obsidian (not CommonMark)

Markdown
Markdown was created in 2004.[^1]

[^1]: By John Gruber, with Aaron Swartz.
How GitHub / Obsidian shows it

Markdown was created in 2004.1


  1. By John Gruber, with Aaron Swartz. ↩
Custom heading IDs#

Sets the anchor yourself. Supported by Pandoc, PHP Markdown Extra, Hugo, Jekyll (kramdown), MkDocs and Docusaurus; GitHub and GitLab ignore it and show the braces, using automatic ids instead.

Where: Pandoc, Hugo, Jekyll, MkDocs, Docusaurus; not GitHub or GitLab

Markdown
### Install {#setup}
How GitHub / Obsidian shows it
Install

Rendered by Pandoc, Hugo or kramdown with id="setup", so /page#setup links here.

Emoji shortcodes#

Colon-wrapped names. Typing a colon in GitHub, Slack, Discord or Notion opens an emoji picker. Pasting the emoji itself works everywhere.

Where: GitHub, GitLab, Slack, Discord; not Obsidian (without a plugin) or CommonMark

Markdown
Ship it :rocket: :+1: :tada:
How GitHub / Obsidian shows it

Ship it 🚀 👍 🎉

Math (LaTeX)#

TeX between $ signs inline, $$ for a display block. GitHub also accepts $`…`$ and a ```math block; GitLab supports the same forms. Notion uses $$…$$ for inline equations.

Where: GitHub, GitLab, Obsidian, Notion (own syntax)

Markdown
Inline: $E = mc^2$

$$
\sum_{i=1}^{n} i = \frac{n(n+1)}{2}
$$
How GitHub / Obsidian shows it

Inline: E = mc2

∑i=1n i = n(n+1) ⁄ 2

Mermaid diagrams#

A code block with the language mermaid becomes a diagram: flowcharts, sequence, class, state, Gantt and ER diagrams.

Where: GitHub, GitLab, Obsidian, Notion (Mermaid code block)

Markdown
```mermaid
flowchart LR
  A[Write] --> B{Review}
  B -->|ok| C[Publish]
  B -->|changes| A
```
How GitHub / Obsidian shows it
Callouts / alerts#

GitHub has five types: NOTE, TIP, IMPORTANT, WARNING, CAUTION. GitLab (17.10+) accepts the same syntax. Obsidian has many more types, custom titles (> [!tip] Title) and folding (> [!faq]-).

Where: GitHub, GitLab 17.10+, Obsidian; a plain quote elsewhere

Markdown
> [!NOTE]
> Useful information.

> [!WARNING]
> Critical content that needs attention.
How GitHub / Obsidian shows it
ⓘ Note

Useful information.

⚠ Warning

Critical content that needs attention.

Collapsible section#

HTML, but widely supported. Leave blank lines around the Markdown inside, or it is not parsed.

Where: GitHub, GitLab, Obsidian, most static-site generators

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

Hidden **Markdown** content.

</details>
Rendered
Click to expand

Hidden Markdown content.

Highlight#

Obsidian and some editors (Typora, iA Writer); GitHub shows the equals signs. Use <mark> where HTML is allowed.

Where: Obsidian, Typora; not GitHub

Markdown
This is ==highlighted== text.
How GitHub / Obsidian shows it

This is highlighted text.

Compatibility: CommonMark, GitHub, GitLab, Obsidian, Notion, Slack, Discord, Reddit, Jira

✓ works as written · ~ works with different syntax or only partly (see note) · ✗ not available. Notion and Slack's composer convert Markdown shortcuts as you type rather than rendering a Markdown file; Jira Data Center fields use wiki markup, while Jira Cloud's editor accepts Markdown-style shortcuts while typing.

FeatureCommonMarkGitHub (GFM)GitLabObsidianNotionSlack (mrkdwn)DiscordRedditJira wiki
Headings #✓ Yes✓ Yes✓ Yes✓ Yes~ Partly / different syntax
# , ## , ### shortcuts while typing
✗ No
Use *bold* lines
~ Partly / different syntax
#, ## and ### only
✓ Yes~ Partly / different syntax
h1. to h6.
Bold / italic✓ Yes✓ Yes✓ Yes✓ Yes✓ Yes~ Partly / different syntax
*bold* and _italic_ (single characters)
✓ Yes
Also __underline__
✓ Yes~ Partly / different syntax
*bold* and _italic_
Strikethrough✗ No✓ Yes
~~ or ~
✓ Yes✓ Yes✓ Yes
~text~ or ~~text~~
~ Partly / different syntax
~text~
✓ Yes✓ Yes~ Partly / different syntax
-text-
Inline code✓ Yes✓ Yes✓ Yes✓ Yes✓ Yes✓ Yes✓ Yes✓ Yes~ Partly / different syntax
{{monospace}}
Fenced code block✓ Yes✓ Yes✓ Yes✓ Yes✓ Yes~ Partly / different syntax
``` works, no language highlighting
✓ Yes~ Partly / different syntax
New Reddit and apps; old.reddit needs 4-space indent
~ Partly / different syntax
{code:java} … {code}
Syntax highlighting~ Partly / different syntax
Language is passed to the renderer; highlighting is up to it
✓ Yes✓ Yes✓ Yes✓ Yes
Pick the language on the block
✗ No✓ Yes✗ No✓ Yes
{code:language}
Blockquote >✓ Yes✓ Yes✓ Yes✓ Yes~ Partly / different syntax
Type " then space; > then space makes a toggle
✓ Yes✓ Yes
>>> quotes the rest of the message
✓ Yes~ Partly / different syntax
bq. or {quote} … {quote}
Lists✓ Yes✓ Yes✓ Yes✓ Yes✓ Yes~ Partly / different syntax
Composer turns "- " into a list; no list syntax in API mrkdwn
✓ Yes✓ Yes~ Partly / different syntax
* bullets, # numbers, ** to nest
Images ![alt](url)✓ Yes✓ Yes✓ Yes✓ Yes
Also ![[file.png]]
~ Partly / different syntax
On import or paste
✗ No
Upload instead
✗ No
Attach or paste a link
✗ No
Upload in the editor
~ Partly / different syntax
!image.png!
Tables✗ No✓ Yes✓ Yes✓ Yes~ Partly / different syntax
Pasted Markdown tables become simple tables
✗ No✗ No✓ Yes~ Partly / different syntax
||head|| and |cell|
Task lists✗ No✓ Yes✓ Yes
Also [~] for inapplicable
✓ Yes~ Partly / different syntax
[] then space makes a to-do
✗ No✗ No✗ No✗ No
Footnotes✗ No✓ Yes✓ Yes✓ Yes
Also inline ^[note]
✗ No✗ No✗ No✗ No✗ No
Heading anchors✗ No~ Partly / different syntax
Automatic only, no {#id}
~ Partly / different syntax
Automatic only
~ Partly / different syntax
Link with [[#Heading]]
~ Partly / different syntax
Copy a block link instead
✗ No✗ No✗ No~ Partly / different syntax
{anchor:name}
Emoji shortcodes :smile:✗ No✓ Yes✓ Yes✗ No
Plugin needed
~ Partly / different syntax
Typing : opens a picker
✓ Yes✓ Yes✗ No~ Partly / different syntax
Text smileys such as :) :D (y)
Math $…$✗ No✓ Yes✓ Yes✓ Yes~ Partly / different syntax
$$…$$ inline, /equation for blocks
✗ No✗ No✗ No✗ No
Mermaid diagrams✗ No✓ Yes✓ Yes✓ Yes✓ Yes
Code block set to Mermaid
✗ No✗ No✗ No✗ No
Needs a Marketplace app
Callouts > [!NOTE]✗ No✓ Yes
5 types
✓ Yes
17.10+
✓ Yes
Many types, foldable
✗ No
Use /callout
✗ No✗ No✗ No~ Partly / different syntax
{panel} … {panel}
Raw HTML✓ Yes~ Partly / different syntax
Safe subset; no script, style or iframes
~ Partly / different syntax
Safe subset
~ Partly / different syntax
Sanitised subset
✗ No✗ No✗ No✗ No✗ No
Single newline = line break✗ No
Two trailing spaces or \
~ Partly / different syntax
In comments yes, in .md files no
~ Partly / different syntax
In comments yes, in files no
~ Partly / different syntax
Yes unless "Strict line breaks" is on
✓ Yes
Shift+Enter in a block
✓ Yes✓ Yes✗ No
Two trailing spaces
~ Partly / different syntax
Newline yes; \\ forces one

Same thing, different syntax

The pairs that trip people up when pasting between tools: Slack and Jira use single * for bold, and Slack links put the URL first.

ElementMarkdown / GFMSlack mrkdwnDiscordRedditJira wiki
Bold**bold***bold***bold****bold***bold*
Italic*italic*_italic_*italic**italic*_italic_
Strikethrough~~text~~~text~~~text~~~~text~~-text-
Underline(none; <ins> in HTML)(none)__text__(none)+text+
Inline code`code``code``code``code`{{code}}
Code block```js … `````` … ``````js … ```4-space indent{code:js} … {code}
Heading## Title(none)## Title## Titleh2. Title
Quote> text> text> text> textbq. text
Bullet list- item• item (typed)- item- item* item
Numbered list1. item1. item (typed)1. item1. item# item
Spoiler<details> (HTML)(none)||text||>!text!<(none)

Markdown playground

Preview (CommonMark + GFM)
Release notes

Version 2.0 is out. Read the full changelog.

What changed
  • Faster start-up
  • New dark mode
  • Legacy API removed
Platform Status
Web ✅
Desktop beta
  • Write notes
  • Publish
npm install my-app@2

Questions? Reply to this post.

Rendered with marked in your browser; nothing is uploaded. Footnotes, math, Mermaid and alerts appear as plain text here because they are platform extensions. Need a Word file? Paste the Markdown into ChatGPT to Word. Counting words? Use the word counter.

Previews and the playground render in your browser; nothing you type is sent anywhere. Browse all free tools.

Found a problem, or something that could be better? We read every message and we fix things quickly.

This Markdown cheat sheet shows every element twice: the Markdown you type and what it renders as, side by side, so you can copy the source and know what you will get. The basics (headings, emphasis, lists, links, images, code) come first, then the extended syntax most people actually need on GitHub: tables, task lists, strikethrough, footnotes, alerts, math and Mermaid diagrams.

Markdown is not one language. CommonMark defines the core; GitHub and GitLab add their own extensions; Obsidian and Notion add more; Slack, Discord, Reddit and Jira each use something Markdown-like with different rules, such as *single asterisks* for bold in Slack and Jira. The compatibility table shows what works where, and the translation table gives the exact syntax for each chat or ticketing tool. Previews are rendered with the open-source marked library (CommonMark plus GFM); features it does not implement show how GitHub or Obsidian displays them. A small playground at the end renders anything you type, in your browser.

How to use

  1. Search for an element (table, checkbox, footnote, line break) or jump to a section from the chips at the top.
  2. Copy the Markdown from the left of any card; the right shows how it renders.
  3. Check the compatibility table before using an extension outside GitHub, and the translation table when pasting into Slack, Discord, Reddit or Jira.
  4. Paste your own text into the playground to preview it, then copy the HTML or download a .md file.

Frequently asked questions

How do I make a table in Markdown?

Write the header row with pipes, then a separator row of dashes, then the data rows: | Name | Age |, then | --- | --- |, then | Ana | 31 |. Colons in the separator set alignment (:--- left, :---: centre, ---: right). Tables are a GitHub Flavored Markdown extension, supported by GitHub, GitLab, Obsidian, Reddit and most editors, but not by plain CommonMark, Slack or Discord.

How do I add a line break without starting a new paragraph?

End the line with two spaces or a backslash, or use <br> where HTML is allowed. A single newline is otherwise joined into the same paragraph in CommonMark and GitHub .md files. GitHub comments, Obsidian (by default), Slack and Discord treat every newline as a line break, which is why the same text can look different in a README and in an issue.

What is the difference between CommonMark and GitHub Flavored Markdown?

CommonMark is a precise specification of the original Markdown syntax. GitHub Flavored Markdown (GFM) is a strict superset that adds tables, task lists, strikethrough, extended autolinks and a filter for unsafe HTML. On github.com, footnotes, alerts, math, Mermaid diagrams and emoji shortcodes are added on top of GFM by GitHub's own processing.

How do I write a checkbox or to-do list in Markdown?

Use a list item that starts with [ ] for an open task or [x] for a done one: - [ ] Review, - [x] Write draft. GitHub and GitLab render clickable checkboxes in issues and pull requests, Obsidian toggles them in reading view, and GitLab also accepts [~] for an inapplicable task.

Does Slack support Markdown?

Partly, with its own rules called mrkdwn: *bold* with single asterisks, _italic_, ~strikethrough~ with single tildes, `code` and ``` code blocks, > quotes, and links written as <https://url|text> in messages sent through the API. There are no headings, tables or images. Slack's message composer also converts some formatting as you type, and Block Kit has a separate markdown block that accepts standard Markdown.

How do I add a footnote in Markdown?

Put [^1] where the reference goes and define it on its own line anywhere in the document: [^1]: The source. GitHub, GitLab and Obsidian number footnotes in order of use and list them at the bottom with back-links. CommonMark, Slack, Discord, Reddit and Notion have no footnotes.

Writing Markdown that renders the same everywhere

• Leave a blank line before and after headings, lists, code blocks, tables and HTML blocks. Many "why didn't it render" problems are a missing blank line.

• Use fenced code blocks with a language (```python) rather than indentation; they are clearer and get highlighting.

• Use * for emphasis rather than _, because underscores inside words (snake_case_names) are left alone by CommonMark but treated differently by older renderers.

• Pick one bullet character per list; switching from - to * starts a new list.

• Indent nested list content to line up with the text of the parent item, not a fixed two or four spaces.

• Write alt text for every image. It is shown when the image fails to load and read aloud by screen readers.

README essentials on GitHub

GitHub renders README.md at the root, in docs/ or in .github/. Headings automatically get anchors, and GitHub builds a table of contents from them (the outline button on the file view), so a clear heading structure is the table of contents. Relative links and images (./docs/setup.md, ./images/demo.png) work on github.com and keep working in forks and on other branches, unlike absolute URLs.

Alerts (> [!NOTE], > [!WARNING]) stand out for installation caveats, Mermaid code blocks draw architecture diagrams that stay editable, and <details> collapses long sections such as full configuration references. Keep the first screen to what the project is, how to install it and a minimal example; everything else can sit below.

Related free tools

  • ChatGPT to Word — Paste an answer from ChatGPT, Claude or Gemini and copy it into Word, Google Docs or email with real headings, tables and lists instead of ** and #.
  • Word Counter — Count words, characters, sentences and reading time, and check X, LinkedIn, Instagram, YouTube, SEO and SMS limits as you type.
  • Git Cheat Sheet — Git commands organised by what you want to do: undo the last commit, rename a branch, delete a remote branch. Modern switch/restore with classic equivalents and danger badges.
  • Regex Cheat Sheet — Every regular expression token with a working example, support in JavaScript, PCRE/PHP, Python, Go, Java and .NET, and a Try it link that opens the regex tester pre-filled.
  • Diff Checker — Compare two versions of a text, code or JSON file and see exactly which lines, words and characters changed.