Documentation
¶
Overview ¶
Package markdown renders the final assistant answer as styled terminal output. It is the one markdown renderer in the program: Writer.Assistant is the only caller in non-test code.
Rendering never fails a turn. Render returns the styled answer, or the input unchanged when the input is empty, oversized, or the renderer errors. Whether to render at all is decided by the caller (see ui.Writer), so this package does no TTY or environment checks itself: Render always styles, which also keeps it deterministic under test.
Index ¶
Constants ¶
const MaxInputBytes = 256 * 1024
MaxInputBytes caps the answer Render will style. Above it the raw markdown goes through unchanged: a huge report still prints, it just does not get colors. 256 KiB is far above any report worth styling line by line, and glamour on a pathological input must not stall a turn.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Mode ¶
type Mode string
Mode selects when the final answer is styled.
const ( // ModeAuto styles only on a terminal: stdout is a TTY and neither // NO_COLOR nor TERM=dumb opts out. Piped output stays raw markdown. ModeAuto Mode = "auto" // ModeAlways styles even when piped. Explicit opt-out; scripts that // parse stdout should keep the default. ModeAlways Mode = "always" // ModeNever prints raw markdown, exactly as before rendering existed. ModeNever Mode = "never" )