Documentation
¶
Overview ¶
Package diff registers the unified / git diff renderer with the stripes registry. Import for side effects to enable text/x-diff support:
import _ "github.com/firetiger-oss/stripes/diff"
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Render ¶
Render writes a styled rendering of the unified or git diff read from r to w. Hunk headers, file headers, additions, deletions, context lines, and the "\ No newline at end of file" marker are each styled from the matching slot in styles.
Parsing is delegated to github.com/bluekeyes/go-gitdiff so we don't reinvent unified-diff parsing; rendering is owned by stripes so the color slots stay consistent with the rest of the library. When the input does not parse as a diff at all (no files recognized), Render falls back to writing the bytes plain — the yaml renderer uses the same fall-back ethos. On successful parse the renderer colors the original input bytes line-by-line rather than re-serializing the parsed structure: this preserves quirks of the source (path prefixes, hunk-header comments, exact spacing) and avoids gitdiff's canonicalization of plain unified diffs.
Types ¶
This section is empty.