Xaringan: [Feature] writing the prezentation into ONE FILE

Created on 2 Dec 2016  路  10Comments  路  Source: yihui/xaringan

  1. THX for another great package! I love it already

  2. Would i be possible to create just ONE HTML file containing the necessary figures? It is easier to distribute per mail, and R studio seams to generate knitr reports this way already.

Now I have to share the .html file PLUS the _files folder, right?

Most helpful comment

@jaredlander Actually I had an idea to make it much faster for remark.js to render slides that contain (a lot of) base64 encoded data. I don't think the plugin you mentioned could help here, but thanks for the pointer anyway!

Rest assured your request will be fulfilled since it has been "officially" logged at: https://yihui.org/en/2019/01/rstudio-conf/#jared-lander-s-annual-feature-requests

All 10 comments

Done. Please see ?xaringan::moon_reader for caveats of self_contained = TRUE. Usually I use Netlify to host the slides, so I don't have to email things back and forth (just send a URL), e.g. http://slides.yihui.name/xaringan/.

I need to work harder on this issue. Yet another request: https://stackoverflow.com/q/54902007/559676

FWIW, I had a weird idea on this subject:

  • save the HTML page in MHTML format (_welcome back in the golden age of Internet Explorer!_)
    All the required assets are then encoded in base64. This works well, even for fonts declared in @font-face rules. Automating this step could be done with headless Chrome and the Page.captureSnapshot DevTools method. Otherwise, one can do it by hand after enabling this flag chrome://flags/#save-page-as-mhtml.
  • browsers do not open MHTML (for security reasons) but one can imagine post-processing this text file to build a self contained HTML.

I know this idea has the aesthetics of steampunk but I am quite sure it could be done.

As I get the itch from time to time to switch to xaringan from ioslides, the lack of a self-contained file keeps coming up. It seems to be solved for just about everything other than background images.

In the past I made it work by base64 encoding the images and passing that string to the backround-image property as a URL.

background-image: url(`r knitr::image_uri(filename.jpg")`)

However, this makes the file very large (not a big deal) but very slow to load. See this talk as an example.

Then I found this plugin from the remark team: https://github.com/remarkjs/remark-embed-images

Is it possible this could be our solution? I'll admit I haven't tested it, because node is beyond my knowledge, I just find hacky ways to do things with @yihui's great tools.

@jaredlander Actually I had an idea to make it much faster for remark.js to render slides that contain (a lot of) base64 encoded data. I don't think the plugin you mentioned could help here, but thanks for the pointer anyway!

Rest assured your request will be fulfilled since it has been "officially" logged at: https://yihui.org/en/2019/01/rstudio-conf/#jared-lander-s-annual-feature-requests

I saw that blog post and loved it!

I look forward to whatever solution you have in mind. I'd ask what it is, but I'm not sure I'd be able to offer much feedback.

Fixed with #207. @jaredlander You can order your new computer and install TinyTeX now if you want.

remotes::install_github('yihui/xaringan')

This still needs a little bit more documentation. I should be able to get it done soon. In particular, don't use

background-image: url(`r knitr::image_uri(filename.jpg")`)

but use this directly:

background-image: url(filename.jpg)

I must say @yihui, I am impressed, both by your code and your hint on Twitter. Awesomeness all around.

The main hero was @srvanderplas. She contributed the code in April last year, but I never had a chance to digest it until yesterday. Two other people who contributed indirectly were @sctyner and @shelmich, because they organized the Uncoast Unconf last year. Without that chance, I wouldn't be able to share this thorny issue in person with the cool hacker @srvanderplas or have her work on it.

I think I can safely promise them that you'll treat them with the best pizza in NYC if they go there in the future.

Thank you everyone! Pizza crawl on me in NYC! Ice cream too.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

richardohrvall picture richardohrvall  路  3Comments

paullemmens picture paullemmens  路  5Comments

bnicenboim picture bnicenboim  路  5Comments

rsangole picture rsangole  路  3Comments

DavisVaughan picture DavisVaughan  路  3Comments