Documentation
¶
Index ¶
- func Normalize(in string) (string, error)
- type ChromaRenderer
- func (gr *ChromaRenderer) FindMatchesInContent(content string)
- func (gr *ChromaRenderer) GetCurrentSelectedMatch() int
- func (gr *ChromaRenderer) GetMatches() []MatchPosition
- func (gr *ChromaRenderer) RenderContent(yaml string, width int) (string, error)
- func (gr *ChromaRenderer) SetCurrentSelectedMatch(index int)
- func (gr *ChromaRenderer) SetFormatter(name string)
- func (gr *ChromaRenderer) SetSearchTerm(term string)
- type Document
- type MatchPosition
- type SearchHighlighter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChromaRenderer ¶
type ChromaRenderer struct {
// contains filtered or unexported fields
}
ChromaRenderer handles rendering content with chroma styling.
func NewChromaRenderer ¶
func NewChromaRenderer(t *theme.Theme, lineNumbersDisabled bool) *ChromaRenderer
NewChromaRenderer creates a new ChromaRenderer.
func (*ChromaRenderer) FindMatchesInContent ¶
func (gr *ChromaRenderer) FindMatchesInContent(content string)
FindMatchesInContent finds matches in the given content and stores them. This is useful when you need to find matches immediately rather than waiting for the next render.
func (*ChromaRenderer) GetCurrentSelectedMatch ¶
func (gr *ChromaRenderer) GetCurrentSelectedMatch() int
GetCurrentSelectedMatch returns the index of the currently selected match.
func (*ChromaRenderer) GetMatches ¶
func (gr *ChromaRenderer) GetMatches() []MatchPosition
GetMatches returns the current search matches.
func (*ChromaRenderer) RenderContent ¶
func (gr *ChromaRenderer) RenderContent(yaml string, width int) (string, error)
RenderContent renders YAML content with chroma styling.
func (*ChromaRenderer) SetCurrentSelectedMatch ¶
func (gr *ChromaRenderer) SetCurrentSelectedMatch(index int)
SetCurrentSelectedMatch sets the index of the currently selected match.
func (*ChromaRenderer) SetFormatter ¶
func (gr *ChromaRenderer) SetFormatter(name string)
SetFormatter sets the chroma formatter explicitly. This is primarily useful for testing.
func (*ChromaRenderer) SetSearchTerm ¶
func (gr *ChromaRenderer) SetSearchTerm(term string)
SetSearchTerm sets the search term and clears existing matches.
type Document ¶
type Document struct {
Object *kube.Object
// Value we filter against. This exists so that we can maintain positions
// of filtered items if titles are edited while a filter is active. This
// field is ephemeral, and should only be referenced during filtering.
FilterValue string
Body string
Title string
Desc string
}
func (*Document) BuildFilterValue ¶
func (m *Document) BuildFilterValue()
Generate the value we're doing to filter against.
type MatchPosition ¶
type MatchPosition struct {
Line int // 0-based line number.
Start int // 0-based character position within the line.
End int // 0-based character position within the line (exclusive).
Length int // Length of the match.
}
MatchPosition represents a search match position within the content.
type SearchHighlighter ¶
type SearchHighlighter struct {
// contains filtered or unexported fields
}
SearchHighlighter handles search-specific highlighting via *ansis.StyleEditor.
func NewSearchHighlighter ¶
func NewSearchHighlighter(highlightStyle, selectedHighlightStyle lipgloss.Style) *SearchHighlighter
NewSearchHighlighter creates a new SearchHighlighter.
func (*SearchHighlighter) ApplyHighlights ¶
func (sh *SearchHighlighter) ApplyHighlights(text string, matches []MatchPosition, selectedMatch int) string
ApplyHighlights applies search highlighting to content that already has chroma styling. It converts MatchPosition slices to [StyleRange] slices and delegates to the *ansis.StyleEditor.