Conversation
generateFontParams replaced a quoted family name with capture group 1, the
quote character itself, so `fonts: { sans: '"Helvetica Neue", Roboto' }`
emitted `family="` and Google Fonts answered 400. Use group 2, the name.
✅ Deploy Preview for slidev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
@slidev/client
create-slidev
create-slidev-theme
@slidev/parser
@slidev/cli
@slidev/types
commit: |
This branch has not been deployed
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.
A font family written with CSS-style quotes ends up in the webfont CDN URL as a bare quote character, so the stylesheet request fails.
generateFontParams(packages/slidev/node/utils.ts:78) runsi.replace(/^(['"])(.*)\1$/, '$1'). Group 1 is the quote, group 2 is the name. Replacing with$1collapses the whole family down to a single".Repro headmatter:
resolveFontskeeps the token verbatim inwebfonts, and the emitted link ishttps://fonts.googleapis.com/css2?family=":wght@200;400;600&family=Roboto:.... I ran both against the real API: that URL returns400,family=Helvetica+Neue:wght@200;400;600&display=swapreturns200with the@font-faceblock. The CSS2 API docs write the spec asfamily=<name>with+for spaces (family=Crimson+Pro); no quoting.Quoting is an expected input shape here:
resolveFonts.toQuoted(packages/parser/src/config.ts:174) tests the same pattern to avoid double-quoting a name in the CSSfont-family. So the CSS side handles quoted names and the URL side destroys them.One-character fix, plus a case in
test/utils.test.tscovering both quote styles. Existing snapshots are unchanged, since unquoted names never matched the pattern.Out of scope, same area:
config.ts:171filterswebfontswith!local.includes(i)on raw strings, sosans: '"Fira Code"'withlocal: Fira Codestill fetches from the CDN. That one changes the matching semantics of a documented option, so I left it alone.