Skip to main content

Module render

Module render 

Source
Expand description

Assistant markdown rendering: streaming terminal renderer for model output.

Port of the “Assistant Markdown Rendering” section of refs/ds4/ds4_agent.c. The renderer handles only the cheap markdown cues that make terminal output readable: **bold**, *italic*, inline code, and fenced code blocks with a kilo-style keyword highlighter. It is a streaming parser, so it buffers only ambiguous marker bytes long enough to decide whether they are formatting or literal text. It also hides <think> tags and renders thinking text grey.

Structs§

RenderOptions
Options controlling the token renderer’s output.
Syntax
One language entry of the poor man’s code highlighter.
TailCapture
Ring buffer recording the last N output bytes plus a total byte count.
TokenRenderer
Streaming markdown-aware terminal renderer for assistant output.

Functions§

syntax_for_lang
Looks up a syntax entry by language name or alias, defaulting to generic.
syntax_for_path
Looks up a syntax entry from a file path’s basename and extension.