Skip to main content

Crate limner

Crate limner 

Source
Expand description

A ratatui markdown renderer with image placeholders, code blocks, styled headings, lists, blockquotes, links, and more.

§Quick start

Parse markdown into ratatui text lines ready for a Paragraph widget:

use limner::{render_markdown, MarkdownStyle};

let lines = render_markdown("# Hello **world**", &MarkdownStyle::default(), 80);
assert_eq!(lines.lines.len(), 1);

§Per-section alignment

Every block-level element has a corresponding *_alignment field. Set them to Alignment::Center, Alignment::Right, or Alignment::Justify to control how that element is laid out:

use limner::{render_markdown, Alignment, MarkdownStyle};

let style = MarkdownStyle {
    paragraph_alignment: Alignment::Justify,
    heading_1_alignment: Alignment::Center,
    code_block_alignment: Alignment::Right,
    ..MarkdownStyle::default()
};

let _result = render_markdown("# Title\n\nLong paragraph here...", &style, 60);

See the MarkdownStyle struct and Alignment enum for all available options. The render_markdown function and MarkdownStyle struct for details.

Re-exports§

pub use render::render_markdown;
pub use render::render_markdown_with_extra;
pub use render::ImageInfo;
pub use render::LinkInfo;
pub use render::RenderResult;
pub use style::Alignment;
pub use style::MarkdownStyle;
pub use pulldown_cmark;

Modules§

layout
render
style