尝试这种方式(假设文件名是格式测试.qmd)
格式测试.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
```
然后从控制台运行以下代码,立即生成 html 和 github 风格的 markdown (gfm) 文件。
# install.packages("quarto")
quarto::quarto_render("format_test.qmd", output_format = "all")
或者,如果您更喜欢使用终端(或者如果您不是 R 用户),您可以在终端中运行以下命令,
quarto render format_test.qmd --to html,gfm
请小心指定多种格式,不要在中间放置任何空格,即将它们键入为html,gfm
.
并且在终端中运行上述命令不需要您指定format
文档中的 yaml 选项。因此对于
格式测试.qmd
---
title: "Untitled"
---
## Quarto
Quarto enables you to weave together content and executable code
into a finished document. To learn more about Quarto
see <https://quarto.org>.
quarto render format_test.qmd --to pdf,html,gfm
将生成 HTML、pdf 和 markdown 格式的三个文件。