-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsession-output-formats.qmd
75 lines (52 loc) · 1.52 KB
/
session-output-formats.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
title: "Output formats"
subtitle: "Session - Creating things from Quarto"
---
## Wizard
Using the wizard in RStudio gives a selection of output possibilities:
::: {.incremental}
- html (default and very accessible as well as interactive)
- word
- pdf
:::
A full list is on the [Quarto documentation website](https://quarto.org/docs/output-formats/all-formats.html) with links to the code to use in the YAML
## Rendering to multiple outputs
Whilst it's possible to list several outputs in the YAML:
```markdown
format:
html:
toc: true
docx:
toc: true
```
only the first will render with the `Render` button in RStudio.
## Using {quarto} package
The {quarto} package (which is different to Quarto which is in RStudio) can render to different formats:
```{r}
#| echo: fenced
quarto::quarto_render(output_format = "docx")
```
. . .
:::{.callout-warning collapse=false appearance='default' icon=true}
## Quarto project
- This function prompts for the project to be a Quarto project
- In RStudio this can be set up from the beginning with `File > New Project... > Quarto project`
- An additional file called `_quarto.yml` is generated with code:
```markdown
project:
title: "intro-quarto"
```
:::
## And all formats
The following can generate all outputs:
```{r}
#| echo: fenced
quarto::quarto_render(output_format = "all")
```
## Run any file
It's possible to Render any Quarto file (even when not open in RStudio):
```{r}
#| echo: fenced
quarto::quarto_render("images_report/example_report.qmd")
```
## Next Section