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

highlight

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package highlight applies chroma syntax highlighting to diff content, picking a lexer from the file path. Highlighting is best effort: a path with no known lexer renders unstyled.

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 provides syntax highlighting for code.

func New

func New() *Highlighter

New creates a new syntax highlighter.

func (*Highlighter) HighlightLine

func (h *Highlighter) HighlightLine(filePath, line string) string

HighlightLine applies syntax highlighting to a single line of code filePath is used to detect the language Returns the highlighted line with lipgloss styling.

func (*Highlighter) IsEnabled

func (h *Highlighter) IsEnabled(filePath string) bool

IsEnabled returns whether syntax highlighting is available for a file.

Jump to

Keyboard shortcuts

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