Markdown
Literate programming
Literate programming: mixing a document formatting language and a programming language.
In this session, we will focus on the document formatting language. And the programming language in the next session.
Markdown
Markdown (md
) is a light-weight markup language for creating formatted text. Quarto (and RMarkdown before it) uses md
as the document formatting language. md
is also used in many websites, e.g. Github, Hackmd; and many static site generators / software, e.g. Jekyll, Hugo, Slack, MS teams.
We will use Github as the testbed. And then we will try to create our first Quarto document and render it.
Text formatting (The essential)
`monospace`.
Text attributes *italic*, **bold**,
Horizontal rule:
---
Exercise:
Produce something like this:
abcd
ef
Good to know
> "ego cogito, ergo sum"
ego cogito, ergo sum
~~Nothing~~
Headings
# Heading
GESIS
## Subheading
is
### Alternative heading
wonderful
#### Alternative subheading
*Hello World!*
Lists
* Item A
* Item B
* Item C
* Item D
1. Item 1
2. Item 2
3. Item 3
1. Item 1
2. Item 2
* Item 2a
* Item 2b
Exercises:
Produce a ranking of cities, e.g.
- Mannheim
- Cologne
- Mainz
- Konstanz
List out all the things you ate this morning for breakfast
- Black Coffee
- Air
Links / Images
[Github](https://github.com/)
![cat](https://upload.wikimedia.org/wikipedia/commons/1/15/Cat_August_2010-4.jpg)
Good to know
Adjusting the size (Quarto)
![cat](https://upload.wikimedia.org/wikipedia/commons/1/15/Cat_August_2010-4.jpg){width=100}
Local file
![cat](img/pic.png)
Exercises:
Produce a list of websites (with links) you like to visit, e.g.
Find a dog picture on Wikipedia and link to it
Produce a sourced quote (Optional)
A Markdown-formatted document should be publishable as-is, as plain text, without looking like it’s been marked up with tags or formatting instructions. – John Gruber
Quarto document (qmd)
A qmd document looks like this
---
title: "This is an example"
format: html
editor: source
---
# Hello
`example`
This is an
1. Hello
2. World
3. Gesis
And it contains three parts
- YAML Front-matter (optional)
- Body
- Code chunks (optional)
We’ll deal with Code chunks and YAML later. Let’s focus on the Body first.
To create a new Quarto document with RStudio: New File
-> Quarto Document
. (Or just create a new empty text file with your favorite text editor)
- Source Editor / Visual Editor
- Render button
By default, a Quarto document renders to HTML.
Rendering
Suppose you want to render test.qmd
## by default to: test.html
quarto render test.qmd
## other filename
quarto render test.qmd -o index.html
Preview
quarto preview test.qmd
Exercises:
Try out all the markups you know in a Quarto document
Tips: render as often as you can to see the changes
Project:
Create your CV as a qmd
file