Skip to main content

render_markdown_table

Function render_markdown_table 

Source
pub fn render_markdown_table(
    header: &[String],
    body: &[Vec<String>],
    available_width: usize,
    indent: &str,
    body_color: Option<Color>,
) -> Vec<Line<'static>>
Expand description

Render a parsed markdown table as box-drawing styled Lines.

Why: Inline rendering keeps the table flush with surrounding chat text, avoiding a layout split for a ratatui Table widget. Box characters give a clean visual frame that scans well in monospaced fonts. What: Given header + body rows, computes per-column widths (max of header and any body cell), clamps total table width to available_width, and emits top border, header row, separator, body rows, bottom border. Border glyphs use Color::DarkGray; cell content uses body_color if provided. Test: tests::render_markdown_table_emits_expected_lines, tests::render_markdown_table_truncates_when_too_wide.