Skip to main content

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("Alice", "30");
31//! table.add_row_str("Bob", "25");
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-based and repr-style 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) |
88//! | [`markdown`] | Markdown rendering via pulldown-cmark: headings, code, lists, blockquotes, tables |
89//! | [`json`] | Pretty-printed JSON with syntax-highlighted keys/values |
90//! | [`logging`] | [`RichHandler`] for the `log` crate with colored levels |
91//! | [`traceback`] | Rich exception tracebacks with locals, source code, frame suppression, panic hook |
92//!
93//! ### Interactive
94//!
95//! | Module | Provides |
96//! |--------|----------|
97//! | [`prompt`] | 5 prompt types: [`Prompt`], [`IntPrompt`], [`FloatPrompt`], [`Confirm`], [`Select`] |
98//!
99//! ### Export
100//!
101//! | Module | Provides |
102//! |--------|----------|
103//! | [`export`] | HTML, SVG, and text export with 4 preset terminal themes |
104//!
105//! ## Examples by Use Case
106//!
107//! ### Markdown with Tables
108//!
109//! ```rust,no_run
110//! use rusty_rich::{render_markdown, Console};
111//!
112//! let md = render_markdown("# Report\n\n| Item | Qty |\n|------|-----|\n| A    | 10  |\n| B    | 5   |");
113//! Console::new().println(&md);
114//! ```
115//!
116//! ### Progress Bars
117//!
118//! ```rust,no_run
119//! use rusty_rich::Progress;
120//!
121//! let mut progress = Progress::new();
122//! let task = progress.add_task("Downloading...", Some(100.0));
123//! // … in a loop: progress.update(task, n as f64);
124//! println!("{}", progress.render(80));
125//! ```
126//!
127//! ### Interactive Prompts
128//!
129//! ```rust,no_run
130//! use rusty_rich::{Prompt, Confirm, IntPrompt, Select};
131//!
132//! let name = Prompt::ask_with("Enter name").unwrap();
133//! let password = Prompt::new("Password").password(true).ask().unwrap();
134//! let ok = Confirm::ask_with("Continue?", true).unwrap();
135//! let age = IntPrompt::ask_with("Age").unwrap();
136//! let choice = Select::new("Pick").choice("Red", "r").choice("Blue", "b").ask().unwrap();
137//! ```
138//!
139//! ### Live Display with Writer
140//!
141//! ```rust,no_run
142//! use rusty_rich::{Live, LiveWriter, Panel};
143//! use std::io::Write;
144//!
145//! let mut live = Live::new(Panel::new("Starting...").title("Status"));
146//! let mut writer = live.create_writer();
147//! live.start().unwrap();
148//!
149//! writeln!(writer, "Processing items...").unwrap();
150//! live.update(Panel::new("Done!").title("Status")).unwrap();
151//! live.stop().unwrap();
152//! ```
153//!
154//! ### Traceback Panic Hook
155//!
156//! ```rust,no_run
157//! use rusty_rich::traceback;
158//!
159//! // Install a global panic hook for rich tracebacks
160//! traceback::install();
161//!
162//! // Or render manually
163//! // let tb = Traceback::from_exception("MyError", "details", frames)
164//! //     .show_locals(true)
165//! //     .max_frames(5);
166//! ```
167//!
168//! ### Full-Screen Applications
169//!
170//! ```rust,no_run
171//! use rusty_rich::{Console, Screen};
172//!
173//! let mut console = Console::new();
174//! let mut screen = console.screen();
175//! screen.enter();   // enters alt screen
176//! // … render content …
177//! screen.exit();    // restores terminal
178//! ```
179//!
180//! ### HTML & SVG Export
181//!
182//! ```rust,no_run
183//! use rusty_rich::{export_svg, ExportSvgOptions};
184//!
185//! let svg = export_svg(ExportSvgOptions::default());
186//! std::fs::write("output.svg", svg).unwrap();
187//! ```
188//!
189//! ## Color & Style System
190//!
191//! 256 named colors via [`Color::parse`], plus hex/RGB constructors with automatic downgrade:
192//!
193//! ```rust
194//! use rusty_rich::{Color, Style};
195//!
196//! // Named colors — 256 ANSI palette
197//! let c = Color::parse("hot_pink").unwrap();
198//! let c = Color::parse("steel_blue").unwrap();
199//!
200//! // Hex / RGB
201//! let c = Color::from_hex("#FF6600").unwrap();
202//! let c = Color::from_rgb(100, 200, 50);
203//!
204//! // Style with 13 attributes + links
205//! let s = Style::new()
206//!     .color(Color::parse("cyan").unwrap())
207//!     .bgcolor(Color::parse("#1E1E2E").unwrap())
208//!     .bold(true)
209//!     .italic(true)
210//!     .underline(true)
211//!     .link("https://example.com");
212//! ```
213//!
214//! ## Box Styles (17 built-in)
215//!
216//! ```text
217//! BOX_ROUNDED        ╭─╮ │ │ ╰─╯     BOX_HEAVY       ┏━┓ ┃ ┃ ┗━┛
218//! BOX_SQUARE         ┌─┐ │ │ └─┘     BOX_DOUBLE      ╔═╗ ║ ║ ╚═╝
219//! BOX_ASCII          +-+ | | +-+     BOX_MARKDOWN    | Table style
220//! ```
221//!
222//! ## Comparison with Python Rich
223//!
224//! rusty-rich achieves ~72% feature parity with Python Rich 13.x (197 tests).
225//! Missing features: `Pretty` (object rendering), `Inspect` (introspection), emoji support, Jupyter integration,
226//! ANSI decoder, and system pager.
227//!
228//! ## Feature Flags
229//!
230//! No feature flags — all functionality is included by default. Dependencies are
231//! carefully chosen for minimal compile times.
232//!
233//! ## Crate Organization
234//!
235//! The crate is organized into 5 module groups:
236//!
237//! - **Core** ([`color`], [`style`], [`segment`], [`text`], [`theme`],
238//!   [`measure`], [`align`], [`markup`], [`ratio`], [`highlighter`],
239//!   [`cells`], [`console`], [`box_drawing`])
240//! - **Renderables** ([`panel`], [`table`], [`tree`], [`rule`],
241//!   [`padding`], [`columns`], [`layout`])
242//! - **Dynamic** ([`prompt`], [`progress`], [`progress_columns`],
243//!   [`spinner`], [`status`], [`live`], [`screen`])
244//! - **Content** ([`syntax`], [`markdown`], [`json`], [`logging`],
245//!   [`traceback`])
246//! - **Export** ([`export`])
247//!
248//! Most commonly-used types are re-exported at the crate root for convenience.
249
250// -- Core modules -----------------------------------------------------------
251
252/// Unicode cell width utilities for CJK and emoji text measurement.
253pub mod cells;
254/// 256 named ANSI colors, TrueColor/8-bit/Standard, RGB↔ANSI conversion, blending.
255pub mod color;
256/// 13 text attributes (bold, italic, underline, …), links, style combination.
257pub mod style;
258/// Styled text unit with control codes — the smallest rendering primitive.
259pub mod segment;
260/// Styled text with `Span`-based markup and text manipulation utilities.
261pub mod text;
262/// Named style maps (170+ defaults) with stack-based inheritance.
263pub mod theme;
264/// Width measurement protocol for layout negotiation between renderables.
265pub mod measure;
266/// Horizontal and vertical alignment wrappers for renderables.
267pub mod align;
268/// BBCode-like markup parser: `[bold red]text[/bold red]`.
269pub mod markup;
270/// Proportional space distribution algorithms with minimums and maximums.
271pub mod ratio;
272/// Regex-based and repr-style text highlighters.
273pub mod highlighter;
274/// Central rendering engine — Console, Renderable trait, capture, export.
275pub mod console;
276/// 17 box/border drawing styles from ASCII to heavy Unicode double-lines.
277pub mod box_drawing;
278
279// -- Renderable components --------------------------------------------------
280
281/// Bordered container with optional title, subtitle, and padding.
282pub mod panel;
283/// Tabular data with column definitions, colspan/rowspan, sections, and 17 border styles.
284pub mod table;
285/// Hierarchical tree with Unicode or ASCII branch guides.
286pub mod tree;
287/// Horizontal divider line with optional centered, left-, or right-aligned title.
288pub mod rule;
289/// CSS-style padding (1–4 side values) around any renderable.
290pub mod padding;
291/// Side-by-side column layout with equal-width and expand options.
292pub mod columns;
293/// Recursive split-pane layout engine with ratio sizing and named regions.
294pub mod layout;
295
296// -- Dynamic / animated components ------------------------------------------
297
298/// Interactive prompts: string, int, float, confirm, select with password mode.
299pub mod prompt;
300/// Multi-task progress bars with configurable column layouts and iterable tracking.
301pub mod progress;
302/// 11 progress column types: bar, text, spinner, time, file size, transfer speed.
303pub mod progress_columns;
304/// 55 animated spinners with case-insensitive name-based lookup.
305pub mod spinner;
306/// Animated spinner with status message, in-place refresh via carriage return.
307pub mod status;
308/// Auto-updating display region with stdout/stderr capture via `LiveWriter`.
309pub mod live;
310/// Full-screen rendering, alternate screen buffer, and screen update helpers.
311pub mod screen;
312
313// -- Content rendering ------------------------------------------------------
314
315/// Syntax highlighting via syntect (100+ languages, Sublime Text theme support).
316pub mod syntax;
317/// Markdown rendering via pulldown-cmark: headings, code, lists, blockquotes, tables.
318pub mod markdown;
319/// Pretty-printed JSON with syntax-highlighted keys, strings, numbers, booleans.
320pub mod json;
321/// `RichHandler` for the `log` crate — colored log levels with file/line info.
322pub mod logging;
323/// Rich exception tracebacks with source code, locals, frame suppression, panic hook.
324pub mod traceback;
325
326// -- Export -----------------------------------------------------------------
327
328/// HTML, SVG, and plain-text export with 4 preset terminal color themes.
329pub mod export;
330
331// -- Re-exports for convenience ---------------------------------------------
332// Most commonly-used types are re-exported at the crate root so you can write
333// `use rusty_rich::Panel` instead of `use rusty_rich::panel::Panel`.
334
335// -- Core types --------------------------------------------------------------
336
337/// 256 named colors + TrueColor/8-bit support with automatic downgrade.
338pub use color::Color;
339/// What level of color the terminal supports (Standard, EightBit, TrueColor).
340pub use color::ColorSystem;
341/// How a [`Color`] is stored internally (Default, Standard, EightBit, TrueColor).
342pub use color::ColorType;
343
344/// Terminal text style — 13 attributes, fg/bg color, links, and combination logic.
345pub use style::Style;
346/// Stack of styles for nested markup — push/pop to track inheritance.
347pub use style::StyleStack;
348
349/// A piece of styled text with optional control codes — the smallest renderable unit.
350pub use segment::Segment;
351/// A collection of [`Segment`]s with convenience methods.
352pub use segment::Segments;
353
354/// Styled text with `Span` regions, markup support, and text manipulation methods.
355pub use text::Text;
356/// A styled region within a [`Text`] — defined by start/end offsets and a [`Style`].
357pub use text::Span;
358
359/// A named style map — look up styles by key (e.g. `"repr.number"`, `"markdown.h1"`).
360pub use theme::Theme;
361
362/// Horizontal alignment: `Left`, `Center`, `Right`, or `Full` (justified).
363pub use align::AlignMethod;
364/// Vertical alignment: `Top`, `Middle`, or `Bottom`.
365pub use align::VerticalAlignMethod;
366/// Wraps a renderable with horizontal and vertical alignment.
367pub use align::Align;
368
369/// Width measurement (minimum, maximum) returned by the layout protocol.
370pub use measure::Measurement;
371
372// -- Console -----------------------------------------------------------------
373
374/// The central rendering engine — prints renderables, manages terminal state.
375pub use console::Console;
376/// Options passed to renderables during the rendering pass (width, height, overflow, etc.).
377pub use console::ConsoleOptions;
378/// Terminal size in character cells (width × height).
379pub use console::ConsoleDimensions;
380/// How text overflow is handled: `Fold`, `Crop`, `Ellipsis`, or `Ignore`.
381pub use console::OverflowMethod;
382/// Trait for types that can be rendered to terminal output.
383pub use console::Renderable;
384/// The result of rendering: lines of segments plus nested renderable items.
385pub use console::RenderResult;
386/// Either a [`Segment`] or a nested renderable — produced during rendering.
387pub use console::RenderItem;
388/// A type-erased, cloneable wrapper around any [`Renderable`].
389pub use console::DynRenderable;
390/// Renders multiple renderables sequentially as one unit.
391pub use console::Group;
392/// Returns a mutex-guarded reference to the global (singleton) [`Console`].
393pub use console::get_console;
394/// Drop-in replacement for `println!` that uses the global console.
395pub use console::print_objects as print;
396/// Print a markup string (e.g. `"[bold red]text[/bold red]"`) via the global console.
397pub use console::print_str;
398/// Pretty-print a `serde_json::Value` via the global console.
399pub use console::print_json_val as print_json;
400
401// -- Box drawing -------------------------------------------------------------
402
403/// A box/border style defined by 32 corner and edge characters.
404pub use box_drawing::BoxStyle;
405#[doc(no_inline)]
406pub use box_drawing::{
407    BOX_ROUNDED, BOX_SQUARE, BOX_HEAVY, BOX_HEAVY_EDGE, BOX_HEAVY_HEAD,
408    BOX_DOUBLE, BOX_DOUBLE_EDGE, BOX_SIMPLE, BOX_SIMPLE_HEAVY,
409    BOX_MINIMAL, BOX_MINIMAL_HEAVY, BOX_ASCII, BOX_ASCII2,
410    BOX_SQUARE_DOUBLE_HEAD, BOX_MINIMAL_DOUBLE_HEAD, BOX_SIMPLE_HEAD,
411    BOX_ASCII_DOUBLE_HEAD,
412};
413
414// -- Renderables -------------------------------------------------------------
415
416/// A bordered container with optional title, subtitle, border style, and padding.
417pub use panel::Panel;
418/// Tabular data widget with headers, footers, colspan/rowspan, and 17 box styles.
419pub use table::Table;
420/// A column definition for a [`Table`] — header, footer, width, alignment, ratio.
421pub use table::Column;
422/// A table cell with optional style, colspan, and rowspan.
423pub use table::Cell;
424
425/// A hierarchical tree with Unicode or ASCII branch guides.
426pub use tree::Tree;
427/// A horizontal divider line with optional centered, left-, or right-aligned title.
428pub use rule::Rule;
429/// CSS-style padding (1–4 side values) around any renderable.
430pub use padding::Padding;
431/// Padding dimension specification: 1, 2, or 4 values (like CSS).
432pub use padding::PaddingDimensions;
433/// Side-by-side column layout with equal-width and expand options.
434pub use columns::Columns;
435/// Recursive split-pane layout engine with ratio sizing.
436pub use layout::Layout;
437/// A node in the layout tree — either a `Split` or a `Leaf`.
438pub use layout::LayoutNode;
439/// Layout split direction: `Horizontal` (columns) or `Vertical` (rows).
440pub use layout::Direction;
441/// A screen region defined by x, y, width, and height.
442pub use layout::Region;
443
444// -- Progress ----------------------------------------------------------------
445
446/// Multi-task progress display with configurable column layouts.
447pub use progress::Progress;
448/// A single progress bar — renders as a filled bar with percentage.
449pub use progress::ProgressBar;
450/// A file wrapper that tracks read progress via a task in [`Progress`].
451pub use progress::ProgressFile;
452/// A tracked task within a [`Progress`] display — holds description, total, completed.
453pub use progress::Task;
454/// An iterator wrapper that automatically advances a progress task on each iteration.
455pub use progress::TrackIterator;
456
457/// Trait for progress column types — renders one cell per task.
458pub use progress_columns::ProgressColumn;
459/// Shows a progress bar for each task.
460pub use progress_columns::BarColumn;
461/// Shows "completed/total" as file sizes with a separator.
462pub use progress_columns::DownloadColumn;
463/// Shows the completed file size for each task.
464pub use progress_columns::FileSizeColumn;
465/// Shows "completed/total" with raw numbers.
466pub use progress_columns::MofNCompleteColumn;
467/// Shows a spinner (animated during active, checkmark when finished).
468pub use progress_columns::SpinnerColumn;
469/// Shows the completion percentage for each task.
470pub use progress_columns::TaskProgressColumn;
471/// Shows a formatted text field from task metadata.
472pub use progress_columns::TextColumn;
473/// Shows the elapsed time for each task.
474pub use progress_columns::TimeElapsedColumn;
475/// Shows the estimated remaining time for each task.
476pub use progress_columns::TimeRemainingColumn;
477/// Shows the total file size for each task.
478pub use progress_columns::TotalFileSizeColumn;
479/// Shows the transfer speed for each task.
480pub use progress_columns::TransferSpeedColumn;
481/// Format a byte count as a human-readable size string.
482pub use progress_columns::format_size;
483/// Format a bytes-per-second rate as a human-readable speed string.
484pub use progress_columns::format_speed;
485
486// -- Spinners ----------------------------------------------------------------
487
488/// An animated spinner — frames, interval, text, and style.
489pub use spinner::Spinner;
490/// A predefined spinner animation: slice of frame strings + frame interval.
491pub use spinner::SpinnerFrames;
492/// The default spinner (dots).
493pub use spinner::DEFAULT_SPINNER;
494/// Look up a spinner by name (case-insensitive).
495pub use spinner::get_spinner;
496/// All registered spinners as a slice of (name, spinner) pairs.
497pub use spinner::SPINNERS;
498#[doc(no_inline)]
499pub use spinner::{
500    SPINNER_ARC, SPINNER_ARROW, SPINNER_ARROW2, SPINNER_ARROW3,
501    SPINNER_BOUNCING_BAR, SPINNER_BOUNCING_BALL,
502    SPINNER_CHRISTMAS, SPINNER_CIRCLE, SPINNER_CLOCK,
503    SPINNER_EARTH, SPINNER_GRENADE,
504    SPINNER_GROW_HORIZONTAL, SPINNER_GROW_VERTICAL,
505    SPINNER_HAMBURGER, SPINNER_HEARTS, SPINNER_MONKEY,
506    SPINNER_NOISE, SPINNER_PONG, SPINNER_RUNNER, SPINNER_SHARK,
507    SPINNER_TOGGLE, SPINNER_TRIANGLE, SPINNER_VERTICAL_BARS,
508};
509
510// -- Prompts -----------------------------------------------------------------
511
512/// String input prompt with optional password mode and choice validation.
513pub use prompt::Prompt;
514/// Base configuration shared by all prompt types.
515pub use prompt::PromptBase;
516/// Error type for prompt operations: invalid response, I/O error, or cancellation.
517pub use prompt::PromptError;
518/// Integer input prompt — loops until a valid i64 is entered.
519pub use prompt::IntPrompt;
520/// Floating-point input prompt — loops until a valid f64 is entered.
521pub use prompt::FloatPrompt;
522/// Yes/no confirmation prompt with configurable default answer.
523pub use prompt::Confirm;
524/// Numbered-choice selection prompt — user picks from a list by number.
525pub use prompt::Select;
526
527/// An animated spinner with a status message, refreshed in-place via carriage return.
528pub use status::Status;
529
530/// Auto-updating display region — refreshs content at a configurable rate.
531pub use live::Live;
532/// A writer that captures output for display within a [`Live`] region.
533pub use live::LiveWriter;
534
535/// Full-screen renderable — fills the terminal and crops/pads to fit.
536pub use screen::Screen;
537/// RAII guard for the alternate screen buffer — enters on creation, exits on drop.
538pub use screen::ScreenContext;
539/// Wraps a renderable for screen updates at a specific x/y offset.
540pub use screen::ScreenUpdate;
541
542// -- Content rendering -------------------------------------------------------
543
544/// Syntax-highlighted code block — language, theme, line numbers, word wrap.
545pub use syntax::Syntax;
546/// Render a markdown string into a [`MarkdownRender`].
547pub use markdown::render_markdown;
548/// A markdown document renderable — headings, code, lists, blockquotes, tables.
549pub use markdown::MarkdownRender;
550/// Render a `serde_json::Value` into a [`JsonRender`].
551pub use json::render_json;
552/// Pretty-printed, syntax-highlighted JSON renderable.
553pub use json::JsonRender;
554
555/// A logging handler for the `log` crate — renders records with Rich styling.
556pub use logging::RichHandler;
557
558/// Rich exception traceback — box-drawn, with source code context and locals.
559pub use traceback::Traceback;
560/// A chain of exceptions — one or more [`Stack`]s of [`Frame`]s.
561pub use traceback::Trace;
562/// One exception level in a traceback — type, value, frames, notes.
563pub use traceback::Stack;
564/// A single stack frame — file, line number, function name, source line, locals.
565pub use traceback::Frame;
566/// Install a global panic hook that renders Rich-formatted tracebacks to stderr.
567pub use traceback::install;
568
569/// Trait for text highlighters — takes a [`Text`] and returns a styled [`Text`].
570pub use highlighter::Highlighter;
571/// Highlights Python-repr-like output: URLs, numbers, paths, quoted strings.
572pub use highlighter::ReprHighlighter;
573/// A no-op highlighter that returns text unchanged.
574pub use highlighter::NullHighlighter;
575/// Highlights text using regex patterns mapped to styles.
576pub use highlighter::RegexHighlighter;
577
578// -- Export ------------------------------------------------------------------
579
580/// Export rendered output as a full HTML document.
581pub use export::export_html;
582/// Export rendered output as HTML and save to a file.
583pub use export::save_html;
584/// Options for HTML export: font, font size, line height, theme, code styling.
585pub use export::ExportHtmlOptions;
586/// Export rendered output as an SVG document with terminal chrome.
587pub use export::export_svg;
588/// Export rendered output as SVG and save to a file.
589pub use export::save_svg;
590/// Options for SVG export: font, font size, theme, dimensions, code styling.
591pub use export::ExportSvgOptions;
592/// Export rendered output as plain text (optionally strip ANSI escapes).
593pub use export::export_text;
594/// Export rendered output as plain text and save to a file.
595pub use export::save_text;
596/// Options for text export: text content and ANSI strip flag.
597pub use export::ExportTextOptions;
598/// A terminal color theme for HTML/SVG export (background, foreground, ANSI palette).
599pub use export::ExportTheme;
600/// Monokai export theme.
601pub use export::EXPORT_THEME_MONOKAI;
602/// Dimmed Monokai export theme.
603pub use export::EXPORT_THEME_DIMMED_MONOKAI;
604/// Night Owlish export theme.
605pub use export::EXPORT_THEME_NIGHT_OWLISH;
606/// SVG-optimized export theme.
607pub use export::EXPORT_THEME_SVG;
608/// Convert segments to HTML spans with inline CSS.
609pub use export::segments_to_html;
610/// Escape text for safe HTML embedding.
611pub use export::escape_html;
612/// Strip ANSI escape sequences from a string.
613pub use export::strip_ansi_escapes;
614/// HTML document template string.
615pub use export::CONSOLE_HTML_FORMAT;
616/// SVG document template string.
617pub use export::CONSOLE_SVG_FORMAT;
618
619/// Parse a BBCode-like markup string and return a styled [`Text`].
620pub use markup::render as render_markup;
621/// Escape square brackets in a string so they are not interpreted as markup tags.
622pub use markup::escape as escape_markup;