Suppose I want to do something like a “paragraph hyphenation” - when the paragraph reaches the end of a page and must break, something happens - say, set the text color to be red, or add the text “banana” after its ending. Is such a thing possible?
Looking from my template file at the body element, Typst doesn’t use pagebreaks internally, in the same way linebreaks may only be inserted manually. I was lead to this by the fact show pagebreak: ... works only for manual insertions of pagebreak(). I suppose this is the case with linebreak() as well.
A possible way of achieving it may be to run some function every time counter(page).step() is used internally (if it even is), or some clever way of using state to track changes. No particular ideas, really.