Markdown Toolbox Logo Markdown Toolbox

Home
Blog

Buy Me A Coffee

How do I Add a Page Break in Markdown?

Thursday, December 21, 2023

Inserting page breaks in Markdown is not supported by the standard Markdown syntax. However, you can achieve this by incorporating HTML into your Markdown document, which is especially useful when converting the document to a PDF or printing it.

To add a page break, use the HTML <div> tag with the style attribute set to page-break-after: always;. This instructs the printer or PDF converter to start a new page after this point.

For example:

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

Place this line of HTML code where you want the page break to occur in your Markdown document. It won't be visible in the Markdown viewer but will take effect in the printed or PDF version.

Keep in mind that support for HTML in Markdown and the interpretation of CSS styles like page-break-after can vary depending on the Markdown processor and the tool used for printing or PDF conversion.