main
 1#import "@preview/bullseye:0.1.0": show-target
 2
 3#import "../utils/slugger.typ": slugger
 4
 5#let auto-reslugify-headings(body) = {
 6  let headings-slug-record = state("headings-slug-record", (:))
 7  show heading: it => context {
 8    let record = headings-slug-record.get()
 9    let ((slug,), record) = slugger(it.body, record: record)
10    headings-slug-record.update(record)
11    html.elem(
12      "h" + str(it.level + 1),
13      attrs: (id: slug),
14      it.body,
15    )
16  }
17
18  body
19}
20
21#let heading-template-html(body) = {
22  show heading: auto-reslugify-headings
23
24  body
25}
26
27#let heading-template-paged(body) = {
28  show heading: set text(style: "italic")
29  show title: set text(style: "italic")
30
31  body
32}
33
34#let heading-template(body) = {
35  show: show-target(paged: heading-template-paged, html: heading-template-html)
36
37  body
38}