Tutorials 25 min read

Markdown Has No Page Break — What Each Tool Uses Instead, and What the Line Does Everywhere Else

MMNMNOTE
page-breakmarkdownpdf-exportprintobsidiantyporapandocquartovscodegithub

Markdown has no page break. Each exporter reads its own line — an HTML div with a CSS break, a div with a class, or the LaTeX command \newpage — and other apps read that line differently. On GitHub, of four break lines, one vanished, two printed as text, and one wrapped the rest of the note.1

The question is old — and one of the most-read on the Obsidian forum. "Page Breaks for PDFs", opened in February 2021, had 80,665 views on 28 November 2026, and three later threads on page breaks add 17,297 more.2

An answer in one of those threads put it in two sentences: "Markdown does not support page breaks. A kludge is to use html code or css."3 The kludge works — in the app it was written for.

The frustration is current. A user who opened a thread on 30 October 2026 wrote: "I’ve been sitting here for an hour trying to export a PDF."4

What follows is one test note, seven break lines and what three readers made of them; each tool's documented line, in its own words; the CSS rule underneath most of them; a print rule that keeps break lines out of the note; and a search for the ones already there.


Seven break lines, three readers, one test note

Seven break lines, documented by Typora, VS Code's Markdown PDF, pandoc, Quarto and the Obsidian forum, were run through GitHub's renderer, pandoc's Word export and a browser-style HTML pipeline. None worked in all three. The inline-style div came closest — invisible on GitHub — yet pandoc made no Word page break from it.1

The main test note, with blank lines between blocks:

# Title

Para one.

<div style="page-break-after: always;"></div>

Para two.

\newpage

Para three.

<div class="page"/>

Para four.

<div style="page-break-after: always; visibility: hidden"> \pagebreak </div>

Para five.

A second note held the other three lines — the modern CSS name, the closed class div and Quarto's shortcode:

<div style="break-after: page;"></div>

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

{{< pagebreak >}}

In the Word test, each of the seven was also run alone between two paragraphs.1

Two kinds of evidence sit behind this post — kept apart on purpose. Observed means the line was run through the reader and the output read back. Documented means the result comes from the tool's own pages. Typora, Obsidian and Markdown PDF were not run.

Line in the noteDocumented byGitHub (observed)pandoc → Word (observed)Browser print pipeline
<div style="page-break-after: always;"></div>Typora; Obsidian forumempty div, nothing showsno breakbreak, by the CSS rule
<div style="break-after: page;"></div>Obsidian forum (2025)empty div, nothing showsno breakbreak, by the CSS rule
<div class="page"></div>VS Code Markdown PDFempty div, nothing showsno breakbreak only where a .page rule exists
<div class="page"/>VS Code Markdown PDFa div that holds every paragraph after itno break; pandoc warns the div is "unclosed"a div that holds every paragraph after it
\newpagepandoc's pagebreak filterprinted as textdropped without the filter; one break with itprinted as text
hidden div with \pagebreak insideObsidian forum (2023)style removed, \pagebreak showsno breakbreak, text hidden
{{< pagebreak >}}Quartoprinted as textprinted as text (Quarto itself breaks)printed as text

The browser-style pipeline is markdown-it with HTML enabled — the parser family VS Code's Markdown PDF builds on — followed by a standards-conforming HTML parser. Its structure was observed; its "break" cells are what the CSS standard says a print engine does with that style — no page was printed.15

Every line that breaks somewhere leaves something behind somewhere else.

Typora: an inline-style div, or a setting that breaks at every heading

Typora documents two ways to break a PDF. A manual line, <div style="page-break-after:always"></div>, breaks the page where it sits. A setting, Page Break Between Top Headings, breaks before every top-level heading and before the footnotes. Typora was not run for this test; this section reads its documentation, updated 31 October 2026.6

The manual line, in Typora's words: "You can input <div style="page-break-after:always"></div> in your document to manually add a page break at that position."6

The setting does the same job without a line in the note. "When “Page Break Between Top Headings” is enabled, a page break will be inserted between sections divided by top level headings (h1). Also, a page break will be inserted before footnote definitions."6

