Skip to main content

Module markdown

Module markdown 

Source

Structs§

MdState
Parser state maintained across lines of a streamed response.

Functions§

finalize
Emit any still-buffered block (e.g., a table that ended without a following non-table line). Call at stream end.
finalize_with_width
Width-aware variant of finalize. See render_line_with_width.
flush_aligned_table
Flush a buffered markdown table as a column-aligned block. Computes the max display width per column, pads every cell accordingly, renders with // box chars in muted gray. Inline markdown inside cells is honoured.
flush_aligned_table_with_width
Width-aware variant. When max_width > 0 and the table can’t fit at its natural column widths, fall back to a flat key/value record format (header: cell per line, blank line between rows) so no information is lost to per-cell truncation. max_width = 0 keeps box-table rendering at natural widths regardless of size.
render_inline_line
Legacy single-line inline renderer — kept for direct callers (tests, simple assistant lines). Does not track block state.
render_line
Render one complete line with block- and inline-level markdown applied. Returns None if the line should be omitted from output (e.g., a fence marker ``` that toggles code-block state but isn’t itself visible text).
render_line_with_width
Width-aware variant of render_line. When max_width > 0, a flushed table’s column widths are capped so every line fits the budget — otherwise wrap_cells_to_width downstream chops long rows and shatters the table’s border structure. max_width = 0 keeps legacy behaviour.