Luke Oliff.

TIL: Recording Terminal Sessions as SVGs With termtosvg

·TIL·1 min read·Luke Oliff

Documentation needs terminal recordings. termtosvg captures your session as an SVG file.

termtosvg demo.svg

Records every keystroke and output. Press Ctrl+D to stop. The resulting SVG is a vector animation that plays in any browser.

termtosvg --still-frames demo.svg

Output a sequence of still SVG frames instead of an animation. Useful for printed documentation.

termtosvg record demo.svg

Explicit record command. Same result but more readable in scripts.

Why SVG over GIF?

SVGs are smaller, resolution independent, and the text is selectable. GIFs are pixel based and get blurry on retina screens.

How do I install termtosvg?

pip install termtosvg

Python 3 only. Requires pyte and svgwrite.