Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Enable lazy-loading of images in HTML docs #25752

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

Merged
merged 1 commit into from
Apr 26, 2023

Conversation

sam-sw
Copy link
Contributor

@sam-sw sam-sw commented Apr 22, 2023

PR Summary

Leverage docutils to automatically set the loading attribute of images to "lazy" in the HTML docs. This should hopefully improve performance, especially on cellular or low-bandwidth connections.

Closes #24331

PR Checklist

Linked Issue

  • Added "closes #0000" in the PR description to link it to the original issue.

Documentation and Tests

  • [N/A] Has pytest style unit tests (and pytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • [N/A] New plotting related features are documented with examples.

Release Notes

  • [N/A] New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • [N/A] API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • [N/A] Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a while, please feel free to ping @matplotlib/developers or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.

You can also join us on gitter for real-time discussion.

For details on testing, writing docs, and our review process, please see the developer guide

We strive to be a welcoming and open project. Please follow our Code of Conduct.

@tacaswell
Copy link
Member

Thank you for this work.

Looking at the built docs what should we be checking to tell if this had the intended affect or not?

Copy link
Contributor

@greglucas greglucas left a comment

Choose a reason for hiding this comment

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

This looks good to me. I think it is good to save bandwidth when we can.

In Chrome I was able to test with: "inspect" -> "Network" tab -> Change "No Throttling" to "Fast 3G". Then the simplest page to see this on for me was the "Examples" gallery. If you land on that page a few images will be loaded towards the top. Then wait a bit and scroll down quickly and a lot more will be loaded. Compare that to the devdocs page where all of the images are loaded right away. (Network tab will show you when the requests for new images were made as well along the timeline)

@QuLogic QuLogic merged commit 60efcb0 into matplotlib:main Apr 26, 2023
@QuLogic QuLogic added the Documentation: build building the docs label Apr 26, 2023
@QuLogic QuLogic added this to the v3.8.0 milestone Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation: build building the docs
Projects
Development

Successfully merging this pull request may close these issues.

[Doc]: Lazy loading for images
5 participants