23 releases
| 0.3.7 | Dec 27, 2025 |
|---|---|
| 0.3.6 | Nov 3, 2025 |
| 0.3.5 | May 7, 2025 |
| 0.3.3 | Mar 12, 2025 |
| 0.2.2 | Mar 2, 2024 |
#50 in Command-line interface
45,687 downloads per month
Used in 34 crates
(31 directly)
48KB
969 lines
Tui-markdown
An experimental Proof of Concept library for converting markdown content to a Ratatui Text
value. See Markdown-reader for an example application that uses this library.
GitHub Repository · API Docs · [Examples] · Changelog · Contributing
Installation
cargo add tui-markdown
Usage
let input = "# Heading\n\n**bold**"; // this can come from whereever
let text = tui_markdown::from_str(input);
text.render(area, &mut buf);
Status
This is working code, but not every markdown feature is supported. PRs welcome!
- Headings
- Heading attributes / classes / anchors
- Normal paragraphs
- Block quotes
- Nested block quotes
- Bold (strong)
- Italic (emphasis)
- Strikethrough
- Ordered lists
- Unordered lists
- Code blocks
- Html
- Footnotes
- Linebreak handling
- Rule
- Tables
- Tasklists
- Links
- Images
- Metadata blocks
- Superscript
- Subscript
Linebreaks are rendered with Markdown defaults: soft breaks become spaces, hard breaks insert a new line.
Metadata blocks are rendered using the metadata block style so front matter is visible, including
the delimiter lines (for example --- in YAML-style blocks).
use ratatui::text::Text;
use tui_markdown::from_str;
let markdown = r#"---
title: Demo
tags:
- one
- two
---
Body
"#;
let text = from_str(markdown);
assert_eq!(
text,
Text::from_iter([
"---".into(),
"title: Demo".into(),
"tags:".into(),
" - one".into(),
" - two".into(),
"---".into(),
"".into(),
"Body".into(),
])
);
License
Copyright (c) 2024 Josh McKinney
This project is licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
See CONTRIBUTING.md.
Dependencies
~12–19MB
~247K SLoC