main
1#import "@preview/bullseye:0.1.0": target
2#import "../utils/renderer-check.typ": is-renderer
3
4/// Margin notes.
5///
6///
7/// - content (content):
8/// - block (boolean): Whether to render as a block element. Default is `false`.
9/// - When `block: false`:
10/// - In HTML output with `block: false`, it just like footnotes in web but no numbering,
11/// wrapped in a span with class "marginnote".
12/// - In Feed HTML output, it will be a footnote without numbering.
13/// - In PDF output, it will be a footnotes without numbering.
14/// - When `block: true`:
15/// - In HTML output with `block: true`, it will be wrapped in a div with class "marginnote".
16/// - In PDF output, it will be a normal content wrapped in `#block()`.
17/// -> content
18#let marginnote(content, block: false) = context {
19 if target() == "html" {
20 return if block {
21 html.div(
22 class: "marginnote",
23 content,
24 )
25 } else {
26 if is-renderer("tybios") {
27 footnote(numbering: (..i) => "", content)
28 } else {
29 html.span(
30 class: "marginnote",
31 content,
32 )
33 }
34 }
35 } else {
36 return if block { std.block(content) } else { footnote(numbering: (..i) => "", content) }
37 }
38}