5

It should be possible to create a self-contained HTML file with Quarto using

format:
  html:
    embed-resources: true

as documented here: https://quarto.org/docs/output-formats/html-basics.html#self-contained, yet when I try to email the resulting HTML file, the chart does not appear, as in this image - [

and I get a file folder along with the HTML file

![enter image description here][2]][2].

(I think it was working last week, I'm not sure but I definitely did get a self-contained file).

Am I doing something wrong?

MWE:

---
title: "foo"
format: 
  html: 
    embed-resources: true
---

```{r}
library(ggplot2)

mtcars |> 
  ggplot(aes(mpg, disp)) + 
  geom_point() 
```

Using system("quarto render elevators.qmd --output elevators.html") gives the same result.

dpel
  • 1,954
  • 1
  • 21
  • 31
  • I am actually getting a self-contained file. Can you elaborate on "it does not work for me"? How did you find out its not working? – shafee Feb 13 '23 at 11:52
  • Thanks for trying. I have added extra detail to explain. – dpel Feb 13 '23 at 12:01
  • Oh! you are getting an `elevators_files` folder. Then definitely it is not working! However, what is your quarto version? And I am not able to install `elevators` package. From where can I install the package? – shafee Feb 13 '23 at 12:08
  • Does it work via the command line? E.g. `quarto render test.qmd --output test.html`? – Julian Feb 13 '23 at 12:08
  • @shafee updated MWE to replace `elevators` with `mtcars` – dpel Feb 13 '23 at 12:14
  • @Julian Nope, I get the same result. – dpel Feb 13 '23 at 12:22

2 Answers2

7

self-contained: true works for me, e.g.,

format: 
  html:
    self-contained: true

using Quarto v1.2 - the current version at time of writing

dpel
  • 1,954
  • 1
  • 21
  • 31
  • 2
    I am quite sure it has something to do with the quarto version. I would recommend specifying your quarto version along with this answer for future reference. – shafee Feb 13 '23 at 12:45
0

I solved with this:

---
format:
    html: 
       embed-resources: true
---
RxT
  • 486
  • 7
  • 17
  • The question states that I tried this but it didn't work. Could you explain how your answer helps? – dpel Aug 17 '23 at 09:07