How to Control Page Breaks in Markdown PDF — Drag, Click, and Layout Rules

Four ways to control page breaks in Markdown PDF—drag preview handles, click-toggle blocks, Precise page breaks, and Layout rules. Control pagination without editing your .md source.

The problem with page breaks in Markdown PDF output

When converting Markdown documents—specs, reports, meeting notes—to PDF, things often go wrong:

Most converters offer little control over where pages break. Markdown Document Converter lets you decide exactly where each page break goes—without touching your Markdown source.

Markdown has no “page” syntax

Markdown is a flowing text format—there is no native “insert page break here.” Pagination happens after HTML conversion, via CSS print properties or the preview/layout UI described below. Embedding <div style="page-break-after: always;"> in .md works in some pipelines but hurts source readability and forces edits whenever layout changes.

Reference: CSS @media print (general case)

When you own the stylesheet, print rules often look like the snippet below. Always verify in print preview—PDF engines may interpret rules slightly differently.

@media print {
  h1 {
    break-before: page;
  }
  table, pre {
    break-inside: avoid;
  }
}

Save as PDF also depends on margins, paper size, orientation, and scaling—not CSS alone.

After you change paper, orientation, cover, or TOC

Changing A4/Letter, portrait/landscape, or adding a cover/TOC can shift where breaks fall. Scroll the whole preview to catch unwanted blank pages (e.g. a “break before heading” rule hitting right after a cover). Re-check breaks around landscape pages if you mix orientations.


Four ways to control page breaks

1. Drag page-break lines in the preview

In the Preview tab, drag the page-break line to move it between block boundaries. Want the next heading to start on a fresh page? Just drag the break up to it. This works without editing your Markdown at all.

Drag as many times as you like to find the right layout before exporting.

Dragging a page-break line in the preview panel

Figure: Drag the dashed line in Preview to place the page break where you want it.

2. Click a block to toggle its page break

Click any content block to instantly add or remove a page break before it. Use drag to move existing breaks, and click to add or remove them—combine the two for efficient fine-tuning.

3. Precise page breaks (auto-measured)

The Precise page breaks button measures the actual rendered height of each block and inserts breaks just before a page would overflow. It builds a solid starting layout quickly; then you can drag to refine.

4. Layout rules for the whole document

Under Layout → Page breaks, set rules with a single checkbox:

RuleEffect
Break before h1Every major heading starts on a new page
Break before h2Every section heading starts on a new page
Avoid break inside tableTables stay on one page
Avoid break inside code blockCode blocks stay on one page

Set document-wide rules here, then use drag for any per-break adjustments.


Keep your Markdown source clean

A common workaround for Markdown page breaks is inserting raw HTML like <div style="page-break-after: always;"></div> directly into .md files. That works, but it clutters your source, means editing Markdown every time the layout changes, and bleeds presentation concerns into content files.

Markdown Document Converter keeps all page-break instructions in the preview and layout settings—your .md file never changes.


Privacy: files never leave your browser

Conversion, preview, and PDF generation all run entirely in your browser. Internal documents, confidential specs, and sensitive reports are safe to use.


Who benefits most


How to get started