render

package
v0.58.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package render provides pure rendering functions for message blocks. These functions are stateless and can be used by both streaming and historical message rendering paths, eliminating code duplication.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssistantBlock

func AssistantBlock(content string, width int, theme style.Theme) string

AssistantBlock renders an assistant message with markdown styling.

func CustomBlock added in v0.58.1

func CustomBlock(content, label string, width int, theme style.Theme) string

CustomBlock renders a message with herald Note styling and a custom label. Content is rendered as markdown before being wrapped in the alert. This creates a one-off Typography instance with the given label so callers can use any title (e.g. "Help", "Warning") without changing the shared typography's default "Info" label.

func ErrorBlock

func ErrorBlock(errorMsg string, ty *herald.Typography, theme style.Theme) string

ErrorBlock renders an error message with herald Caution styling.

func HighlightFileTokens added in v0.58.1

func HighlightFileTokens(text string, theme style.Theme) string

HighlightFileTokens wraps @file tokens in the given text with the theme accent color so they stand out visually in rendered user messages.

func ReasoningBlock

func ReasoningBlock(content string, duration int64, width int, ty *herald.Typography, theme style.Theme) string

ReasoningBlock renders a reasoning/thinking block with muted italic text. If duration > 0, shows "Thought for Xs" label. Otherwise shows just "Thought". The width parameter controls soft-wrapping so long reasoning lines don't get cut off.

func SystemBlock

func SystemBlock(content string, ty *herald.Typography, theme style.Theme) string

SystemBlock renders a system message with herald Note styling.

func ToolBlock

func ToolBlock(displayName, params, body string, isError bool, width int, ty *herald.Typography, theme style.Theme) string

ToolBlock renders a tool execution result with header and body.

func UserBlock

func UserBlock(content string, width int, ty *herald.Typography, theme style.Theme) string

UserBlock renders a user message with herald Tip styling. The width parameter controls line wrapping so long messages don't overflow. Any @file tokens in the content are highlighted with the theme accent color.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL