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 == 1in the body of the show rule, any heading with a higher level will not be shown at all, as the show rule returnsnonefor them. You should instead use awhere-selector as in#show heading.where(level: 1): it => ... -
A normal
pagebreakmay create an unwanted empty page when the previous page is already empty. You maybe want to set theweakparameter to prevent that.