-
-
Notifications
You must be signed in to change notification settings - Fork 530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Adds print styles for Starlight docs pages #157
Draft
tony-sull
wants to merge
10
commits into
main
Choose a base branch
from
feat/print-stylesheet
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
662ecd5
initial pass at print styles
b78fe96
refactor: using modifiers for display util classes
fc17193
make sure the header tools group is hidden
55eed5c
avoid page breaks in code blocks
5a8e7a1
a few layout fixes for Safari printing viewport
819ea02
fixed header was hiding print content
47b116c
Merge branch 'main' into feat/print-stylesheet
tony-sull 9c46292
refactor: moving all print style selectors to the global CSS sheet
a302379
nit: @media print isn't needed in the global sheet
bc290f6
Merge branch 'main' into feat/print-stylesheet
tony-sull File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
:root, | ||
::backdrop { | ||
/* Colours (light mode) */ | ||
--sl-color-white: hsl(223, 13%, 10%) !important; | ||
--sl-color-gray-1: hsl(222, 13%, 16%) !important; | ||
--sl-color-gray-2: hsl(222, 11%, 23%) !important; | ||
--sl-color-gray-3: hsl(225, 9%, 36%) !important; | ||
--sl-color-gray-4: hsl(221, 8%, 56%) !important; | ||
--sl-color-gray-5: hsl(228, 8%, 77%) !important; | ||
--sl-color-gray-6: hsl(231, 23%, 94%) !important; | ||
--sl-color-gray-7: hsl(240, 20%, 97%) !important; | ||
--sl-color-black: hsl(0, 0%, 100%) !important; | ||
|
||
--sl-color-orange-high: hsl(var(--sl-hue-orange), 80%, 25%) !important; | ||
--sl-color-orange: hsl(var(--sl-hue-orange), 90%, 60%) !important; | ||
--sl-color-orange-low: hsl(var(--sl-hue-orange), 90%, 88%) !important; | ||
--sl-color-green-high: hsl(var(--sl-hue-green), 80%, 22%) !important; | ||
--sl-color-green: hsl(var(--sl-hue-green), 90%, 46%) !important; | ||
--sl-color-green-low: hsl(var(--sl-hue-green), 85%, 90%) !important; | ||
--sl-color-blue-high: hsl(var(--sl-hue-blue), 80%, 30%) !important; | ||
--sl-color-blue: hsl(var(--sl-hue-blue), 90%, 60%) !important; | ||
--sl-color-blue-low: hsl(var(--sl-hue-blue), 88%, 90%) !important; | ||
--sl-color-purple-high: hsl(var(--sl-hue-purple), 39%, 30%) !important; | ||
--sl-color-purple: hsl(var(--sl-hue-purple), 90%, 60%) !important; | ||
--sl-color-purple-low: hsl(var(--sl-hue-purple), 80%, 90%) !important; | ||
--sl-color-red-high: hsl(var(--sl-hue-red), 80%, 30%) !important; | ||
--sl-color-red: hsl(var(--sl-hue-red), 90%, 60%) !important; | ||
--sl-color-red-low: hsl(var(--sl-hue-red), 80%, 90%) !important; | ||
|
||
--sl-color-accent-high: hsl(var(--sl-hue-accent), 80%, 30%) !important; | ||
--sl-color-accent: hsl(var(--sl-hue-accent), 90%, 60%) !important; | ||
--sl-color-accent-low: hsl(var(--sl-hue-accent), 88%, 90%) !important; | ||
|
||
--sl-color-text-accent: var(--sl-color-accent) !important; | ||
--sl-color-text-invert: var(--sl-color-black) !important; | ||
--sl-color-bg-nav: var(--sl-color-gray-7) !important; | ||
--sl-color-bg-sidebar: var(--sl-color-bg) !important; | ||
--sl-color-bg-inline-code: var(--sl-color-gray-6) !important; | ||
--sl-color-hairline-shade: var(--sl-color-gray-6) !important; | ||
|
||
--sl-color-backdrop-overlay: hsla(225, 9%, 36%, 0.66) !important; | ||
|
||
/* Shadows (light mode) */ | ||
--sl-shadow-sm: 0px 1px 1px hsla(0, 0%, 0%, 0.06), | ||
0px 2px 1px hsla(0, 0%, 0%, 0.06) !important; | ||
--sl-shadow-md: 0px 8px 4px hsla(0, 0%, 0%, 0.03), | ||
0px 5px 2px hsla(0, 0%, 0%, 0.03), 0px 3px 2px hsla(0, 0%, 0%, 0.06), | ||
0px 1px 1px hsla(0, 0%, 0%, 0.06) !important; | ||
--sl-shadow-lg: 0px 25px 7px rgba(0, 0, 0, 0.01), | ||
0px 16px 6px hsla(0, 0%, 0%, 0.03), 0px 9px 5px hsla(223, 13%, 10%, 0.08), | ||
0px 4px 4px hsla(0, 0%, 0%, 0.16), 0px 4px 2px hsla(0, 0%, 0%, 0.04) !important; | ||
} | ||
|
||
.print\:hidden { | ||
display: none !important; | ||
} | ||
.print\:flex { | ||
display: flex !important; | ||
} | ||
.print\:block { | ||
display: block !important; | ||
} | ||
|
||
/* index.astro */ | ||
main { | ||
padding-bottom: 0 !important; | ||
} | ||
main > .content-panel { | ||
padding-block-start: 0 !important; | ||
} | ||
|
||
/* components/MarkdownContent.astro */ | ||
.content pre { | ||
overflow-x: hidden !important; | ||
white-space: pre-wrap !important; | ||
page-break-inside: avoid; | ||
} | ||
|
||
/* layout/PageFrame.astro */ | ||
.page > header { | ||
position: relative !important; | ||
} | ||
.page > .main-frame { | ||
padding-inline-start: 0 !important; | ||
} | ||
|
||
/* layout/TwoColumnContent.astro */ | ||
.main-pane { | ||
--sl-sidebar-width: 0px !important; | ||
--sl-content-width: 100% !important; | ||
} |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah, looks like this is under Vite’s inline assets limit, so is getting inlined as a data URI in the build output 😅
That’s why we’re seeing the increase in HTML size, but no change in bundled CSS.
Let me check if there’s a workaround for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A feature to fix this just merged in Vite!
vitejs/vite#15454
Looks like this might work once that is released in Vite 6/Astro 5:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be
?url&no-inline
to mark the CSS as an asset URL first, and then force not inline it as a data URL.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah thank you, Bjorn! I wasn’t 100% sure from the docs added in the Vite PR. I edited my suggestion to track that.