A Rust library providing markdown rendering, collapsible JSON/TOML tree views, and a rich hybrid scroll system — all built on top of ratatui.
Features
- Markdown rendering — parse and render markdown to styled
ratatui::text::Lines, with support for headings, lists, code blocks, blockquotes, tables, and inline formatting (bold, italic, inline code) - Collapsible trees — parse JSON or TOML into interactive collapsible trees with expand/collapse, styled keys, and keyboard navigation
- Hybrid scroll system — dual-mode scrolling: free-scroll for exploring content, engaged mode for navigating focusable items
- MarkdownPreview widget — unified widget that combines markdown rendering, tree views, and action items into a single scrollable view
- RichTheme — fully themeable via the
RichTextThemetrait: 15+ color slots for text, borders, JSON values, popups, and more - CJK-aware text wrapping — correct width calculation for CJK characters via
unicode-width - TOML frontmatter support — optionally strip
+++-delimited TOML frontmatter from rendered content
Quick Start
Prerequisites
- Rust 1.74+
- ratatui 0.29
Installation
[]
= "0.1"
For the full feature set (enabled by default):
[]
= { = "0.1", = ["preview"] }
Individual features can be enabled selectively:
| Feature | Description |
|---|---|
markdown |
Markdown parsing and rendering |
scroll |
Hybrid scroll and scrollable widgets |
tree |
JSON/TOML collapsible tree (requires scroll) |
preview |
MarkdownPreview unified widget (requires all) |
Example
use ;
// Parse and render markdown to ratatui Lines
use MarkdownRenderer;
let md = new;
let blocks = md.parse;
let lines = md.render;
// Render a collapsible JSON tree
use CollapsibleTree;
let mut tree = from_json_str.unwrap;
let lines = tree.render_lines;
let focusable = tree.build_focusable_items;
tree.toggle; // collapse/expand
Documentation
- Getting Started
- Markdown Module
- Scroll System
- Tree View
- Preview Widget
- Theme Customization
- API Reference
- Multilingual docs under
docs/guides/(en, zhs, zht, ja, ko, fr, es, ru, ar)
License
Dual-licensed under MIT OR Apache-2.0.