Skip to content

smelt.render

Tier: UiHost - Requires a terminal UI; calling these from headless mode raises.

Visibility: Public - Stable Lua API intended for user config and plugins.

Paint text / markdown / syntax-highlighted code / split diffs into a Buf. UiHost-only.

smelt.render.diff_split

fun(left: smelt.buf.Buf, right: smelt.buf.Buf, opts: smelt.render.DiffSplitOpts): nil

Types: smelt.buf.Buf, smelt.render.DiffSplitOpts

Paint a side-by-side diff between opts.old and opts.new into two buffers. Both buffers end up with the same row count; synthetic padding rows align them. Pick syntax via opts.lang or opts.path.

smelt.render.markdown

fun(buf: smelt.buf.Buf, source: string): nil

Types: smelt.buf.Buf

Render markdown source into the buffer using the same renderer the transcript uses for assistant text blocks.

smelt.render.syntax

fun(buf: smelt.buf.Buf, opts: smelt.render.SyntaxOpts): nil

Types: smelt.buf.Buf, smelt.render.SyntaxOpts

Paint syntect-highlighted code from opts.content into the buffer as a plain block. Pick syntax via opts.lang or opts.path. Unknown languages fall back to plain text.

smelt.render.text

fun(buf: smelt.buf.Buf, content: string, opts: smelt.render.TextOpts?): nil

Types: smelt.buf.Buf, smelt.render.TextOpts

Paint plain text into a buffer. With no opts.hl_group, text renders as dim body. Pass opts.hl_group = "ErrorMsg" for errors, "SmeltAccent" for accent, or any registered theme group; the mapping is the caller's choice, not the renderer's. opts.width overrides the wrapping width for tool layouts rendered into narrower panes.