#page break before headings

14 messages · Page 1 of 1 (latest)

subtle kayak
#

Is it possible to automatically insert a page break before level 1 headings ?
I tried some stuff with show but I get the following "error"/restriction

get pagebreaks are not allowed inside of containers"

Is there some way around ?

prisma pollen
#

try this:

show heading: it => {
  if it.level == 1 {
    pagebreak()
  }
  it
}
subtle kayak
#

yeah that's what I tried

#

pagebreaks are not allowed inside of containers

prisma pollen
#

?render

#show heading: it => {
  if it.level == 1 {
    pagebreak()
  }
  it
}
here wie are with text before heading
The render engine does not render multiple Pages, should Note that it skips 2 Pages
= Heading 
== SubHeading
= Heading 
void plazaBOT
prisma pollen
#

it works locally and with @void plaza

prisma pollen
#

ah, you want to write this in a template file not in the main file

#

?render ```#let tmpl() = {
show heading: it => {
if it.level == 1 {
pagebreak()
}
it.body
}
}
#tmpl()

= Heading
== SubHeading
= Heading```

prisma pollen
#

because the pagebreak is in a different container as you mentioned.