Y2Z / monolith

⬛️ CLI tool for saving complete web pages as a single HTML file
https://crates.io/crates/monolith
Creative Commons Zero v1.0 Universal
11.22k stars 315 forks source link

Images from reveal.js presentations aren't included correctly #300

Open kollienne opened 2 years ago

kollienne commented 2 years ago

Images in the bundled .html file end up as links to <file_path>/images/whatever.png, instead of data:image/...

For example: https://biods.org/talks/2020_Auckland_Broad_AI

image

should be:

image

snshn commented 2 years ago

Hello @kelmes,

Thank you for reporting this! It seems like the page is using data-src instead of src, e.g. <img class="stretch" data-src="../teaching/images/costpergenome_2017.jpg">. The JS logic then takes care of renaming those attributes to src when the page loads. Monolith could possibly look for images with that attribute and use that to embed those assets, I'll try to see what's most appropriate in this case.

snshn commented 2 years ago

Try this:

chromium --headless --disable-gpu --dump-dom https://biods.org/talks/2020_Auckland_Broad_AI | monolith - -b https://biods.org/talks/2020_Auckland_Broad_AI -o biods_2020_Auckland_Broad_AI.html

if you add the -I flag for isolation/privacy, the video won't play... so that's the only item that didn't get saved — it's a lazy-loaded video on a slide that's not the first one (slide #6), so chrome/chromium won't be able to rename that attribute.