Commit d3fcee2

HPCesia <me@hpcesia.com>
2026-02-04 10:21:20
Basic Tufted style sidenote support
1 parent f1cc81a
Changed files (3)
src
contents
_lib
styles
src/contents/_lib/lib.typ
@@ -5,5 +5,24 @@
 
 #let post-template(body) = {
   show math.equation: to-mathml
+  show footnote: it => {
+    if target() == "html" {
+      let number = counter(footnote).display(it.numbering)
+      let fn-id = "fn-" + number
+      let ref-id = "fnref-" + number
+
+      html.sup(html.a(
+        href: "#" + fn-id,
+        id: ref-id,
+        number,
+      ))
+      html.span(
+        class: "marginnote",
+        id: fn-id,
+        html.sup(html.a(href: "#" + ref-id, number)) + [ ] + it.body,
+      )
+    }
+  }
+
   body
 }
src/styles/article/index.css
@@ -1,6 +1,8 @@
 @import "./figure.css";
 @import "./heading.css";
 @import "./paragrah.css";
+@import "./sidenote.css";
 @import "./table.css";
 
 @apply text-base lg:text-lg;
+@apply max-w-full md:max-w-2/3;
src/styles/article/sidenote.css
@@ -0,0 +1,14 @@
+.marginnote {
+  @apply relative block;
+  @variant max-md {
+    @apply w-[95%] float-left m-2;
+  }
+  @variant md {
+    @apply w-1/2 mr-[calc(-1/2*100%)] float-right clear-right;
+    @apply pl-4;
+  }
+}
+
+section[role="doc-endnotes"] {
+  @apply hidden;
+}