Expand description
Validates the value a plugin’s render(ctx) function returns and
converts it into a RenderedSegment the layout engine can consume.
Return shape per docs/specs/plugin-api.md §Plugin return shape:
()(rhai unit) → hide this segment for this invocation- A map with
runs: [#{ text, role?, fg?, bold?, italic?, underline?, dim? }, ...]plus optionalwidthandright_separator
RenderedSegment is single-style, so multi-run input surfaces
as PluginError::MalformedReturn with a message pointing at the
limitation.
hyperlink threads through to Style.hyperlink so capable
terminals render the run as an OSC 8 link.
bg and width are silently accepted but not acted on: bg
requires a host Style field that doesn’t exist yet; width is
recomputed from rendered text. Silence is deliberate — a plugin
author who writes these fields for forward compatibility doesn’t
trigger a load error.
Functions§
- validate_
return - Convert a plugin’s render-return value into a
RenderedSegment.()yieldsOk(None)(segment hidden); any other shape mismatch yieldsPluginError::MalformedReturn.