0

The support documents for html-widgets suggest that it is possible to save a stand alone html page from an r markdown document with interactive html components intact, without relying on shiny. The documentation is located here (https://bookdown.org/yihui/rmarkdown/html-widgets.html#fn13).

Is this true? When I run an example script below from a RMD file in rstudio and save the output as a standalone web page the resulting html is no longer interactive.

---
title: "An Interactive Map"
---

Below is a map that shows the location of the
Department of Statistics, Iowa State University.

```{r out.width='100%', echo=FALSE}
library(leaflet)
leaflet() %>% addTiles() %>%
  setView(-93.65, 42.0285, zoom = 17) %>%
  addPopups(
    -93.65, 42.0285,
    'Here is the <b>Department of Statistics</b>, ISU'
  )
```
Sardine
  • 1
  • 1
  • that example works for me and likely for most everyone else. what is the error you see? did you open the javascript console in the browser to see if there were any resource load issues? do you have internet access when you try to view it (leaflet requires full on internet access)? – hrbrmstr Nov 09 '18 at 20:42
  • So when I open java script console in the preview page in my browser I get this warning. MathJax.js?config=TeX-AMS-MML_HTMLorMML:32 WARNING: cdn.mathjax.org has been retired. Check https://www.mathjax.org/cdn-shutting-down/ for migration tips. When I open the console in the version I saved, I get the same warning and two errors: /C:/extensions/MathMenu.js?V=2.7.1:1 Failed to load resource: net::ERR_FILE_NOT_FOUND – Sardine Nov 09 '18 at 20:50
  • you should probably upgrade some packages including rmarkdown https://stackoverflow.com/questions/25892993/correct-mathjax-source-in-rstudio-and-rmarkdown – hrbrmstr Nov 09 '18 at 20:53
  • I updated my rmarkdown package and attempted to follow the instructions regarding the changes to the cdn.mathjax. I am no longer getting the warning but I am still getting load the errors on mathmenu.js and mathzoom.js. Is there something else to update? – Sardine Nov 09 '18 at 21:28
  • I was able to generate funtioning html by including this in my markdown header: output: html_document: mathjax: https://cdn.rawgit.com/mathjax/MathJax/2.7.1/MathJax.js The html that is saved by knitr is fully functional but if I open the preview in my browser and save the "complete web-page" that copy is not. – Sardine Nov 10 '18 at 00:59

0 Answers0