The setting is the better default. It is a rule about the document's shape — nothing is typed into the note, and nothing shows up as stray markup in another app.

One caveat concerns Word. Typora's documentation says: "For formats other than HTML, PDF and Images, Typora use pandoc for exporting." [sic]6 In this test, pandoc made no Word page break from that div.1 So a Typora .docx export probably ignores it too — an inference, not a result, because Typora itself was not run.

VS Code's Markdown PDF: a class, and the short form that wraps the rest of the note

The Markdown PDF extension for VS Code documents two lines, <div class="page"/> and <div class="page"></div>, and its stylesheet supplies the break with .page { page-break-after: always; }. Use the second. To an HTML parser, the short form is not a closed tag — it opens a div that every later paragraph falls inside.78

The README offers both as equals: "Please use either of the following to insert a page break."7

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

The HTML standard settles which one is safe. On a non-void element such as div — one that needs a closing tag — a trailing slash is a parse error, and "The parser behaves as if the U+002F (/) is not present." The specification adds, in parentheses: "(Self-closing tags don't exist in HTML.)"8

The test showed what that means in practice. GitHub's renderer opened a div at that line and closed it only after the last paragraph. pandoc read it the same way — and warned: "Div at in.md line 13 column 1 unclosed at in.md line 22 column 1, closing implicitly." In the browser-style pipeline the div ended up with three children — every block after it.1

On GitHub this is nearly invisible — the class is removed, and the wrapper has no styling. The damage shows wherever CSS targets the div. A user reported it to the extension in April 2021, in an issue titled "Invalid HTML in readme": "The exported HTML page would "capture" all content beneath that line within that "page" div!"9 The issue is still open.

Markdown PDF's own PDF export handles the short form — because it rewrites it. The extension's source describes a step that "Normalizes self-closing non-void elements to open/close pairs" — and the code applies it to every export type except HTML.10 So the README's first example breaks a PDF page and, in an HTML export, wraps the note — the case the 2021 issue describes.

That handling once went missing. Version 2.0.0, dated 13 April 2026, stopped breaking on the short form; an issue was opened the same day, and version 2.0.1, dated 14 April, fixed it: "Fix: Self-closing <div class="page" /> now correctly triggers a page break".11 A one-day fix is fast — and the closed form never needed one.

Markdown PDF was not run for this test. Its behaviour here is read from its source code at the commit of 29 July 2026, the newest on 28 November 2026.10

pandoc and Quarto: \newpage through a filter, or a shortcode

pandoc reads \newpage as LaTeX and, without help, drops it silently from Word, HTML and plain-text output. The pagebreak filter from pandoc-ext turns it into a real break in eight formats, Word included. Quarto has its own line, {{< pagebreak >}}. GitHub reads neither, and prints both as text.11213

The test used pandoc 3.9. Converted to Word, the main note produced 0 page breaks without the filter and 1 with it — from \newpage, the only line the filter reads. Neither style div, the class div nor the hidden div produced a Word break, with or without the filter.1

The filter's README describes its job: it "converts paragraps [sic] containing only the LaTeX \newpage or \pagebreak command into appropriate pagebreak markup for other formats".12 The command must sit alone in its paragraph — a blank line above, a blank line below. The fully supported formats number eight: AsciiDoc, ConTeXt, Word, EPUB, groff ms, Typst, HTML and LaTeX. "ODT is supported, but requires additional settings in the reference document".12

pandoc note.md -L pagebreak.lua -o note.docx

The other formats get an invisible character. "In all other formats, the page break is represented using the form feed character."12 In the test, converting the note to Markdown with the filter wrote a literal form feed into the output — a control character most editors do not show.1

Quarto builds the break in. "The pagebreak shortcode enables you to insert a native pagebreak into a document," its documentation says, and "Native pagebreaks are supported for HTML, LaTeX, Context, MS Word, Open Document, ePub, and Typst (for other formats a form-feed character \f is inserted)."13

The shortcode is Quarto's alone. Run through plain pandoc, {{< pagebreak >}} came out as a paragraph of text in the Word file — and as text on GitHub.1

