retext
retext copied to clipboard
Page break doesn't work with heading or empty line preceding
The page break in PDF export or print preview doesn't work if the line before is a heading or empty line.
Related: Page break in markdown does not work #290 Can I use page breaks in Markdown?
<!-- Required extensions: attr_list -->
First page
# Doesn't work here
{: style="page-break-before: always" }
{: style="page-break-before: always" }
Doesn't work here either
New page starts here
{: style="page-break-before: always" }
This solution works:
*<!-- -->*
{: style="page-break-before: always" }
For headers, you can put the attributes on the same line:
# Header Title {: style="page-break-before: always" }
With empty line, it indeed doesn't work, because you need something to attach the attribute too.
You can also use raw HTML if you really need an empty object:
<div style="page-break-before: always"></div>