Markdown cheat sheet

Markdown is plain text with a few simple symbols for formatting. Here's everything you need, plus tips for turning it into a PDF that looks professionally typeset.

Headings

Start a line with one to six # characters. Use a single # heading for the document title: md2pdf.me also uses it as the PDF's file name.

# Document title
## Section
### Subsection

Emphasis

You typeYou get
*italic* or _italic_italic
**bold**bold
***bold italic***bold italic
~~strikethrough~~strikethrough
`code`code

Lists

Use -, * or + for bullets and numbers followed by a period for ordered lists. Indent by two or more spaces to nest.

- Apples
- Oranges
  - Blood oranges

1. Preheat the oven
2. Mix the batter
3. Bake for 25 minutes

The numbers don't have to be in order: Markdown renumbers them for you, so 1. on every line works too.

[md2pdf.me](https://md2pdf.me)
<https://example.com>
![A description of the picture](https://example.com/photo.jpg)

Bare web addresses like https://example.com become links automatically. Images need to be on the web for the online converter to reach them; the command-line version can also use images on your computer.

Code

Wrap code in three backticks and name the language to get syntax highlighting. Long lines wrap in the PDF instead of being cut off.

```javascript
function greet(name) {
  return `Hello, ${name}!`;
}
```

Common language names include python, javascript, typescript, bash, json, yaml, sql, html, css, go, rust, java, c and cpp.

Tables

Separate columns with pipes and put a row of dashes under the header. Colons set the alignment.

| Item    | Qty | Price  |
| :------ | :-: | -----: |
| Coffee  |  2  |  $6.00 |
| Bagel   |  1  |  $3.50 |

The columns don't need to line up in your text; it just makes the source easier to read.

Quotes & dividers

> The best way to predict the future is to invent it.

---

Three dashes on their own line draw a divider. In the Classic style it becomes a small ornament, like a scene break in a book.

Task lists, footnotes & emoji

- [x] Draft the proposal
- [ ] Send it for review

Markdown was created in 2004.[^1]

[^1]: By John Gruber, with help from Aaron Swartz.

Ship it :rocket: :tada:

Footnotes are numbered automatically and collected at the end of the document. Emoji shortcodes use the same names as GitHub and Slack.

Page breaks

Markdown has no page-break syntax, but you can use a line of HTML. Put this on its own line, with a blank line before and after:

<div class="page-break"></div>

Everything after it starts on a new page. You don't need breaks to keep things tidy, though: md2pdf.me already keeps headings with the paragraph that follows them, and avoids splitting code blocks, quotes, images and table rows across pages.

Tips for great PDFs

Open the converter