Skip to content

Claude's answers, rendered: Markdown, math, charts and diagrams drawn in the Claude Code terminal. Independent project, not affiliated with Anthropic.

TypeScript claude-code-mod

Fonts: body text in the terminal's font, at the terminal's size

razorback16b2220b22fc3d
diff --git a/docs/themes.md b/docs/themes.md
index 5cbf482..ad84593 100644
--- a/docs/themes.md
+++ b/docs/themes.md
@@ -2,7 +2,7 @@
← Back to the [README](../README.md)
-A theme sets the colours, fonts and spacing of the picture. Three themes are in the mod:
+A theme sets the colours, fonts and spacing of the picture. Body text always uses the terminal's own font at the terminal's text size. Three themes are in the mod:
| Name | Looks like |
|---|---|
diff --git a/hooks/lib/settings.ts b/hooks/lib/settings.ts
index c4397ca..3154b80 100644
--- a/hooks/lib/settings.ts
+++ b/hooks/lib/settings.ts
@@ -54,7 +54,7 @@ export const DEFAULT_CELL: Cell = { width: 16, height: 32 }
// room height now, `design-w` and `design-h` the design (the space at the
// first compile of the text). Its live Typst blocks scale by
// min(content width / design-w, height / design-h).
-export const TEMPLATE_VERSION = '8'
+export const TEMPLATE_VERSION = '9'
// Part of the key of a picture with the row grid only: bump it when such a
// picture or its bullet row changes, so the keys with the grid off stay.
export const GRID_VERSION = '2'
diff --git a/render/fonts.typ b/render/fonts.typ
index ba8047b..f913692 100644
--- a/render/fonts.typ
+++ b/render/fonts.typ
@@ -1,7 +1,10 @@
// Font lists shared by md.typ and measure.typ. They come from the active
// theme (theme.typ: `fonts.body` and `fonts.code`, merged over vscode).
#import "theme.typ": fonts
-#let sans = fonts.body
+// The terminal's own font first for body text, so the hooks module sizes it
+// exactly as the terminal's text.
+#let term-font = sys.inputs.at("term-font", default: "")
+#let sans = if term-font != "" { (term-font,) + fonts.body } else { fonts.body }
#let mono-base = fonts.code
// The row grid (md.typ, grid=1): the ink of a line of the current text
// (needs context), "bdfhkl" `up` from the baseline and "gjpqy" `down`, and
diff --git a/render/themes/README.md b/render/themes/README.md
index e1bdf4c..a892120 100644
--- a/render/themes/README.md
+++ b/render/themes/README.md
@@ -38,7 +38,7 @@ Example: pink inline code, rounder boxes.
|---|---|---|
| `name`, `description`, `source` | | Shown by `/iui theme` |
| `syntax.dark`, `syntax.light` | `dark.tmTheme`, `light.tmTheme` | Code colours: a TextMate theme file in this folder. If you leave this out, the vscode files are used. If you name a file, it must exist. |
-| `fonts.body` | SF Pro Text, Helvetica Neue, Helvetica, Arial, … | Body font list (first installed one wins, per character) |
+| `fonts.body` | SF Pro Text, Helvetica Neue, Helvetica, Arial, … | Body font list (first installed one wins, per character). The terminal's own font is always put first, so body text is exactly the terminal's size (at `/iui size 100`). This list is used when the terminal's font is not known. |
| `fonts.code` | Menlo, SF Mono, DejaVu Sans Mono, … | Code font list |
| `fonts.use-terminal-font` | `true` | Put the terminal's own font first for code |
| `dark.*`, `light.*` | see `vscode/theme.json` | Colours: `fg`, `muted`, `link`, `accent` (checked boxes), `bg` (the page colour that live Typst blocks get as `theme.bg`), `border` (h1/h2 rules, hr, table rows), `th-border`, `inline-code-fg`, `inline-code-bg`, `code-fg`, `code-plain-fg` (code blocks with no language; if you leave it out, `code-fg` is used), `code-bg`, `code-border`, `quote-bg`, `quote-border`, `check` (tick in a checked box), `red`, `green`, `blue`, `yellow`, `orange`, `purple` (for drawings) |