grimbough / msmbstyle

Tufte inspired bookdown template
https://www-huber.embl.de/users/msmith/msmbstyle/
59 stars 17 forks source link

knitr::include_url #11

Open ericpgreen opened 5 years ago

ericpgreen commented 5 years ago

I'm trying to embed a webpage in a book as shown here, but the frame does not appear in the html output. Any ideas?

```{r test, echo=FALSE}
knitr::include_app("https://yihui.shinyapps.io/miniUI/", 
  height = "600px")
knitr::include_url("https://github.com/grimbough/msmbstyle", 
  height = "600px")
grimbough commented 5 years ago

Out of interest, does this work for you in a standard R Markdown document? Currently I can't get anything to appear even if I'm using the standard template produced by Rstudio -> "New Document" -> "R Markdown"

grimbough commented 5 years ago

Based on some trial and error it looks like you have to specify out.extra in the chunk options. I don't know if this is a bug in knitr since it doesn't seem to be mentioned in any of the documentation, but this will get an embedded page to render for me:

```{r embed, out.extra='style="border: none;"', out.width='56%'}
knitr::include_url('https://msmith.de')


![image](https://user-images.githubusercontent.com/971237/56903383-7dd40480-6a9c-11e9-82fa-0ae9e3b87713.png)

For some reason if I try `https://github.com` the iframe is inserted into the page, but no content appears.  Not sure if that's a transient problem, Github specific, or something else.
ericpgreen commented 5 years ago

Thanks @grimbough. Odd because I can't even get a frame with the solution that worked for you:

knitr::include_url('https://msmith.de')

I'm using knitr 1.22, standard R markdown doc.

grimbough commented 5 years ago

Just want to check that you also included the out.extra='style="border: none;"' in the code chunk options. If I don't put that then nothing appears for me either, regardless of the overall style I'm trying to use.

ericpgreen commented 5 years ago

Yeah, I think I am including it correctly.

Screenshot 2019-05-09 14 13 05