Expand description
HTML, SVG, and plain-text export with 4 preset terminal color themes.
HTML and SVG export — equivalent to Rich’s _export_format.py and
Console export methods.
Converts rendered console output into HTML and SVG documents, preserving
colors, styles, and layout. Uses TerminalTheme to map ANSI colors to
CSS-compatible RGB values.
Structs§
- Export
Html Options - Options for HTML export.
- Export
SvgOptions - Options for SVG export.
- Export
Text Options - Options for plain-text export (strips ANSI escape codes).
- Export
Theme - A terminal color theme used for HTML/SVG export.
Constants§
- CONSOLE_
HTML_ FORMAT - The HTML document template used by
export_html. - CONSOLE_
SVG_ FORMAT - The SVG document template used by
export_svg. - EXPORT_
THEME_ DIMMED_ MONOKAI - Dimmed Monokai variant – lower contrast, suitable for comfortable reading.
- EXPORT_
THEME_ MONOKAI - Monokai-inspired dark theme for HTML/SVG export.
- EXPORT_
THEME_ NIGHT_ OWLISH - Night Owl-inspired dark theme with deep blue background.
- EXPORT_
THEME_ SVG - Light theme with white background, suitable for SVG export snippets.
Functions§
- escape_
html - Escape special HTML characters in text.
- escape_
xml - Escape special XML characters (
&,<,>,",') in text. - export_
html - Generate a full HTML document from rendered terminal output.
- export_
svg - Generate a full SVG document from rendered terminal output.
- export_
text - Export text, optionally stripping ANSI escape sequences. Returns plain text.
- save_
html - Save rendered output as an HTML file.
- save_
svg - Save rendered output as an SVG file.
- save_
text - Save text output to a file, optionally stripping ANSI escape sequences.
- segments_
to_ html - Convert Rich styled segments to HTML with inline CSS spans.
- strip_
ansi_ escapes - Strip ANSI escape sequences from text, returning plain text.