regebro / hovercraft

Make dynamic impressive presentations from text files!
https://hovercraft.readthedocs.org
MIT License
1.48k stars 209 forks source link

Support of embed mode #58

Open sebastienbeau opened 9 years ago

sebastienbeau commented 9 years ago

Hi, First of all thanks a lot for hovercraft, it's a really great tool! I was using landslide before and I want to move on hovercraft. For some special reason I need to have the support of embed mode like in landslide in order to produce a only one html page with everythink inside (css, html, image...).

I would like to know If you will be interested to integrate this option If we do a PR ?

We can use the same args as landslide :

-i, --embed Embed stylesheet and javascript contents, base64-encoded images in presentation to make a standalone document

What do you think? Thanks a lot for hovercraft I really enjoy it ;)

regebro commented 9 years ago

Yeah, why not? :-) Can you explain more on how you would do it?

frederikmoellers commented 7 years ago

I think this would be quite handy, though it will definitely have limits. What you can do: Whenever hovercraft encounters an external resource (an image, a CSS file or a JavaScript file), instead of inserting a reference to this file into the HTML document, it would paste the file contents (base64-encoded in the case of images). What you can't do: If JavaScript loads external resources dynamically, you can't handle this. As an example, MathJax only needs a single JavaScript file to be included in the HTML document, but it will load all CSS and fonts dynamically when being loaded. As hovercraft can't know what will be loaded at runtime (I think this also depends on the locale and other things), it cannot include all necessary files in the HTML page. I believe the Chrome extension SingleFile tries to do the same, though I haven't tried it.

regebro commented 7 years ago

Yeah, it's really two things here, one making it into one file, thereby making it easier to upload or send by email, and the other is making sure that it works even when you don't have internet.

Of course, unless you yourself directly loads resources online, there was no case of loading things from the internet before I merged the Mathjax functionality. I'll see if I can make offline Mathjax support, because then we don't have to care about that issue.