Skip to content

Add styles to support printing the tutorial#771

Open
sruggier wants to merge 1 commit intotokio-rs:masterfrom
sruggier:pr/add-print-styles
Open

Add styles to support printing the tutorial#771
sruggier wants to merge 1 commit intotokio-rs:masterfrom
sruggier:pr/add-print-styles

Conversation

@sruggier
Copy link

@sruggier sruggier commented Oct 7, 2024

In particular, this makes it possible to save an offline copy of the tutorial to PDF or paper, or any blog posts of interest.

@Darksonn
Copy link
Member

Darksonn commented Oct 7, 2024

Thanks. I tried it and it looks ok. However, there's a CI failure due to the "prettier" formatter.

@sruggier sruggier force-pushed the pr/add-print-styles branch from 9d23a80 to 71c5c32 Compare October 7, 2024 21:07
@sruggier
Copy link
Author

sruggier commented Oct 7, 2024

Thanks, it should be fixed now. I also added a bit of detail to the first commit's subject and description.

@sruggier
Copy link
Author

@Darksonn Would you mind re-approving the CI workflow? It should pass now.

@mox692
Copy link
Member

mox692 commented Oct 20, 2024

@sruggier I just re-ran tests. (It seems that some tests are still failing, though)

@sruggier sruggier force-pushed the pr/add-print-styles branch from 71c5c32 to 666e62d Compare October 20, 2024 15:48
@sruggier
Copy link
Author

@mox692 Thanks! I've rebased on the master branch, which seems to have a fix for the failing tests.

@sruggier
Copy link
Author

@Darksonn @mox692 friendly reminder to review this 😅

Copy link
Member

@mox692 mox692 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay, I left a comment about dependency addition, but otherwise looks good to me!

$footer-color: white;

@import "../node_modules/bulma/bulma.sass";
@import "../node_modules/bulma-print/bulma-print";
Copy link
Member

@mox692 mox692 Feb 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently, what this import refers to is just a few lines of CSS, so I think we can simply paste it inline in styles/styles.scss rather than adding bulma-print. What do you think?

(Also, it seems that bulma-print library hasn't been updated for some time.)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion! I explored inlining only the needed declarations, which turned out to be just one, and I think this version of the PR is much better overall.

I also looked at the home page and a few blog posts, made a few improvements, and now the entire site should look reasonable when printed.

@sruggier sruggier force-pushed the pr/add-print-styles branch from 6e26f7c to 206b91b Compare April 13, 2025 16:52
This adds printing-specific styles, which hide the navigation elements,
remove excess whitespace, wrap code blocks, and avoid breaking them
across separate pages, if possible.

This makes it possible to export the website and documentation to PDF or
paper, for offline reading.
@sruggier sruggier force-pushed the pr/add-print-styles branch from 206b91b to fd150da Compare February 14, 2026 21:57
@sruggier sruggier requested a review from mox692 February 14, 2026 22:17
@sruggier
Copy link
Author

@carllerche @Darksonn Sorry to bother you, but do either of you have a bit of time to review this?

It should be much simpler now that the PR is only adding a single hunk of well-commented CSS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants