Documentation
¶
Index ¶
- Constants
- Variables
- func InfoStyle() lipgloss.Style
- func LoadTheme()
- func NewHuhExecCmd(fn func() error) tea.ExecCommand
- func NewPagerCmd(title, content string, contentType int) tea.Cmd
- func RenderChafa(url string, termWidth int) (string, error)
- func RenderITerm2(url string, termWidth int) (string, error)
- func RenderKitty(url string, _ int) (string, error)
- func RenderOSC8(alt, rawURL string) string
- func RunPager(title, content string, contentType int) error
- func RunTable(cfg TableConfig) error
- func StateStyle(state string) lipgloss.Style
- func TitleStyle() lipgloss.Style
- func Truncate(s string, maxWidth int) string
- type EditDoneMsg
- type FetchResultMsg
- type HelpKey
- type HuhExecCmd
- type ImageRef
- type RendererType
- type TableConfig
- type Theme
- type ViewAction
- type ViewErrorMsg
Constants ¶
const ( ContentMarkdown = 0 ContentDiff = 1 ContentPlain = 2 )
Variables ¶
Functions ¶
func NewHuhExecCmd ¶
func NewHuhExecCmd(fn func() error) tea.ExecCommand
func RenderChafa ¶
RenderChafa runs chafa to convert the image at url into unicode art sized to termWidth columns.
func RenderITerm2 ¶
RenderITerm2 encodes the image as an iTerm2 Inline Images Protocol sequence. Spec: https://iterm2.com/documentation-images.html
func RenderKitty ¶
RenderKitty encodes the image at url as a Kitty Graphics Protocol APC sequence (chunked base64, f=100 lets kitty auto-detect format from magic bytes). Spec: https://sw.kovidgoyal.net/kitty/graphics-protocol/
func RenderOSC8 ¶
RenderOSC8 returns an OSC 8 hyperlink so the user can click the image URL in terminals that support it (kitty, WezTerm, iTerm2, etc.).
func RunTable ¶
func RunTable(cfg TableConfig) error
func StateStyle ¶
func TitleStyle ¶
Types ¶
type EditDoneMsg ¶
type EditDoneMsg struct {
Err error
}
type FetchResultMsg ¶
type HuhExecCmd ¶
type HuhExecCmd struct {
// contains filtered or unexported fields
}
func (*HuhExecCmd) Run ¶
func (h *HuhExecCmd) Run() error
func (*HuhExecCmd) SetStderr ¶
func (h *HuhExecCmd) SetStderr(w io.Writer)
func (*HuhExecCmd) SetStdin ¶
func (h *HuhExecCmd) SetStdin(r io.Reader)
func (*HuhExecCmd) SetStdout ¶
func (h *HuhExecCmd) SetStdout(w io.Writer)
type ImageRef ¶
func ExtractImages ¶
ExtractImages returns all  references found in raw markdown.
type RendererType ¶
type RendererType int
const ( RendererNone RendererType = iota RendererChafa RendererKitty RendererITerm2 )
func DetectRenderer ¶
func DetectRenderer() RendererType
DetectRenderer probes the environment for image rendering capability. Priority: Kitty Graphics Protocol > iTerm2 Inline Images > chafa > none (OSC 8 hyperlink fallback).
func RenderImage ¶
func RenderImage(ref ImageRef, renderer RendererType, termWidth int) (string, RendererType)
RenderImage tries each renderer in priority order and returns the rendered content along with the renderer that succeeded.
type TableConfig ¶
type TableConfig struct {
Columns []table.Column
Rows []table.Row
Height int
HelpKeys []HelpKey
OnSelect func(row table.Row)
OnCopy func(row table.Row)
OnView func(row table.Row) tea.Cmd
OnDiff func(row table.Row) tea.Cmd
OnFetch func(row table.Row) tea.Cmd
OnEdit func(row table.Row) tea.ExecCommand
}
type Theme ¶
type Theme struct {
Accent lipgloss.Color
Border lipgloss.Color
HeaderFg lipgloss.Color
SelectedFg lipgloss.Color
SelectedBg lipgloss.Color
HelpKey lipgloss.Color
HelpDesc lipgloss.Color
Success lipgloss.Color
Error lipgloss.Color
Warning lipgloss.Color
GlamourStyle string
}
func ActiveTheme ¶
func ActiveTheme() Theme
type ViewErrorMsg ¶
type ViewErrorMsg struct {
Err error
}