conditionally embed video in R-markdown (bookdown)
问题 If I simply copy and paste an HTML code provided by YouTube into a .Rmd file, this works fine for gitbook output. Here is an example of the code <iframe width="560" height="315" src="https://www.youtube.com/embed/9AI3BkKQhn0" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen> </iframe> However, I get error messages for PDF and EPUB outputs. In order to avoid this, I thought I could use conditional compilation, e.g. ```{r} if (knitr