Skip to content

feat($theme-default): Improve typography for print media (close #2498) #2519

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@
position: relative;
top: -1px;
}
@media print {
.icon.outbound {
display: none;
}
}
</style>
4 changes: 4 additions & 0 deletions packages/@vuepress/theme-default/components/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,8 @@ $navbar-horizontal-padding = 1.5rem
overflow hidden
white-space nowrap
text-overflow ellipsis

@media print
.navbar
display none
</style>
3 changes: 3 additions & 0 deletions packages/@vuepress/theme-default/components/PageEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,7 @@ export default {
float none
text-align left

@media print
.page-edit
display none
</style>
4 changes: 4 additions & 0 deletions packages/@vuepress/theme-default/components/Sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,8 @@ export default {
top calc(1rem - 2px)
& > .sidebar-links
padding 1rem 0

@media print
.sidebar
display none
</style>
18 changes: 17 additions & 1 deletion packages/@vuepress/theme-default/styles/code.styl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ div[class*="language-"]
&.line-numbers-mode
.highlight-lines .highlighted
position relative
&:before
&::before
content ' '
position absolute
z-index 3
Expand Down Expand Up @@ -135,3 +135,19 @@ div[class~="language-php"]:before
content "php"

@import '~prismjs/themes/prism-tomorrow.css'

@media print
{$contentClass} pre code, {$contentClass} pre[class*="language-"] code
color #000
white-space pre-wrap
page-break-inside avoid

code, pre, div[class*="language-"], div[class*="language-"] .highlight-lines .highlighted
background-color #fff
page-break-inside avoid

div[class*="language-"].line-numbers-mode .highlight-lines
.highlighted::before
&::after
background-color #fff
page-break-inside avoid
6 changes: 6 additions & 0 deletions packages/@vuepress/theme-default/styles/custom-blocks.styl
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@
summary
outline none
cursor pointer

@media print
.custom-block .custom-block-title
&.tip, &.warning, &.danger, &.details
background-color #fff

20 changes: 20 additions & 0 deletions packages/@vuepress/theme-default/styles/index.styl
Original file line number Diff line number Diff line change
Expand Up @@ -199,3 +199,23 @@ th, td
padding-left 0

@require 'mobile.styl'

@media print
body
color #000

h1, h2, h3, h4, h5
page-break-after avoid
page-break-before avoid

img, table
page-break-inside avoid

h2+p
page-break-before avoid

a[href^="http://"]::after, a[href^="https://"]::after
content " [" attr(href) "] "

.page
padding-left 0