{"id":50521908,"url":"https://github.com/Dicklesworthstone/rich_rust","last_synced_at":"2026-06-19T23:00:37.891Z","repository":{"id":333242919,"uuid":"1136654529","full_name":"Dicklesworthstone/rich_rust","owner":"Dicklesworthstone","description":"Beautiful terminal output for Rust inspired by Python's Rich: tables, panels, syntax highlighting, progress bars, and full-color rendering","archived":false,"fork":false,"pushed_at":"2026-05-14T20:01:24.000Z","size":4799,"stargazers_count":55,"open_issues_count":0,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-14T22:07:30.184Z","etag":null,"topics":["cli","developer-tools","rust","terminal","tui"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Dicklesworthstone.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-01-18T04:50:00.000Z","updated_at":"2026-05-14T20:01:33.000Z","dependencies_parsed_at":"2026-05-14T22:03:21.549Z","dependency_job_id":null,"html_url":"https://github.com/Dicklesworthstone/rich_rust","commit_stats":null,"previous_names":["dicklesworthstone/rich_rust"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/Dicklesworthstone/rich_rust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dicklesworthstone%2Frich_rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dicklesworthstone%2Frich_rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dicklesworthstone%2Frich_rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dicklesworthstone%2Frich_rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dicklesworthstone","download_url":"https://codeload.github.com/Dicklesworthstone/rich_rust/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dicklesworthstone%2Frich_rust/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34550858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","developer-tools","rust","terminal","tui"],"created_at":"2026-06-03T05:00:34.606Z","updated_at":"2026-06-19T23:00:37.885Z","avatar_url":"https://github.com/Dicklesworthstone.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# rich_rust\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"rich_rust_illustration.webp\" alt=\"rich_rust - Beautiful terminal output for Rust\"\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![codecov](https://codecov.io/gh/Dicklesworthstone/rich_rust/graph/badge.svg)](https://codecov.io/gh/Dicklesworthstone/rich_rust)\n[![Crates.io](https://img.shields.io/crates/v/rich_rust.svg)](https://crates.io/crates/rich_rust)\n[![Documentation](https://docs.rs/rich_rust/badge.svg)](https://docs.rs/rich_rust)\n[![License: MIT](https://img.shields.io/badge/License-MIT%2BOpenAI%2FAnthropic%20Rider-blue.svg)](https://github.com/Dicklesworthstone/rich_rust/blob/master/LICENSE)\n\n\u003c/div\u003e\n\nBeautiful terminal output for Rust, inspired by Python's Rich.\n\n\u003cdiv align=\"center\"\u003e\n\u003ch3\u003eQuick Install\u003c/h3\u003e\n\n```bash\ncargo add rich_rust\n```\n\n\u003cp\u003e\u003cem\u003eOr with all features: \u003ccode\u003ecargo add rich_rust --features full\u003c/code\u003e\u003c/em\u003e\u003c/p\u003e\n\u003c/div\u003e\n\n---\n\n## Run the Demo\n\nSee rich_rust in action with the **Nebula Deploy** demo — a complete showcase of terminal UI capabilities wrapped in a fictional deployment narrative.\n\n```bash\n# Full demo with all features (recommended)\ncargo run --bin demo_showcase --features showcase\n\n# Quick mode for faster run\ncargo run --bin demo_showcase --features showcase -- --quick\n\n# CI-safe mode (non-blocking, deterministic output)\ncargo run --bin demo_showcase --features showcase -- --quick --no-live --no-interactive\n\n# List available scenes\ncargo run --bin demo_showcase --features showcase -- --list-scenes\n\n# Run a specific scene\ncargo run --bin demo_showcase --features showcase -- --scene hero\n```\n\n**What the demo showcases:**\n- **Typography** — styled text, colors, bold/italic/underline, themes\n- **Tables** — alignment, borders, headers, badges, ASCII fallback\n- **Panels** — box styles, titles, padding, nested layouts\n- **Trees** — hierarchical data, custom guides, icons\n- **Progress** — bars, spinners, live updates\n- **Syntax** — code highlighting for 100+ languages (Rust, YAML, TOML, etc.)\n- **Markdown** — CommonMark + GFM rendering\n- **JSON** — pretty-printed, theme-aware output\n- **Tracing** — structured logging integration\n- **Export** — HTML/SVG capture of terminal output\n\n---\n\n## TL;DR\n\n### The Problem\n\nBuilding beautiful terminal UIs in Rust is tedious. You either:\n- Write raw ANSI escape codes (error-prone, unreadable)\n- Use low-level crates that require boilerplate for simple things\n- Miss features like automatic terminal capability detection, tables, progress bars\n\n### The Solution\n\n**rich_rust** brings Python Rich's ergonomic API to Rust: styled text, tables, panels, progress bars, syntax highlighting, and more. Zero `unsafe` code, automatic terminal detection.\n\n### Why Use rich_rust?\n\n| Feature | rich_rust | Raw ANSI | colored | termion |\n|---------|-----------|----------|---------|---------|\n| Markup syntax (`[bold red]text[/]`) | Yes | No | No | No |\n| Tables with auto-sizing | Yes | No | No | No |\n| Panels and boxes | Yes | No | No | No |\n| Progress bars \u0026 spinners | Yes | No | No | No |\n| Syntax highlighting | Yes | No | No | No |\n| Markdown rendering | Yes | No | No | No |\n| Auto color downgrade | Yes | No | Partial | No |\n| Unicode width handling | Yes | No | No | Partial |\n\n---\n\n## Quick Example\n\n```rust\nuse rich_rust::prelude::*;\n\nfn main() {\n    let console = Console::new();\n\n    // Styled text with markup\n    console.print(\"[bold green]Success![/] Operation completed.\");\n    console.print(\"[red on white]Error:[/] [italic]File not found[/]\");\n\n    // Horizontal rule\n    console.rule(Some(\"Configuration\"));\n\n    // Tables\n    let mut table = Table::new()\n        .title(\"Users\")\n        .with_column(Column::new(\"Name\"))\n        .with_column(Column::new(\"Role\").justify(JustifyMethod::Right));\n\n    table.add_row_cells([\"Alice\", \"Admin\"]);\n    table.add_row_cells([\"Bob\", \"User\"]);\n\n    console.print_renderable(\u0026table);\n\n    // Panels\n    let panel = Panel::from_text(\"Hello, World!\")\n        .title(\"Greeting\")\n        .width(40);\n\n    console.print_renderable(\u0026panel);\n}\n```\n\n**Output:**\n\n```\nSuccess! Operation completed.\nError: File not found\n─────────────────── Configuration ───────────────────\n┌─────────────────────── Users ───────────────────────┐\n│ Name   │   Role │\n├────────┼────────┤\n│ Alice  │  Admin │\n│ Bob    │   User │\n└────────────────────────────────────────────────────┘\n┌─────────── Greeting ───────────┐\n│ Hello, World!                  │\n└────────────────────────────────┘\n```\n\n---\n\n## Design Philosophy\n\n### 1. Zero Unsafe Code\n\n```rust\n#![forbid(unsafe_code)]\n```\n\nThe entire codebase uses safe Rust. No segfaults, no data races, no undefined behavior.\n\n### 2. Python Rich Compatibility\n\nAPI and behavior closely follow Python Rich. If you know Rich, you know rich_rust. The [RICH_SPEC.md](RICH_SPEC.md) documents every behavioral detail.\n\n### 3. Renderable Extensibility\n\nInstead of Python's duck typing, rich_rust uses explicit render methods and an\noptional measurement trait:\n\n```rust\nuse rich_rust::console::{Console, ConsoleOptions};\nuse rich_rust::measure::{Measurement, RichMeasure};\nuse rich_rust::segment::Segment;\n\nstruct MyRenderable;\n\nimpl MyRenderable {\n    fn render(\u0026self, width: usize) -\u003e Vec\u003cSegment\u003e {\n        vec![Segment::plain(format!(\"width={width}\"))]\n    }\n}\n\nimpl RichMeasure for MyRenderable {\n    fn rich_measure(\u0026self, _console: \u0026Console, _options: \u0026ConsoleOptions) -\u003e Measurement {\n        Measurement::exact(10)\n    }\n}\n```\n\nRenderables expose `render(...) -\u003e Vec\u003cSegment\u003e`. Implement `RichMeasure` to\nparticipate in layout width calculations.\n\n### 4. Automatic Terminal Detection\n\nrich_rust detects terminal capabilities at runtime:\n- Color support (4-bit, 8-bit, 24-bit truecolor)\n- Terminal dimensions\n- Unicode support\n- Legacy Windows console\n\nColors automatically downgrade to what the terminal supports.\n\n### 5. Minimal Dependencies\n\nCore functionality has few dependencies. Optional features (syntax highlighting, markdown, JSON, tracing) are behind feature flags to keep compile times fast.\n\n---\n\n## Comparison vs Alternatives\n\n| Feature | rich_rust | Python Rich | colored | termcolor | owo-colors |\n|---------|-----------|-------------|---------|-----------|------------|\n| **Language** | Rust | Python | Rust | Rust | Rust |\n| **Markup parsing** | `[bold]text[/]` | `[bold]text[/]` | No | No | No |\n| **Tables** | Yes | Yes | No | No | No |\n| **Panels/Boxes** | Yes | Yes | No | No | No |\n| **Progress bars** | Yes | Yes | No | No | No |\n| **Trees** | Yes | Yes | No | No | No |\n| **Syntax highlighting** | Yes (syntect) | Yes (Pygments) | No | No | No |\n| **Markdown** | Yes | Yes | Yes | No | No |\n| **JSON pretty-print** | Yes | Yes | No | No | No |\n| **Color downgrade** | Auto | Auto | Partial | Yes | No |\n| **Zero unsafe** | Yes | N/A | Yes | Yes | Yes |\n| **No runtime** | Yes | No (Python) | Yes | Yes | Yes |\n| **Single binary** | Yes | No | Yes | Yes | Yes |\n\n**When to use rich_rust:**\n- You want Python Rich's features in Rust\n- You need tables, panels, or progress bars\n- You want markup syntax for styling\n- You're building CLI tools that need beautiful output\n\n**When to use alternatives:**\n- `colored`: Simple color-only needs, minimal dependencies\n- `termcolor`: Cross-platform color with Windows support\n- `owo-colors`: Zero-allocation, const colors\n- Python Rich: You're writing Python\n\n---\n\n## Installation\n\n### From crates.io\n\n```bash\ncargo add rich_rust\n```\n\n### With Optional Features\n\n```bash\n# Syntax highlighting\ncargo add rich_rust --features syntax\n\n# Markdown rendering\ncargo add rich_rust --features markdown\n\n# JSON pretty-printing\ncargo add rich_rust --features json\n\n# Tracing integration\ncargo add rich_rust --features tracing\n\n# All features\ncargo add rich_rust --features full\n```\n\n### From Source\n\n```bash\ngit clone https://github.com/Dicklesworthstone/rich_rust\ncd rich_rust\ncargo build --release\n```\n\n### Cargo.toml\n\n```toml\n[dependencies]\nrich_rust = \"0.1\"\n\n# Or with features:\nrich_rust = { version = \"0.1\", features = [\"full\"] }\n```\n\n---\n\n## Quick Start\n\n### 1. Create a Console\n\n```rust\nuse rich_rust::prelude::*;\n\nlet console = Console::new();\n```\n\n### 2. Print Styled Text\n\n```rust\n// Using markup syntax\nconsole.print(\"[bold]Bold[/] and [italic red]italic red[/]\");\n\n// Using explicit style\nconsole.print_styled(\"Styled text\", Style::new().bold().underline());\n\n// Plain text (no markup parsing)\nconsole.print_plain(\"[brackets] are literal here\");\n```\n\n### 3. Create a Table\n\n```rust\nlet mut table = Table::new()\n    .title(\"Data\")\n    .with_column(Column::new(\"Key\"))\n    .with_column(Column::new(\"Value\").justify(JustifyMethod::Right));\n\ntable.add_row_cells([\"version\", \"1.0.0\"]);\ntable.add_row_cells([\"status\", \"active\"]);\n\nconsole.print_renderable(\u0026table);\n```\n\n### 4. Create a Panel\n\n```rust\nlet panel = Panel::from_text(\"Important message here\")\n    .title(\"Notice\")\n    .subtitle(\"v1.0\")\n    .width(50);\n\nconsole.print_renderable(\u0026panel);\n```\n\n### 5. Print a Rule\n\n```rust\n// Simple rule\nconsole.rule(None);\n\n// Rule with title\nconsole.rule(Some(\"Section\"));\n\n// Styled rule\nlet rule = Rule::with_title(\"Custom\")\n    .style(Style::parse(\"cyan bold\").unwrap_or_default())\n    .align_left();\nconsole.print_renderable(\u0026rule);\n```\n\n---\n\n## Feature Reference\n\n### Markup Syntax\n\n| Markup | Effect |\n|--------|--------|\n| `[bold]text[/]` | Bold text |\n| `[italic]text[/]` | Italic text |\n| `[underline]text[/]` | Underlined text |\n| `[red]text[/]` | Red foreground |\n| `[on blue]text[/]` | Blue background |\n| `[bold red on white]text[/]` | Combined styles |\n| `[#ff0000]text[/]` | Hex color |\n| `[rgb(255,0,0)]text[/]` | RGB color |\n| `[color(196)]text[/]` | 256-color palette |\n\n### Themes (Named Styles)\n\nPython Rich defines many named styles (e.g. `rule.line`, `table.header`). `rich_rust`\nports this theme system and lets you add custom names:\n\n```rust\nuse rich_rust::prelude::*;\n\nlet theme = Theme::from_style_definitions([(\"warning\", \"bold red\")], true).unwrap();\nlet console = Console::builder().theme(theme).build();\nconsole.print(\"[warning]Danger[/]\");\n```\n\n### Style Attributes\n\n```rust\nStyle::new()\n    .bold()\n    .italic()\n    .underline()\n    .strikethrough()\n    .dim()\n    .reverse()\n    .foreground(Color::parse(\"red\").unwrap())\n    .background(Color::parse(\"white\").unwrap())\n```\n\n### Color Systems\n\n| System | Colors | Detection |\n|--------|--------|-----------|\n| Standard | 16 | Basic terminals |\n| 256-color | 256 | Most modern terminals |\n| Truecolor | 16M | iTerm2, Windows Terminal, etc. |\n\n### Box Styles\n\n```rust\nPanel::from_text(\"content\").rounded()  // ╭─╮ (default)\nPanel::from_text(\"content\").square()   // ┌─┐\nPanel::from_text(\"content\").heavy()    // ┏━┓\nPanel::from_text(\"content\").double()   // ╔═╗\nPanel::from_text(\"content\").ascii()    // +-+\n```\n\n### Progress Bars\n\n```rust\nlet bar = ProgressBar::new()\n    .completed(75)\n    .total(100)\n    .width(40);\n\nconsole.print_renderable(\u0026bar);\n```\n\n### Trees\n\n```rust\nlet mut root = TreeNode::new(\"Root\");\nroot.add_child(TreeNode::new(\"Child 1\"));\nroot.add_child(TreeNode::new(\"Child 2\"));\n\nlet tree = Tree::new(root);\nconsole.print_renderable(\u0026tree);\n```\n\n### Live Updates\n\n```rust\nuse rich_rust::prelude::*;\n\nfn main() -\u003e std::io::Result\u003c()\u003e {\n    let console = Console::new().shared();\n    let live = Live::new(console.clone()).renderable(Text::new(\"Loading...\"));\n\n    live.start(true)?;\n    live.update(Text::new(\"Done!\"), true);\n    live.stop()?;\n\n    Ok(())\n}\n```\n\nFor external writers, use `live.stdout_proxy()` / `live.stderr_proxy()` to route output\nthrough the Live display.\n\n### Layouts\n\n```rust\nuse rich_rust::prelude::*;\n\nlet mut layout = Layout::new().name(\"root\");\nlayout.split_column(vec![\n    Layout::new()\n        .name(\"header\")\n        .size(3)\n        .renderable(Panel::from_text(\"Header\")),\n    Layout::new().name(\"body\").ratio(1),\n]);\n\nif let Some(body) = layout.get_mut(\"body\") {\n    body.split_row(vec![\n        Layout::new().name(\"left\").ratio(1).renderable(Panel::from_text(\"Left\")),\n        Layout::new().name(\"right\").ratio(2).renderable(Panel::from_text(\"Right\")),\n    ]);\n}\n\nconsole.print_renderable(\u0026layout);\n```\n\n### Logging\n\n```rust\nuse rich_rust::prelude::*;\nuse log::LevelFilter;\n\nfn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let console = Console::new().shared();\n    RichLogger::new(console)\n        .level(LevelFilter::Info)\n        .show_path(true)\n        .init()?;\n\n    log::info!(\"Server started\");\n    Ok(())\n}\n```\n\nNote: `log` macros come from the `log` crate; add `log = \"0.4\"` to your `Cargo.toml`.\n\nTracing: enable `rich_rust` feature `tracing` and install `RichTracingLayer` if you use\nthe `tracing` ecosystem.\n\n### HTML/SVG Export\n\nExport terminal output to shareable files:\n\n```rust\nuse rich_rust::prelude::*;\n\nlet mut console = Console::new();\nconsole.begin_capture();\nconsole.print(\"[bold green]Hello[/]\");\n\nlet html = console.export_html(false);  // false = don't clear buffer\nlet svg = console.export_svg(true);     // true = clear buffer after\n```\n\n**Note:** The HTML/SVG exports follow Python Rich's export templates (including optional\nterminal-window chrome). SVG is rendered with SVG primitives (`\u003ctext\u003e`, `\u003crect\u003e`, clip paths),\nso it works in browsers and in many SVG-capable viewers (no `\u003cforeignObject\u003e` required).\n\nFor a quick demo of export capabilities, run:\n```bash\ncargo run --bin demo_showcase --features showcase -- --export\n```\n\n### Syntax Highlighting (requires `syntax` feature)\n\n```rust\nuse rich_rust::prelude::*;\n\nlet code = r#\"fn main() { println!(\"Hello\"); }\"#;\nlet syntax = Syntax::new(code, \"rust\")\n    .line_numbers(true)\n    .theme(\"Solarized (dark)\");\n\nconsole.print_renderable(\u0026syntax);\n```\n\n### Markdown Rendering (requires `markdown` feature)\n\n```rust\nuse rich_rust::prelude::*;\n\nlet md = Markdown::new(\"# Header\\n\\nParagraph with **bold**.\");\nconsole.print_renderable(\u0026md);\n```\n\n### Pretty / Inspect\n\nRust doesn't have Python-style runtime reflection, so rich_rust's equivalents are\n`Debug`-based and deterministic.\n\n```rust\nuse rich_rust::prelude::*;\n\n#[derive(Debug)]\nstruct Config {\n    mode: String,\n    retries: usize,\n}\n\nlet console = Console::new();\nlet cfg = Config {\n    mode: \"safe\".to_string(),\n    retries: 3,\n};\n\nconsole.print_renderable(\u0026Pretty::new(\u0026cfg));\ninspect(\u0026console, \u0026cfg);\n```\n\n### Tracebacks\n\n`Traceback` is a renderable inspired by Python Rich's `rich.traceback`.\n\nYou can construct it from explicit frames (deterministic, great for tests/fixtures),\nor capture a real runtime backtrace when the `backtrace` feature is enabled.\n\n```rust\nuse rich_rust::prelude::*;\n\nlet console = Console::new();\nlet traceback = Traceback::new(\n    vec![\n        TracebackFrame::new(\"\u003cmodule\u003e\", 14),\n        TracebackFrame::new(\"level1\", 11),\n        TracebackFrame::new(\"level2\", 8),\n        TracebackFrame::new(\"level3\", 5),\n    ],\n    \"ZeroDivisionError\",\n    \"division by zero\",\n);\n\nconsole.print_exception(\u0026traceback);\n```\n\nAutomatic capture (requires `backtrace` feature):\n\n```rust\nuse rich_rust::prelude::*;\n\nlet console = Console::new();\nlet traceback = Traceback::capture(\"MyError\", \"something went wrong\");\nconsole.print_exception(\u0026traceback);\n```\n\n---\n\n## Architecture\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│                         Console                              │\n│  (Central coordinator: options, rendering, I/O)             │\n└─────────────────────────┬───────────────────────────────────┘\n                          │\n                          ▼\n┌─────────────────────────────────────────────────────────────┐\n│                      Renderables                             │\n│  (Text, Table, Panel, Rule, Tree, Progress, Syntax, etc.)   │\n│  Expose render() + optional RichMeasure for sizing           │\n└─────────────────────────┬───────────────────────────────────┘\n                          │\n                          ▼\n┌─────────────────────────────────────────────────────────────┐\n│                        Segments                              │\n│  (Atomic unit: text + optional style + control codes)       │\n└─────────────────────────┬───────────────────────────────────┘\n                          │\n                          ▼\n┌─────────────────────────────────────────────────────────────┐\n│                     ANSI Codes + Output                      │\n│  (Style diffing, escape sequences, terminal write)          │\n└─────────────────────────────────────────────────────────────┘\n```\n\n### Render Pipeline (Step-by-Step)\n\n1. **Input** — A string (optionally with markup) or a renderable (Table, Panel, Tree, etc.).\n2. **Markup parsing** — `[bold red]text[/]` is parsed into `Text` + styled spans.\n3. **Renderable layout** — Each renderable converts itself into `Vec\u003cSegment\u003e`.\n4. **Segment stream** — Segments carry plain text + optional `Style` + control codes.\n5. **ANSI generation** — Styles are diffed and rendered to ANSI SGR (or skipped if disabled).\n6. **Output** — `Console` writes the final stream to the configured `Write`.\n\n### Module Structure\n\n```\nsrc/\n├── lib.rs           # Crate root, prelude\n├── color.rs         # Color system (4/8/24-bit)\n├── style.rs         # Style attributes (bold, italic, etc.)\n├── segment.rs       # Atomic rendering unit\n├── text.rs          # Rich text with spans\n├── markup/          # Markup parser ([bold]...[/])\n├── measure.rs       # Width measurement protocol\n├── console.rs       # Console I/O coordinator\n├── terminal.rs      # Terminal detection\n├── cells.rs         # Unicode cell width\n├── box.rs           # Box drawing characters\n└── renderables/\n    ├── align.rs     # Alignment\n    ├── columns.rs   # Multi-column layout\n    ├── padding.rs   # Padding\n    ├── panel.rs     # Boxed panels\n    ├── progress.rs  # Progress bars, spinners\n    ├── rule.rs      # Horizontal rules\n    ├── table.rs     # Tables with auto-sizing\n    ├── tree.rs      # Hierarchical trees\n    ├── syntax.rs    # Syntax highlighting (optional)\n    ├── markdown.rs  # Markdown rendering (optional)\n    └── json.rs      # JSON pretty-print (optional)\n```\n\n## Feature Parity (Python Rich)\n\nSee `FEATURE_PARITY.md` for the authoritative matrix and `RICH_SPEC.md` for detailed behavior notes.\n\n**Implemented**\n- Markup (`[bold red]text[/]`), styles, colors, hyperlinks\n- Tables, panels, rules, trees, columns, padding, alignment\n- Terminal control renderable (`Control`) + control-code helpers\n- Progress bars \u0026 spinners\n- Live updating / dynamic refresh (`Live`)\n- Layout engine (`Layout`)\n- Logging handler integration (`RichLogger`)\n- HTML/SVG export (`Console::export_html` / `Console::export_svg`)\n- Syntax highlighting (feature `syntax`) (see `FEATURE_PARITY.md` for remaining parity gaps)\n- Markdown rendering (feature `markdown`) (see `FEATURE_PARITY.md` for remaining parity gaps)\n- JSON pretty-print (feature `json`) (see `FEATURE_PARITY.md` for remaining parity gaps)\n- Traceback rendering (`Traceback`, `Console::print_exception`) (explicit frames for deterministic tests; optional `Traceback::capture` via feature `backtrace`)\n- Unicode width handling + auto color downgrade\n\n**Notes**\n- rich_rust is output-focused, but it also includes small, pragmatic interactive helpers (prompts, pager, status) for common CLI workflows.\n\n---\n\n## Demo Showcase: `demo_showcase`\n\nWe’re building a standalone `demo_showcase` binary that shows off rich_rust end-to-end in a single cohesive narrative (product-grade visuals, not just a grab bag of examples).\n\n### Narrative\n\n**Nebula Deploy** — a fictional deployment/release assistant. It naturally justifies a live dashboard, progress, structured data views, and a deliberate failure for traceback/debug tooling.\n\n### Scene Flow\n\n`--list-scenes` must output stable names (used by `--scene \u003cname\u003e`), in this order (with a one-line purpose + any feature-gate notes):\n\n| Scene | Purpose | Exercises |\n|------|---------|----------|\n| `hero` | Introduce Nebula Deploy and the visual \"brand\". | markup, Style/Theme, Emoji, Rule/Panel |\n| `dashboard` | Show the live split-screen dashboard (services + pipeline + logs). | Layout, Live, Progress, logging |\n| `markdown` | Show a runbook / release notes view. | Markdown (feature `markdown`) |\n| `syntax` | Show a config/code snippet view. | Syntax (feature `syntax`) |\n| `json` | Show an API payload view. | Json (feature `json`) |\n| `table` | Show data tables with various styles. | Table with sorting, alignment |\n| `panels` | Show boxed content with titles. | Panel with borders, padding |\n| `tree` | Show hierarchical data structures. | Tree with nested nodes |\n| `layout` | Show split-screen layouts. | Layout with columns/rows |\n| `emoji_links` | Show emoji and hyperlink support. | Emoji, OSC8 links |\n| `debug_tools` | Walk through a failure and recovery workflow. | Pretty/Inspect, Traceback |\n| `tracing` | Show tracing integration. | RichTracingLayer (feature `tracing`) |\n| `traceback` | Show error tracebacks. | Traceback rendering |\n| `export` | Export the run to artifacts for sharing. | `Console::export_html`, `Console::export_svg` |\n| `outro` | Wrap up with a crisp summary and next steps. | Table, Tree, Rule |\n\nFeature-gated scenes must self-report clearly when disabled (and how to enable the required `--features ...`).\n\n### CLI Contract (Explicit + Stable)\n\nThe goal is (a) safe in CI/pipes and (b) tunable for maximum “wow” in a real terminal.\n\n`demo_showcase --help` should read like a real CLI:\n\n```text\ndemo_showcase — Nebula Deploy (rich_rust showcase)\n\nUSAGE:\n    demo_showcase [OPTIONS]\n\nOPTIONS:\n    --list-scenes               List available scenes and exit\n    --scene \u003cname\u003e              Run a single scene (see --list-scenes)\n    --seed \u003cu64\u003e                Seed deterministic demo data (default: 0)\n    --quick                     Reduce sleeps/runtime (CI-friendly)\n    --speed \u003cmultiplier\u003e        Animation speed multiplier (default: 1.0)\n\n    --interactive               Force interactive mode\n    --no-interactive            Disable prompts/pager/etc\n    --live                      Force live refresh\n    --no-live                   Disable live refresh; print snapshots\n    --screen                    Use alternate screen (requires live)\n    --no-screen                 Disable alternate screen\n\n    --force-terminal            Treat stdout as a TTY (even when piped)\n    --width \u003ccols\u003e              Override console width\n    --height \u003crows\u003e             Override console height\n    --color-system \u003cmode\u003e       auto|none|standard|eight_bit|truecolor\n    --emoji                     Enable emoji (default)\n    --no-emoji                  Disable emoji\n    --safe-box                  Use ASCII-safe box characters\n    --no-safe-box               Use Unicode box characters (default)\n    --links                     Enable OSC8 hyperlinks\n    --no-links                  Disable OSC8 hyperlinks\n\n    --export                    Write an HTML/SVG bundle to a temp dir\n    --export-dir \u003cpath\u003e         Write an HTML/SVG bundle to a directory\n\n    -h, --help                  Print help and exit\n```\n\n**Export Usage**\n\nExport captures the full demo output and writes two files:\n- `demo_showcase.html` — Standalone HTML with inline CSS. Opens in any browser.\n- `demo_showcase.svg` — Scalable vector graphic rendered with SVG text and shapes.\n\n```bash\n# Quick export to temp directory (prints path)\ncargo run --bin demo_showcase --features showcase -- --export\n\n# Export to specific directory\ncargo run --bin demo_showcase --features showcase -- --export-dir ./output\n\n# Recommended flags for clean export\ncargo run --bin demo_showcase --features showcase -- \\\n    --export-dir ./output \\\n    --no-interactive \\\n    --color-system truecolor \\\n    --width 100 \\\n    --quick\n```\n\n**Viewing exported files:**\n- **HTML:** Open directly in any browser. Colors and styles are preserved.\n- **SVG:** Open in any modern browser (Chrome, Firefox, Safari). The SVG uses only standard\n  SVG primitives (text, rects, clip paths), so it is broadly compatible.\n\n**Defaults (\"auto\")**\n\n- `interactive=auto` means: interactive only when stdout is a TTY and `TERM` is not `dumb`/`unknown`.\n- `live=auto` means: `live = interactive`.\n- `screen=auto` means: `screen = live \u0026\u0026 interactive` (TTY-only).\n- `links=auto` means: hyperlinks only when `interactive`; override with `--links` / `--no-links`.\n- `FORCE_COLOR` may force color output, but must **not** enable interactive/live behavior; use `--force-terminal` to intentionally override TTY checks.\n\n**Safety requirements**\n\n- If stdout is not a TTY and `--force-terminal` is not set:\n  - disable live refresh and alternate screen\n  - disable prompt/pager helpers\n  - print static snapshots only\n- No scene may require user input to terminate.\n- No infinite loops; any animation must be time-bounded and/or gated on TTY.\n- Unknown flags must yield a concise error plus a `--help` hint.\n- `--scene` must validate known names and print an “available scenes” list on error.\n\n**Implementation note:** keep CLI parsing dependency-light (hand-rolled; no large CLI frameworks).\n\n---\n\n## Troubleshooting\n\n### Colors not showing\n\n**Symptom:** Text prints without colors in terminal.\n\n**Causes \u0026 Fixes:**\n1. **Piped output:** Colors disabled when stdout isn't a TTY. Use `FORCE_COLOR=1` env var.\n2. **Terminal doesn't support colors:** Try a modern terminal (iTerm2, Windows Terminal).\n3. **TERM variable:** Ensure `TERM` is set correctly (`xterm-256color`, etc.).\n\n### Unicode characters garbled\n\n**Symptom:** Box characters display as `?` or mojibake.\n\n**Fixes:**\n1. Use `.ascii()` variant: `Panel::from_text(\"...\").ascii()`\n2. Set terminal encoding to UTF-8\n3. Use a font with box-drawing characters (most monospace fonts have them)\n\n### Table columns too wide/narrow\n\n**Symptom:** Table layout doesn't fit terminal.\n\n**Fixes:**\n1. Get terminal width: `console.width()`\n2. Set explicit column widths: `Column::new(\"...\").width(20)`\n3. Set min/max widths: `Column::new(\"...\").min_width(10).max_width(40)`\n\n### Markup not parsing\n\n**Symptom:** `[bold]text[/]` prints literally.\n\n**Fixes:**\n1. Use `console.print()` not `console.print_plain()`\n2. Check for unbalanced brackets\n3. Escape literal brackets: `\\[not markup\\]`\n\n### Windows console issues\n\n**Symptom:** Escape codes visible or wrong colors on Windows.\n\n**Fixes:**\n1. Use Windows Terminal (modern) instead of cmd.exe\n2. Enable virtual terminal processing: `SetConsoleMode` with `ENABLE_VIRTUAL_TERMINAL_PROCESSING`\n3. rich_rust auto-detects this, but old cmd.exe may not support it\n\n---\n\n## Limitations\n\n- **No input:** This is an output library; use `crossterm` or `dialoguer` for input\n- **Limited input:** rich_rust includes prompts/pager/status helpers, but it is not a full TUI/input widget framework. For complex input, use crates like `dialoguer`, `rustyline`, or `inquire`.\n- **No async:** Rendering is synchronous; wrap in `spawn_blocking` if needed\n- **Live redirection:** `Live` can redirect process-wide stdout/stderr in interactive terminals (TTY-only). In piped/non-interactive contexts it stays disabled; use `live.stdout_proxy()` / `live.stderr_proxy()` for external writers.\n- **HTML/SVG export:** Export is intended to match Python Rich's HTML/SVG export behavior and templates.\n\n---\n\n## FAQ\n\n**Q: How does this compare to Python Rich?**\n\nA: rich_rust targets feature-for-feature parity with Python Rich. When behavior differs, treat it as a bug (or an explicitly documented, test-covered deviation) and track it until resolved.\n\n**Q: Is this production-ready?**\n\nA: It's in active development (v0.1.x). Core features work well, but the API may change. Pin your version in Cargo.toml.\n\n**Q: Can I use this in a TUI application?**\n\nA: rich_rust is for styled output, not interactive TUIs. For interactive apps, use `ratatui`, `cursive`, or `tui-rs` (which can potentially use rich_rust for styled text rendering).\n\n**Q: Why not just use Python Rich via PyO3?**\n\nA: Native Rust has no Python runtime dependency, compiles to a single binary, and avoids FFI overhead. If you're already in Rust, stay in Rust.\n\n**Q: How do I contribute?**\n\nA: See the \"About Contributions\" section below.\n\n**Q: What's the minimum Rust version?**\n\nA: Rust 2024 edition (nightly required currently). Check `rust-toolchain.toml` for specifics.\n\n---\n\n## About Contributions\n\nPlease don't take this the wrong way, but I do not accept outside contributions for any of my projects. I simply don't have the mental bandwidth to review anything, and it's my name on the thing, so I'm responsible for any problems it causes; thus, the risk-reward is highly asymmetric from my perspective. I'd also have to worry about other \"stakeholders,\" which seems unwise for tools I mostly make for myself for free. Feel free to submit issues, and even PRs if you want to illustrate a proposed fix, but know I won't merge them directly. Instead, I'll have Claude or Codex review submissions via `gh` and independently decide whether and how to address them. Bug reports in particular are welcome. Sorry if this offends, but I want to avoid wasted time and hurt feelings. I understand this isn't in sync with the prevailing open-source ethos that seeks community contributions, but it's the only way I can move at this velocity and keep my sanity.\n\n---\n\n## License\n\nMIT License (with OpenAI/Anthropic Rider). See [LICENSE](LICENSE) for details.\n\n---\n\n\u003cp align=\"center\"\u003e\n  \u003csub\u003eMade with Rust by \u003ca href=\"https://github.com/Dicklesworthstone\"\u003eJeffrey Emanuel\u003c/a\u003e\u003c/sub\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDicklesworthstone%2Frich_rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDicklesworthstone%2Frich_rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDicklesworthstone%2Frich_rust/lists"}