Chapter 3 A quick introduction to Markdown

3.1 What is Markdown?

Markdown is a lightweight markup language that you can use to add formatting elements to plaintext text documents.

markdown.org

You can create markdown documents in any text editor that can create plain text files. For making things in bookdown, I prefer to use the RStudio IDE so I have access to the build tools while I’m writing.

3.2 Markdown syntax

You may already be familiar with some/all of the markdown syntax from using things like Moodle. A nice markdown cheat sheet can be found here.

These are some of the features I use most frequently. In the following examples, the grey boxes with mono-spaced font show the markdown and the green boxes show the rendered output. The “\” you see in the raw markdown is an escape character to render the #, * etc. as symbols rather than a formatter.

3.2.1 Headings

You can make different levels of headings using different numbers of #’s at the start of a line

# One \#  for a chapter 
## Two \#\# for a section 
### Three \#\#\# for a subsection

Chapter 1  One # for a chapter

1.1  Two ## for a section

1.1.1  Three ### for a subsection

More details about chapter and section headings is in Section 4.1

3.2.2 Text formatting

You can make text italic using one * or _ at each end of the text. Bold uses two of each.

make italics using _one underscore_ or *one star* at each end
make bold using __two underscores__ or **two stars** at each end

make italics using one underscore or one star at each end

make bold using two underscores or two stars at each end

3.2.3 Lists

Making lists is easy too!

*   Bulleted lists
*   are made by putting
*   a \* (asterix) 
-   or a dash (-)
-   at the start of the line.
-   You don't even need to be consistent.
    - You can make a sub-list by adding 4 spaces before the -
        - but I'm not sure how many levels this goes to...
  • Bulleted lists
  • are made by putting
  • a * (asterix)
  • or a dash (-)
  • at the start of the line.
  • You don’t even need to be consistent.
    • You can make a sub-list by adding 4 spaces before the -
      • but I’m not sure how many levels this goes to…
1. To make a numbered list
2. you just number things
3. i.e. 1., 2., at the start of a line
7. and it doesn't matter
4. if your numbers are in the right order
1. or if you keep using
1. the same number
  1. To make a numbered list
  2. you just number things
  3. i.e. 1., 2., at the start of a line
  4. and it doesn’t matter
  5. if your numbers are in the right order
  6. or if you keep using
  7. the same number

You can also do

a) Alphabetical lists
a) using lower case letters,
A) or using
A) upper case letters
  1. Alphabetical lists
  2. using lower case letters,
  1. or using
  2. upper case letters

or you can

1. mix all of them together
    a) if that's how
        - you like to spend
        - your time. 
  1. mix all of them together
    1. if that’s how
      • you like to spend
      • your time.

  1. If you look at the source code for this section you’ll see that the code to display the headings example doesn’t match the markdown. This was a hacky way to get it to display correctly without messing up the section numbering If you find a solution for how to reset section numbers please let me know, because I’ve spent far too long on Stack Overflow today.↩︎