Help us shape the future of Go! Take the 2026 Go Developer Survey

dmp

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: BSD-3-Clause, MIT Imports: 3 Imported by: 0

Documentation

Overview

Package dmp provides an diffutils.InlineHighlighter implementation using Google's diff-match-patch algorithm (via sergi/go-diff) for character-level inline diff highlighting.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Highlighter

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

Highlighter implements diffutils.InlineHighlighter using diff-match-patch for character-level diffs between two lines.

func NewHighlighter

func NewHighlighter(args *HighlighterArgs) *Highlighter

NewHighlighter creates a Highlighter with optional configuration.

func (*Highlighter) HighlightInline

func (h *Highlighter) HighlightInline(oldLine, newLine string) (oldResult, newResult string)

HighlightInline returns old and new lines with ANSI escape sequences marking deleted and inserted characters respectively.

type HighlighterArgs

type HighlighterArgs struct {
	// DeletedColor is the ANSI color code for deleted characters (default: red "31").
	DeletedColor string
	// InsertedColor is the ANSI color code for inserted characters (default: green "32").
	InsertedColor string
}

HighlighterArgs holds configuration for NewHighlighter.

Jump to

Keyboard shortcuts

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