Skip to main content

Module html_export

Module html_export 

Source
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§

EncryptedContent
Encrypted content bundle ready for embedding in HTML.
EncryptionParams
Encryption parameters matching Web Crypto API defaults.
ExportOptions
Options for HTML export.
FilenameMetadata
Metadata for filename generation.
FilenameOptions
Options for filename generation.
HtmlExporter
Main exporter for generating HTML from sessions.
HtmlTemplate
The HTML template structure.
Message
A message to render.
MessageGroup
A group of related messages for consolidated rendering.
RenderOptions
Options for rendering conversations.
ScriptBundle
Bundle of JavaScript for the template.
StyleBundle
Bundle of CSS styles for the template.
TemplateMetadata
Metadata displayed in the document header.
ToolCall
Tool call information.
ToolCallWithResult
Tool call paired with its result for correlation.
ToolResult
Extended tool result with status and content.

Enums§

EncryptionError
Errors that can occur during encryption.
MessageGroupType
Type of message group for rendering decisions.
RenderError
Errors that can occur during rendering.
TemplateError
Errors that can occur during template generation.
ToolStatus
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.