feat: add fonts: asset key to bring fonts into the deck contract#160
Merged
Conversation
Closes #159. Adds a fonts: frontmatter key (with deck-adjacent fonts/ auto-detect) that resolves to a directory or file. peitho then copies the fonts verbatim into the build output, the PDF export workspace, and the present cache — so site, PDF, and presenter all render with the same web fonts regardless of host environment (fixes WenQuanYi Zen Hei fallback on Linux CI). The five-lens invariants held: symlinks rejected symmetrically for source and directory entries, deterministic filename order, dotfile filtering in watch mode, always-clear dist/fonts/ so a removed fonts: key doesn't leak stale bytes into publish, and recursive watch expansion for nested subdirs like @fontsource/inter/. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01M2CDJTHJnfgNJrDJTamnQC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fonts:frontmatter key (with deck-adjacentfonts/auto-detect) as a first-class asset, parallel tolayouts:/css:/syntaxes:.decks.gosu.ke.docs/plans/2026-07-07-fonts-asset.md.Closes #159.
Highlights
url()parsing. Deck CSS writesurl("fonts/xxx.woff2"); the emittedpeitho.csssits at the output root so the relative URL resolves to the copiedfonts/sibling.@fontsource/inter/) are supported..DS_Store/.swprebuild storms.dist/fonts/is always cleared at build time so a removedfonts:key doesn't leak stale bytes intopeitho publish.decksrepo can migratebuild.mjs's font injection tofonts:(documented in the plan doc; not in this PR).Test plan
cargo test --workspace(3× per race-check discipline) — 490 passingcargo clippy --workspace --all-targets -- -D warningscargo fmt --all --checkgit diff --exit-code bindings/cd packages/peitho-present && npm run build && npm test && npm run typecheckgit diff --exit-code packages/peitho-present/dist/shell.jsfonts:at a Noto Sans JP.woff2+@font-faceCSS, runpeitho export pdf, verify/BaseFontshows Noto (not WenQuanYi) in the exported PDF🤖 Generated with Claude Code
https://claude.ai/code/session_01M2CDJTHJnfgNJrDJTamnQC