Obsidian: no documented break, and one forum line that works

Obsidian's help documents five Export to PDF settings, and none of them is a page break. A search of its help files, at the commit of 26 November 2026, found no mention of one. The forum's answer since February 2021 is the inline-style div, on its own line and outside a code block. Obsidian was not run for this test.1415

The five settings are file name as title, page size, landscape, margin and downscale percent.14 For anything else the help page points to styling: "To change how an export looks, you can use a CSS snippet."14

The forum filled the gap the day the request was posted. On 16 February 2021, ottovanluchene suggested <div style="page-break-after: always;"></div>, and the person who asked replied: "thanks @ottovanluchene - that works."15 Six months later came a placement rule: "Don’t add it in a code block. It will not show up in preview mode."15

Obsidian's HTML rules explain why placement matters. "Obsidian does not render Markdown syntax inside HTML elements." And: "HTML blocks must be complete and cannot contain blank lines within them."16 Keep the div on one line — no line breaks inside it — with a blank line above and below.

Two later answers added variants. In 2023: "You can add <div style="page-break-after: always; visibility: hidden"> \pagebreak </div> anywhere in your note to force a page break."17 In 2025, the modern CSS name: "You can add <div style="break-after: page;"></div> for page breaks anywhere."18

The 2023 hybrid costs the most outside Obsidian — GitHub removes the style, so the hidden \pagebreak shows on the page.1

Two Obsidian results are expected but untested. \newpage should show as text, since it is a LaTeX command outside a math block. And because HTML blocks must be complete, the short div class="page" is unlikely to wrap later paragraphs the way it does on GitHub.

GitHub: the reader every break line meets

GitHub has no page break and no print layout, so every break line arrives there as something else. Its renderer removed the style attribute and the class, leaving empty divs; it printed \newpage, \pagebreak and Quarto's shortcode as text; and it let the short div hold the rest of the note.1

GitHub matters here because it is where a Markdown file most often gets read by someone else. A README, a shared notes repository, a snippet pasted into an issue — each is rendered by GitHub, not by the app that wrote the break.

The style stripping is not new to break lines. GitHub removes the style attribute from HTML in Markdown, which is also why coloured text loses its colour there — covered in Colored Text in Markdown.19

For break lines, the stripping is mostly harmless — an empty div shows nothing. The trouble is text: \newpage, {{< pagebreak >}} and the \pagebreak inside a hidden div all appear as visible words in the rendered file.1

The visibility: hidden trick has the same weakness as other ways of hiding text in a note — it works only where the style survives. That question is covered for comments in Three Ways to Hide a Comment in a Markdown Note.20

page-break-after and break-after are the same rule

The two CSS names do the same job. The W3C's CSS Fragmentation module treats page-break-after: always as a legacy alias of break-after: page, and both act only on paginated output — a print or a PDF export. On screen, every break line in this post does nothing at all.5

The aliasing is a requirement, not a suggestion. User agents "must alias the page-break-before, page-break-after, and page-break-inside properties to break-before, break-after, and break-inside by treating the page-break-* properties as legacy shorthands", with always mapped to page.5 The module is a W3C Candidate Recommendation, dated 4 December 2018.

Another passage explains why the reading view looks unchanged. "These values only have an effect in paginated contexts; if the flow is not paginated, they have no effect."5

So the 2021 and 2025 forum answers are one answer — in two spellings. Either works in a print engine that follows the standard.

The cleaner option: a print rule, not a line in the note

A print stylesheet can break before every top-level heading without one break line in the note: @media print { h1 { break-before: page; } }. The note stays plain Markdown in every app, and the layout decision moves to the exporter — where an earlier post argues it belongs.2117

That post, Why Plain Markdown Prints Better, argues that a plain note prints well because the page is left to the typesetter, and puts it in seven words: "The file declares nothing; the stylesheet decides."21 A break line is the exception to that idea. A print rule keeps it intact.

Archie, an Obsidian forum user, made the same point in 2021: "Markdown and paged format documents are fundamentally different in this regard and should remain so. it is only a problem of conversion."15

The rule, in its current spelling:

@media print {
  h1 { break-before: page; }
}

The 2023 forum answer gives the older spelling, for top-level and second-level headings:17

@media print { h1, h2 { page-break-before: always; } }

Under the aliasing rule above, the two behave the same.5

Where it goes depends on the tool. In Obsidian, it is a CSS snippet — the route the help page names for changing how an export looks.14 In Typora, the Page Break Between Top Headings setting does the same thing without CSS.6

A manual break still earns its place for a few pages a rule cannot predict — a cover page, an appendix, a wide table that should start fresh. One line in a long document is a fair price. A line before every section is a stylesheet written by hand.

Which break line to use, by where the note is going

Choose the break line for the exporter you print from, then check what it leaves in the other apps that open the note. For a PDF from Typora or Obsidian, use the inline-style div. For VS Code's Markdown PDF, use the closed div class="page". For Word through pandoc, use \newpage with the filter.671215

  1. PDF from Typora or Obsidian. <div style="page-break-after: always;"></div> on its own line, with blank lines around it, outside any code block. On GitHub it leaves an empty div.1615
  2. PDF from VS Code's Markdown PDF. <div class="page"></div>, never the short form.78
  3. Word, EPUB or Typst through pandoc. \newpage alone in its paragraph, converted with -L pagebreak.lua. On GitHub it prints as text.112
  4. A Quarto document. {{< pagebreak >}}. Outside Quarto it prints as text.113
  5. A note that also lives on GitHub. Prefer a print rule. If a line is needed, the three empty-div forms were the only lines that left nothing visible there.1

No single line works everywhere. The empty-div lines leave the least behind — and none of them gave a break in pandoc's Word export.1

<div style="page-break-after: always;"></div>

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

\newpage

{{< pagebreak >}}

Find the break lines already in your notes

One search finds every break line from this post in a folder of Markdown notes, and a second finds the short div class="page" form alone. A preview command rewrites that form as an open-and-close pair. All three were tested with GNU grep 3.12 and GNU sed 4.9 on a sample folder.1

Run these from the top of a notes folder. Find every break line:

grep -rnE '\\(newpage|pagebreak)|page-break-|break-(after|before):|class="page"|\{\{< *pagebreak' --include=*.md .

On the sample it listed fourteen lines, covering all seven forms. It skipped the phrase "a page-break in prose", because the pattern needs a hyphen after page-break.1

Find only the short form:

grep -rnE '<div class="page" */>' --include=*.md .

Preview the fix. This prints the result without changing the file:

sed -E 's#<div class="page" */>#<div class="page"></div>#g' note.md

On the sample, both <div class="page"/> and <div class="page" /> became <div class="page"></div>.1 Add -i only after reading the preview.

The count is worth knowing before a move — every \newpage and every shortcode is a line of visible text in the next app that does not read it.

What was tested, and what was only read

Three readers were run on 28 November 2026: GitHub's Markdown API in its GitHub-flavoured mode, pandoc 3.9 with and without the pagebreak filter, and markdown-it with HTML enabled followed by a standards HTML parser. Typora, Obsidian and Markdown PDF were not run; their rows come from documentation, source code and forum answers.1

No page was printed. The "break" cells for the browser pipeline are what the CSS standard says a print engine does with the style, not a result from a PDF.5 The Markdown PDF section reads its source code, which can change in a release.10

Obsidian's behaviour rests on two sources — its help pages, and forum users who confirmed the inline-style div works. Its \newpage and short-div behaviour is expected from its documented HTML rules, not tested.1615

The forum figures — 80,665 views on the main thread and 17,297 on three others — were read on 28 November 2026 and will move.2

Frequently Asked Questions

How do I insert a page break in Markdown? Markdown has no page break syntax. Use the line your exporter reads: <div style="page-break-after: always;"></div> for Typora and Obsidian PDFs, <div class="page"></div> for VS Code's Markdown PDF, or \newpage with pandoc's pagebreak filter for Word. Each line behaves differently in other apps, so check where else the note is read.

