Skip to content

smelt.layout

Tier: Host — Available in every runtime, including headless mode.

Composable block layout (vbox/hbox/leaf/diff/file_view) for tool render callbacks.

smelt.layout.diff

fun(opts: table): table

Inline-diff render directive — the worker renders the diff directly into the block buffer. opts.old, opts.new are the before/after strings; opts.path picks syntax via extension; opts.anchor (defaults to opts.old) is the diff-view anchor; opts.lang overrides path-based syntax.

smelt.layout.file_view

fun(opts: table): table

Syntax-highlighted file-view render directive — single line-number column, no diff bg. opts.content is the source text; opts.path picks syntax via extension; opts.lang overrides path-based syntax.

smelt.layout.hbox

fun(items: table): table

Lay items out horizontally. Each entry is either a layout userdata (defaults to fill weight 1) or { layout, cols=N } / { layout, weight=N } for a fixed-column or weighted slot.

smelt.layout.leaf

fun(buf: any): table

Wrap a Buf handle (or raw buf id) into a leaf block layout that renders the buffer's contents in place.

smelt.layout.markdown

fun(content: string): any

Build a leaf layout from a markdown string. Common pattern for render callbacks that want full block-level markdown (headings, fenced code, lists, tables) instead of plain dim body text.

smelt.layout.sep

fun(char: string?): any

Build a 1×1 leaf from a single glyph. Auto-repeats to fill the parent's axis: sep("│") in an hbox = vertical divider, sep("─") in a vbox = horizontal.

smelt.layout.text

fun(content: string, opts: table?): any

Build a leaf layout from a string. Common pattern for render callbacks.

smelt.layout.vbox

fun(items: table): table

Stack items vertically into a single block layout. Each item must be a layout userdata produced by layout.leaf/layout.vbox/layout.hbox/layout.diff/layout.file_view.