Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quarto with R does not correctly use htmltools for dependency creation #1497

Closed
cderv opened this issue Jul 22, 2022 · 1 comment
Closed
Labels
bug Something isn't working
Milestone

Comments

@cderv
Copy link
Collaborator

cderv commented Jul 22, 2022

Bug description

In a new project, this is the reprex document

---
title: "Untitled"
format: 
  html:
    self-contained: false
---

## Title

```{r}
mtcars |> 
  kableExtra::kbl()
```

This will error with latest htmltools 0.5.3 version:

#> Error in `normalizePath()`:
#> ! path[1]="test_files\libs/kePrint-0.0.1": Le chemin d’accès spécifié est introuvable
#> Backtrace:
#>     ▆
#>  1. └─global .main()
#>  2.   └─execute(...)
#>  3.     └─pandoc_includes(...)
#>  4.       └─dependencies_from_render(input, files_dir, knit_meta, format)
#>  5.         └─html_dependencies_as_string(extras$dependencies, files_dir)
#>  6.           └─base::lapply(dependencies, htmltools::copyDependencyToDir, files_dir)
#>  7.             └─htmltools (local) FUN(X[[i]], ...)
#>  8.               └─base::normalizePath(target_dir, "/", TRUE)
#> Warning messages:
#> 1: In dir.create(outputDir) :
#>   cannot create dir 'test_files\libs', reason 'No such file or directory'
#> 2: In dir.create(target_dir) :
#>   cannot create dir 'test_files\libs\kePrint-0.0.1', reason 'No such file or directory'
#> Execution halted

Note that with 0.5.2 version, the warning are still there

#> Warning messages:
#> 1: In dir.create(outputDir) :
#>   cannot create dir 'test_files\libs', reason 'No such file or directory'
#> 2: In dir.create(target_dir) :
#>   cannot create dir 'test_files\libs\kePrint-0.0.1', reason 'No such file or directory'

This is because the directory passed to copyDependencyToDir for test.qmd is test_files/libs which is not really supported in htmtools I believe. I opened an issue there to discuss: rstudio/htmltools#331

Quick fix in quarto would be to create test_files/ folder ourself, but v1 is already out, so this can wait and we could see in htmltools can support it IMO.

@cderv cderv added the bug Something isn't working label Jul 22, 2022
@cderv cderv added this to the Future milestone Jul 22, 2022
@jjallaire
Copy link
Collaborator

It seems like we have to fix this for v1.0 or many htmlwidgets (and other htmltools scenarios) won't work. Do you agree?

dragonstyle added a commit that referenced this issue Jul 22, 2022
We need to ensure that the dependency directory exists before we copy dependencies using htmltools.

Fixes #1497
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants