Skip to content
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

[zmarkdown] Lazy-load images #505

Merged
merged 1 commit into from
Jan 14, 2024

Conversation

StaloneLab
Copy link
Member

Fixes #496

Lazy-loading for iframes was added by commit 28b2196 , this PR aims at lazy-loading all images for ZMarkdown.

Since parsing of images is done by remark directly, implementation was done using a postprocessor, which adds an attribute loading=lazy for all images, except emoticons. Since these are guaranteed to be lightweight and served from our servers, I considered they could be eagerly loaded (see condition in postprocessor).

As it is the case with all postprocessors, this one can be easily disabled with a configuration option (lazyLoadImages). Since this feature should be ignored by browser not supporting it, I feel like we do not need a major version for enforcing this setting in the default configuration.

@StaloneLab StaloneLab added type/request This is great to have semver/minor This is a backward-compatible change labels Jan 5, 2024
@StaloneLab StaloneLab self-assigned this Jan 5, 2024
@StaloneLab StaloneLab merged commit ee1e046 into zestedesavoir:master Jan 14, 2024
3 checks passed
@StaloneLab
Copy link
Member Author

Thanks @artragis , I am releasing a new version [email protected] with the recent changes.

@StaloneLab StaloneLab deleted the lazy-load-images-496 branch January 14, 2024 11:32
@StaloneLab StaloneLab added this to the [email protected] milestone Jan 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/minor This is a backward-compatible change type/request This is great to have
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HTML export: should we add a lazy-loading attribute to all images and iframes?
2 participants