Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RenderYAML ¶
func RenderYAML(node *AnnotatedNode, theme Theme, opts RenderOptions) string
RenderYAML turns an AnnotatedNode tree into syntax-highlighted YAML with colored backgrounds on changed lines.
Types ¶
type AnnotatedNode ¶
type AnnotatedNode struct {
Value any
Change ChangeType
Children map[string]*AnnotatedNode
List []*AnnotatedNode
}
AnnotatedNode represents a single node in the diff tree.
A node is exactly one of: a map (Children is set), a list (List is set), or a scalar leaf (Value is set). Change records what happened to the node between the old and new versions.
func Diff ¶
func Diff(a, b map[string]any) *AnnotatedNode
Diff compares two maps and returns a tree where every node is annotated with a ChangeType. Pass the result to RenderYAML to get highlighted output.
type RenderOptions ¶
type RenderOptions struct {
IndentSize int
EnableBackgroundHighlight bool
// ChangesOnly, when true, omits map keys and list items that have no
// changes anywhere in their subtree, producing a compact diff that shows
// only what changed (with the surrounding path kept for context).
ChangesOnly bool
}
Click to show internal directories.
Click to hide internal directories.