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

Add native lazy loading for chapter images (inc iframes) #351

Closed
tunetheweb opened this issue Nov 6, 2019 · 2 comments · Fixed by #484
Closed

Add native lazy loading for chapter images (inc iframes) #351

tunetheweb opened this issue Nov 6, 2019 · 2 comments · Fixed by #484
Assignees
Labels
development Building the Almanac tech stack enhancement New feature or request
Milestone

Comments

@tunetheweb
Copy link
Member

Some of the chapters might have a lot of graphics. If possible we should add native lazy loading for the chapter graphics (except for the chapter heading and the logo).

I'm not sure that is possible as we are writing in markdown and using showdown to convert to HTML and it doesn't look to have an option to add attributes to image tags.

Could do a bulk edit for image tags in body section at end of chapter generation but that sounds kind of hacky...

Easiest option might be to change all images in chapter markdown to native HTML instead of markdown? Once-off pain for long term gain?

Thoughts @rviscomi , @mikegeyser ?

@rviscomi rviscomi added development Building the Almanac tech stack enhancement New feature or request labels Nov 7, 2019
@rviscomi rviscomi added this to the SHIP IT! milestone Nov 7, 2019
@rviscomi
Copy link
Member

rviscomi commented Nov 7, 2019

Yeah I think this would be a nice improvement. Best approach IMO would be to implement this in the markup generator, since we want to encourage authors to write simple markdown like ![foo](./img.png).

@mikegeyser
Copy link
Contributor

I think the simplest would be to implement it the same way as the generate_figure_ids with a nifty regex replace and add in the loading="lazy" attribute. I can have a go at it a little later.

@mikegeyser mikegeyser self-assigned this Nov 7, 2019
@rviscomi rviscomi modified the milestones: SHIP IT!, Après Ski Nov 8, 2019
@tunetheweb tunetheweb changed the title Add native lazy loading for chapter images Add native lazy loading for chapter images (inc iframes) Nov 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Building the Almanac tech stack enhancement New feature or request
Projects
None yet
3 participants