How to get the current header (level: 1)?

Sorry for asking, it is a very simple question. How can I get the heading (level: 1) ? I need to do some processing before including it in the footer with the page number.

Thank you.

Get how? query(heading.where(level: 1))?

https://typst.app/docs/reference/introspection/query/#finding-elements

1 Like

Based on the last sentence, I believe @Andrew_Duncan is looking to include the most recent heading in the footer.

To achieve this, I’ll recommend using the hydra package: hydra – Typst Universe

With it, calling hydra(1) or hydra(2) in the header or footer will display the latest heading. Check its docs for more information!

1 Like