yamls

package
v0.25.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Normalize

func Normalize(in string) (string, error)

Normalize text to aid in the filtering process. In particular, we remove diacritics, "ö" becomes "o". Title that Mn is the unicode key for nonspacing marks.

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, opts ...ChromaRendererOpt) *ChromaRenderer

NewChromaRenderer creates a new ChromaRenderer.

func (*ChromaRenderer) ClearDiffs added in v0.20.0

func (gr *ChromaRenderer) ClearDiffs()

func (*ChromaRenderer) ClearErrors added in v0.22.0

func (gr *ChromaRenderer) ClearErrors()

ClearErrors removes all error highlights.

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) SetError added in v0.22.0

func (gr *ChromaRenderer) SetError(startLine, startCol, endLine, endCol int)

SetError adds an error highlight at the specified position. If endLine is provided and differs from startLine, it handles multi-line errors.

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.

func (*ChromaRenderer) Unload added in v0.20.0

func (gr *ChromaRenderer) Unload()

Unload clears the current state of the renderer.

type ChromaRendererOpt added in v0.22.0

type ChromaRendererOpt func(*ChromaRenderer)

func WithInitialLineNumber added in v0.22.0

func WithInitialLineNumber(line int) ChromaRendererOpt

WithInitialLineNumber sets the initial line number for the renderer.

func WithLineNumbersDisabled added in v0.22.0

func WithLineNumbersDisabled(b bool) ChromaRendererOpt

WithLineNumbersDisabled disables line numbers in the renderer.

type DiffHighlighter added in v0.20.0

type DiffHighlighter struct {
	// contains filtered or unexported fields
}

DiffHighlighter handles diff-specific highlighting via *ansis.StyleEditor.

func NewDiffHighlighter added in v0.20.0

func NewDiffHighlighter(insertedStyle, deletedStyle, editedStyle lipgloss.Style) *DiffHighlighter

NewDiffHighlighter creates a new DiffHighlighter.

func (*DiffHighlighter) ApplyDiffHighlights added in v0.20.0

func (dh *DiffHighlighter) ApplyDiffHighlights(text string, diffs []DiffPosition) string

ApplyDiffHighlights applies diff highlighting to content that already has chroma styling. It converts DiffPosition slices to ansis.StyleRange slices and delegates to the *ansis.StyleEditor.

type DiffPosition added in v0.20.0

type DiffPosition 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).
	Type  DiffType // Type of change (added, removed, or changed).
}

DiffPosition represents a diff change position within the content.

type DiffType added in v0.20.0

type DiffType int

DiffType represents the type of diff change.

const (
	DiffInserted DiffType = iota
	DiffDeleted
	DiffEdited
)

type Differ added in v0.20.0

type Differ struct {
	// contains filtered or unexported fields
}

func NewDiffer added in v0.20.0

func NewDiffer() *Differ

NewDiffer creates a new Differ.

func (*Differ) ClearDiffs added in v0.20.0

func (dh *Differ) ClearDiffs()

ClearDiffs clears the current diff positions.

func (*Differ) FindAndCacheDiffs added in v0.20.0

func (dh *Differ) FindAndCacheDiffs(currentContent string) []DiffPosition

FindAndCacheDiffs calls Differ.FindDiffs, stores the diffs internally and re-returns them if the content hasn't changed.

func (*Differ) FindDiffs added in v0.20.0

func (dh *Differ) FindDiffs(currentContent string) []DiffPosition

FindAndCacheDiffs finds differences between the current content and the original content using go-udiff.

func (*Differ) GetDiffs added in v0.20.0

func (dh *Differ) GetDiffs() []DiffPosition

GetDiffs returns the current diff positions.

func (*Differ) SetInitialContent added in v0.20.0

func (dh *Differ) SetInitialContent(content string)

SetInitialContent sets the initial content for diff comparison.

func (*Differ) SetOriginalContent added in v0.20.0

func (dh *Differ) SetOriginalContent(content string)

SetOriginalContent sets the original content for diff comparison.

func (*Differ) Unload added in v0.20.0

func (dh *Differ) Unload()

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 ErrorHighlighter added in v0.22.0

type ErrorHighlighter struct {
	// contains filtered or unexported fields
}

ErrorHighlighter handles error-specific highlighting via *ansis.StyleEditor.

func NewErrorHighlighter added in v0.22.0

func NewErrorHighlighter(errorStyle lipgloss.Style) *ErrorHighlighter

NewErrorHighlighter creates a new ErrorHighlighter.

func (*ErrorHighlighter) ApplyErrorHighlights added in v0.22.0

func (eh *ErrorHighlighter) ApplyErrorHighlights(text string, errors []ErrorPosition) string

ApplyErrorHighlights applies error highlighting to content that already has chroma styling. It converts ErrorPosition slices to ansis.StyleRange slices and delegates to the *ansis.StyleEditor.

type ErrorPosition added in v0.22.0

type ErrorPosition 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).
}

ErrorPosition represents an error position within the content.

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).
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL