-
Notifications
You must be signed in to change notification settings - Fork 1
/
third-section-new-chapter.qmd
224 lines (127 loc) · 5.43 KB
/
third-section-new-chapter.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# New Chapter
## Learning Objectives
Every chapter also needs Learning Objectives.
## Libraries
For this chapter, we'll need the following packages attached:
*Remember to add [any additional packages you need to your course's own docker image](https://github.com/jhudsl/OTTR_Template/wiki/Using-Docker#starting-a-new-docker-image).
```{r}
library(magrittr)
```
## Topic of Section
You can write all your text in sections like this, using `##` to indicate a new header. you can use additional pound symbols to create lower levels of headers.
See [here](https://www.rstudio.com/wp-content/uploads/2015/02/rmarkdown-cheatsheet.pdf) for additional general information about how you can format text within R Markdown files. In addition, see [here](https://pandoc.org/MANUAL.html#pandocs-markdown) for more in depth and advanced options.
### Subtopic
Here's a subheading (using three pound symbols) and some text in this subsection!
## Code examples
You can demonstrate code like this:
```{r}
output_dir <- file.path("resources", "code_output")
if (!dir.exists(output_dir)) {
dir.create(output_dir)
}
```
And make plots too:
```{r}
hist_plot <- hist(iris$Sepal.Length)
```
You can also save these plots to file:
```{r}
png(file.path(output_dir, "test_plot.png"))
hist_plot
dev.off()
```
## Image example
How to include a Google slide. It's simplest to use the `ottrpal` package:
```{r}
#| fig-align: "center"
#| fig-alt: "Major point!! example image"
#| echo: false
#| out-width: "100%"
ottrpal::include_slide("https://docs.google.com/presentation/d/1Dw_rBb1hySN_76xh9-x5J2dWF_das9BAUjQigf2fN-E/edit#slide=id.g252f18e2576_1_0")
```
But if you have the slide or some other image locally downloaded you can also use HTML like this:
<img src="resources/images/figure/1YmwKdIy9BeQ3EShgZhvtb3MgR8P6iDX4DfFD65W_gdQ_gcc4fbee202_0_141.png" title="Major point!! example image" alt="Major point!! example image" style="display: block; margin: auto; max-width: 100%; height: auto;" />
## Video examples
You may also want to embed videos in your course. If alternatively, you just want to include a link you can do so like this:
Check out this [link to a video](https://www.youtube.com/embed/VOCYL-FNbr0) using markdown syntax.
### Using `knitr`
To embed videos in your course, you can use `knitr::include_url()` like this:
Note that you should use `echo=FALSE` in the code chunk because we don't want the code part of this to show up. If you are unfamiliar with [how R Markdown code chunks work, read this](https://rmarkdown.rstudio.com/lesson-3.html).
```{r}
#| echo: false
knitr::include_url("https://www.youtube.com/embed/VOCYL-FNbr0")
```
### Using HTML
<iframe src="https://www.youtube.com/embed/VOCYL-FNbr0" width="672" height="400px"></iframe>
### Using `knitr`
```{r, fig.align="center", echo=FALSE, out.width="100%"}
knitr::include_url("https://drive.google.com/file/d/1mm72K4V7fqpgAfWkr6b7HTZrc3f-T6AV/preview")
```
### Using HTML
<iframe src="https://drive.google.com/file/d/1mm72K4V7fqpgAfWkr6b7HTZrc3f-T6AV/preview" width="672" height="800px"></iframe>
## Website Examples
Yet again you can use a link to a website like so:
[A Website](https://yihui.org)
You might want to have users open a website in a new tab by default, especially if they need to reference both the course and a resource at once.
[A Website](https://yihui.org){target="_blank"}
Or, you can embed some websites.
### Using `knitr`
This works:
```{r, fig.align="center", echo=FALSE}
knitr::include_url("https://yihui.org")
```
### Using HTML
<iframe src="https://yihui.org" width="672" height="400px"></iframe>
## Stylized boxes
Occasionally, you might find it useful to emphasize a particular piece of information. To help you do so, we have provided css code and images (no need for you to worry about that!) to create the following stylized boxes.
You can use these boxes in your course with either of two options: using HTML code or Pandoc syntax.
### Using `rmarkdown` container syntax
The `rmarkdown` package allows for a different syntax to be converted to the HTML that you just saw and also allows for conversion to LaTeX. See the [Bookdown](https://bookdown.org/yihui/rmarkdown-cookbook/custom-blocks.html) documentation for more information. Note that Bookdown uses Pandoc.
```
::: {.notice}
Note using rmarkdown syntax.
:::
```
::: {.notice}
Note using rmarkdown syntax.
:::
As an example you might do something like this:
::: {.notice}
Please click on the subsection headers in the left hand
navigation bar (e.g., 2.1, 4.3) a second time to expand the
table of contents and enable the `scroll_highlight` feature
([see more](introduction.html#scroll-highlight))
:::
### Using HTML
To add a warning box like the following use:
<div class = "notice">
Followed by the text you want inside
</div>
This will create the following:
<div class = "notice">
Followed by the text you want inside
</div>
Here is a `<div class = "warning">` box:
<div class = "warning">
Note text
</div>
Here is a `<div class = "github">` box:
<div class = "github">
GitHub text
</div>
Here is a `<div class = "dictionary">` box:
<div class = "dictionary">
dictionary text
</div>
Here is a `<div class = "reflection">` box:
<div class = "reflection">
reflection text
</div>
Here is a `<div class = "wip">` box:
<div class = "wip">
Work in Progress text
</div>
## Dropdown summaries
<details><summary> You can hide additional information in a dropdown menu </summary>
Here's more words that are hidden.
</details>