libvt.format¶
Plain-text, ANSI/DEC VT, and HTML formatters for terminal snapshots.
-
class libvt.format.Formatter¶class libvt.format.Formatter¶
Bases:
objectSerialize a
Snapshotto plain text, VT, or HTML.Replay VT output into a fresh
Terminalof the same size and profile. Seeformat()for the VT export contract.Examples
>>> from libvt.terminal import Formatter, OutputFormat, Terminal >>> term = Terminal(rows=2, cols=8) >>> term.feed(b"\x1b[31mhello world\x1b[0m") >>> Formatter(OutputFormat.PLAIN, unwrap=True).format_snapshot(term.committed) 'hello world'