summaryrefslogtreecommitdiff
path: root/tests/typ/meta/query-header.typ
blob: dd83c1286bceec91765f36a6d1dfd4a308f73f16 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Test creating a header with the query function.

---
#set page(
  paper: "a7",
  margin: (y: 1cm, x: 0.5cm),
  header: {
    smallcaps[Typst Academy]
    h(1fr)
    locate(it => {
      let after = query(selector(heading).after(it), it)
      let before = query(selector(heading).before(it), it)
      let elem = if before.len() != 0 {
        before.last()
      } else if after.len() != 0 {
        after.first()
      }
      emph(elem.body)
    })
  }
)

#outline()

= Introduction
#lorem(35)

= Background
#lorem(35)

= Approach
#lorem(60)