fix: shrink file tree code blocks - #2208
Open
luozejian wants to merge 1 commit into
Open
Conversation
|
@luozejian is attempting to deploy a commit to the Svelte Team on Vercel. A member of the Team first needs to authorize it. |
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.
Before submitting the PR, please make sure you do the following
feat:,fix:,chore:, ordocs:.Fixes #258
Problem
File tree code blocks in documentation and blog posts currently expand to the full content width, even when the tree itself is much narrower. This leaves a large amount of empty space and makes file trees look disproportionate compared with their content.
Solution
Shrink
treecode blocks to their intrinsic content width on non-mobile viewports while keeping them capped at the available content width.The inner
preuses automatic width so it can contribute its intrinsic size, with extra right padding reserved for the copy button. Mobile layouts keep the existing full-width block and horizontal scrolling behavior.This only targets code blocks whose generated
prehasdata-language="tree"; other code blocks are unchanged.Validation
Chrome layout measurements:
The following checks pass:
pnpm --filter @sveltejs/site-kit lintpnpm --filter @sveltejs/site-kit checkpnpm --filter svelte.dev checkpnpm build