Documentation
¶
Overview ¶
Package highlight renders safe, line-oriented ANSI emphasis for terminal output.
It is deliberately a presentation-only layer. Callers retain the original terminal bytes in Session and pass a separate output stream to Renderer. Its WinTerm-inspired semantic theme adapts to the local terminal's TrueColor, 256-color, or 16-color capability.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Renderer)
Option configures one Renderer.
func WithColorProfile ¶
WithColorProfile selects the ANSI color capability used for generated presentation styles. Callers should select the profile from the local output terminal; it does not describe the remote terminal.
type Renderer ¶
type Renderer struct {
// contains filtered or unexported fields
}
Renderer incrementally renders terminal text to one local output stream.
Renderer is not safe for concurrent use. One attached terminal client must own one Renderer and serialize Write and Flush calls around any unrelated local status output. It never modifies the caller's input slice.
func New ¶
New creates a Renderer that writes styled terminal output to output. It uses TrueColor unless an Option selects another local color profile.
A nil output discards rendered bytes. It is useful for callers that need to exercise parser behavior without a local terminal writer.
func (*Renderer) Flush ¶
Flush writes any incomplete terminal line and ends prompt-echo state. Callers invoke it before local status output or orderly disconnect so later remote prompts are rendered independently and output remains ordered.
func (*Renderer) Write ¶
Write accepts terminal bytes and forwards complete safe lines with ANSI emphasis. Unsafe line controls are forwarded unchanged. Remote escape sequences switch presentation to byte-transparent output until their line and any persistent SGR or alternate-screen state safely end.
A recognized shell prompt is emitted before a newline so a remote shell can remain interactive. The following echoed command is deliberately forwarded unchanged until its newline.