
Markdown rendering, Mermaid diagrams, syntax highlighting, collapsible trees, and rich scroll widgets for ratatui
<a href="https://github.com/celestia-island/ratatui-markdown/blob/dev/README.md">English</a> |
<a href="https://github.com/celestia-island/ratatui-markdown/blob/dev/docs/guides/zhs/index.md">简体中文</a> |
<a href="https://github.com/celestia-island/ratatui-markdown/blob/dev/docs/guides/zht/index.md">繁體中文</a> |
<a href="https://github.com/celestia-island/ratatui-markdown/blob/dev/docs/guides/ja/index.md">日本語</a> |
<a href="https://github.com/celestia-island/ratatui-markdown/blob/dev/docs/guides/ko/index.md">한국어</a> |
<a href="https://github.com/celestia-island/ratatui-markdown/blob/dev/docs/guides/fr/index.md">Français</a> |
<a href="https://github.com/celestia-island/ratatui-markdown/blob/dev/docs/guides/es/index.md">Español</a> |
<a href="https://github.com/celestia-island/ratatui-markdown/blob/dev/docs/guides/ru/index.md">Русский</a> |
<a href="https://github.com/celestia-island/ratatui-markdown/blob/dev/docs/guides/ar/index.md">العربية</a>
A Rust library providing markdown rendering, Mermaid diagrams, syntax highlighting, collapsible JSON/TOML tree views, and a rich hybrid scroll system — all built on top of ratatui.
ratatui::text::Lines, with support for headings, lists, code blocks, blockquotes, tables, images, and inline formatting (bold, italic, inline code)```mermaid code blocks (feature-gated: mermaid)highlight-lang-*) images via the ImageResolver trait (feature-gated: image)RenderHooks traitRichTextTheme trait: 15+ color slots for text, borders, JSON values, popups, and moreunicode-width+++-delimited TOML frontmatter from rendered content[dependencies]
ratatui-markdown = "0.3"
For the full feature set (enabled by default):
[dependencies]
ratatui-markdown = { version = "0.3", features = ["preview"] }
Individual features can be enabled selectively:
| Feature | Description | Default |
|---|---|---|
markdown |
Markdown parsing and rendering | ✓ |
image |
Image resolution via ImageResolver trait |
✓ |
scroll |
Hybrid scroll and scrollable widgets | ✓ |
tree |
JSON/TOML collapsible tree (requires scroll) |
✓ |
preview |
MarkdownPreview unified widget (requires markdown, scroll, tree) |
✓ |
mermaid |
Mermaid diagram rendering (requires markdown) |
✓ |
viewer |
MarkdownViewer widget (requires markdown, scroll) |
✓ |
highlight |
Syntax highlighting via tree-sitter | |
highlight-lang-* |
Individual language grammars (requires highlight) |
|
highlight-lang-all |
All bundled language grammars |
| Example | Description | Features required |
|---|---|---|
basic |
Minimal markdown rendering | — |
code |
Syntax-highlighted code blocks | highlight-lang-all |
custom_code_block |
Custom code block rendering hooks | — |
image |
Image embedding and zoom | image |
mermaid |
Mermaid diagram rendering | mermaid |
tree_list |
Collapsible JSON/TOML tree view | — |
cargo run --example basic
cargo run --example code --features highlight-lang-all
cargo run --example image
cargo run --example mermaid
cargo run --example tree_list
Dual-licensed under MIT OR Apache-2.0.
$ claude mcp add ratatui-markdown \
-- python -m otcore.mcp_server <graph>