quarto-term
Persistent interactive terminal sessions for Quarto
quarto-term is a Quarto extension that runs commands in a real, persistent shell session. State carries across cells, colors render faithfully, and you can drive fullscreen TUI apps, all from your .qmd file.
quarto-term is great for:
- Documentation and tutorials: CLI tools, shell concepts, installation guides, git workflows, and API exploration with real output and persistent state
- Technical books and courses: faithful terminal rendering for any “type this, see that” sequence, including TUI walkthroughs, database demos, and data pipeline chains
- DevOps and security: runbooks, CTF writeups, and environment setup guides where colored tool output and multi-step sessions matter
export NAME="quarto-term"
echo "Hello, $NAME"
Hello, quarto-term
htop
0[| 0.7%] Tasks: 42, 112 thr, 118 kthr; 1 runnin
1[| 0.7%] Load average: 0.32 0.41 0.18
2[ 0.0%] Uptime: 00:13:46
3[| 0.7%]
Mem[||||||||||||| 949M/15.6G]
Swp[ 0K/3.00G]
[Main] [I/O]
PID USER PRI NI VIRT RES SHR S CPU%▽MEM% TIME+ Command
1370 root 20 0 442M 35804 12936 S 0.7 0.2 0:01.03 /usr/bin/pyth
5190 runner 20 0 8356 4784 3800 R 0.7 0.0 0:00.04 htop
1 root 20 0 22848 14404 9848 S 0.0 0.1 0:02.95 /sbin/init
155 root 19 -1 113M 18144 16844 S 0.0 0.1 0:00.52 /usr/lib/syst
218 root RT 0 298M 43708 8760 S 0.0 0.3 0:00.03 /sbin/multipa
226 root 20 0 25980 8000 5184 S 0.0 0.0 0:00.20 /usr/lib/syst
227 root 20 0 298M 43708 8760 S 0.0 0.3 0:00.00 /sbin/multipa
228 root RT 0 298M 43708 8760 S 0.0 0.3 0:00.00 /sbin/multipa
229 root RT 0 298M 43708 8760 S 0.0 0.3 0:00.00 /sbin/multipa
230 root RT 0 298M 43708 8760 S 0.0 0.3 0:00.00 /sbin/multipa
231 root RT 0 298M 43708 8760 S 0.0 0.3 0:00.03 /sbin/multipa
233 root RT 0 298M 43708 8760 S 0.0 0.3 0:00.00 /sbin/multipa
394 root 20 0 3848 2908 1988 S 0.0 0.0 0:00.24 /usr/lib/linu
F1Help F2Setup F3SearchF4FilterF5Tree F6SortByF7Nice -F8Nice +F9Kill F10Quit
All of the above was produced from a single .qmd file using quarto-term.
Why quarto-term?
Quarto’s built-in bash engine executes each code cell in an isolated subshell. That means:
- Variables,
cd, and other state don’t persist between cells. - You can’t show interactive TUI applications (htop, vim, nyancat).
- Output is plain text with no ANSI color support.
- There’s no way to send special keys (Ctrl-C, arrow keys).
- You can’t produce terminal recordings alongside your document.
quarto-term solves all of these by running a single persistent shell session that all cells share. It captures output using a real terminal emulator (including colors, cursor movement, and fullscreen apps), and can optionally produce asciicast or termshow recordings for playback.
Features
- Persistent sessions. State carries across cells (variables, working directory, shell history).
- ANSI color rendering. Faithfully renders colored output as HTML/LaTeX.
- Fullscreen capture. Capture TUI apps like htop, vim, or nyancat.
- Special keys. Send Ctrl-C, arrow keys, Enter, Escape, and more.
- Human typing simulation. Configurable speed and error rate for realistic recordings.
- Terminal recordings. Produce
.cast(asciicast v2) or.termshowfiles alongside your document. - Line options. Control timing, key behavior, and prompt expectations per line.
- Multi-line commands. Automatic PS2 continuation prompt detection.
- Styling. Built-in colorschemes with light/dark mode support, fonts, and sizing.
- Multiple output formats. HTML, LaTeX/PDF, and Markdown.
Quick install
quarto add jeroenjanssens/quarto-termOn first render, the correct binary for your platform is automatically downloaded from GitHub Releases and cached locally. Supported platforms: macOS (ARM and Intel), Linux (x86_64 and ARM), and Windows.
See Get Started for a complete walkthrough.