Fix Typst extension logo paths in subdirectories by making brand paths project-absolute#14075
Merged
gordonwoodhull merged 4 commits intomainfrom Feb 20, 2026
Merged
Fix Typst extension logo paths in subdirectories by making brand paths project-absolute#14075gordonwoodhull merged 4 commits intomainfrom
gordonwoodhull merged 4 commits 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. |
2 tasks
e116dae to
2d840ac
Compare
Transform brand logo paths to project-absolute (with / prefix) before merging with document logo metadata via resolveLogo. This ensures brand paths resolve correctly via Typst --root while document-sourced paths remain input-relative. Closes #13917. Removes the projectOffset() hack from typst-brand-yaml.lua that was indiscriminately prepending ../ to all logo paths. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move logos into images/ subdirectories so path resolution tests exercise multi-component paths. Nest the _metadata.yml test document one level deeper (sub/deep/doc.qmd) to test parent-directory metadata inheritance. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Brand logo paths in Typst image() calls now have a leading / since they are resolved as project-absolute paths. Update all 29 affected test regex patterns accordingly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use (/|\\\\) instead of literal / in test regexes so they match both Unix forward slashes and Windows backslashes in Typst output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
adbecd3 to
d205d47
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.
Replaces #13931 which would only make things more brittle.
The root cause was that we were using project-relative paths for brand logo paths, and then attempting to correct them to document-relative paths. And we ended up correcting logos specified in extension, project, or in the document itself.
Instead, we can use project-absolute paths for brand logo paths. We only do this for Typst to keep the change minimal -- but there do seem to be related bugs in dashboard and revealjs which might need a similar fix.
The important lesson is that when dealing with relative paths that may come from multiple locations, you must resolve the path either relative to the document or project-absolute, before it gets merged with any other source. (The situation in q2 is somewhat better because we will use
!pathto tag paths, but the principle remains.)Summary
/-prefixed) before merging with document logo metadata viaresolveLogo, so brand paths resolve correctly via Typst--rootwhile document-sourced paths remain input-relativeprojectOffset()hack fromtypst-brand-yaml.luathat indiscriminately prepended../to all logo paths_quarto.yml, front matter,_metadata.yml, extension) in subdirectoriesCloses #13917.
Test plan
typst/logo-path/tests pass (from-brand, from-quarto-yml, from-frontmatter, from-metadata-yml, from-extension)brand/logo/tests with Typst regexes passtypst/brand-yaml/logo/tests pass🤖 Generated with Claude Code