Documentation
¶
Overview ¶
Package render turns session content into pre-styled, pre-wrapped terminal lines: markdown through a goldmark AST walk, fenced code through a chroma highlighter bucketed into the theme's syntax roles, and file changes through a width-adaptive diff view. Everything it returns obeys the screen contract: each string is one terminal row no wider than the given width, and every styled span is self-contained (prefix, text, reset), so the output can be committed to scrollback or repainted in the live region without any escape-state bookkeeping.
The package is pure: no clock, no terminal, nothing mutated per render. The same source at the same width always renders to the same lines, which keeps it property-testable and safe to call from a replayed session.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Diff ¶
Diff renders the change from before to after as themed terminal lines: a header naming the path with added and removed counts, then hunks with line-number gutters. The layout adapts to width: side-by-side columns on a wide terminal, unified below that. Paired changed lines carry a word-level highlight (reverse video over the add and remove styles) so a one-token edit inside a long line is findable at a glance.
Types ¶
type Markdown ¶
type Markdown struct {
// contains filtered or unexported fields
}
Markdown renders markdown source to themed terminal lines. It understands the GFM constructs the session actually meets in model output: headings, paragraphs, fenced and indented code (syntax-highlighted), blockquotes, nested ordered and unordered lists, task lists, tables, thematic breaks, links, images, emphasis, strikethrough, and inline code. Unknown or raw HTML degrades to muted plain text, never to dropped content.
func NewMarkdown ¶
NewMarkdown returns a renderer bound to a theme. The parser is retained because goldmark parsers are expensive to build and safe to reuse.