r-lib / pkgdown

Generate static html documentation for an R package
https://pkgdown.r-lib.org/
Other
721 stars 336 forks source link

Quarto articles, in the `vignettes/articles/*` sense, don't seem to work #2821

Open jennybc opened 4 days ago

jennybc commented 4 days ago

I'm working on making usethis::use_vignette() and usethis::use_article() work for .qmd. In that PR (https://github.com/r-lib/usethis/pull/2085), I feel like I've got the right files going in the right places, etc., and .qmd vignettes (vignettes/*.qmd) seem fine. But when it comes time to build the site, I see problems with anything like vignettes/articles/*.qmd:

> pkgdown::build_site()
── Installing package abcde into temporary library ──────────────────────────────────────────────────────────────────────────
── Building pkgdown site for package abcde ─────────────────────────────────────
Reading from: /Users/jenny/tmp/abcde
Writing to: /Users/jenny/tmp/abcde/docs
── Sitrep ──────────────────────────────────────────────────────────────────────
✔ URLs ok.
✔ Favicons ok.
✔ Open graph metadata ok.
✔ Articles metadata ok.
✔ Reference metadata ok.
── Initialising site ───────────────────────────────────────────────────────────
── Building home ───────────────────────────────────────────────────────────────
Writing authors.html
Reading LICENSE.md
Writing LICENSE.html
Writing LICENSE-text.html
Reading DESCRIPTION
Writing index.html
Writing 404.html
── Building function reference ─────────────────────────────────────────────────
Writing reference/index.html
── Building articles ───────────────────────────────────────────────────────────
Writing articles/index.html
Reading vignettes/articles/rmarkdown-article.Rmd
Writing articles/rmarkdown-article.html
Reading vignettes/rmarkdown-vignette.Rmd
Writing articles/rmarkdown-vignette.html
Reading vignettes/articles/quarto-article.qmd
Reading vignettes/quarto-vignette.qmd
Running `quarto render`
Run `rlang::last_trace()` to see where the error occurred.
Error:
! ! in callr subprocess.
Caused by error in `.f(.x[[i]], .y[[i]], ...)`:
! No built file found for vignettes/articles/quarto-article.qmd
Hide Traceback
    ▆
 1. └─pkgdown::build_site()
 2.   └─pkgdown:::build_site_external(...)
 3.     └─callr::r(...)
 4.       └─callr:::get_result(output = out, options)
 5.         └─throw(callr_remote_error(remerr, output), parent = fix_msg(remerr[[3]]))

Trying to just build articles also falls over:

> pkgdown::build_articles()
── Building articles ────────────────────────────────────────────────────────────────────────────────────────────────────────
Reading vignettes/articles/quarto-article.qmd
Reading vignettes/quarto-vignette.qmd
Running `quarto render`
Run `rlang::last_trace()` to see where the error occurred.
Error in `.f()`:
! No built file found for vignettes/articles/quarto-article.qmd
Hide Traceback
     ▆
  1. └─pkgdown::build_articles()
  2.   └─pkgdown:::build_quarto_articles(pkg, quiet = quiet)
  3.     ├─pkgdown:::unwrap_purrr_error(...)
  4.     │ └─base::withCallingHandlers(...)
  5.     └─purrr::walk2(...)
  6.       └─purrr::map2(.x, .y, .f, ..., .progress = .progress)
  7.         └─purrr:::map2_("list", .x, .y, .f, ..., .progress = .progress)
  8.           ├─purrr:::with_indexed_errors(...)
  9.           │ └─base::withCallingHandlers(...)
 10.           ├─purrr:::call_with_cleanup(...)
 11.           └─pkgdown (local) .f(.x[[i]], .y[[i]], ...)
 12.             └─cli::cli_abort("No built file found for {.file {input_file}}")
 13.               └─rlang::abort(...)

The toy package I'm working with: https://github.com/jennybc/abcde

In sleuthing around for packages that actually have vignettes/articles/*.qmd, I came across someone using their own fork and branch for qmd article rendering that I suspect is a workaround for what I'm seeing? 🤷‍♀️

https://github.com/ethanbass/pkgdown/tree/qmd_articles https://github.com/ethanbass/pkgdown/commit/8b10575ae7835cd4cbccff12b675a192e6bb84a0

I poked around a couple of other hits and so far haven't come across any where it looks like things are "just working" for anyone with vignettes/articles/*.qmd*.

jennybc commented 4 days ago

Yes I can personally attest to success with pkgdown::build_site() if I install pkgdown from the fork and branch mentioned above. They are definitely onto something promising.

jennybc commented 4 days ago

Here's another toy package, that contains only a qmd article, also not able to build a pkgdown site: https://github.com/jennybc/fghij

jennybc commented 12 hours ago

usethis 3.1.0 is on CRAN now (the version that adds .qmd support to use_vignette() and use_article()).