-
Notifications
You must be signed in to change notification settings - Fork 2
Markdown
Markdown is commonly used for writing documentation, README files, and other text-based content. It is widely supported across various platforms, including GitHub, RStudio, and many blogging platforms. It is easy to learn, and once you know a little, you will be able to write documents, create issues and pull request, and participate in discussion on GitHub. It is also the foundation for Rmarkdown and Quarto documents (markdown combined with R code).
- Headers
- Horizontal rule
- Emphasis
- Escape special characters
- Lists
- Block quotes
- Links
- Code blocks
- Strikethroughs
- Math equations
- Tables
- Check boxes
- Bibliographies
- HTML
The size of the header is determined by the number of # used precedding the header. These are equivalent to <h> tags in html documents.
## smaller size 2 header `<h2>`
### even smaller size 3 header `<h3>`
#### tiny header (size 4) `<h4>`
produces this:
A size 6 is the smallest you can go
A horizontal rule can be achieved in three ways: Use either three consectutive hyphens, asterisks, or underscores
---
***
___
Three hyphens are standard.
It is easy to make words bold and italic by using asteriks (*)
Make a word *italic*
Make a word **bold**
Make a word ***bold and italic***
produces this:
Make a word italic
Make a word bold
Make a word bold and italic
If you want to use characters like * , _ , !, + etc in your code then you need to "escape" them. This involves typing a backslash immediately before the character eg. \*
\* , \_ , \!, \+
prduces this:
* , _ , !, +
There are two types of lists, ordered and unordered lists. Unordered lists will use bullet points for each list item. You can use either *, +, or - for list items
* item 1
* item 2
+ sub item
+ another sub item
- another
* last item
* item 3
produces:
- item 1
- item 2
- sub item
- another sub item
- another
- last item
- item 3
Uses numbers in consecutive order. Either type list numbers or use 1. for all list items
1. item 1
2. item 2
3. item 3
or
1. item 1
1. item 2
1. item 3
produces this:
- item 1
- item 2
- item 3
Block quotes are a way to indent some text fro greater emphasis. Often people will use persoal quotes in a block quote.
> A block quotation (also known as a long quotation or extract) is a quotation in a written document that is set off from the *main* text as a paragraph, or block of text, and typically distinguished visually using indentation and a different typeface or smaller size font.
will produce this:
A block quotation (also known as a long quotation or extract) is a quotation in a written document that is set off from the main text as a paragraph, or block of text, and typically distinguished visually using indentation and a different typeface or smaller size font.
There are several options for links. We can link other parts of the document using the document headers, we can link to images locally or on the web, and we can link to web sites.
Link to [Emphasis](#emphasis) chapter
Link to [Block quotes](#block-quotes) chapter
produces:
Link to Emphasis chapter
Link to Block quotes chapter
Try clicking on the links! Note: blank spaces in header titles need to replaced with a hyphens, (-), when linked to.
Link to an image locally. For this example we have an image called CHL_SEASONAL_ANOMS_2019.png located in the figures folder.

The text "Seasonal anomolies" is considered the title text and will be seen as mouse over text in markdown and html files (but not pdfs)
This syntax for this line is equivalent to the following html:
<img src="figures/CHL_SEASONAL_ANOMS_2019.png" alt="alt txt" title="Seasonal anomolies">

To make this link clickable we just wrap all of this in square brackets and add a link
[](https://github.com)
Linking to an image on the web uses exacly the same format. Just substitute the path for the image url
/GettyImages-108313003-5a9e18f2bfb2431492fa41f5148717ff.jpg "waterfall")
We have already used these in the above document. We encompass chunks of code between "fences" These fences are a sequence of 3 back ticks.
```
For more help in R type ?dplyr
```
produces:
For more help in R type ?dplyr
We can also use inline code using a single back tick.
A package i like in R is called `dplyr` produces:
A package i like in R is called
dplyr
These are used for showing crossed out text.
I ~~dont~~ like ice cream
produces:
I
dontlike ice cream
There are a great deal of options for mathematical equations (Greek letter, subscripts, superscripts, math symbols, fractions etc.). The mathematical typesetting is based on LaTeX. These are not part of the Markdown core specs but different flavors of markdown have support for Equations, for example Rmarkdown. Here is small flavor: (You will need to knit in Rmarkdown or live preview in Visual Studio Code to see the rendered output). Math equations will not render on GitHub as markdown files.
The variable $X$ is Normally distributes with mean $\mu$ and stanard deviation $\sigma$.
produces:
The variable
$X$ is Normally distributes with mean$\mu$ and stanard deviation$\sigma$ .
All equations are enclosed between $$
The Normal distribution can be written as:
$$f\left(X,\underline\theta\right) = \frac{1}{\sigma\sqrt{2\pi}}e^{-\frac{1}{2}\left(\frac{x-\mu}{\sigma}\right)^2}$$
Tables can be added using the pipe, ( | ), symbol to separate columns.
|name|occupation|dob|
|---|:---:|---|
|jim|chef|1988-02-22|
|bob|comedian|1966-05-01|
produces:
name occupation dob jim chef 1988-02-22 bob comedian 1966-05-01
The use of colons in the spearator line justifies text to the left, right, or centered (as shown above in the middle column)
- [x] checkbox item
- [ ] open box
produces:
- checkbox item
- open box
Using bib files are not part of markdown but extensions in Visual studio code can help with that. They can also be linked to when editing in Rmarkdown.
Markdown files can be used in conjuction with cascading style sheets (.css files) and html to create custom layouts, in particular for websites/webpages.
/GettyImages-108313003-5a9e18f2bfb2431492fa41f5148717ff.jpg)