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

Feature request : Add support for lazy loading images #637

Closed
heitorPB opened this issue Apr 11, 2023 · 4 comments
Closed

Feature request : Add support for lazy loading images #637

heitorPB opened this issue Apr 11, 2023 · 4 comments

Comments

@heitorPB
Copy link

Cross post from getzola/zola#2055:

To make our pages load faster and minimize the use of bandwidth/memory when a user does not scroll a whole page ; we can use the following attribute to make the image load only when needed (lazy loading):

<img src="image.jpg" loading="lazy" />

references :

Is this something that pulldown-cmark is interested in? This could be configurable and not-lazy by default to be consistent with current state.

@Martin1887
Copy link
Collaborator

This issue seems easy to implement but the HTML renderer is built as a simple use case of handling parsing events and adding options to it is out of scope, meanwhile setting always the lazy-loading option could be worse for other users.

It makes a lot of sense splitting the HTML renderer to another crate, and that crate could read a TOML file with options like this to have a lot of customizations. However, this will not happen in the short term, because there are other more urgent issues.

Nevertheless, creating a new crate initially handling the current options and with those extensions in mind would be not hard and it would be a good starting point to strip out the HTML renderer in favour of external renderers, so if anyone makes it, it would be appreciated.

Related to #519 and #526.

@heitorPB
Copy link
Author

heitorPB commented May 7, 2023

This issue seems easy to implement but the HTML renderer is built as a simple use case of handling parsing events and adding options to it is out of scope, meanwhile setting always the lazy-loading option could be worse for other users.

That totally makes sense and I totally agree.

You mentioned that splitting the HTML renderer to another crate is not in the list of most urgent issues. Where can I find the roadmap and be of help?

@Martin1887
Copy link
Collaborator

#519 pull request will be merged relatively soon and #526 will also be fixed relatively soon but a bit later.

However, creating the external crate is not in the roadmap and it is entirely a different project. As commented in #408 (comment), a good starting point to create it can be copying the escape.rs and html.rs modules of this project and making a library crate receiving a MD path and a configuration object and a binary crate that reads a TOML file into a configuration object and a MD path to call the lib crate.

So you can help creating this project :). If you have any questions don't hesitate in asking help.

@Martin1887
Copy link
Collaborator

#645 has been created to track all requested features that would fit in a new full-featured HTML renderer crate.

@Martin1887 Martin1887 closed this as not planned Won't fix, can't repro, duplicate, stale May 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants