-
Notifications
You must be signed in to change notification settings - Fork 482
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
Implement size threshold for HTML pages #2205
Conversation
I think I'm happy with the API here now, though this could use some tests. |
|
||
The size threshold, with a reasonable default, exists so that users would not deploy huge pages | ||
accidentally (which among other this will result in bad UX for the readers and negatively impacts | ||
SEO). It is relatively easy to have e.g. an `@example` produce a lot of output. |
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.
What is the alternative? Could documenter automatically save plots to file and load them from there?
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.
JuMP has quite a few pages which are large:
- (292 kb) https://github.com/jump-dev/JuMP.jl/blob/gh-pages/v1.13.0/tutorials/applications/power_systems/index.html
- (279 kb) https://github.com/jump-dev/JuMP.jl/blob/gh-pages/v1.13.0/tutorials/getting_started/getting_started_with_data_and_plotting/index.html
- (438 kb) https://github.com/jump-dev/JuMP.jl/blob/gh-pages/v1.13.0/tutorials/nonlinear/space_shuttle_reentry_trajectory/index.html
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.
Good point, I should also check JuMP docs. But yes: #2143. It won't be in 1.0, but hopefully in 1.1 or so. In the meanwhile, the solution is just to set large enough size_threshold
(or set it to nothing
).
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.
What if there was an exclude::Vector{String}
argument where you could explicitly ignore some large pages?
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.
That seems like a good idea. Forcing people to set a global size setting to ignore one page is not ideal. I'll merge this as is, but let's get that into 1.0 in a follow-up PR.
As a few cases for file sizes, the SciML main docs have the following pages that are
I suspect all those pages have huge figures. The Julia manual has generally much bigger pages, with quite a few pages over
This is a harder case I think. JuMP is a bit similar:
Documenter's own manual pages are all |
This reverts commit 3065a9b.
Adds
size_threshold
andsize_threshold_warn
arguments to theDocumenter.HTML
constructor that can be used to set a maximum size for the generated HTML files. If any page goes above that threshold, the build will fail with an error or a warning likeThe current default values for the thresholds are
200 KiB
and100 KiB
, respectively. This is quite conservative, but I reckon most manuals that do not have huge pages or a lot of generated content should be fine. Also, for SEO, the recommendation is to have HTML pages be less than100 KiB
, which is what informed this choice.Close #2142.