-
Notifications
You must be signed in to change notification settings - Fork 3
/
ch-031-markdown.rmd
274 lines (155 loc) · 6.08 KB
/
ch-031-markdown.rmd
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
---
title: "Markdown Guide"
output:
html_document:
theme: readable
highlight: tango
toc: true
toc_depth: 1
number_sections: true
self_contained: false
css: textbook.css
---
-------------
<br>
![](figures/keep-calm-and-markdown.png)
<br>
-------------
<br>
<br>
Markdown is a set of simple conventions for formatting text in R Markdown (RMD) files.
It makes it easy to create professional documents with minimal effort.
Here are the basic formatting rules for Markdown:
# Headers
```
# Heading One (h1)
## Heading Two (h2)
### Heading Three (h3)
#### Heading Four (h4)
##### Heading Five (h5)
###### Heading Six (h6)
```
![](figures/heading_formats.png)
---
# Text Style
```
With Markdown, it is possible to emphasize words by making them *italicized*, using *astericks* or _underscores_, or making them **bold**, using **double astericks** or __double underscores__.
Of course, you can combine those two formats, with both _**bold and italicized**_ text, using any combination of the above syntax.
You can also add a strikethrough to text using a ~~double tilde~~.
```
With Markdown, it is possible to emphasize words by making them *italicized*, using *astericks* or _underscores_, or making them **bold**, using **double astericks** or __double underscores__.
Of course, you can combine those two formats, with both _**bold and italicized**_ text, using any combination of the above syntax.
You can also add a strikethrough to text using a ~~double tilde~~.
---
# Lists
## Unordered
```
* First item
* Second item
* Third item
* First nested item
* Second nested item
```
* First item
* Second item
* Third item
* First nested item
* Second nested item
## Ordered
```
1. First item
2. Second item
3. Third item
1. First nested item
2. Second nested item
```
1. First item
2. Second item
3. Third item
1. First nested item
2. Second nested item
---
# Hyperlinks
Create links by wrapping the link text in square brackets [ ], and the URL in adjacent parentheses ( ).
```
[Google News](https://news.google.com)
```
[Google News](https://news.google.com)
---
# Images
Insert images in a similar way, but add an exclamation mark in front of square brackets ![ ], and the image file name goes in the parentheses ( ).
```
![alt_text_here](image_file.png)
```
The *alt text* appears when the image cannot be located, or is read by devices for the blind when the mouse hovers over the image. It
It is common practice to place all of the image files in an "assets" or "images" folder to keep your directory tidy. You can reference files inside a folder using the folder name and the forward slash:
```
![a flower](images/flower.jpg)
```
![a flower](figures/flower.jpg)
---
Or you can link directly to an image online using the URL address of the image:
```
![](https://cdn-image.travelandleisure.com/sites/default/files/styles/1600x1000/public/1507062474/hotel-everest-namche-nepal-mountain-lodge-MOUNTAIN1017.jpg)
```
![](https://cdn-image.travelandleisure.com/sites/default/files/styles/1600x1000/public/1507062474/hotel-everest-namche-nepal-mountain-lodge-MOUNTAIN1017.jpg)
---
If you want to include images you need to add the image file to the [images folder](https://github.com/DS4PS/ddm-textbook-summer-2019/tree/master/images) in this repository. Web-friendly formats like PNG, JPEG, or GIF are preferred.
You can just drag and drop the images into the folder, and GitHub will automatically initiate an upload option. After the upload progress bar is complete, click on the green "Commit changes" icon to complete the upload process.
You will then reference images in text using markdown syntax (see the Markddown Guide above for more details):
---
# Tables
```
| Title 1 | Title 2 | Title 3 | Title 4 |
|------------------|------------------|-----------------|-----------------|
| First entry | Second entry | Third entry | Fourth entry |
| Fifth entry | Sixth entry | Seventh entry | Eight entry |
| Ninth entry | Tenth entry | Eleventh entry | Twelfth entry |
| Thirteenth entry | Fourteenth entry | Fifteenth entry | Sixteenth entry |
```
| Title 1 | Title 2 | Title 3 | Title 4 |
|------------------|------------------|-----------------|-----------------|
| First entry | Second entry | Third entry | Fourth entry |
| Fifth entry | Sixth entry | Seventh entry | Eight entry |
| Ninth entry | Tenth entry | Eleventh entry | Twelfth entry |
| Thirteenth entry | Fourteenth entry | Fifteenth entry | Sixteenth entry |
---
# Videos
If you would like to post a video:
1. Upload the video to a video platform like YouTube, and insert an iframe of the video into your document.
2. In YouTube, you will find iframes by clicking on the Share option, and the "Embed" icon.
![iframe](figures/iframe.png)
3. Paste this text into your markdown document, and it will add the video to your page:
```
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/VVRHTF5Ikro" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
```
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/VVRHTF5Ikro" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
---
# Blockquotes
## Single line
```
> My mom always said life was like a box of chocolates. You never know what you're gonna get.
```
> My mom always said life was like a box of chocolates. You never know what you're gonna get.
## Multiline
```
> What do you get when you cross an insomniac, an agnostic and a dyslexic?
>
> Someone who stays up all night wondering whether there really is a dog.
>
> – _Hal Incandenza_
```
> What do you get when you cross an insomniac, an agnostic and a dyslexic?
>
> Someone who stays up all night wondering whether there really is a dog.
>
> – _Hal Incandenza_
---
# Horizontal Rule
```
---
```
---
<br>
<br>
<br>