| Crates.io | tui-markdown |
| lib.rs | tui-markdown |
| version | 0.3.7 |
| created_at | 2024-02-27 09:57:18.66201+00 |
| updated_at | 2025-12-27 21:00:03.595297+00 |
| description | A simple library for converting markdown to a Rataui Text value |
| homepage | |
| repository | https://github.com/joshka/tui-markdown |
| max_upload_size | |
| id | 1154968 |
| size | 94,967 |
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
cargo add tui-markdown
let input = "# Heading\n\n**bold**"; // this can come from whereever
let text = tui_markdown::from_str(input);
text.render(area, &mut buf);
This is working code, but not every markdown feature is supported. PRs welcome!
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(),
])
);
Copyright (c) 2024 Josh McKinney
This project is licensed under either of
at your option.
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.