How do I add a page break when exporting a PDF from Obsidian? Obsidian's help lists no page-break setting. Forum users since 2021 put <div style="page-break-after: always;"></div> on its own line, with blank lines around it and outside any code block. For a break before every heading, a CSS snippet such as @media print { h1 { break-before: page; } } avoids break lines in the note.

Why does \newpage show up as text in my note? \newpage is a LaTeX command, and most Markdown renderers do not run LaTeX. In a 28 November 2026 test, GitHub printed it as text, and a markdown-it pipeline did the same. pandoc dropped it silently from Word output unless the pagebreak filter was used, in which case it became one real page break.

What is the page break for VS Code Markdown PDF? Use <div class="page"></div>. The README also offers <div class="page"/>, but HTML has no self-closing div, so other readers treat it as an opening tag that wraps the rest of the note. Markdown PDF's own PDF export rewrites the short form — a fix restored in version 2.0.1, 14 April 2026 — but its HTML export does not.

How do I add a page break in pandoc for a Word document? Put \newpage alone in its own paragraph and convert with the pagebreak filter: pandoc note.md -L pagebreak.lua -o note.docx. In a 28 November 2026 test, that produced one Word page break, against none without the filter. HTML page-break divs produced no Word break either way. Quarto users can write {{< pagebreak >}} instead.

Is page-break-after the same as break-after? Yes. The W3C's CSS Fragmentation module requires browsers to treat page-break-after as a legacy alias of break-after, with always mapped to page. Both apply only to paginated output such as printing or PDF export. On screen, neither has any effect, which is why a break line looks like nothing in reading view.

Why did everything after my page break end up inside a div? The break was probably written as <div class="page"/>. HTML ignores the trailing slash on a div, so the line opens a div that is closed only at the end of the document. GitHub, pandoc and a markdown-it pipeline all nested the later paragraphs inside it. Write <div class="page"></div> instead.


A page break is an instruction to one printer — and every other app that opens the note reads it too.


mnmnote.com keeps notes as plain Markdown on your own device, which is the reason to choose a break line by every app the note will meet, not just the one that prints it.

