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

Path issue in Quarto vignette / article #2722

Open
olivroy opened this issue Jul 15, 2024 · 2 comments
Open

Path issue in Quarto vignette / article #2722

olivroy opened this issue Jul 15, 2024 · 2 comments
Labels

Comments

@olivroy
Copy link
Collaborator

olivroy commented Jul 15, 2024

I get an issue while trying to read external content in the vignettes folder with a Quarto article when building pkgdown.

Let's say my vignettes/ folder contains the following files

vignettes/article-quarto.qmd

---
title: "Title"
---

```{r}
#| label: setup
knitr::read_chunk("visual_test.R")
```

```{r}
#| label: simple
```

vignette/article.Rmd

---
title: "Case Study: gtcars"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{Case Study: gtcars}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r options, message=FALSE, warning=FALSE, include=FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

library(gt)
library(dplyr)
library(tibble)
knitr::read_chunk("visual_tests.R")
```

```{r}
#| label: simple
```

vignettes/visual_tests.R

# I would like to have those reused inside my articles / vignettes
## ----simple, echo=TRUE-------------------------------
1 + 1

I get an issue that Quarto can't find the path.

Running pkgdown::build_article("article-quarto", quiet = FALSE) errors, while it works with the Rmd article.

Error in `file()`:
! cannot open the connection
Backtrace:
  1. knitr::knit(..., tangle = TRUE)
  2. knitr:::process_file(text, output)
  5. knitr:::process_tangle(group)
  6. knitr:::tangle_block(x)
  9. knitr::read_chunk("knitr-chunks.R")
 10. xfun::read_utf8(path)
 11. base::readLines(con, encoding = "UTF-8", warn = FALSE)
 12. base::file(con, "r")
Warning message:
In file(con, "r") :
  cannot open file 'knitr-chunks.R': No such file or directory
Calls: build_articles ... eval -> read_chunk -> read_utf8 -> readLines -> file

Quitting from lines 18-19 [unnamed-chunk-2] (/var/folders/m5/623cy_fn5ts603hrw87n4_p40000gn/T//RtmpRNRUJv/file37963f0180c0.md)

I have confirmed that this is not an issue for a Rmd vignette. I am simply looking for a way to reuse things in a Quarto vignette.

Happy to provide a reprex with a self-contained directory if this isn't possible to reproduce easily

@hadley
Copy link
Member

hadley commented Jul 15, 2024

I think your issue is missing some text?

@olivroy
Copy link
Collaborator Author

olivroy commented Jul 15, 2024

Apologies. I edited my issue and opened a demo PR (#2723) in case that's useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants