litedown icon indicating copy to clipboard operation
litedown copied to clipboard

Embedded resources not being cleaned

Open TimTaylor opened this issue 1 year ago • 1 comments

Apologies if I'm misunderstanding but it doesn't seem like embedded images (not checked when other resources are embedded) are being cleaned from disk. Minimal reprex ...

dir.create(dir <- tempfile())
file_in  <- file.path(dir, "example.litedown")

text <- r"(---
output:
    litedown::html_format
---

```{r}
plot(1:10,1:10)
```)"

cat(text, file = file_in)
list.files(dir, recursive = TRUE)
#> [1] "example.litedown"
litedown::fuse(file_in)
list.files(dir, recursive = TRUE)
#> [1] "example__files/chunk-1-1.png" "example.html"                
#> [3] "example.litedown"

Hope this makes sense.

TimTaylor avatar Jul 24 '24 20:07 TimTaylor

You are right. This hasn't been done in litedown yet. Thanks for the reminder!

yihui avatar Jul 24 '24 21:07 yihui

Done now. Plot files are cleaned up by default. To keep them, set embed_cleanup: false, e.g.,

output:
  litedown::html_format:
    options:
      embed_cleanup: false

yihui avatar Oct 12 '24 01:10 yihui