htmldiff

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diff

func Diff(input ghtmx.Component, expected string) (actual, diff string, err error)

func DiffCtx

func DiffCtx(ctx context.Context, input ghtmx.Component, expected string) (actual, diff string, err error)

func DiffStrings

func DiffStrings(expected, actual string) (output, diff string, err error)

DiffStrings compares expected and actual HTML after normalizing both sides: each is parsed with x/net/html and re-printed one node per line with insignificant whitespace collapsed, so formatting differences do not register as diffs. Returns the normalized actual value and the diff.

func Normalize

func Normalize(src string) (string, error)

Normalize parses src as an HTML document and prints it in a canonical form: one element per line, indented, with runs of whitespace in text collapsed to a single space. Text inside pre and textarea is preserved verbatim, since whitespace is significant there.

Types

This section is empty.

Jump to

Keyboard shortcuts

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