Render Quarto .qmd files to Markdown, designed to work as a pre-processor for static site generators.
.qmd → .md + figures
# Requires Quarto CLI
brew install quarto # macOS
# Install the tool
uv syncQuarto needs a Python environment with Jupyter and your notebook dependencies (numpy, matplotlib, etc.). Create a separate data science venv:
# Create the environment
uv venv ~/envs/datascience --python 3.12
# Install packages
uv pip install --python ~/envs/datascience/bin/python \
jupyter numpy matplotlib pandas
# Use it with quarto-prerender
quarto-prerender pages/ --python ~/envs/datascience/bin/pythonAdd more packages as needed for your notebooks.
# Render all .qmd files in a directory
quarto-prerender pages/
# With options
quarto-prerender pages/ \
--cache .quarto_cache \
--assets pages/assets/quarto \
--force
# Watch mode
quarto-prerender pages/ --watch
# Verbose output
quarto-prerender pages/ -v- Finds all
.qmdfiles in the target directory - Runs
quarto renderwith GFM output format - Moves generated figures to
assets/quarto/{path}/ - Fixes figure paths in the generated
.md - Preserves original frontmatter (public, published, etc.)
pages/
├── analysis/
│ ├── report.qmd # Source
│ └── report.md # Generated
└── assets/
└── quarto/ # Generated figures
└── analysis/
└── report_files/
└── figure-1.png
Use the qmd-as-md-obsidian plugin to edit .qmd files in Obsidian.
---
title: "Analysis Report"
public: true
date: 2025-01-15
tags: [ml, analysis]
execute:
freeze: auto
jupyter: python3
---
# Model Performance
```{python}
#| label: fig-loss
#| fig-cap: "Training loss over epochs"
#| out-width: "600px"
import matplotlib.pyplot as plt
import numpy as np
epochs = np.arange(100)
loss = np.exp(-epochs/20) + 0.1 * np.random.randn(100)
plt.figure(figsize=(10, 6))
plt.plot(epochs, loss)
plt.xlabel("Epoch")
plt.ylabel("Loss")
plt.show()
## Figure Sizing
Figures are responsive by default (no fixed width). To set a specific width for a figure, use Quarto's `out-width` option:
```python
#| out-width: "600px"
For responsive images on mobile, ensure your site's CSS includes img { max-width: 100%; }.
Add to your content repository's .gitignore:
# Quarto cache
.quarto_cache/
# Generated figures
assets/quarto/