Skip to main content

Module export

Module export 

Source
Expand description

Export conversation sessions to standalone HTML files.

Produces a self-contained HTML document with embedded CSS and JS that renders a conversation session with:

  • Color-coded user / assistant / system messages
  • Markdown → HTML rendering (basic, no external deps)
  • ANSI escape code → HTML span conversion (full 256-color + true-color support)
  • Tool calls and results in styled blocks (bash, file ops, search)
  • Collapsible thinking blocks
  • Metadata header (model, provider, date, token counts)
  • Dark theme (default) with light-theme toggle
  • Syntax highlighting for code blocks (via highlight.js CDN)
  • Session tree navigation for branched sessions

Structs§

ExportMeta
Metadata attached to an export (optional but encouraged).
HtmlExportOptions
Options for HTML export.
TreeNode
A single rendered node in the session tree.

Functions§

ansi_lines_to_html
Convert an array of ANSI-escaped lines to HTML. Each line is wrapped in a <div class="ansi-line"> element.
ansi_to_html
Convert ANSI-escaped text to HTML with inline styles.
export_html
Render a flat list of session entries into a self-contained HTML string.
export_html_with_options
Render a flat list of session entries into a self-contained HTML string with fine-grained control over the output via HtmlExportOptions.
export_to_html
Convenience function: export session entries to an HTML string using the given HtmlExportOptions.