I have tried
#show heading: it => [#v(1fr) #v(1.3em) #it]
to introduce extra stretch at headings at least, but that also ends up introducing that stretch on pages that end in a pagebreak / the last page; unless I also add a #v(1000fr) at the end.
Is there some way to check how "full" a page is to switch between doing this and just leaving it be? Because I'd prefer that even over the "depends on pagebreaks / last page" thing that LaTeX does with \flushbottom (as far as I understand it)
Solution (thanks to PgSuper):
#show heading: it => [#v(1fr, weak:true) #v(1.3em) #it]
(didn't actually work, my tests were just broken)
Actual solution:
#let sequence = [abc #v(100fr)].func()
#let styled = [#set par(justify: true); foo].func()
#let addlastpage = (this, x) => if x.func() == sequence {
[
#for i in x.children.slice(0, x.children.len() - 1) {
i
}
#this(this, x.children.last())
]
} else if x.func() == styled {
styled(this(this, x.child), x.styles)
} else {
[#x #v(1000fr)]
}
#show: x => addlastpage(addlastpage, x)
#show pagebreak: it => [#v(1000fr) #it]
#show heading: it => if it.level == 1 { [#pagebreak() #it] } else { [#v(1fr) #v(20pt) #it] }