main
 1#import "@preview/bullseye:0.1.0": match-target
 2
 3#import "./components/frame.typ": frame
 4#import "./components/image.typ": img
 5#import "./components/ruby.typ": ruby
 6#import "./components/sidenote.typ": sidenote
 7
 8///
 9///
10/// - body (content):
11/// - lang (str): pass to `set text(lang: lang)`
12/// - region (str, none): pass to `set text(region: region)`
13/// - toc (bool): whether to show post TOC
14/// -> content
15#let post-template(body, lang: "en", region: none, toc: true) = {
16  set text(lang: lang, region: region)
17
18  import "./templates/blockquote.typ": blockquote-template
19  import "./templates/footnote.typ": footnote-template
20  import "./templates/heading.typ": heading-template
21  import "./templates/raw.typ": raw-template
22
23  show: blockquote-template
24  show: footnote-template
25  show: heading-template
26  show: raw-template
27
28  context {
29    let frontmatter = query(<frontmatter>)
30      .first(default: (value: (title: "", date: auto)))
31      .value
32    set document(
33      title: frontmatter.title,
34      date: frontmatter.date,
35      description: frontmatter.at("desc", default: none),
36    )
37    if frontmatter.title != "" { title() }
38
39    if toc { match-target(html: sidenote(outline(), block: true), paged: ()) }
40  }
41
42  body
43}