Documentation
¶
Index ¶
Constants ¶
const ( BodyMIMETypeHTML = "text/html" BodyMIMETypePlain = "text/plain" )
BodyMIMEType values understood by ProcessBody/ProcessBodyWithInline. Empty string means "unknown" — the renderer falls back to running markdownToHTML before HTML parsing, which is correct for plaintext-with-markdown bodies but can mangle complex HTML (e.g. tables with attribute-heavy <td style="...">).
Variables ¶
This section is empty.
Functions ¶
func ImageProtocolSupported ¶ added in v0.18.0
func ImageProtocolSupported() bool
ImageProtocolSupported checks if any supported image protocol terminal is detected.
func RenderImageToStdout ¶ added in v0.21.1
func RenderImageToStdout(placement *ImagePlacement, screenRow int, screenCol ...int)
RenderImageToStdout writes an image directly to stdout at the given screen row using cursor positioning. This bypasses bubbletea's cell-based renderer which cannot handle graphics protocol escape sequences.
The escape sequence and row count were captured at HTML processing time by prerenderImage, so this call is a plain stdout write with no decode.
func SixelSupported ¶ added in v0.36.0
func SixelSupported() bool
SixelSupported returns true if the terminal uses the Sixel graphics protocol.
Types ¶
type ImagePlacement ¶ added in v0.21.1
type ImagePlacement struct {
Line int // Line number in the processed body text where the image starts
Rows int // Number of terminal rows the rendered image occupies (from termimage)
Encoded string // Cached terminal escape sequence from termimage (rendered once at layout time)
}
ImagePlacement holds the data needed to render an image at a specific line in the email body. Images are rendered directly to stdout (bypassing bubbletea's cell-based renderer which cannot handle graphics protocols).
Encoded and Rows are populated at HTML processing time by prerenderImage using termimage.DisplayWithSize, so paint-stage rendering is a plain stdout write and layout-stage row reservation matches the rendered output exactly.
func ProcessBody ¶
func ProcessBody(rawBody, mimeType string, h1Style, h2Style, bodyStyle lipgloss.Style, disableImages bool) (string, []ImagePlacement, error)
ProcessBody takes a raw email body, decodes it, and formats it as plain text with terminal hyperlinks. mimeType is "text/html", "text/plain", or "" (unknown — falls back to legacy markdown→HTML pre-pass).
func ProcessBodyWithInline ¶ added in v0.11.0
func ProcessBodyWithInline(rawBody, mimeType string, inline []InlineImage, h1Style, h2Style, bodyStyle lipgloss.Style, disableImages bool) (string, []ImagePlacement, error)
ProcessBodyWithInline renders the body and resolves CID inline images when provided. Returns the rendered body text, image placements for out-of-band rendering, and any error. mimeType is "text/html", "text/plain", or "" (unknown — falls back to legacy markdown→HTML pre-pass).