Markdown#
Markdown is a lightweight, HTML-like language that lets us format text, insert images, and create documents. This means that you won’t, for example, highlight a word and find the bold button in a menu bar. Instead, you will use Markdown notation to indicate what formatting you would like. Once you learn Markdown, you’ll start to see it everywhere - README files on GitHub, note-taking apps, documentation, and of course, Jupyter notebooks.
Why Markdown?#
In this class, you’ll use Markdown to:
Write explanations alongside your Python code in Jupyter notebooks
Create professional-looking reports that combine code, output, and analysis
Document your projects with README files
Take notes that include formatted text, code snippets, and math equations
Basic Syntax#
Headers#
Use # symbols to create headers. More # symbols = smaller headers.
Markdown |
Result |
|---|---|
|
Largest header |
|
Second level |
|
Third level |
Text Formatting#
Markdown |
Result |
|---|---|
|
bold text |
|
italic text |
|
bold and italic |
|
|
Lists#
Unordered lists use -, *, or +:
- First item
- Second item
- Nested item
- Another nested item
- Third item
Numbered lists use numbers:
1. First step
2. Second step
3. Third step
Links and Images#
Links:
[Link text](https://www.example.com)
Example: [Elon University](https://www.elon.edu) creates Elon University
Images:

Code#
For inline code, use single backticks: `print("hello")` renders as print("hello").
For code blocks, use triple backticks with an optional language identifier:
```python
import pandas as pd
df = pd.read_csv('data.csv')
print(df.head())
```
This renders as:
import pandas as pd
df = pd.read_csv('data.csv')
print(df.head())
Blockquotes#
Use > for quotes:
> This is a blockquote. Great for highlighting
> important information or citing sources.
This is a blockquote. Great for highlighting important information or citing sources.
Math and Equations#
This is especially important for finance! Markdown supports LaTeX math notation.
Inline Math#
Use single dollar signs for inline math: $\mu$ renders as \(\mu\).
Examples:
Markdown |
Result |
|---|---|
|
\(\mu\) (mean) |
|
\(\sigma\) (standard deviation) |
|
\(\beta\) (beta) |
|
\(r_f\) (risk-free rate) |
|
\(R^2\) (R-squared) |
Display Equations#
Use double dollar signs for centered equations:
$$
R_p = \sum_{i=1}^{n} w_i R_i
$$
Renders as:
Common Finance Equations#
Sharpe Ratio:
$$
\text{Sharpe Ratio} = \frac{R_p - R_f}{\sigma_p}
$$
CAPM:
$$
E(R_i) = R_f + \beta_i (E(R_m) - R_f)
$$
Portfolio Variance (two assets):
$$
\sigma_p^2 = w_1^2\sigma_1^2 + w_2^2\sigma_2^2 + 2w_1w_2\sigma_1\sigma_2\rho_{12}
$$
Tables#
Create tables using pipes | and hyphens -:
| Asset | Weight | Return |
|-------|--------|--------|
| AAPL | 0.40 | 12.5% |
| MSFT | 0.35 | 10.2% |
| GOOG | 0.25 | 8.7% |
Renders as:
Asset |
Weight |
Return |
|---|---|---|
AAPL |
0.40 |
12.5% |
MSFT |
0.35 |
10.2% |
GOOG |
0.25 |
8.7% |
Jupyter Book Special Features#
Since our course notes use Jupyter Book, you have access to some extra features:
Notes and Warnings#
```{note}
This is a helpful note for students.
```{note}
This is a helpful note for students.
```{warning}
Be careful about this common mistake!
```{warning}
Be careful about this common mistake!
Tips#
```{tip}
A useful tip for your workflow.
```{tip}
A useful tip for your workflow.
Practice in VS Code#
In VS Code (and Codespaces), you can:
Preview Markdown: Right-click on a
.mdfile and select “Open Preview” (or useCmd+Shift+Von Mac,Ctrl+Shift+Von Windows)Side-by-side editing: Use
Cmd+K Vto see your Markdown and preview side by sideIn Jupyter notebooks: Double-click a Markdown cell to edit it, then
Shift+Enterto render it
Resources#
Here’s a Markdown cheatsheet - bookmark this! You’ll get the hang of it very quickly.
The Markdown Section from Coding for Economists is excellent and goes into more detail.
For LaTeX math symbols, this reference guide is comprehensive.
You can read more about how to use VS Code and Markdown.