Skip to content

smelt.render

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

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: table): nil

Types: smelt.buf.Buf

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: table): nil

Types: smelt.buf.Buf

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: table?): nil

Types: smelt.buf.Buf

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.