How to Add a Page Break in Markdown (for PDF)
Markdown has no page-break syntax — here’s how to force a new page when exporting to PDF, with \newpage, an HTML comment, CSS, or automatic breaks before headings.
Updated · 4 min read
Plain Markdown has no concept of pages, so there’s no official page-break syntax. When you export to PDF, though, you often need one: a cover page, chapters, an appendix. Here are the options and when to use each.
1. \newpage on its own line
The simplest option, borrowed from LaTeX and Pandoc:
## Chapter 1
Some text.
\newpage
## Chapter 2
The Markdown to PDF editor also accepts \pagebreak, <!-- pagebreak --> and [pagebreak]. In the live preview you’ll see a dashed “Page break” line where the new page starts.
2. An HTML element with CSS
If your tool doesn’t support \newpage, raw HTML usually works because most converters render through a browser:
<div style="break-after: page"></div>
break-after: page is the modern property; older guides use page-break-after: always, which browsers still understand.
3. Automatic breaks before headings
For long documents it’s easier to let headings decide. In the editor, open Style → Document → Start a new page before and choose Each H1 or H1 & H2. The first heading in the document never gets a blank page before it.
With your own CSS (Style → Custom CSS) you can do the same thing:
.doc h2 { break-before: page; }
Keeping things together
The opposite problem — content splitting badly — is handled automatically:
- headings stay with the paragraph that follows them,
- table rows, short code blocks, diagrams, equations and callouts aren’t split,
- table headers repeat on every page when a long table continues.
To keep a specific block together, wrap it:
<div style="break-inside: avoid">
…content that must stay on one page…
</div>
Quick reference
| You want | Use |
|---|---|
| Force a new page here | \newpage |
| Every chapter on a new page | Style → Start a new page before → Each H1 |
| Keep a block on one page | <div style="break-inside: avoid"> |
| A cover page | Front matter title: + Style → Cover page |
Try it on your own document
Free, private and right in your browser — no signup.