unified

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package unified renders AST-aware unified diffs.

Package unified renders AST-aware unified diffs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(srcFile, dstFile string, srcBytes, dstBytes []byte, env *serialize.Envelope, opts RenderOptions) string

Render formats the diff envelope as a unified diff with AST highlights and move markers.

Types

type RenderOptions

type RenderOptions struct {
	// Color turns ANSI styling on or off.
	Color bool
	// ContextLines sets how many surrounding lines to show (default: 3).
	ContextLines int
	// LineNumbers shows source and destination line numbers in the gutter.
	LineNumbers bool
	// DisableAnnotations hides AST move and shift badges from line output.
	DisableAnnotations bool
	// SuppressHunkFallbackAnnotation stops hunk headers from repeating the fallback tag when the file banner already shows it.
	SuppressHunkFallbackAnnotation bool
	// Wrap enables soft line wrapping to fit the terminal width.
	Wrap bool
	// TerminalWidth is the wrap boundary (0 to auto-detect from the terminal).
	TerminalWidth int
	// TabWidth sets spaces per tab stop (default: 4).
	TabWidth int
	// SrcLabel is an optional label appended to the source file header.
	SrcLabel string
	// DstLabel is an optional label appended to the destination file header.
	DstLabel string
	// ShowStyleChanges displays changes that only differ in whitespace or formatting.
	ShowStyleChanges bool
}

RenderOptions controls how we render the unified diff.

Jump to

Keyboard shortcuts

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