Skip to main content

Module markdown

Module markdown 

Source
Expand description

Inline-markdown renderer for assistant messages.

Handles the constructs that come up most in LLM responses:

  • bold (**...**)
  • italic / italic (*...*, _..._)
  • inline code (`...`)
  • line-level heading (# , ## , …)
  • fenced code block with syntax highlighting via syntect
  • simple bullet (- / * )
  • Markdown table (|col1|col2| + |---|---|)

Public entry points:

  • render_inline — single-line inline markdown → Vec<Span<'static>>
  • render_table — slice of table-row lines → Vec<Line<'static>>

Structs§

MdState
State carried across consecutive lines so fenced code blocks can span multiple lines.
RenderedLine
Result of rendering a single line.

Functions§

is_table_line
Returns true when the line should be treated as part of a Markdown table (starts with | after optional whitespace, or contains |).
render_inline
Render one logical line of markdown-ish text into styled spans.
render_markdown
Parse text as Markdown and return ratatui Lines for display.
render_table
Render a Markdown table (sequence of |...| lines, including the optional |---|---| separator row) into a set of styled Lines.