Crate tui_markdown

Crate tui_markdown 

Source
Expand description

A simple markdown renderer widget for Ratatui.

This module provides a simple markdown renderer widget for Ratatui. It uses the pulldown-cmark crate to parse markdown and convert it to a Text widget. The Text widget can then be rendered to the terminal using the ‘Ratatui’ library.

§Features

  • highlight-code (enabled by default) — Enable syntax highlighting using syntect and ansi-to-tui

§Example

use ratatui::text::Text;
use tui_markdown::from_str;

let markdown = r#"
This is a simple markdown renderer for Ratatui.

- List item 1
- List item 2

```rust
fn main() {
    println!("Hello, world!");
}
```
"#;

let text = from_str(markdown);
frame.render_widget(text, frame.area());

Structs§

DefaultStyleSheet
The default style set
Options
Collection of optional parameters that influence markdown rendering.

Traits§

StyleSheet
A collection of ratatui_core::style::Styles consumed by the renderer.

Functions§

from_str
Render Markdown input into a [ratatui::text::Text] using the default Options.
from_str_with_options
Render Markdown input into a [ratatui::text::Text] using the supplied Options.