0

I'm having trouble permanently embedding images in my RStudio ioslides presentation.

Specifically, the problem occurs when I try to include local images via:

![](image.png)

The images will appear successfully when I knit the document and open it directly from its folder on my computer. But if I share the html file with anyone else or copy and paste to another directory on my computer, all images embedded via ![](image.png) disappear.

My YAML header looks like this:

---
title: 'Title'
subtitle: 'Subtitle'
author: "Harrison"
date: '`r format(Sys.time(), "%d %B, %Y")`'
output: 
  ioslides_presentation:
    self_contained: true
    widescreen: true
    smaller: true
    css: custom.css
    incremental: false
---

I thought that "self-contained" is supposed to accomplish what I want, that is, to create a fully self-contained html document.

Note: My images are successfully permanently embedded when I use the include_graphics() function from knitr to add a jpeg or png file.

Any idea what is going on?

Harrison
  • 51
  • 1
  • 3

1 Answers1

0

I cannot reproduce your problem. Here is my reproducible example:

---
title: 'Title'
subtitle: 'Subtitle'
author: "Harrison"
date: '`r format(Sys.time(), "%d %B, %Y")`'
output: 
  ioslides_presentation:
    self_contained: true
    keep_md: true
---

## First slide

```{r, test, dev='png'}
plot(1)
```

## Second slide

![](`r knitr::fig_chunk('test', 'png')`)

Both images are corrected embedded.

Please try to update your packages. If it still fails after updating all packages, please provide your xfun::session_info('rmarkdown').

Yihui Xie
  • 28,913
  • 23
  • 193
  • 419