Skip to main content

render_markdown

Function render_markdown 

Source
pub fn render_markdown(text: &str, wrap_width: u16) -> Vec<Line<'static>>
Expand description

Parse text as Markdown and return ratatui Lines for display.

Supported elements (minimum viable set):

  • Bold **text** → bold style
  • Italic *text* → italic style
  • Inline code `code`Color::Cyan
  • Fenced code blocks ``` → each line prefixed with in cyan
  • Unordered lists - item / * item → prefixed with
  • Ordered lists 1. item → prefixed with N.
  • Horizontal rules --- → a line of chars filling wrap_width
  • Plain paragraphs → rendered as-is

Falls back to a single raw line per \n if parsing produces no output (e.g. an empty string or whitespace-only input).