Footnotes

  1. MNMNOTE, test-note run, 28 November 2026. Two test notes (seven break lines) through: GitHub's Markdown API (POST /markdown, mode gfm); pandoc 3.9 to Word, HTML, plain text and Markdown, with and without the pandoc-ext pagebreak filter at commit 5b70d614 (30 October 2026), counting page breaks in the Word file's document.xml, and each line also run alone between two paragraphs; markdown-it-py 3.0.0 (commonmark, HTML enabled) followed by html5lib. The search and preview commands were run with GNU grep 3.12 and GNU sed 4.9 on a sample folder. Typora, Obsidian and Markdown PDF were not run. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 ↩9 ↩10 ↩11 ↩12 ↩13 ↩14 ↩15 ↩16 ↩17 ↩18 ↩19 ↩20 ↩21 ↩22

  2. Obsidian Forum, views field read 28 November 2026: "Page Breaks for PDFs" (topic 13107, opened 16 February 2021) 80,665; "Ability to choose where page breaks in PDF" (27120) 8,093; "Page breaks for PDF (again)" (101637) 7,004; "Page break is corrupted when export to pdf" (69666) 2,200. https://forum.obsidian.md/t/13107.json and the same path for each topic number. ↩ ↩2

  3. Jeffrey J Weimer (DrJJWMac), reply in "Ability to choose where page breaks in PDF," Obsidian Forum, 14 November 2021. https://forum.obsidian.md/t/ability-to-choose-where-page-breaks-in-pdf/27120 ↩

  4. garugc, "Text formatting is a total disaster," Obsidian Forum, 30 October 2026. https://forum.obsidian.md/t/text-formatting-is-a-total-disaster/120014 ↩

  5. W3C, CSS Fragmentation Module Level 3, Candidate Recommendation, 4 December 2018, §3.1 and §3.4. https://www.w3.org/TR/css-break-3/ Accessed 2026-11-28. ↩ ↩2 ↩3 ↩4 ↩5 ↩6

  6. Typora, "Export," Typora Support, published 20 April 2021, updated 31 October 2026. https://support.typora.io/Export/ Accessed 2026-11-28. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7

  7. yzane, Markdown PDF for VS Code, README section "Page Break" and styles/markdown-pdf.css. https://github.com/yzane/vscode-markdown-pdf Accessed 2026-11-28. ↩ ↩2 ↩3 ↩4

  8. WHATWG, HTML Living Standard, §13.2.2 "Parse errors," non-void-html-element-start-tag-with-trailing-solidus. https://html.spec.whatwg.org/multipage/parsing.html Accessed 2026-11-28. ↩ ↩2 ↩3

  9. Venryx, "Invalid HTML in readme," yzane/vscode-markdown-pdf issue #248, 13 April 2021, open as of 28 November 2026. https://github.com/yzane/vscode-markdown-pdf/issues/248 ↩

  10. yzane, Markdown PDF source, src/utils.ts (transformHtmlBlock) and src/extension.ts, commit 37bee5a1 (29 July 2026). https://github.com/yzane/vscode-markdown-pdf/blob/37bee5a16aa6/src/utils.ts Accessed 2026-11-28. ↩ ↩2 ↩3

  11. yzane, Markdown PDF CHANGELOG, version 2.0.1 (2026/04/14), and issue #428, "Self-closing <div class="page" /> is ignored after v2.0.0 (page break no longer works)," opened 13 April 2026. https://github.com/yzane/vscode-markdown-pdf/blob/master/CHANGELOG.md · https://github.com/yzane/vscode-markdown-pdf/issues/428 Accessed 2026-11-28. ↩

  12. pandoc-ext, "pagebreak" filter README, commit 5b70d614 (30 October 2026). https://github.com/pandoc-ext/pagebreak Accessed 2026-11-28. ↩ ↩2 ↩3 ↩4 ↩5 ↩6

  13. Quarto, "Markdown Basics," section "Page Breaks." https://quarto.org/docs/authoring/markdown-basics.html#page-breaks Accessed 2026-11-28. ↩ ↩2 ↩3

  14. Obsidian, "PDFs," Obsidian Help, section "Export to PDF." https://help.obsidian.md/pdf (source: obsidian-help commit 1a4e17c, 26 November 2026; a search of en/ for page.break|pagebreak|break-after|break-before|@media print returned no matches). Accessed 2026-11-28. ↩ ↩2 ↩3 ↩4

  15. ottovanluchene, DudeNamedBen and Archie, "Page Breaks for PDFs," Obsidian Forum, posts of 16 February and 11 August 2021. https://forum.obsidian.md/t/page-breaks-for-pdfs/13107 ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7

  16. Obsidian, "HTML content," Obsidian Help. https://help.obsidian.md/html (source: obsidian-help commit 1a4e17c, 26 November 2026). Accessed 2026-11-28. ↩ ↩2

  17. ariehen, reply in "Page break is corrupted when export to pdf," Obsidian Forum, 19 October 2023. https://forum.obsidian.md/t/page-break-is-corrupted-when-export-to-pdf/69666 ↩ ↩2 ↩3

  18. ariehen, reply in "Page breaks for PDF (again)," Obsidian Forum, 7 June 2025. https://forum.obsidian.md/t/page-breaks-for-pdf-again/101637 ↩

  19. MNMNOTE, "Colored Text in Markdown: Which Apps Keep It, Which Strip the Style, and the Tag GitHub Deletes Outright." https://blog.mnmnote.com/posts/colored-text-in-markdown-which-apps-keep-it-and-which-delete-it ↩

  20. MNMNOTE, "Three Ways to Hide a Comment in a Markdown Note, and Where Each One Shows Up Anyway." https://blog.mnmnote.com/posts/three-ways-to-hide-a-comment-in-a-markdown-note ↩

  21. MNMNOTE, "Why Plain Markdown Prints Better: The Page Break Is the Whole Argument." https://blog.mnmnote.com/posts/plain-markdown-looks-better-printed-than-your-rich-text-export ↩ ↩2