limner
A ratatui markdown renderer with image placeholders, styled headings, code blocks, and more.
[]
= "0.1"
Usage
use ;
use ;
let content = "# Hello\n\nThis is **markdown** with `code`.";
let style = MarkdownStyle ;
let lines = render_markdown;
let paragraph = new.wrap;
Output lines work directly with ratatui's Paragraph widget — scrolling,
line counting, and word-wrapping are all handled by the existing widget.
Features
- Headings (levels 1–3) with configurable styles
- Bold, italic, strikethrough with proper nesting
- Inline code and code blocks with full-width background
- Links with styled text and prefix
- Images rendered as placeholder text (
🖼 alt-text) - Blockquotes with per-line indicators
- Ordered and unordered lists
- Horizontal rules
- Lightweight — only depends on
ratatui,pulldown-cmark, andunicode-width - Terminal image rendering (optional) — via
image-protocolfeature; requires a terminal that supports Kitty graphics protocol, Sixel, or iTerm2
Terminal image rendering
Enable the image-protocol feature to render images via the terminal's native
graphics protocol (Kitty, Sixel, or iTerm2):
[]
= { = "0.1", = ["image-protocol"] }
Images in markdown () are tracked as ImageInfo metadata.
After drawing the ratatui frame, call prepare_inline_images() to insert
Image widgets at the correct positions:
use ;
use HashMap;
let result = render_markdown;
let mut protocol_cache = new;
let picker = from_query_stdio?;
let font_size = picker.font_size;
let placements = prepare_inline_images;
// Then render Image widgets inside terminal.draw() using the placements.
The caller is responsible for populating the image_cache
(HashMap<String, DynamicImage>).
Demo
# Text-only (no image rendering required)
# With terminal image rendering (Kitty/Sixel/iTerm2)
Theming
MarkdownStyle exposes every element's [Style] and text prefix.
Set only the fields you want to override:
let my_style = MarkdownStyle ;
License
MIT