Reference

Markdown basics

Markdown is plain text with a few symbols that turn into formatting. You'll find it in README.md files, pull requests, docs, chat tools and prompt files. Each example below shows what you type next to what readers see.

01

Headings

Start a line with one to six # characters followed by a space. More hashes mean a smaller, lower-level heading.

You write
# Heading 1
## Heading 2
### Heading 3
#### Heading 4
##### Heading 5
###### Heading 6
Readers see

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5

Heading 6

Tip

Use one # heading per document and don't skip levels. Screen readers and generated tables of contents rely on that outline.

02

Inline code

Wrap commands, file names or short snippets in single backticks to show them in a monospace font.

You write
Run `npm install` before you start.

Show a backtick: `` `code` ``
Readers see

Run npm install before you start.

Show a backtick: `code`

Backticks inside code

If your snippet contains a backtick, wrap it in double backticks and add a space on each side.

03

Code blocks

Put three backticks on the line before and after a multi-line snippet. Add a language name after the opening backticks to turn on syntax highlighting.

With a language

You write
```js
function greet(name) {
  return `Hello, ${name}!`;
}
```
Readers see
function greet(name) {
  return `Hello, ${name}!`;
}

Terminal commands

You write
```bash
git checkout -b feature/docs
npm run build
```
Readers see
git checkout -b feature/docs
npm run build
Tip

Common language names: js, ts, python, bash, json, yaml, diff. To show a fence inside a fence, wrap the outer block in four backticks.

04

Lists

Start lines with - for bullets or 1. for numbers. Indent by two spaces to nest a list.

Bullet list

You write
- Apples
- Oranges
  - Blood orange
  - Navel
- Pears
Readers see
  • Apples
  • Oranges
    • Blood orange
    • Navel
  • Pears

Numbered list

You write
1. Clone the repo
2. Install dependencies
3. Start the dev server
Readers see
  1. Clone the repo
  2. Install dependencies
  3. Start the dev server

Task list

You write
- [x] Write the draft
- [ ] Review it
- [ ] Publish
Readers see
  • Write the draft
  • Review it
  • Publish
Tip

Leave a blank line between a paragraph and a list, or some renderers treat the list as part of the paragraph.

05

Quotes

Start a line with > to quote it. A lone > keeps paragraphs in the same quote, and >> nests one quote inside another.

You write
> Simplicity is prerequisite for reliability.
>
> — Edsger W. Dijkstra
Readers see

Simplicity is prerequisite for reliability.

— Edsger W. Dijkstra

Nested quote

You write
> First level
>
>> Nested reply
Readers see

First level

Nested reply

06

Tables

Separate columns with pipes | and put a row of dashes under the header. Colons in that row set the alignment: :-- left, :-: center, --: right.

You write
| Command | Purpose      | Runs |
| :------ | :----------: | ---: |
| `dev`   | Local server |    1 |
| `build` | Production   |    2 |
Readers see
Command Purpose Runs
dev Local server 1
build Production 2
Tip

The pipes don't have to line up. Aligning them only makes the source easier to read. To use a literal pipe inside a cell, write \|.

07

Cheat sheet

Everything on this page at a glance.

ElementSyntax
Heading ## Title
Inline code `code`
Code block ```lang … ```
Bullet list - item
Numbered list 1. item
Task list - [ ] todo
Quote > text
Table | a | b |