r-universe-org / help

Support and bug tracker for R-universe
https://docs.r-universe.dev/
8 stars 2 forks source link

Pre-rendered articles using R.rsp::asis don't display properly #143

Open dmphillippo opened 2 years ago

dmphillippo commented 2 years ago

In my package I have a number of vignettes that are pre-rendered due to longer run times; the rendered html files are then included using R.rsp::asis.

These all show up correctly in my universe, however the page cannot be scrolled - see this article for example, in comparison to the same vignette on the pkgdown site.

It seems to be something to do with the height of the iframe that contains the rendered article, but what or why is beyond me!

jeroen commented 2 years ago

Yes it works correctly from the direct url (that is also linked at the top of the dashboard): https://dmphillippo.r-universe.dev/articles/multinma/example_atrial_fibrillation.html

Screenshot 2022-04-13 at 5 22 02 PM

The problem is that we inject iframeresizer code into the vignette html when we generate the articles, however your asis html files don't have this right now. Also the markup is ugly of course.

How is it possible that pkgdown is able to generate a pretty custom formatted article from your as-is html file?

dmphillippo commented 2 years ago

Ah that makes sense, thanks!

Well, I actually have pkgdown set up to rebuild the vignettes from the Rmds rather than using the asis html. I'm not sure the latter would be possible, and probably not pretty! The pre-compilation is only really needed to keep build time down on CRAN.

Is it possible for r-universe to inject the script to the asis html after the fact?

jeroen commented 2 years ago

If the purpose is to keep the build-time down, it may be easier to only precompute the Rmd -> md part (i.e. run the R code), instead of shipping the full html with a separate vignette engine?

This is the method that I also use for my own vignettes, described also here: https://ropensci.org/blog/2019/12/08/precompute-vignettes/

dmphillippo commented 2 years ago

Thanks Jeroen. I did look at the Rmd to md option at the time, but I can't remember now why I went down the html asis route instead. I agree that your way does make more sense!