Skip to content

How can an R package's knit_print() discover the active Quarto project output-dir during rendering? #14544

@ashishtiwari03

Description

@ashishtiwari03

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 example myplot/plot.json,
myplot/animint.js, etc. The HTML returned by knit_print() refers to myplot/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 final
output directory.

Question: from inside an R package knit_print() method during quarto::quarto_render(), what is the recommended way
to 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    supporta request for support

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions