How can an R package's knit_print() discover the active Quarto project output-dir during rendering? #14545
Replies: 3 comments 7 replies
This comment has been hidden.
This comment has been hidden.
-
|
The location of files created by knitr can be configured by knitr with Regarding |
Beta Was this translation helpful? Give feedback.
-
|
Quarto sets some environment variable you can get from your R session You could use that. However, in your case, if you are passing your assets as html dependencies, I would expect them to be moved in the output dir correctly. I think you are trying to handle yourself the directories resolution. You should probably leverage knit_print metadata to pass your assets as html dependencies to be used for your code to be working in HTML. Look at It could also be as html dependencies if your package leverage htmltools or htmlwidgets Look at Hope it helps |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
In animint2 we are trying to support interactive plots in Quarto websites/books.
Context: animint/animint2#325
PR: animint/animint2#331
animint2::knit_print.animint()writes a directory of web assets for each plot, for examplemyplot/plot.json,myplot/animint.js, etc. The HTML returned byknit_print()refers tomyplot/plot.json.This works in single-file R Markdown, but in Quarto website/book projects the final rendered output goes into a
project output directory such as
_site/or_book/. We need to copy the generated asset directory into the finaloutput directory.
Question: from inside an R package
knit_print()method duringquarto::quarto_render(), what is the recommended wayto determine the final output directory for the current document/project?
Is there an official environment variable, knitr option, or Quarto API that gives the project output directory and
current document output path? We want to avoid manually parsing
_quarto.yml.Beta Was this translation helpful? Give feedback.
All reactions