Expand description
HTML export module for self-contained session exports.
This module generates standalone HTML files from coding agent session transcripts. The exported files are:
- Self-contained: All critical CSS/JS inlined for offline operation
- Progressive enhancement: CDN resources enhance but don’t break offline view
- Encrypted (optional): Web Crypto compatible encryption for sensitive content
- Accessible: Semantic HTML with proper ARIA attributes
§Architecture
html_export/
├── mod.rs # Module facade (this file)
├── template.rs # Core HTML template generation
├── styles.rs # CSS (critical inline + Tailwind CDN fallback)
├── scripts.rs # JS (decryption, search, theme toggle)
├── renderer.rs # Conversation -> HTML rendering
├── filename.rs # Smart filename generation
└── encryption.rs # Web Crypto compatible encryption§Usage
ⓘ
use cass::html_export::{HtmlExporter, ExportOptions};
let exporter = HtmlExporter::new();
let html = exporter.export_session(&session, ExportOptions::default())?;
std::fs::write("session.html", html)?;Modules§
- colors
- Color palette matching TUI theme.rs for visual consistency.
Structs§
- Encrypted
Content - Encrypted content bundle ready for embedding in HTML.
- Encryption
Params - Encryption parameters matching Web Crypto API defaults.
- Export
Options - Options for HTML export.
- Filename
Metadata - Metadata for filename generation.
- Filename
Options - Options for filename generation.
- Html
Exporter - Main exporter for generating HTML from sessions.
- Html
Template - The HTML template structure.
- Message
- A message to render.
- Message
Group - A group of related messages for consolidated rendering.
- Render
Options - Options for rendering conversations.
- Script
Bundle - Bundle of JavaScript for the template.
- Style
Bundle - Bundle of CSS styles for the template.
- Template
Metadata - Metadata displayed in the document header.
- Tool
Call - Tool call information.
- Tool
Call With Result - Tool call paired with its result for correlation.
- Tool
Result - Extended tool result with status and content.
Enums§
- Encryption
Error - Errors that can occur during encryption.
- Message
Group Type - Type of message group for rendering decisions.
- Render
Error - Errors that can occur during rendering.
- Template
Error - Errors that can occur during template generation.
- Tool
Status - Status of a tool execution.
Functions§
- agent_
css_ class - Get the CSS class for an agent slug.
- agent_
display_ name - Get human-readable agent name.
- agent_
slug - Normalize agent name to canonical slug.
- datetime_
slug - Format a Unix timestamp as a filename-safe datetime string.
- encrypt_
content - Encrypt content for client-side decryption.
- extract_
topic - Extract a topic from conversation content.
- generate_
filename - Generate a safe, descriptive filename.
- generate_
filepath - Generate a filename with path.
- generate_
full_ filename - Generate a complete filename with all components.
- generate_
scripts - Generate all JavaScript for the template.
- generate_
styles - Generate all CSS styles for the template.
- get_
downloads_ dir - Get the default export directory.
- is_
valid_ filename - Check if a filename is valid across platforms.
- normalize_
topic - Normalize a topic string to lowercase with underscores.
- render_
message - Render a single message to HTML.
- render_
message_ groups - Render a list of message groups to HTML (consolidated rendering).
- unique_
filename - Generate a unique filename that doesn’t collide with existing files.
- workspace_
slug - Extract workspace/project name from a path.