yihui / knitr

A general-purpose tool for dynamic report generation in R
https://yihui.org/knitr/
2.36k stars 873 forks source link

Support `.qmd` in `knitr::spin()` #2284

Closed cderv closed 10 months ago

cderv commented 10 months ago

From discussion at

Currently format = "qmd" is not possible.

I think we could do format = "qmd" in spin(), to do like .Rmd but putting chunk options in YAML probably. With knit = FALSE / report = FALSE, it would produce a valid .qmd document.

We could also offer to run quarto::quarto_render() if report = TRUE - this is related to

where we shared the idea of running rmarkdown::render() on .Rmd using R Markdown V2 and not expecting knit2html()

Storing the idea here. Any thoughts @yihui ?

We could also argue that quarto convert myscript.R could be used (or another comment) to build from a .R to a .qmd

yihui commented 10 months ago

Done (since it's quite simple).

spin(text = c('#| echo: false','1+1'), format = 'qmd', knit = F)

I'm not sure if the quarto cli should support quarto render script.R directly, or only let the R package quarto support it. I'll leave this decision to the quarto team.

cderv commented 10 months ago

Thanks @yihui !

if the quarto cli should support quarto render script.R directly,

I have opened https://github.com/quarto-dev/quarto-cli/issues/6660 for follow the discussion on this idea

github-actions[bot] commented 4 months ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.