-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
feat: Support browser-level image lazy-loading #1432
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
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/docsify-core/docsify-preview/79yc50200 |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 715f5f4:
|
LGTM |
@anikethsaha done |
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.
LGTM.
@sy-records, @anikethsaha, @Koooooo-7 -- This needs further discussion. Please hold off merging until I can provide detailed feedback... |
@sy-records, @anikethsaha, @Koooooo-7 -- Two quick suggestions regarding issues and PRs moving forward:
|
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.
Thanks to @sy-records for the PR.
Unfortunately, I just don't see the value proposition of the implementation found in this PR. The changes allow adding an attribute to images using markdown syntax, but users familiar enough with "lazy-loading" and willing to modify their markdown to support it can just as easily do so using HTML (which is also valid markdown):

<img src="image.jpg" loading="lazy">
If we want to support lazy-loading, let's make it a feature of docsify that all users can benefit from without technical knowledge or tedious work (like manually adding attributes to their markdown).
I've added detailed comments to #1431. Let's continue the discussion and make sure we've thought through the implementation and value proposition for end-users before moving forward.
Thanks!
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 good.
Question for @jhildenbiddle: is that the recommended way to test it? Or should we test a regex instead of a snapshot?
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.
We should make config option names meaningful based on their purpose.
We should make the config option name imgLoading
(or similar) instead of just loading
(many things can "load").
Summary
Support browser-level image lazy-loading.
What kind of change does this PR introduce? (check at least one)
If changing the UI of default theme, please provide the before/after screenshot:
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
fix #xxx[,#xxx]
, where "xxx" is the issue number)resolve #1431
You have tested in the following browsers: (Providing a detailed version will be better.)
If adding a new feature, the PR's description includes:
To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.