Skip to content

Markdown Cheat Sheet

Markdown syntax for READMEs, docs and comments, with examples.

About Markdown cheat sheet

Markdown is a plain-text format that converts to HTML: # for headings, asterisks for emphasis, brackets for links. It's used for READMEs, documentation sites, issue trackers, chat apps and note-taking tools because it's readable even before it's rendered. CommonMark is the specification most renderers follow today, so the basic syntax behaves the same almost everywhere.

GitHub Flavored Markdown (GFM) adds tables, task lists, strikethrough and automatic links on top of CommonMark, and GitHub adds its own extras such as alerts and footnotes. Other platforms support different subsets, so check the second table against where your text will appear. Try any snippet in the Markdown preview to see it rendered.

Basic syntax

MarkdownResultNote
# Heading 1Heading, level 1 to 6 with # to ######## Section
**bold**Bold__bold__ works too
*italic*Italic_italic_ works too
***bold italic***Bold and italic
`code`Inline code
[text](https://example.com)Link[text](url "title") adds a tooltip
![alt text](image.png)ImageAlt text describes the image for screen readers
> quoteBlock quoteNest with >>
- itemBulleted list* or + also work
1. itemNumbered listNumbering starts from the first number
---Horizontal rule*** or ___ also work
Line one Line twoLine break: end a line with two spaces or a backslashA blank line starts a new paragraph
\*not italic\*Escape a Markdown character with a backslash

GitHub Flavored Markdown

Extensions supported by GitHub, GitLab, many editors and the Markdown preview tool.

MarkdownResultNote
```js code ```Fenced code block with a language for highlighting~~~ fences also work
| A | B | | --- | --- | | 1 | 2 |Table:--- left, :---: center, ---: right aligns a column
- [ ] task - [x] doneTask list
~~strikethrough~~Strikethrough
https://example.comAutolinked URLBecomes a link without brackets
Footnote[^1] [^1]: NoteFootnote (GitHub; not every renderer)
> [!NOTE] > TextAlert box (GitHub only)NOTE, TIP, IMPORTANT, WARNING, CAUTION

Good to know

Raw HTML

Most renderers let you mix HTML into Markdown, for example <details> for collapsible sections. Many sites, GitHub included, strip scripts, styles and some attributes for security, so stick to simple elements.

More references