-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Can't specify output directory with quarto_render()
#81
Comments
Quarto is a CLI tool and For project Quarto has a However, it seems here you are in another use case.
How are you rendering the template qmd ? Usually with templates, they should be moved to a project location. This is how it works with R Markdown templates (using the Moving template file and resources before rendering is important because rendering could need to write some files at the source location. Having an output directory to move results may not be enough. Is the pattern :
Let's discuss this further. Hope it helps. |
Hi @cderv, I'm in the second situation, in terms of the template is a parameterized report. I render the .Rmd template from the When I tried this using |
Thanks for the precision. I know the situation. This is my personal view on this I would not try to call render on the file within the package. You will consider folder I would say this is not good practice, all the more because in some situation, a package installation folder is not writeable and will be read -only. For this type of need, I would use the following pattern.
This will be safer for your rendering, and it is good practice for a package to only write in specific place (temporary directory or user's data directory for things that should stay). With that in mind, you may understand better the Quarto approach.
Managing outputs for users was very tricky and prone to error. Between the inputs, the resources, the intermediary outputs, the different formats and all. We had a hard time in rmarkdown and it is buggy in some place. (lots of opened issues https://github.com/rstudio/rmarkdown/issues?q=label%3A%22theme%3A+paths%22+is%3Aopen+sort%3Aupdated-desc) So for now, Quarto does things minimal on this. It may evolve in the future, but I believe the good practice will stay. Hope it helps understand. Would you be willing to try one of the approach above ? |
Since parameters supplied to I am aware of workarounds, such as bypassing
|
I was thinking of intermediates file mainly. I recall that in some case the
I don't recommend too. I am advising to copy resources from your package to a temp directory for the rendering process and then move stuff to end destination, before cleaning stuff. That is the process recommended in Shiny apps for example (https://shiny.rstudio.com/articles/generating-reports.html)
Here you are referring to using Regarding output directory for a rendering, you should add to this discussion and follow quarto-dev/quarto-cli#2171
Sorry I may have misunderstood then. I though you were offering a function in package as wrapper of
Quarto is an evolution of R Markdown for next generation scientific publishing. It does not replace R Markdown in the way that R Markdown is not going away, and Quarto even use part of R Markdown internally. Quarto extends R Markdown ecosystem that R users benefits since some years to other scientific communities by starting fresh with the experience and new vision.
Something I may have missed and misunderstood: Do you manage to do what you want with Quarto CLI calling Quarto works with the notion of projects which brings many new features and possibility, and offer the mechanism of extensions to offer shared content. Maybe the current design of Quarto does not yet answer to your past workflow, or maybe this workflow needs adaptation. Anyway, I don't think this is a direct issue of the R package Quarto which this issue thread is about. You should contribute to linked discussion or open a new one to share your feedback. I'll do internally. I was trying to help find a good workflow to work with quarto and templates. I am happy to keep sharing and help on that if you think that is useful to you. Anyway, thanks a lot for the discussion by the way. That is very enlightening. I wonder what we could do at the R package level. But we want to keep it as close to Quarto itself. |
While rendering with
I view this as a Thanks for the discussion as well, I do look forward to seeing Quarto and the R package |
Oh that is interesting. So this is really something in the usage context of R template within package... 🤔
We are currently only passing argument to There is a Anyway, the upstream issue is about all this, so this will evolves in time. Thank you again. |
quarto::quarto_render() will not render a .qmd document to .html anywhere but the original directory; as a workaround, since this is a known issue and we cannot render an .html inside this R package, the function copies the .qmd template to the desired outpur dir, renders it, and then deletes the template; params updated for clarity
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Here to say - i loved quarto - its crisp and simple thank you :) |
I'm adding my current solution for others and critique.
|
There is no parameter for
quarto_render()
that allows the user to set a desired output directory when rendering a .qmd document.In
rmarkdown::render()
this functionality is seen with theoutput_dir
parameter.The use case I have for setting an output directory, other than it being generally useful, is rendering a .qmd template from an R package. Currently,
quarto_render()
attempts to write the output document to the location of the template in the R package directory. This therefore limits the utility of quarto templates in R packages. I would like to seequarto_render()
to work asrmarkdown::render()
does, which allows users to set an output directory for the destination of a rendered template.The text was updated successfully, but these errors were encountered: