Markdown cheat sheet: the syntax for documents and books

Markdown uses plain characters for formatting: # for headings, **two asterisks** for bold, *one* for italic, - or 1. for lists, [text](url) for links, ![alt](image) for images, pipes for tables and three backticks for code. Those work in almost every editor. Page breaks, line breaks and footnotes are not in the core syntax, so check what your tool does with them before you rely on them.

Markdown is a set of plain-text conventions that a converter turns into formatting. You type **done** and the reader sees done. The whole core syntax fits on one page, which is the point of this one: keep it open while you write.

The tables below cover what a document, report or book uses. Anything marked "depends on the tool" is not part of the original syntax, and editors handle it differently.

What is the basic Markdown syntax?

You typeYou getNotes
# TitleA level 1 headingOne per chapter or document
## SectionA level 2 headingThe main sections
### SubsectionA level 3 headingUse sparingly
**bold**boldTwo asterisks each side
*italic**italic*One asterisk, or underscores
***both****both*Three asterisks
` code `codeInline, in a monospace face
A blank lineA new paragraphThe rule people forget

Headings need a space after the #. #Title is a paragraph in most converters, not a heading. And keep the levels in order: a ### straight under a # confuses the outline and any table of contents built from it. Headings in Markdown explains why.

How do you write lists in Markdown?

- A bullet
- Another bullet
  - A nested bullet (indent two spaces)

1. First step
1. Second step
1. Third step

Numbered lists renumber themselves in most converters, so 1. on every line is fine and saves renumbering when you insert a step. Leave a blank line before a list, or some editors will glue it onto the paragraph above.

How do you add links and images?

You typeYou get
[bukpress](https://buk.press)A link with that text
<https://buk.press>The address itself as a link
![A chart of sales](chart.png)An image, with alt text
![Cover](https://example.com/cover.jpg)An image from a URL

The text in square brackets of an image is the alt text: what a screen reader says and what shows if the image fails to load. Write it as a short description, not a filename. For images that have to look sharp in a PDF, images in Markdown that still look sharp has the sizes.

How do you make a table in Markdown?

| Chapter | Words | Pages |
|---|---:|---:|
| Introduction | 1,200 | 3 |
| Getting started | 4,500 | 11 |
  • The second line is required. Without the dashes, it is not a table.
  • Colons set the alignment: :--- left, :---: centre, ---: right. Right-align columns of numbers.
  • The pipes don't have to line up. Lining them up only makes the source easier to read.
  • Tables are an extension (GitHub Flavored Markdown), but nearly every modern tool supports them.

Long tables are where PDFs go wrong. Markdown tables that survive the page break covers what happens when one crosses a page.

How do you add code, quotes and rules?

```python
print("A fenced code block, with a language name")
```

> A block quote. Start each line with >.

---

The language name after the opening backticks turns on syntax highlighting where the tool supports it. Code blocks in a PDF deals with long lines running off the page.

Three hyphens on their own line are a horizontal rule in standard Markdown. Some tools give them another job, which is the next section.

Which syntax depends on the tool?

These are the parts that change between editors and converters. Check them before you write 40 pages that rely on them.

FeatureCommon syntaxWhat varies
Page breakRaw HTML or a tool-specific markerStandard Markdown has none
Line breakTwo spaces at line end, or a backslashSome tools treat one Enter as a break
FootnotesText[^1] and [^1]: NoteNot in core Markdown; many tools print it as text
Task lists- [ ] To doGitHub and note apps only
Strikethrough~~gone~~An extension, widely supported
Raw HTML<div> and friendsSome tools render it, some strip it

Line breaks cause the most confusion. In standard Markdown a single Enter does nothing: the two lines join into one paragraph. Why Markdown eats your line breaks explains the rule and the workarounds. For page breaks, how to control page breaks in Markdown lists the syntax per tool, and footnotes and endnotes covers the alternatives when footnote syntax isn't supported.

How does bukpress read this syntax?

bukpress turns a Markdown file into a typeset PDF, and it settles the "depends on the tool" rows this way:

  • --- on its own line is a page break, not a rule.
  • ---- (four or more hyphens) is a printed divider between sections.
  • ___ is a plain thin rule, useful as a fill-in line in a workbook.
  • Every # heading starts a new page, so a chapter never begins at the bottom of one.
  • One Enter is a real line break, so poetry and addresses keep their lines.
  • A table that runs past the bottom of a page repeats its header row on the next.
  • Raw HTML is stripped, so stick to Markdown.

The editor has the same reference built in, with an insert button for each entry. The Free plan exports PDFs of up to 40 pages, 20 a month, with no watermark; see pricing for the rest.

What should you do next?

Keep the first table beside you for a week of writing; after that you will rarely need it. Then test the tool-dependent rows in the editor you actually use, with a page break, a long table and a two-line address, before you write the whole document around them.

Common questions

Is there one official Markdown syntax?

There are several flavours. John Gruber's original 2004 description is the base, CommonMark is a stricter specification of it, and GitHub Flavored Markdown adds tables, task lists and strikethrough. The basics in the first table work everywhere.

How do I make text bigger in Markdown?

Use a heading level. Markdown has no font-size syntax; the size of each heading level is set by the tool or its theme.

How do I add a blank line in Markdown?

A blank line between two paragraphs is already a paragraph break. Several blank lines in a row usually collapse into one, so extra space has to come from the tool's spacing settings or a page break.

Can I underline text in Markdown?

Not in standard Markdown. Underlines are usually read as links, so most writers use italic or bold for emphasis instead.

Read next

Explainers · 6 min read

Markdown for writers: the only syntax a book needs

Markdown is a way of writing formatting as ordinary characters: a # before a line makes it a heading, two asterisks around a word make it bold, a blank line starts a new paragraph. A book uses about a dozen of these marks. You can learn them in an afternoon, and the file stays readable in any editor.

Read it
How-to · 4 min read

How to control page breaks in Markdown

Markdown has no page break because it describes structure, not pages, so every method is really an instruction to whatever renders it. The three that work are a raw HTML div with a CSS page-break rule, a LaTeX \newpage command through Pandoc, or a renderer that assigns a meaning to a plain-text marker.

Read it
How-to · 4 min read

Markdown tables that survive the page break

A table that crosses a page loses its header because most Markdown-to-PDF pipelines emit a plain HTML table with no thead, and repeating a header row requires the renderer to know which row is the header. Fix the markup first, then the renderer.

Read it

Write it in Markdown. Ship a book.

bukpress turns the file you are already writing into a typeset PDF and EPUB: your type, your covers, no watermark on any plan.

Start free, no card required