Skip to content

Give a presentation's [[!style]] the size of its text - #422

Merged
Swordlash merged 5 commits into
mainfrom
deck-text-size
Dec 4, 2026
Merged

Swordlash merged 5 commits into
mainfrom
deck-text-size

Conversation

@Swordlash

@Swordlash Swordlash commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

WP5.147, first step: the size of a presentation's text, for the whole deck. The owner asked whether the size of the text in presentations can be set, and chose the whole deck first, with a size for one slide or a piece of one to follow.

What is built

[[!style]]{theme=dark aspect=4:3 size=small}: a third attribute, size, with small, normal (today's size, the default) and large.

  • wiki-core: TextSize = SmallText | NormalText | LargeText, a size field in DeckOptions, read as the other two attributes are (any case, blanks around).
  • In the browser: the deck's root carries slides-size-small, -normal or -large (deckClasses, so every place a deck is drawn has it: the viewer, the prerender, the editor's preview in both modes, the detached preview, an embedded deck). The stylesheet sets --slide-text-factor to 9/11 for small and 12/11 for large; the slide's four base sizes (title, body, footer, the title slide's title) multiply by it, and everything sized in em inside them follows (code, tables, footnotes, formulas, paddings). The slide's box and aspect do not change. The factor is inherited, so a later value on one slide can override it.
  • Whether a slide fits follows by itself: the measure reads the rendered slide, and a changed look line measures again.
  • In the PDF (Beamer): the class's 9pt for small and 12pt for large; normal adds nothing, so its LaTeX is byte for byte what it was (Beamer's 11pt).
  • A problem in the editor for an unknown size: "“huge” is not a size of [[!style]], which is small, normal or large: the slides keep the default, normal".
  • The guide's slide on themes and the README's copy of it gain the attribute; so does docs/markdown.md, which the assistant's reference embeds.

Why 9pt and 12pt

Measured with one filler paragraph, in the real export's TeX compiled with xelatex and in Chromium with the stylesheet: characters that fit on a slide.

small normal large
16:9, browser 1588 1028 790
16:9, PDF 2204 1350 1189
4:3, browser 2283 1427 1149
4:3, PDF 1890 1223 1006

At 16:9 the browser holds less than the PDF at every size, so a slide that fits in the browser fits in the PDF; 10pt and 14pt would have made the PDF hold relatively less than the browser's small and large do. At 4:3 the browser already held more than the PDF at normal before this change (1427 against 1223), and small widens that a little.

Where it differs from the plan's text

  • The plan said an unknown size is a problem "as an unknown theme is". An unknown theme or aspect is no problem today: it falls back to the default silently, and a test pins that. Only size warns; theme and aspect are left silent so that existing decks gain no warnings (Slides.unknownOptions is written so that they can be added).
  • The editor's bar has no control for the theme or the aspect, so none for the size; the completion inserts a {theme=…} snippet and completes no attribute names, and is unchanged.

Known and left

  • At 4:3 the browser holds more text than the PDF, at every size (older than this change; the paddings in em shrink with the text).
  • An html fence's frame and the cap on an image's height do not scale with the size.
  • PowerPoint keeps its own text size (the option lands in the file's properties, as the theme and the aspect do); the other exports do not receive a deck's options.
  • The slides view ("Present") has no render test of its own; it goes through the same deckClasses.
  • A size for one slide or a piece of one: the next step.

Tests

  • wiki-core: the option's parsing (three names, absent, unknown, case and blanks), the problem (unknown, known, absent, theme and aspect still silent, a later look line, a document).
  • wiki-server: Beamer's \documentclass line for each size.
  • Render on the in-memory DOM: the preview with the whole deck and with one slide across changes of the text; the deck viewer with the guide's deck at large and at small.
  • One walk in a real browser, in the editor's presentation group: the body's font at normal is what it was (24.576 px); title, body, footer and inline code at 9/11 and 12/11 of it; the slide's box 1024×576 at all three; the fit changing with the size.
  • Seen failing on purpose: normal given 11pt (the class line and the pinned LaTeX); a size changing the aspect (the box); normal given a factor (the font).

Verification

Run locally: build-native, build-wasm, format, lint; wiki-core's slides and problems groups (110), wiki-core-html-test (211), the assistant's (126); the server's exports with pandoc (156; one PDF example on SQLite failed once under load and passed alone, its PostgreSQL twin passed in the same run); wiki-app's preview, deck viewer, README and guide groups (218); the browser group "A presentation in the editor" alone (73). The whole native wiki-app suite and the other browser groups are left to CI.

Codex

  • Round 1 (63b2175, gpt-6.2-sol, high): two findings, being fixed. (1) From the rebase onto main, not from the work: main gained a field on Preview.Input (measureFits, Show a presentation as slides in the detached preview #418) and the branch's new test helper builds the record without it, so wiki-app-test does not compile on this head; CI's native jobs are red for that. (2) A code fence with rows=N on a slide has its size fixed in rem, so its text and its cap of lines do not follow the deck's size.

Round 1's fixes (d0d3346). The test's helper sets measureFits (the editor's pane); the whole native tree builds with no warning, and nothing else of the branch touched what main had changed. The detached window draws a deck through the same Preview now (#418), so the size's class reaches it; a check of that is added, and the changelog names the window. On a slide, three sizes that were fixed in rem multiply by the factor: a scrolling listing (its text and its cap of N lines), the copy button, the download link of an interactive SVG; at normal each is exactly what it was (13.6 px, 12 px, 12.8 px). Left, with reasons: paddings and margins in rem (spacing, which does not follow the slide's width today either), the speaker's notes (not on the slide), Mermaid's drawings and an html fence's frame. Found and left, older than this change: on a slide the code inside a scrolling listing is 0.85em of the listing's size, so the cap of N lines holds about 1.18×N lines of code. The browser's walk has a slide with a rows=3 listing, which scales with the rest and failed with the rule out. Run locally: build-native (the whole tree), format, lint; the preview's, the deck viewer's and the live preview's native groups (36); the browser group "A presentation in the editor" alone (73).

(rounds are added here)

🤖 Generated with Claude Code

https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM

A deck's text was one size, and a slide that did not fit could only be
cut down. [[!style]]{size=small|normal|large} sets a factor of every font
size on a slide in the browser and the class's size in points in the
Beamer PDF; normal is today's size in both, and the editor warns of a
size it does not know (WP5.147 of docs/PLAN.md).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM
A browser example: the same slide at small, normal and large, its text
by 9/11 and 12/11 and its box unchanged, and its fit marked again. Fixes
of the render tests' imports, and the formatter's order.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM
The measure behind the choice: what a slide of filler text holds at each
size, in the PDF and in the browser.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM
On a slide a listing with rows=N, a code block's copy button and an
interactive SVG's download link had sizes fixed in rem, so they kept
their size while the text around them changed. They take the deck's
factor now, the same at the normal size. The listing's height cap is in
its own lines, so it follows. Also: the preview's test gives the new
measureFits field (#418), and the detached preview's test checks the
size's class on the window's deck.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HnFn8HVAncUyJ6jU4yhnRM
@Swordlash
Swordlash merged commit aacad18 into main Dec 4, 2026
14 checks passed
@Swordlash
Swordlash deleted the deck-text-size branch December 4, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants