Hi, you can probably find a solution in How to create a pagebreak before every depth 1 heading except for the outline? (though with level
instead of depth
).
Some notes for your specific case:
-
When including the
if it.level == 1
in the body of the show rule, any heading with a higher level will not be shown at all, as the show rule returnsnone
for them. You should instead use awhere
-selector as in#show heading.where(level: 1): it => ...
-
A normal
pagebreak
may create an unwanted empty page when the previous page is already empty. You maybe want to set theweak
parameter to prevent that.