Crate report_leptos

Crate report_leptos 

Source
Expand description

§report-leptos

Leptos SSR renderer for generating static HTML reports.

This crate provides a type-safe, component-based approach to generating beautiful HTML reports using Leptos server-side rendering. Originally built for loctree codebase analysis, it can be used independently for any static report generation needs.

§Features

  • Zero JavaScript Runtime - Pure SSR, no hydration needed
  • Component-Based - Modular, reusable UI components
  • Type-Safe - Full Rust type safety from data to HTML
  • Interactive Graphs - Cytoscape.js integration for dependency visualization

§Quick Start

use report_leptos::{render_report, JsAssets, types::ReportSection};

// Create report data
let section = ReportSection {
    root: "my-project".into(),
    files_analyzed: 42,
    ..Default::default()
};

// Configure JS assets (optional, for graph visualization)
let js_assets = JsAssets::default();

// Render to HTML string
let html = render_report(&[section], &js_assets, false);

// Write to file
std::fs::write("report.html", html).unwrap();

§Architecture

The crate is organized into modules:

§Leptos 0.8 SSR

This library uses Leptos 0.8’s RenderHtml trait:

use leptos::tachys::view::RenderHtml;

let view = view! { <MyComponent /> };
let html: String = view.to_html();

No reactive runtime or hydration is needed - pure static HTML generation.


Developed with 💀 by The Loctree Team (c)2025

Modules§

components
Leptos UI components for rendering HTML reports.
styles
CSS styles for the HTML report.
types
Report data types for structuring analysis results.

Structs§

JsAssets
JavaScript asset paths for graph visualization.

Functions§

render_report
Render a complete HTML report from analyzed sections.