rusty_rich/lib.rs
1//! # rusty-rich
2//!
3//! **Rich text and beautiful formatting in the terminal** — a Rust port of
4//! the popular Python [Rich](https://github.com/Textualize/rich) library.
5//!
6//! Bring stunning terminal output to your Rust CLI tools with minimal code.
7//! Supports TrueColor/256/16-color terminals, produces ANSI escape sequences,
8//! and exports to HTML and SVG.
9//!
10//! ## Quick Start
11//!
12//! ```rust,no_run
13//! use rusty_rich::{Console, Panel, Table, Column, Style, Color};
14//!
15//! let mut console = Console::new();
16//!
17//! // Inline markup
18//! console.print_str("[bold green]Hello, [red]World![/red][/bold green]");
19//!
20//! // Panel with title
21//! let panel = Panel::new("Content inside a box")
22//! .title("My Panel")
23//! .border_style(Style::new().color(Color::parse("cyan").unwrap()));
24//! console.println(&panel);
25//!
26//! // Table with columns
27//! let mut table = Table::new();
28//! table.add_column(Column::new("Name"));
29//! table.add_column(Column::new("Age"));
30//! table.add_row_str(vec!["Alice".into(), "30".into()]);
31//! table.add_row_str(vec!["Bob".into(), "25".into()]);
32//! console.println(&table);
33//! ```
34//!
35//! ## Feature Overview
36//!
37//! ### Core Primitives
38//!
39//! | Module | Provides |
40//! |--------|----------|
41//! | [`color`] | 256 named colors, TrueColor/8-bit/Standard, RGB↔ANSI conversion, blending |
42//! | [`style`] | 13 text attributes (bold/italic/underline/strike/…), links, style combination |
43//! | [`segment`] | Smallest output unit: text + style + control codes; 9 utility functions |
44//! | [`text`] | [`Text`] with [`Span`]-based styling, markup parsing, truncation, wrapping |
45//! | [`cells`] | Unicode cell width utilities for CJK and emoji |
46//! | [`measure`] | Width measurement protocol for layout negotiation |
47//! | [`align`] | Horizontal (Left/Center/Right/Full) and vertical (Top/Middle/Bottom) alignment |
48//! | [`markup`] | BBCode-like parser: `[bold red]text[/bold red]` |
49//! | [`highlighter`] | Regex/Repr/ISO8601/JSON/Path text highlighters |
50//! | [`ratio`] | Proportional space distribution with minimums and maximums |
51//!
52//! ### Console & Rendering
53//!
54//! | Module | Provides |
55//! |--------|----------|
56//! | [`console`] | Central rendering engine: [`Console`], [`Renderable`] trait, [`RenderResult`], [`Group`] |
57//! | [`theme`] | 170+ named style maps with stack-based inheritance via [`Theme`] and `ThemeStack` |
58//! | [`screen`] | Full-screen alt-buffer via [`Screen`], [`ScreenContext`] RAII guard, [`ScreenUpdate`] |
59//!
60//! ### Layout & Renderables
61//!
62//! | Module | Provides |
63//! |--------|----------|
64//! | [`panel`] | Bordered container with title, subtitle, 17 box styles |
65//! | [`table`] | Tabular data with [`Column`], [`Cell`], colspan/rowspan, sections, 17 border styles |
66//! | [`tree`] | Hierarchical tree with Unicode/ASCII guides |
67//! | [`rule`] | Horizontal divider with optional centered title |
68//! | [`columns`] | Side-by-side column layout with equal/expand options |
69//! | [`layout`] | Recursive split-pane layout with ratio sizing and named regions |
70//! | [`padding`] | CSS-style padding (1–4 values) |
71//! | [`box_drawing`] | 17 box/border styles from ASCII to heavy double-lines |
72//!
73//! ### Dynamic Components
74//!
75//! | Module | Provides |
76//! |--------|----------|
77//! | [`progress`] | Multi-task progress bars, [`TrackIterator`] for tracking iterables, [`ProgressFile`] |
78//! | [`progress_columns`] | 11 column types: bar, text, spinner, time, file size, transfer speed, etc. |
79//! | [`spinner`] | 55 animated spinners with case-insensitive name lookup via [`get_spinner`] |
80//! | [`status`] | Animated spinner + status message with in-place refresh |
81//! | [`live`] | Auto-updating region with alt-screen support and [`LiveWriter`] for output capture |
82//!
83//! ### Content Rendering
84//!
85//! | Module | Provides |
86//! |--------|----------|
87//! | [`syntax`] | Syntax highlighting via syntect (100+ languages), lexer guessing, stylize_range |
88//! | [`markdown`] | Markdown rendering via pulldown-cmark: headings, code, lists, blockquotes, tables, images |
89//! | [`json`] | Pretty-printed JSON with syntax-highlighted keys/values |
90//! | [`logging`] | [`RichHandler`] for the `log` crate with colored levels |
91//! | [`log_render`] | Standalone [`LogRender`] formatter for log records as Rich tables |
92//! | [`traceback`] | Rich exception tracebacks with locals, source code, frame suppression, panic hook |
93//!
94//! ### Interactive & Inspection
95//!
96//! | Module | Provides |
97//! |--------|----------|
98//! | [`prompt`] | 5 prompt types: [`Prompt`], [`IntPrompt`], [`FloatPrompt`], [`Confirm`], [`Select`] |
99//! | [`inspect`] | [`Inspect`] for structured object introspection with attribute/method tables |
100//! | [`control`] | [`Control`] for composable terminal escape sequences (cursor, screen, title, bell) |
101//!
102//! ### Additional Renderables
103//!
104//! | Module | Provides |
105//! |--------|----------|
106//! | [`pretty`] | [`Pretty`] printing with [`Node`] tree traversal, [`pprint`], [`pretty_repr`] |
107//! | [`emoji`] | 100+ `:shortcode:` → Unicode emoji replacement via [`Emoji`] |
108//! | [`pager`] | System pager integration (`$PAGER`/`less`) with [`PagerContext`] RAII |
109//! | [`bar`] | Horizontal [`BarChart`] with labels, colors, and auto-scaling |
110//! | [`palette`] | [`Palette`] generation: gradient, rainbow, monochrome |
111//! | [`ansi`] | [`AnsiDecoder`] — parse ANSI escape sequences into styled [`Text`] |
112//! | [`constrain`] | [`Constrain`] — cap the maximum width of any renderable |
113//! | [`styled`] | [`Styled`] — apply a style to all output of a renderable |
114//! | [`containers`] | [`Lines`] and [`Renderables`] for grouping renderables |
115//! | [`filesize`] | [`format_file_size`], [`format_transfer_speed`], [`decimal`] (SI units) |
116//! | [`scope`] | [`render_scope`] / [`scope_summary`] for variable inspection |
117//! | [`file_proxy`] | [`FileProxy`] — auto-refreshing file content display |
118//! | [`diagnose`] | Error diagnostics — [`report`] and [`diagnose`] |
119//! | [`repr`] | [`RichRepr`] trait, [`repr_auto`] / [`rich_repr`] for custom pretty-printing |
120//!
121//! ### Export
122//!
123//! | Module | Provides |
124//! |--------|----------|
125//! | [`export`] | HTML, SVG, and text export with 4 preset terminal themes |
126//!
127//! ## Examples by Use Case
128//!
129//! ### Markdown with Tables
130//!
131//! ```rust,no_run
132//! use rusty_rich::{render_markdown, Console};
133//!
134//! let md = render_markdown("# Report\n\n| Item | Qty |\n|------|-----|\n| A | 10 |\n| B | 5 |");
135//! Console::new().println(&md);
136//! ```
137//!
138//! ### Progress Bars
139//!
140//! ```rust,no_run
141//! use rusty_rich::Progress;
142//!
143//! let mut progress = Progress::new();
144//! let task = progress.add_task("Downloading...", Some(100.0));
145//! // … in a loop: progress.update(task, n as f64);
146//! println!("{}", progress.render(80));
147//! ```
148//!
149//! ### Interactive Prompts
150//!
151//! ```rust,no_run
152//! use rusty_rich::{Prompt, Confirm, IntPrompt, Select};
153//!
154//! let name = Prompt::ask_with("Enter name").unwrap();
155//! let password = Prompt::new("Password").password(true).ask().unwrap();
156//! let ok = Confirm::ask_with("Continue?", true).unwrap();
157//! let age = IntPrompt::ask_with("Age").unwrap();
158//! let choice = Select::new("Pick").choice("Red", "r").choice("Blue", "b").ask().unwrap();
159//! ```
160//!
161//! ### Live Display with Writer
162//!
163//! ```rust,no_run
164//! use rusty_rich::{Live, LiveWriter, Panel};
165//! use std::io::Write;
166//!
167//! let mut live = Live::new(Panel::new("Starting...").title("Status"));
168//! let mut writer = Live::create_writer();
169//! live.start().unwrap();
170//!
171//! writeln!(writer, "Processing items...").unwrap();
172//! live.update(Panel::new("Done!").title("Status")).unwrap();
173//! live.stop().unwrap();
174//! ```
175//!
176//! ### Traceback Panic Hook
177//!
178//! ```rust,no_run
179//! use rusty_rich::traceback;
180//!
181//! // Install a global panic hook for rich tracebacks
182//! traceback::install();
183//! ```
184//!
185//! ### Object Inspection
186//!
187//! ```rust,no_run
188//! use rusty_rich::Inspect;
189//!
190//! let value = vec![1, 2, 3];
191//! let insp = Inspect::new(&value)
192//! .title("my_vec")
193//! .add_attr("len", "usize", "3")
194//! .add_method("push", "fn push(&mut self, value: T)")
195//! .methods(true);
196//! ```
197//!
198//! ### Terminal Control Sequences
199//!
200//! ```rust,no_run
201//! use rusty_rich::control::{Control, control_home, control_clear};
202//!
203//! let clear = Control::clear_home();
204//! let title = Control::title("My App");
205//! let bell = Control::bell();
206//! ```
207//!
208//! ### Log Record Formatting
209//!
210//! ```rust,no_run
211//! use rusty_rich::LogRender;
212//!
213//! let mut renderer = LogRender::new()
214//! .show_time(true)
215//! .show_level(true)
216//! .show_path(true);
217//!
218//! let record = renderer.render_log(
219//! Some("10:30:00"),
220//! "ERROR",
221//! "Connection refused",
222//! Some("src/main.rs"),
223//! Some(42),
224//! );
225//! ```
226//!
227//! ### Full-Screen Applications
228//!
229//! ```rust,no_run
230//! use rusty_rich::{Console, Screen};
231//!
232//! let mut console = Console::new();
233//! let mut screen = console.screen();
234//! screen.enter(); // enters alt screen
235//! // … render content …
236//! screen.exit(); // restores terminal
237//! ```
238//!
239//! ### HTML & SVG Export
240//!
241//! ```rust,no_run
242//! use rusty_rich::{export_svg, ExportSvgOptions};
243//!
244//! let svg = export_svg(&ExportSvgOptions::default());
245//! std::fs::write("output.svg", svg).unwrap();
246//! ```
247//!
248//! ## Color & Style System
249//!
250//! 256 named colors via [`Color::parse`], plus hex/RGB constructors with automatic downgrade:
251//!
252//! ```rust
253//! use rusty_rich::{Color, Style};
254//!
255//! // Named colors — 256 ANSI palette
256//! let c = Color::parse("hot_pink").unwrap();
257//! let c = Color::parse("steel_blue").unwrap();
258//!
259//! // Hex / RGB
260//! let c = Color::from_hex("#FF6600").unwrap();
261//! let c = Color::from_rgb(100, 200, 50);
262//!
263//! // Style with 13 attributes + links
264//! let s = Style::new()
265//! .color(Color::parse("cyan").unwrap())
266//! .bgcolor(Color::parse("#1E1E2E").unwrap())
267//! .bold(true)
268//! .italic(true)
269//! .underline(true)
270//! .link("https://example.com");
271//! ```
272//!
273//! ## Box Styles (17 built-in)
274//!
275//! ```text
276//! BOX_ROUNDED ╭─╮ │ │ ╰─╯ BOX_HEAVY ┏━┓ ┃ ┃ ┗━┛
277//! BOX_SQUARE ┌─┐ │ │ └─┘ BOX_DOUBLE ╔═╗ ║ ║ ╚═╝
278//! BOX_ASCII +-+ | | +-+ BOX_MARKDOWN | Table style
279//! ```
280//!
281//! ## Comparison with Python Rich
282//!
283//! rusty-rich achieves ~88% feature parity with Python Rich 14.x (475+ tests).
284//!
285//! ## Feature Flags
286//!
287//! No feature flags — all functionality is included by default. Dependencies are
288//! carefully chosen for minimal compile times.
289//!
290//! ## Crate Organization
291//!
292//! The crate is organized into 6 module groups across 48 source files:
293//!
294//! - **Core** ([`color`], [`style`], [`segment`], [`text`], [`theme`],
295//! [`measure`], [`align`], [`markup`], [`ratio`], [`highlighter`],
296//! [`cells`], [`console`], [`box_drawing`])
297//! - **Renderables** ([`panel`], [`table`], [`tree`], [`rule`],
298//! [`padding`], [`columns`], [`layout`], [`bar`], [`constrain`],
299//! [`styled`], [`containers`])
300//! - **Dynamic** ([`prompt`], [`progress`], [`progress_columns`],
301//! [`spinner`], [`status`], [`live`], [`screen`], [`control`])
302//! - **Content** ([`syntax`], [`markdown`], [`json`], [`logging`],
303//! [`log_render`], [`traceback`], [`pretty`], [`ansi`])
304//! - **Inspection** ([`inspect`], [`scope`], [`repr`], [`diagnose`])
305//! - **Export & I/O** ([`export`], [`pager`], [`emoji`], [`palette`],
306//! [`filesize`], [`file_proxy`])
307//!
308//! Most commonly-used types are re-exported at the crate root for convenience.
309
310// -- Core modules -----------------------------------------------------------
311
312/// Unicode cell width utilities for CJK and emoji text measurement.
313pub mod cells;
314/// 256 named ANSI colors, TrueColor/8-bit/Standard, RGB↔ANSI conversion, blending.
315pub mod color;
316/// 13 text attributes (bold, italic, underline, …), links, style combination.
317pub mod style;
318/// Styled text unit with control codes — the smallest rendering primitive.
319pub mod segment;
320/// Styled text with `Span`-based markup and text manipulation utilities.
321pub mod text;
322/// Named style maps (170+ defaults) with stack-based inheritance.
323pub mod theme;
324/// Width measurement protocol for layout negotiation between renderables.
325pub mod measure;
326/// Horizontal and vertical alignment wrappers for renderables.
327pub mod align;
328/// BBCode-like markup parser: `[bold red]text[/bold red]`.
329pub mod markup;
330/// Proportional space distribution algorithms with minimums and maximums.
331pub mod ratio;
332/// Regex-based and repr-style text highlighters.
333pub mod highlighter;
334/// Central rendering engine — Console, Renderable trait, capture, export.
335pub mod console;
336/// 17 box/border drawing styles from ASCII to heavy Unicode double-lines.
337pub mod box_drawing;
338
339// -- Renderable components --------------------------------------------------
340
341/// Bordered container with optional title, subtitle, and padding.
342pub mod panel;
343/// Tabular data with column definitions, colspan/rowspan, sections, and 17 border styles.
344pub mod table;
345/// Hierarchical tree with Unicode or ASCII branch guides.
346pub mod tree;
347/// Horizontal divider line with optional centered, left-, or right-aligned title.
348pub mod rule;
349/// CSS-style padding (1–4 side values) around any renderable.
350pub mod padding;
351/// Side-by-side column layout with equal-width and expand options.
352pub mod columns;
353/// Recursive split-pane layout engine with ratio sizing and named regions.
354pub mod layout;
355
356// -- Dynamic / animated components ------------------------------------------
357
358/// Interactive prompts: string, int, float, confirm, select with password mode.
359pub mod prompt;
360/// Multi-task progress bars with configurable column layouts and iterable tracking.
361pub mod progress;
362/// 11 progress column types: bar, text, spinner, time, file size, transfer speed.
363pub mod progress_columns;
364/// 55 animated spinners with case-insensitive name-based lookup.
365pub mod spinner;
366/// Animated spinner with status message, in-place refresh via carriage return.
367pub mod status;
368/// Auto-updating display region with stdout/stderr capture via `LiveWriter`.
369pub mod live;
370/// Full-screen rendering, alternate screen buffer, and screen update helpers.
371pub mod screen;
372
373// -- Content rendering ------------------------------------------------------
374
375/// Syntax highlighting via syntect (100+ languages, Sublime Text theme support).
376pub mod syntax;
377/// Markdown rendering via pulldown-cmark: headings, code, lists, blockquotes, tables.
378pub mod markdown;
379/// Pretty-printed JSON with syntax-highlighted keys, strings, numbers, booleans.
380pub mod json;
381/// `RichHandler` for the `log` crate — colored log levels with file/line info.
382pub mod logging;
383/// Rich exception tracebacks with source code, locals, frame suppression, panic hook.
384pub mod traceback;
385
386// -- Additional renderables --------------------------------------------------
387
388/// Pretty-printing for Rust data structures with tree traversal and syntax highlighting.
389pub mod pretty;
390/// Emoji shortcode replacement — `:smile:` → 😊.
391pub mod emoji;
392/// System pager integration — pipes output to `less` or `$PAGER`.
393pub mod pager;
394/// Constrain the maximum width of any renderable.
395pub mod constrain;
396/// Pre-styled renderable wrapper — applies a style to all output of a renderable.
397pub mod styled;
398/// Horizontal bar chart with labels, colors, and auto-scaling.
399pub mod bar;
400/// Human-readable file size and transfer speed formatting.
401pub mod filesize;
402/// Container renderables — `Lines` and `Renderables` for grouping output.
403pub mod containers;
404/// Color palette generation — gradients, rainbows, monochrome ramps.
405pub mod palette;
406/// Error diagnostics — rich-formatted error reporting.
407pub mod diagnose;
408/// ANSI escape sequence decoder — parse ANSI text into styled `Text`.
409pub mod ansi;
410/// Variable scope inspection — render name→value mappings as tables.
411pub mod scope;
412/// Auto-refreshing file content display — watches file for changes.
413pub mod file_proxy;
414/// Rich representation protocol — customizable pretty-printing for Rust types.
415pub mod repr;
416/// Terminal control sequence generation — cursor movement, screen, titles, bells.
417pub mod control;
418/// Object introspection — structured display of type info, attributes, and methods.
419pub mod inspect;
420/// Standalone log record formatter — renders log records as Rich tables.
421pub mod log_render;
422
423// -- Export -----------------------------------------------------------------
424
425/// HTML, SVG, and plain-text export with 4 preset terminal color themes.
426pub mod export;
427
428// -- Re-exports for convenience ---------------------------------------------
429// Most commonly-used types are re-exported at the crate root so you can write
430// `use rusty_rich::Panel` instead of `use rusty_rich::panel::Panel`.
431
432// -- Core types --------------------------------------------------------------
433
434/// 256 named colors + TrueColor/8-bit support with automatic downgrade.
435pub use color::Color;
436/// What level of color the terminal supports (Standard, EightBit, TrueColor).
437pub use color::ColorSystem;
438/// How a [`Color`] is stored internally (Default, Standard, EightBit, TrueColor).
439pub use color::ColorType;
440
441/// Terminal text style — 13 attributes, fg/bg color, links, and combination logic.
442pub use style::Style;
443/// Stack of styles for nested markup — push/pop to track inheritance.
444pub use style::StyleStack;
445
446/// A piece of styled text with optional control codes — the smallest renderable unit.
447pub use segment::Segment;
448/// A collection of [`Segment`]s with convenience methods.
449pub use segment::Segments;
450
451/// Styled text with `Span` regions, markup support, and text manipulation methods.
452pub use text::Text;
453/// A styled region within a [`Text`] — defined by start/end offsets and a [`Style`].
454pub use text::Span;
455
456/// A named style map — look up styles by key (e.g. `"repr.number"`, `"markdown.h1"`).
457pub use theme::Theme;
458
459/// Horizontal alignment: `Left`, `Center`, `Right`, or `Full` (justified).
460pub use align::AlignMethod;
461/// Vertical alignment: `Top`, `Middle`, or `Bottom`.
462pub use align::VerticalAlignMethod;
463/// Wraps a renderable with horizontal and vertical alignment.
464pub use align::Align;
465
466/// Width measurement (minimum, maximum) returned by the layout protocol.
467pub use measure::Measurement;
468
469// -- Console -----------------------------------------------------------------
470
471/// The central rendering engine — prints renderables, manages terminal state.
472pub use console::Console;
473/// Options passed to renderables during the rendering pass (width, height, overflow, etc.).
474pub use console::ConsoleOptions;
475/// Terminal size in character cells (width × height).
476pub use console::ConsoleDimensions;
477/// How text overflow is handled: `Fold`, `Crop`, `Ellipsis`, or `Ignore`.
478pub use console::OverflowMethod;
479/// Trait for types that can be rendered to terminal output.
480pub use console::Renderable;
481/// The result of rendering: lines of segments plus nested renderable items.
482pub use console::RenderResult;
483/// Either a [`Segment`] or a nested renderable — produced during rendering.
484pub use console::RenderItem;
485/// A type-erased, cloneable wrapper around any [`Renderable`].
486pub use console::DynRenderable;
487/// Renders multiple renderables sequentially as one unit.
488pub use console::Group;
489/// Returns a mutex-guarded reference to the global (singleton) [`Console`].
490pub use console::get_console;
491/// Drop-in replacement for `println!` that uses the global console.
492pub use console::print_objects as print;
493/// Print a markup string (e.g. `"[bold red]text[/bold red]"`) via the global console.
494pub use console::print_str;
495/// Pretty-print a `serde_json::Value` via the global console.
496pub use console::print_json_val as print_json;
497
498// -- Box drawing -------------------------------------------------------------
499
500/// A box/border style defined by 32 corner and edge characters.
501pub use box_drawing::BoxStyle;
502#[doc(no_inline)]
503pub use box_drawing::{
504 BOX_ROUNDED, BOX_SQUARE, BOX_HEAVY, BOX_HEAVY_EDGE, BOX_HEAVY_HEAD,
505 BOX_DOUBLE, BOX_DOUBLE_EDGE, BOX_SIMPLE, BOX_SIMPLE_HEAVY,
506 BOX_MINIMAL, BOX_MINIMAL_HEAVY, BOX_ASCII, BOX_ASCII2,
507 BOX_SQUARE_DOUBLE_HEAD, BOX_MINIMAL_DOUBLE_HEAD, BOX_SIMPLE_HEAD,
508 BOX_ASCII_DOUBLE_HEAD,
509};
510
511// -- Renderables -------------------------------------------------------------
512
513/// A bordered container with optional title, subtitle, border style, and padding.
514pub use panel::Panel;
515/// Tabular data widget with headers, footers, colspan/rowspan, and 17 box styles.
516pub use table::Table;
517/// A column definition for a [`Table`] — header, footer, width, alignment, ratio.
518pub use table::Column;
519/// A table cell with optional style, colspan, and rowspan.
520pub use table::Cell;
521
522/// A hierarchical tree with Unicode or ASCII branch guides.
523pub use tree::Tree;
524/// A horizontal divider line with optional centered, left-, or right-aligned title.
525pub use rule::Rule;
526/// CSS-style padding (1–4 side values) around any renderable.
527pub use padding::Padding;
528/// Padding dimension specification: 1, 2, or 4 values (like CSS).
529pub use padding::PaddingDimensions;
530/// Side-by-side column layout with equal-width and expand options.
531pub use columns::Columns;
532/// Recursive split-pane layout engine with ratio sizing.
533pub use layout::Layout;
534/// A node in the layout tree — either a `Split` or a `Leaf`.
535pub use layout::LayoutNode;
536/// Layout split direction: `Horizontal` (columns) or `Vertical` (rows).
537pub use layout::Direction;
538/// A screen region defined by x, y, width, and height.
539pub use layout::Region;
540
541// -- Progress ----------------------------------------------------------------
542
543/// Multi-task progress display with configurable column layouts.
544pub use progress::Progress;
545/// A single progress bar — renders as a filled bar with percentage.
546pub use progress::ProgressBar;
547/// A file wrapper that tracks read progress via a task in [`Progress`].
548pub use progress::ProgressFile;
549/// A tracked task within a [`Progress`] display — holds description, total, completed.
550pub use progress::Task;
551/// An iterator wrapper that automatically advances a progress task on each iteration.
552pub use progress::TrackIterator;
553
554/// Trait for progress column types — renders one cell per task.
555pub use progress_columns::ProgressColumn;
556/// Shows a progress bar for each task.
557pub use progress_columns::BarColumn;
558/// Shows "completed/total" as file sizes with a separator.
559pub use progress_columns::DownloadColumn;
560/// Shows the completed file size for each task.
561pub use progress_columns::FileSizeColumn;
562/// Shows "completed/total" with raw numbers.
563pub use progress_columns::MofNCompleteColumn;
564/// Shows a spinner (animated during active, checkmark when finished).
565pub use progress_columns::SpinnerColumn;
566/// Shows the completion percentage for each task.
567pub use progress_columns::TaskProgressColumn;
568/// Shows a formatted text field from task metadata.
569pub use progress_columns::TextColumn;
570/// Shows the elapsed time for each task.
571pub use progress_columns::TimeElapsedColumn;
572/// Shows the estimated remaining time for each task.
573pub use progress_columns::TimeRemainingColumn;
574/// Shows the total file size for each task.
575pub use progress_columns::TotalFileSizeColumn;
576/// Shows the transfer speed for each task.
577pub use progress_columns::TransferSpeedColumn;
578/// Format a byte count as a human-readable size string.
579pub use progress_columns::format_size;
580/// Format a bytes-per-second rate as a human-readable speed string.
581pub use progress_columns::format_speed;
582
583// -- Spinners ----------------------------------------------------------------
584
585/// An animated spinner — frames, interval, text, and style.
586pub use spinner::Spinner;
587/// A predefined spinner animation: slice of frame strings + frame interval.
588pub use spinner::SpinnerFrames;
589/// The default spinner (dots).
590pub use spinner::DEFAULT_SPINNER;
591/// Look up a spinner by name (case-insensitive).
592pub use spinner::get_spinner;
593/// All registered spinners as a slice of (name, spinner) pairs.
594pub use spinner::SPINNERS;
595#[doc(no_inline)]
596pub use spinner::{
597 SPINNER_ARC, SPINNER_ARROW, SPINNER_ARROW2, SPINNER_ARROW3,
598 SPINNER_BOUNCING_BAR, SPINNER_BOUNCING_BALL,
599 SPINNER_CHRISTMAS, SPINNER_CIRCLE, SPINNER_CLOCK,
600 SPINNER_EARTH, SPINNER_GRENADE,
601 SPINNER_GROW_HORIZONTAL, SPINNER_GROW_VERTICAL,
602 SPINNER_HAMBURGER, SPINNER_HEARTS, SPINNER_MONKEY,
603 SPINNER_NOISE, SPINNER_PONG, SPINNER_RUNNER, SPINNER_SHARK,
604 SPINNER_TOGGLE, SPINNER_TRIANGLE, SPINNER_VERTICAL_BARS,
605};
606
607// -- Prompts -----------------------------------------------------------------
608
609/// String input prompt with optional password mode and choice validation.
610pub use prompt::Prompt;
611/// Base configuration shared by all prompt types.
612pub use prompt::PromptBase;
613/// Error type for prompt operations: invalid response, I/O error, or cancellation.
614pub use prompt::PromptError;
615/// Integer input prompt — loops until a valid i64 is entered.
616pub use prompt::IntPrompt;
617/// Floating-point input prompt — loops until a valid f64 is entered.
618pub use prompt::FloatPrompt;
619/// Yes/no confirmation prompt with configurable default answer.
620pub use prompt::Confirm;
621/// Numbered-choice selection prompt — user picks from a list by number.
622pub use prompt::Select;
623
624/// An animated spinner with a status message, refreshed in-place via carriage return.
625pub use status::Status;
626
627/// Auto-updating display region — refreshs content at a configurable rate.
628pub use live::Live;
629/// A writer that captures output for display within a [`Live`] region.
630pub use live::LiveWriter;
631
632/// Full-screen renderable — fills the terminal and crops/pads to fit.
633pub use screen::Screen;
634/// RAII guard for the alternate screen buffer — enters on creation, exits on drop.
635pub use screen::ScreenContext;
636/// Wraps a renderable for screen updates at a specific x/y offset.
637pub use screen::ScreenUpdate;
638
639// -- Content rendering -------------------------------------------------------
640
641/// Syntax-highlighted code block — language, theme, line numbers, word wrap.
642pub use syntax::Syntax;
643/// Render a markdown string into a [`MarkdownRender`].
644pub use markdown::render_markdown;
645/// A markdown document renderable — headings, code, lists, blockquotes, tables.
646pub use markdown::MarkdownRender;
647/// Render a `serde_json::Value` into a [`JsonRender`].
648pub use json::render_json;
649/// Pretty-printed, syntax-highlighted JSON renderable.
650pub use json::JsonRender;
651
652/// A logging handler for the `log` crate — renders records with Rich styling.
653pub use logging::RichHandler;
654
655/// Rich exception traceback — box-drawn, with source code context and locals.
656pub use traceback::Traceback;
657/// A chain of exceptions — one or more [`Stack`]s of [`Frame`]s.
658pub use traceback::Trace;
659/// One exception level in a traceback — type, value, frames, notes.
660pub use traceback::Stack;
661/// A single stack frame — file, line number, function name, source line, locals.
662pub use traceback::Frame;
663/// Install a global panic hook that renders Rich-formatted tracebacks to stderr.
664pub use traceback::install;
665
666/// Trait for text highlighters — takes a [`Text`] and returns a styled [`Text`].
667pub use highlighter::Highlighter;
668/// Highlights Python-repr-like output: URLs, numbers, paths, quoted strings.
669pub use highlighter::ReprHighlighter;
670/// A no-op highlighter that returns text unchanged.
671pub use highlighter::NullHighlighter;
672/// Highlights text using regex patterns mapped to styles.
673pub use highlighter::RegexHighlighter;
674
675// -- Export ------------------------------------------------------------------
676
677/// Export rendered output as a full HTML document.
678pub use export::export_html;
679/// Export rendered output as HTML and save to a file.
680pub use export::save_html;
681/// Options for HTML export: font, font size, line height, theme, code styling.
682pub use export::ExportHtmlOptions;
683/// Export rendered output as an SVG document with terminal chrome.
684pub use export::export_svg;
685/// Export rendered output as SVG and save to a file.
686pub use export::save_svg;
687/// Options for SVG export: font, font size, theme, dimensions, code styling.
688pub use export::ExportSvgOptions;
689/// Export rendered output as plain text (optionally strip ANSI escapes).
690pub use export::export_text;
691/// Export rendered output as plain text and save to a file.
692pub use export::save_text;
693/// Options for text export: text content and ANSI strip flag.
694pub use export::ExportTextOptions;
695/// A terminal color theme for HTML/SVG export (background, foreground, ANSI palette).
696pub use export::ExportTheme;
697/// Monokai export theme.
698pub use export::EXPORT_THEME_MONOKAI;
699/// Dimmed Monokai export theme.
700pub use export::EXPORT_THEME_DIMMED_MONOKAI;
701/// Night Owlish export theme.
702pub use export::EXPORT_THEME_NIGHT_OWLISH;
703/// SVG-optimized export theme.
704pub use export::EXPORT_THEME_SVG;
705/// Convert segments to HTML spans with inline CSS.
706pub use export::segments_to_html;
707/// Escape text for safe HTML embedding.
708pub use export::escape_html;
709/// Strip ANSI escape sequences from a string.
710pub use export::strip_ansi_escapes;
711/// HTML document template string.
712pub use export::CONSOLE_HTML_FORMAT;
713/// SVG document template string.
714pub use export::CONSOLE_SVG_FORMAT;
715
716/// Parse a BBCode-like markup string and return a styled [`Text`].
717pub use markup::render as render_markup;
718/// Escape square brackets in a string so they are not interpreted as markup tags.
719pub use markup::escape as escape_markup;
720
721// -- New modules (Phase 2 additions) ------------------------------------------
722
723// Pretty printing
724pub use pretty::Pretty;
725pub use pretty::Node as PrettyNode;
726pub use pretty::pprint;
727pub use pretty::pretty_repr;
728pub use pretty::traverse;
729pub use pretty::install as pretty_install;
730
731// Emoji
732pub use emoji::Emoji;
733pub use emoji::NoEmoji;
734
735// Pager
736pub use pager::Pager;
737pub use pager::PagerContext;
738pub use pager::SystemPager;
739
740// Constrain
741pub use constrain::Constrain;
742
743// Styled
744pub use styled::Styled;
745
746// Bar chart
747pub use bar::Bar;
748pub use bar::BarChart;
749
750// File size
751pub use filesize::format_size as format_file_size;
752pub use filesize::format_speed as format_transfer_speed;
753pub use filesize::pick_unit_and_suffix;
754
755// Containers
756pub use containers::Lines;
757pub use containers::Renderables;
758
759// Palette
760pub use palette::Palette;
761
762// Diagnose
763pub use diagnose::report;
764pub use diagnose::diagnose;
765
766// ANSI decoder
767pub use ansi::AnsiDecoder;
768
769// Scope
770pub use scope::render_scope;
771pub use scope::scope_summary;
772
773// File proxy
774pub use file_proxy::FileProxy;
775
776// Repr protocol
777pub use repr::RichRepr;
778pub use repr::auto as repr_auto;
779pub use repr::rich_repr;
780pub use repr::ReprOptions;
781pub use repr::ReprError;
782
783// Syntax additional exports
784pub use syntax::SyntaxTheme;
785pub use syntax::ANSISyntaxTheme;
786pub use syntax::get_lexer_by_name;
787pub use syntax::get_style_by_name;
788pub use syntax::guess_lexer_for_filename;
789
790// Console additional exports
791pub use console::Capture;
792pub use console::NewLine;
793pub use console::NoChange;
794pub use console::RenderHook;
795pub use console::ThemeContext;
796pub use console::reconfigure;
797
798// Layout additional exports
799pub use layout::Splitter;
800pub use layout::ColumnSplitter;
801pub use layout::RowSplitter;
802pub use layout::NoSplitter;
803
804// Table additional exports
805pub use table::Row;
806
807// Progress additional exports
808pub use progress::RenderableColumn;
809pub use progress::track;
810pub use progress::wrap_file;
811
812// Highlighter additional exports
813pub use highlighter::ISO8601Highlighter;
814pub use highlighter::JSONHighlighter;
815pub use highlighter::PathHighlighter;
816
817// Filesize additional exports
818pub use filesize::decimal as format_size_decimal;
819
820// Control exports
821pub use control::Control;
822pub use control::control_bell;
823pub use control::control_home;
824pub use control::control_clear;
825pub use control::control_move_to;
826pub use control::strip_control_codes;
827pub use control::escape_control_codes;
828
829// Inspect exports
830pub use inspect::Inspect;
831pub use inspect::inspect;
832pub use inspect::inspect_str;
833
834// LogRender exports
835pub use log_render::LogRender;
836pub use log_render::LogRecord;
837pub use log_render::LogTable;