Expand description
TermiFlow - Terminal Mermaid Diagram Renderer
A library for rendering Mermaid flowchart diagrams as ASCII/Unicode art.
§Quick Start
use termiflow::{render, RenderOptions};
let input = "graph TD\n A[Start] --> B[End]";
let output = render(input, RenderOptions::default()).unwrap();
println!("{}", output);§Pipeline
The rendering pipeline has three stages:
- Parse - Convert Mermaid syntax to a graph structure
- Layout - Assign coordinates using the waterfall algorithm
- Render - Draw boxes and edges on a 2D canvas
Re-exports§
pub use config::Config;pub use config::ConfigBuilder;pub use crossing::CrossingConfig;pub use crossing::CrossingMinimizer;pub use crossing::Heuristic;pub use display_profile::display_char_width;pub use display_profile::display_width;pub use display_profile::graphemes;pub use display_profile::split_text_to_width_chunks;pub use display_profile::truncate_to_width;pub use display_profile::DisplayProfile;pub use display_profile::DEFAULT_DISPLAY_PROFILE;pub use graph::Edge;pub use graph::EdgeKind;pub use graph::Graph;pub use graph::Node;pub use json_input::parse_json_graph;pub use layout::coarse_waterfall;pub use parser::parse;pub use parser::ParseConfig;pub use parser::ParseResult;pub use render::critic::AuditSummary;pub use render::critic::AuditVerdict;pub use render::critic::CriticFinding;pub use render::critic::CriticReport;pub use render::critic::FindingCode;pub use render::critic::FindingSeverity;pub use render::render as render_canvas;pub use render::current_render_layer_contract;pub use render::EdgeTrace;pub use render::GeometryTrace;pub use render::NodeTrace;pub use render::RectTrace;pub use render::RenderLayer;pub use render::RenderLayerContract;pub use render::RenderLayerSpec;pub use render::SegmentAxis;pub use render::SegmentTrace;pub use render::SubgraphTrace;pub use render::render_with_feedback as render_canvas_with_feedback;pub use render::RenderOutcome;pub use scaling::CanvasBudget;pub use scaling::DiagramMetrics;pub use scaling::ScalingMode;pub use spacing::SpacingConfig;pub use spacing::SpacingMode;pub use style::BaseStyle;pub use style::CompositeStyle;pub use tui::AnsiDiffPresenter;pub use tui::FrameDelta;pub use tui::TerminalFrame;pub use tui::TerminalPresenter;
Modules§
- config
- Configuration loading with 3-tier priority
- crossing
- Edge Crossing Minimization
- display_
profile - Shared terminal display profile.
- geom
- Basic geometry types for layout and routing experiments.
- graph
- Graph data structures - Node, Edge, Graph, Subgraph
- json_
input - layout
- Coarse layout + Manhattan routing pipeline (default engine).
- measure
- Node measurement helpers (label truncation/wrapping and box height).
- orientation
- Direction-agnostic orientation system for diagram rendering.
- parser
- Mermaid-Lite parser with two-pass parsing
- portals
- Shared subgraph envelope + portal helpers for layout and render.
- render
- Render module - 2D character grid rendering for diagrams.
- scaling
- Adaptive Grid Scaling
- spacing
- Unified Spacing Model
- style
- Border styles and character sets
- tui
- TUI frame model and presenters.
Structs§
- Render
Options - Options for rendering a diagram
Functions§
- layout_
and_ render_ with_ feedback - Lay out a measured graph and render it with bounded layout candidate repair.
- render
- Render a Mermaid diagram to ASCII/Unicode art.
- render_
default - Render with default options (Unicode style, 20-char labels)
- render_
json - Render a TermiFlow JSON graph (see
parse_json_graph) to ASCII/Unicode art. - render_
with_ feedback - Render a Mermaid diagram and return critic/semantic feedback for the final frame.