Markdown Formatting
The narrative portions of a Quarto document are written in Markdown, a lightweight formatting language designed to be readable as plain text while producing polished formatted output. This section covers the Markdown syntax you will use most frequently.
Text Formatting
Surround text with asterisks or underscores to add emphasis:
| Syntax | Result |
|---|---|
*italic text* or _italic text_ |
italic text |
**bold text** or __bold text__ |
bold text |
***bold italic*** |
bold italic |
`code` |
code (monospace, for variable names, function names, file paths) |
~~strikethrough~~ |
|
superscript^2^ |
superscript2 |
subscript~2~ |
subscript2 |
Headings
Headings are created with # symbols. The number of # symbols determines the heading level:
# Level 1 Heading (document title or major section)
## Level 2 Heading (section)
### Level 3 Heading (subsection)
#### Level 4 Heading (sub-subsection)In a Quarto document, # is typically reserved for the document title (set in the YAML header), so most content uses ## for sections and ### for subsections.
Lists
Unordered lists use -, *, or + as bullet markers. Indent with two or four spaces to create nested lists:
Ordered lists use numbers followed by a period. The actual numbers do not matter — Markdown renumbers them automatically:
Task lists use - [ ] for unchecked and - [x] for checked items:
Links and Images
Hyperlinks use square brackets for the display text and parentheses for the URL:
Images use the same syntax with an exclamation mark prefix. The text in square brackets becomes the caption:
To control image size, add attributes in curly braces:
Tables
Tables use pipes (|) and hyphens (-) to define columns and rows. Colons in the separator row control alignment:
| Variable | Type | Description |
|----------|---------|----------------------|
| ID | Integer | Employee identifier |
| Age | Integer | Age in years |
| BMI | Numeric | Body mass index |This produces:
| Variable | Type | Description |
|---|---|---|
| ID | Integer | Employee identifier |
| Age | Integer | Age in years |
| BMI | Numeric | Body mass index |
Alignment options: :--- (left), :---: (center), ---: (right).
Block Quotes
Block quotes are created with > at the start of a line. They are useful for highlighting key findings or quoting sources:
Horizontal Rules
A horizontal rule (divider line) is created with three or more hyphens, asterisks, or underscores on a line by themselves:
Math
Quarto supports LaTeX math notation. Use single dollar signs for inline math and double dollar signs for display math:
The mean is calculated as $\bar{x} = \frac{1}{n}\sum_{i=1}^n x_i$.
$$
\hat{y} = \beta_0 + \beta_1 x_1 + \beta_2 x_2 + \epsilon
$$The inline version renders within a sentence: \(\bar{x} = \frac{1}{n}\sum_{i=1}^n x_i\). The display version renders centered on its own line.