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, images, and inline formatting (bold, italic, inline code) - Image support — resolve
images via theImageResolvertrait (feature-gated:image) - Custom rendering hooks — override rendering of any block type (headings, code blocks, lists, tables, etc.) via the
RenderHookstrait - 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.2"
For the full feature set (enabled by default):
[]
= { = "0.2", = ["preview"] }
Individual features can be enabled selectively:
| Feature | Description |
|---|---|
markdown |
Markdown parsing and rendering |
image |
Image resolution via ImageResolver trait (adds image crate) |
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
- Contributing
- API Reference
Languages
| Language | Documentation |
|---|---|
| English | docs/guides/en/ |
| 简体中文 | docs/guides/zhs/ |
| 繁體中文 | docs/guides/zht/ |
| 日本語 | docs/guides/ja/ |
| 한국어 | docs/guides/ko/ |
| Français | docs/guides/fr/ |
| Español | docs/guides/es/ |
| Русский | docs/guides/ru/ |
| العربية | docs/guides/ar/ |
License
Dual-licensed under MIT OR Apache-2.0.