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
Allow docs to be larger on large screens #1923
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1923 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 63 63
Lines 6677 6677
Branches 1239 1239
=========================================
Hits 6677 6677 Continue to review full report at Codecov.
|
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.
1220px
is way too large unless we also tune how fonts are scaled.
I was trying to find UX research on the subject, and while there is a lot of semi-conflicting material out there, the general conclusion is that 55-70 -- maybe slightly more -- in some cases up to 100 cpl is optimal for reading:
https://ux.stackexchange.com/questions/108801/what-is-the-best-number-of-paragraph-width-for-readability
https://www.researchgate.net/publication/234578707_Optimal_Line_Length_in_Reading--A_Literature_Review
If that is any measure, Stack Overflow seems to also use 660px
(or 658px
to be precise) columns for the main question and answer context.
The problem is, itself, far from new. People had been doing research on optimal layout of newspapers and books long before the computer display came.
The literature also mentions that slightly longer lines may be good for quickly scanning for information, but ~70 cpl is perfect for more thorough reading.
At the current width, our text is about 80 cpl, and about 70 cpl if you don't count whitespace.
In that light, I don't think we should increase the text paragraph width any further.
Maybe we could add some hack to allow code blocks span a little bit further to the right?
See also: https://en.wikipedia.org/wiki/Line_length which reiterates the same points I've raised above. |
Note that 1200px is the complete width of the page, including the sidenav. The proposed change makes the content max width 1000px |
Another very good article: https://www.smashingmagazine.com/2014/09/balancing-line-length-font-size-responsive-web-design/ |
Ok so to recap:
|
Yeah, plus we'll need to be remember that some snippets come inside That effectively uses some further amount of the precious paragraph real estate. |
I've update the style. It's a bit larger but overall the paragraph text has similar line length, (from 660px to 700px). Personally I think it looks better using font size of 14px for the code and 790px of max paragraph width to still show 88 chars correctly, since the code font is a bit small at 13px and I don't think it's of particular concern the number of font per line. @vytas7 do you feel we cannot exceed the current line length on the paragraph? also the paragraph font is 17px, and I think it's large enough already Diff of the alterinative version diff --git a/docs/_static/custom.css b/docs/_static/custom.css
index 276bd700..d168640e 100644
--- a/docs/_static/custom.css
+++ b/docs/_static/custom.css
@@ -23,7 +23,8 @@ h1 a:hover, h2 a:hover, h3 a:hover {
}
div.document {
- max-width: calc(760px + 220px); /* max body width + 220px of sidebar */
+ /* max body width + 60px padding + 220px sidebar */
+ max-width: calc(790px + 60px + 220px);
}
div.footer {
@@ -165,7 +166,7 @@ pre {
}
.highlight pre {
- font-size: 13px;
+ font-size: 14px;
}
|
I still stand by my opinion that ideally I would have the line length at about 82-83 (I basically like that article), but I'm not terribly opinionated about this. We could extend to about 87-89 cpl if it is what others prefer, but my vote is on 82-83. |
After comparing the three options (original, this patch, and the tweaked 790px/14px) I think we should go with the |
Thanks for taking a look. I'll update the branch with your suggestion. |
Updated |
@CaselIT could you also take a look into upgrading to Sphinx 4.x? From what I've seen, it does build now with my changes on some other pull request, but there are huge visual changes that probably need to be rechecked... |
It seems to be all right. See the zip with the current version built with the latest sphinx |
I've also reverted the docutils constraint, since it's constrainted by sphinx / sphinx-tabs etc. |
Yes, I mean those large function name fonts are a coming from Sphinx 4.x, I noticed that when testing myself with that recently merged PR (I addressed a couple of issues preventing build on 4.x without warnings on that PR). |
the issue is of alabaster. Sphix 4 (I suppose) uses tt.descname, tt.descclassname, code.descname, code.descclassname {
font-size: 0.95em;
} |
Another thing though, some lines now run as wide as 103-104 cpl, was it intended to increase that much? Maybe we could slightly increase the paragraph font then? (I do like a lot that code examples avoid scrolling though 👍.) |
let me try a couple of things |
I've tried a couple of thinks. This is with font size 18 Personally I think it's too large. I prefer 17 even if the lines are a bit longer.. 790px is the min to not have scrolling in examples if we want to have 14px as the code font |
Yeah, it does feel a bit too large. At least compared to the navigation sidebar which gets too tiny in comparison. OTOH I noticed FastAPI uses roughly the same large size (computed as 17.6px, but it can depend on the font used), and they normally stay below 100 cpl. Their code examples do use some scrolling, maybe we could also allow that in some exceptional cases provided 99% of snippets do not scroll? |
I've tried to tweak another bit: I think it's a good compromise |
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.
This does look like a pretty good compromise indeed 💯
(Ideally, I would still like to reduce to 82-83 cpl and make it scale up fontsize-wise on very large screens, while designing code snippets differently, but none of us is a graphic designer, and advanced stuff like that is painful to maintain.)
At that point we may try to look for other templates. I recently found this one https://github.com/pradyunsg/furo that I like quite a bit |
Furo is looking pretty ace indeed! |
I wouldn't be opposed to changing themes at some point. |
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.
Looks nice, thanks!
Summary of Changes
Allow the max width of the docs to be larger for uses with a large screen. The current max body is set to 1000px.
On a large screen (2560px).
The version
currend read the docs
There is still a lot of white, but that's definitely nicer to me that the better than the current version. Personally I don't think we gain much by going wider, but it's easy to set 1200-1400px as max body width.
For reference current max is 660px