Documentation
¶
Index ¶
- func RenderImage(data []byte, maxWidth, maxHeight int) (string, int, error)
- func RenderImageHalfBlock(data []byte, maxWidth, maxHeight int) (string, int, error)
- func RenderStyledText(text string, entities []tg.MessageEntityClass) string
- func RenderStyledTextMultiline(text string, entities []tg.MessageEntityClass, width int) string
- type ImageProtocol
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenderImage ¶ added in v0.2.0
RenderImage renders image data using the best available terminal protocol. Returns the rendered string and the number of lines.
func RenderImageHalfBlock ¶
RenderImageHalfBlock renders image data as half-block characters for terminal display. Uses U+2584 (Lower Half Block): top pixel = background color, bottom pixel = foreground color. Returns the rendered string and the number of lines.
func RenderStyledText ¶
func RenderStyledText(text string, entities []tg.MessageEntityClass) string
RenderStyledText applies Telegram entity formatting to message text, returning a styled string suitable for terminal display. Newlines are replaced with spaces so each message occupies one visual line.
func RenderStyledTextMultiline ¶
func RenderStyledTextMultiline(text string, entities []tg.MessageEntityClass, width int) string
RenderStyledTextMultiline applies Telegram entity formatting and preserves newlines. Long lines are word-wrapped to the given width (ANSI-aware).
Types ¶
type ImageProtocol ¶ added in v0.2.0
type ImageProtocol int
ImageProtocol represents the best available image rendering protocol.
const ( ProtoHalfBlock ImageProtocol = iota // Universal fallback ProtoKitty // Kitty graphics protocol ProtoIterm // iTerm2 inline images ProtoSixel // Sixel graphics )
func DetectImageProtocol ¶ added in v0.2.0
func DetectImageProtocol() ImageProtocol
DetectImageProtocol returns the best image protocol available in the current terminal.