How do I knit to two formats simulateously with Quarto?

Viewed 177

Is it possible to create multiple output formats from a Quarto/R Markdown document at once by specifying them in the YAML header?

My guess did not work:

---
title: Stacked Area chart with Annotations
format: 
  - html
  - gfm
---
1 Answers

Try this way (and suppose file name is format_test.qmd)

format_test.qmd

---
title: "Untitled"
format:
  html: default
  gfm: default
---

## Quarto

Quarto enables you to weave together content and executable code
into a finished document. To learn more about Quarto 
see <https://quarto.org>.

## Running Code

When you click the **Render** button a document will 
be generated that includes both content and the output 
of embedded code. You can embed code like this:

```{r}
1 + 1
```

Then from console run this following code to generate both html and github flavoured markdown (gfm) file at once.

# install.packages("quarto")

quarto::quarto_render("format_test.qmd", output_format = "all")
Related