fix: resolve relative font-paths for typst compilation#14068
Merged
gordonwoodhull merged 1 commit intomainfrom Feb 19, 2026
Merged
fix: resolve relative font-paths for typst compilation#14068gordonwoodhull merged 1 commit intomainfrom
gordonwoodhull merged 1 commit intomainfrom
Conversation
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
This was referenced Feb 19, 2026
Fixes #13745 Relative font-paths (from extensions, document metadata, or project config) were passed unchanged to the typst CLI --font-path argument. Typst resolves these relative to its CWD, not the document directory, causing "unknown font family" errors when documents are in project subdirectories. Two changes: - output-typst.ts: resolve relative font-paths against the document directory before passing them to typstCompile - pandoc.ts: ensure brand font directories are absolute so they work regardless of CWD Adds three smoke tests covering extension font-paths, document font-paths from a subdirectory, and brand font-paths from a subdirectory. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ee3417f to
534d192
Compare
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.
Fixes #13745
Replaces #13902
Summary
font-pathsto absolute paths against the document directory before passing them to the Typst CLIfont-pathsin their_extension.ymlfail with "unknown font family" when the document is in a project subdirectoryThe root cause: relative font paths (from extensions, document front matter, or project config) were passed unchanged as
--font-patharguments to the Typst CLI. Typst resolves these relative to its process CWD, which has no defined relationship to the document directory. This caused failures whenever documents weren't at the project root.The fix is a two-line change in
output-typst.tsthat resolves relative paths againstinputDir(the document directory) before passing them totypstCompile. Absolute paths (frombrand.yamlfont resolution or already-resolved/-prefixed project paths) pass through unchanged.Test plan
font-pathswith document in subdirectory (was failing, now passes)font-pathsin front matter with document in subdirectory (was failing, now passes)relative-font-pathproject-absolute/artifacts/fonts(confirms no regression)🤖 Generated with Claude Code