syntax

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package syntax wraps chroma to emit ANSI-colored code that nests safely inside a lipgloss background-color span. The standard chroma TTY formatter terminates every token with ESC[0m (full SGR reset), which would clear the diff line's bg tint mid-row. We emit only foreground SGR plus a foreground-only reset (39) so an outer Background() stays intact.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Highlight

func Highlight(code, filePath string) string

Highlight returns code annotated with ANSI fg SGR escapes inferred from filePath. Output ends with "\x1b[39m" and contains no full resets, so wrapping it in a background span produces a continuous colored band. Unrecognised paths or lex errors return the input verbatim.

Types

This section is empty.

Jump to

Keyboard shortcuts

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