Markdown Reference
One page with the syntax for every common Markdown element, and which flavor supports it. Copy what you need, then follow the link for edge cases and mistakes.
New to Markdown? Start with Markdown Basics, then come back here to look things up.
Core syntax
Works in CommonMark, and in almost every Markdown tool.
| Element | Syntax | Notes | Guide |
|---|---|---|---|
| Heading | # H1 to ###### H6 |
Needs a space after the #. |
Headings |
| Paragraph | Text, then a blank line | A single newline does not start a new paragraph. | Paragraphs |
| Bold | **bold** |
__bold__ also works. |
Text formatting |
| Italic | *italic* |
_italic_ also works. |
Text formatting |
| Bold + italic | ***text*** |
Text formatting | |
| Inline code | `code` |
Code blocks | |
| Code block | Three backticks, then the language | Four-space indentation also works. | Code blocks |
| Blockquote | > quote |
Blockquotes | |
| Bulleted list | - item |
* and + also work. |
Lists |
| Numbered list | 1. item |
The first number sets the start. | Lists |
| Link | [text](https://example.com) |
Links | |
| Image |  |
Images | |
| Horizontal rule | --- |
Leave a blank line above it (see below). | Horizontal rules |
| Hard line break | Two trailing spaces, or a backslash at the end of the line | <br> works where HTML is allowed. |
Line breaks |
| Escape a character | \* |
Works for \#, \[, \_ and more. |
Escaping characters |
| Inline HTML | <kbd>Ctrl</kbd> |
Allowed in CommonMark. Some platforms strip tags. | Markdown and HTML |
Extended syntax (not in CommonMark)
These need a parser that supports them. GFM spec means the feature is defined in the official GitHub Flavored Markdown spec. GitHub.com means GitHub renders it, even if the spec does not define it.
| Feature | Syntax | CommonMark | GFM spec | GitHub.com | Guide |
|---|---|---|---|---|---|
| Tables | | a | b | plus a --- row |
Tables | |||
| Task lists | - [x] done |
Task lists | |||
| Strikethrough | ~~text~~ |
Text formatting | |||
| Bare URL links | https://example.com |
Links | |||
| Footnotes | [^1] |
Footnotes | |||
| Emoji shortcodes | :rocket: |
Emojis | |||
| Math | $E = mc^2$ |
Math | |||
| Alerts | > [!NOTE] |
Alerts | |||
| Mermaid diagrams | A mermaid code block |
Mermaid diagrams |
In CommonMark a bare URL is plain text. Write <https://example.com> to get a link.
Obsidian supports standard Markdown plus its own syntax: [[wikilinks]], callouts and embeds. Those do not render in other tools. See Obsidian Markdown.
Sources: CommonMark spec, GitHub Flavored Markdown spec.
Which flavor are you writing for?
| Where it will be published | What to assume |
|---|---|
| GitHub README, issues, pull requests | GFM plus GitHub.com features. See GitHub Markdown. |
| A docs site or static site generator | Depends on the parser. Check its docs for tables, footnotes and math. |
| An Obsidian vault | Obsidian flavor. Not portable. |
| Unsure, or shared across tools | Stick to CommonMark syntax. See the CommonMark guide. |
For the details of the spec itself, see GitHub Flavored Markdown.
Things that trip people up
- It renders on GitHub, but shows as plain text elsewhere. The feature is probably an extension (a table, footnote or alert). Check the table above.
- A line turns into a heading.
---directly under a line of text makes that line a heading. Put a blank line before a horizontal rule. - A line break disappears. Trailing spaces are invisible and many editors strip them. Use a backslash at the end of the line, or
<br>. - A table or list does not render. Put a blank line before it.
- Markdown inside HTML is shown as text. Inside a block like
<div>or<details>, leave a blank line after the opening tag so the content is read as Markdown.
Guides for each element
Text: Markdown headings · Markdown paragraphs · Markdown lists · Markdown blockquotes · Markdown line breaks · Markdown horizontal rules · Escaping in Markdown
Links and media: Markdown links · Markdown images · Markdown emojis
Code and technical: Markdown code blocks · HTML in Markdown · Markdown math · Mermaid in Markdown
Structure: Markdown tables · Markdown task lists · Markdown footnotes
Flavors and editors: CommonMark · GFM · Markdown on GitHub · Markdown in Obsidian · Markdown in VS Code
Frequently Asked Questions
- 1
Is there an official Markdown standard?
Markdown was created by John Gruber, and his original description left some cases open. CommonMark is a precise specification of the core syntax, and the GitHub Flavored Markdown spec builds on it.
- 2
Why do my table, strikethrough or task list not render?
They are extensions, not part of CommonMark. Your renderer has to support GFM or enable the extension.
- 3
What is the difference between CommonMark and GFM?
GFM is CommonMark plus tables, task lists, strikethrough and bare URL links. The full comparison is on the CommonMark page linked at the bottom of this page.
- 4
Can I use HTML in Markdown?
In CommonMark, yes. Some platforms limit it. GFM filters a few tags, such as
script,iframeandstyle. Use plain Markdown syntax when it does the job. - 5
Do footnotes and math work everywhere?
No. Neither is part of CommonMark or the GFM spec. GitHub renders both, and other tools depend on their parser or plugins.
