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

highlight

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package highlight provides small, terminal-safe syntax highlighting for human-facing previews. It deliberately does not alter source content or participate in scanning, token counts, or selection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(path string, content []byte, options Options) string

Render highlights complete content. It is intended for a terminal writer; callers must decide whether their output is a TTY before enabling it.

func RenderLine

func RenderLine(path, line string, options Options) string

RenderLine highlights one line. Keeping this operation line-local makes it suitable for the TUI, which can render only the visible preview rows.

Types

type Options

type Options struct {
	Enabled  bool
	Theme    Theme
	MaxBytes int
}

Options controls terminal highlighting.

type Theme

type Theme string
const (
	ThemeAuto  Theme = "auto"
	ThemeNone  Theme = "none"
	ThemeDark  Theme = "dark"
	ThemeLight Theme = "light"
)

Jump to

Keyboard shortcuts

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