-
Notifications
You must be signed in to change notification settings - Fork 910
Code appears to come out of the box #826
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
Comments
Sadly, this means that every code listing will be rendered with scrollbars, even though they've been designed to fit all code (with 96-character line lengths) on most browsers on standard displays (Chrome, Brave, Firefox, Edge). We can improve this a bit, by only specifying horizontal scrollbars with Are you browsing on a phone? If so, then yes, some lines will be too long. As always, there will be devices that are too narrow to fit the content, and the code boxes can't reflow. It was a trade-off we decided to accept, as we're mostly targeting printed copies or copies rendered on a full display (usually along with the coding environment of choice). We opted to ensure that all code is visible (using If you can find a way to suppress rendering of the scrollbar when it's not needed, or detect and respond to windows that lack sufficient width (so we could, for example, reduce the code font size), then that would be quite useful. Let us know if you find a way to do this. |
Just played around with this a bit more. I can simulate this by changing the zoom of the page so it's rendered very large. It turns out that But sadly, this brings about another problem. With If you use The best solution I can think of is to have the listing box use a |
I see, perhaps the best thing you could do would be to add a media tag for adjusting the font size in smaller screens with something like:
|
Ah, that's a good idea. Would you care to cobble something up and submit a PR? |
The issue is, I don't think a smaller font size is going to help when readers are on a small screen. I guess leaving it as it is now isn't that bad when you'd have to have a trade-off between aesthetics and accessibility or visibility. I figured out another way, using
which keeps the box width the same as the width of the text. The problem also seems to happen when I use my laptop, so this seems to improve the display on both types of devices. People using smaller screens may need to use the scrollbar on the page to see the entire box, is this fine? If it is, I'll submit a PR. |
Sounds good -- toss it up and I'll check it out. |
Code in Ray Tracing in One Weekend seems to be appearing out of the box(see screenshot below).
A way you could fix this is to replace
overflow: visible;
with
overflow-x: scroll;
in
in book.css.

The text was updated successfully, but these errors were encountered: