How to disable undefined behavior in `outline` title ? (`heading(level: 1)`)

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 returns none for them. You should instead use a where-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 the weak parameter to prevent that.