File size: 3,542 Bytes
9286790
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#let ink = rgb("#1a1a1a")
#let coal = rgb("#28282a")
#let quiet = rgb("#747577")
#let rule = rgb("#d1d1d1")
#let rosewood = rgb("#916f6f")
#let sans = ("Inter", "Segoe UI", "Helvetica Neue", "Arial", "Libertinus Serif")
#let mono = ("Cascadia Mono", "Consolas", "DejaVu Sans Mono")
#let today = datetime.today().display("[year]-[month]-[day]")
#let dots = tiling(size: (24pt, 24pt), place(dx: 11pt, dy: 11pt, circle(radius: 0.8pt, fill: rgb("#ffffff30"))))

#let label(body) = text(font: mono, size: 0.72em, fill: quiet, tracking: 1.5pt, upper(body))

#let base(body) = {
  set text(font: sans, size: 10pt, fill: ink, lang: "en")
  set par(leading: 0.72em, spacing: 1.2em)
  set list(marker: text(fill: quiet)[—])
  set table(stroke: 0.5pt + rule, inset: 7pt)
  show heading: set text(font: mono, weight: "bold")
  show heading: set block(above: 1.7em, below: 0.9em)
  show heading.where(level: 2): it => block(width: 100%, stroke: (bottom: 0.5pt + rule), inset: (bottom: 6pt), it)
  show raw: set text(font: mono)
  show raw.where(block: true): block.with(width: 100%, inset: 10pt, stroke: 0.5pt + rule, fill: rgb("#f7f7f7"))
  show raw.where(block: false): box.with(inset: (x: 3pt), outset: (y: 3pt), fill: rgb("#f0f0f0"))
  show link: underline.with(offset: 2pt)
  show table.cell.where(y: 0): it => label(it)
  body
}

#let callout(title: "Note", body) = block(width: 100%, inset: 10pt, stroke: (left: 2pt + rosewood, rest: 0.5pt + rule))[
  #label(text(fill: rosewood, title)) \
  #body
]

#let documentation(title: "Title", summary: none, author: none, version: none, date: today, body) = {
  show: base
  set page(
    paper: "a4",
    margin: (x: 2.4cm, top: 2.8cm, bottom: 2.4cm),
    header: [#label(title) #h(1fr) #label((version, date).filter(part => part != none).join[ · ])],
    footer: context align(right, label(counter(page).display("1 / 1", both: true))),
  )
  set heading(numbering: "1.1")
  block(below: 2em)[
    #label((author, version, date).filter(part => part != none).join[ · ]) \
    #text(font: mono, size: 24pt, weight: "bold", title)
    #if summary != none { block(above: 0.8em, text(size: 11pt, fill: quiet, summary)) }
  ]
  outline(depth: 2, title: label[Contents])
  body
}

#let note(title: "Title", topic: "Note", author: none, date: today, body) = {
  show: base
  set page(paper: "a4", margin: 2.4cm, footer: context align(right, label(counter(page).display())))
  label(topic)
  h(1fr)
  label((author, date).filter(part => part != none).join[ · ])
  block(above: 0.8em, below: 1.5em, stroke: (bottom: 1pt + ink), inset: (bottom: 10pt), width: 100%, text(
    font: mono,
    size: 20pt,
    weight: "bold",
    title,
  ))
  body
}

#let slides(title: "Title", subtitle: none, author: none, date: today, body) = {
  show: base
  set text(size: 19pt)
  set page(
    paper: "presentation-16-9",
    margin: (x: 2cm, top: 2cm, bottom: 1.8cm),
    footer: context [#label(title) #h(1fr) #label(counter(page).display())],
  )
  show heading.where(level: 1): it => {
    pagebreak(weak: true)
    block(below: 1em, text(size: 28pt, it.body))
  }
  show heading.where(level: 2): set text(size: 20pt)
  page(fill: coal, background: rect(width: 100%, height: 100%, fill: dots), footer: none, align(horizon)[
    #set text(fill: white)
    #label(text(fill: rgb("#afaead"), (author, date).filter(part => part != none).join[ · ])) \
    #text(font: mono, size: 38pt, weight: "bold", title)
    #if subtitle != none { block(above: 0.6em, text(size: 20pt, fill: rgb("#ccc7c6"), subtitle)) }
  ])
  body
}