Last updated: 2021-04-27 16:36:19 EST
Go home
Full overview
Below are some of the most common Markdown decorations. Markdown is a way to write HTML without actually writing HTML. R Markdown uses Pandoc, a document coverter, to turn Markdown into HTML, Word, PowerPoint or PDF documents. (Heads up, you need a LaTeX distribution to make PDF documents. Learn more here.)
For a full overview of R Markdown read through the official docs. They are useful if you are working on a large document (e.g., a paper or slideshow). Even better (and longer) is the definitive guide.
YAML
This is the stuff at the top of an R Markdown document (between the ---
) that prints stuff like the title and author, and determines the overall design of the document. (YAML.
A generic YAML looks like this:
---
title: "title"
subtitle: "subtitle"
author: "author"
output: html_notebook
---
Technically each field but output
can be left blank, but don’t leave them blank, because it’s bad form.
In output
you can add lots of options to change the style of the document, though we recommend you keep things simple. The YAML for this document is:
---
title: "Markdown"
subtitle: "SuffolkEcon"
author: ""
output:
html_notebook:
number_sections: true
theme: readable
highlight: pygments
toc: true
toc_float:
collapsed: yes
---
theme
sets the Boostrap theme that is built-in with R Markdown. highlight
is the theme to make code chunks pretty.
Sections
Sections or headers are made with hastags #
:
# Section
## Subsection
### Subsubsection
Text
Plain
Just write text with no decorations.
Just write text with no decorations.
Paragraphs
Skip a line to write a paragraph. Write short paragraphs.
Here is my first paragraph.
Here is my second paragraph.
Bold
Wrap with a double **
.
**This is bold text.**
This is bold text.
Italics
Wrap with a single *
or _
:
*This is italicized text.*
or
_This is italicized text._
This is italicized text.
Strikethrough
Wrap with a single ~
:
~I regret this text.~
Quotes
Use a single >
:
> It was the best of times, it was the blurst of times.
It was the best of times, it was the blurst of times.
Images
Image must be PNG or JPEG.
![](image.png)
Control the size with {width=}
:
![](image.png){width=75%}
LS0tCnRpdGxlOiAiTWFya2Rvd24iCnN1YnRpdGxlOiAiU3VmZm9sa0Vjb24iCmF1dGhvcjogIiIKb3V0cHV0OiAKICBodG1sX25vdGVib29rOgogICAgbnVtYmVyX3NlY3Rpb25zOiB0cnVlCiAgICB0aGVtZTogcmVhZGFibGUKICAgIGhpZ2hsaWdodDogcHlnbWVudHM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