retext-project / retext

ReText: Simple but powerful editor for Markdown and reStructuredText
GNU General Public License v2.0
1.86k stars 198 forks source link

Page break doesn't work with heading or empty line preceding #585

Open bkaganovich opened 2 years ago

bkaganovich commented 2 years ago

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" }
mitya57 commented 2 years ago

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>