yihui / knitr

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

Make `asis_output` works for Quarto the same as `results: asis` #2332

Open cderv opened 3 months ago

cderv commented 3 months ago

Related to

Example

---
title: "Test"
format: 
  typst:
    keep-typ: true
    keep-md: true
---

```{r}
#| results: asis
knitr::asis_output("`#set page(flipped: true)`{=typst}")


Using `asis_output()` will not apply raw output here, because `options$results = 'asis'` us onlyfor LaTeX output 

https://github.com/yihui/knitr/blob/031e08c74c501e0e1a5d625e0c053977b7a230ec/R/output.R#L514-L518

I think we need it for Quarto as the wrapping used will check for this value 
https://github.com/quarto-dev/quarto-cli/blob/f43107222f70ca3579a520d496597b75b5bd0097/src/resources/rmd/patch.R#L116-L117