highlight

package
v0.6.0 Latest Latest
Warning

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

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

Documentation

Overview

Package highlight turns raw text into styled text for the Files page's read-only viewer. It is a display-layer concern only: the bytes are the file's own, the colors are the theme's.

It is deliberately a hand-rolled, line-oriented highlighter rather than a real parser or a lexer library. A compose file is the app's one file to color, pulling in Chroma for one language is a heavy dependency against the project's minimal-deps stance (see TODO.md's dropped jq), and a best-effort line highlighter is honest about YAML's hard parts - it tracks block scalars so a `command: |` body is not colored as if it were structure, and degrades to plain text on anything it does not recognize rather than coloring it wrongly.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func YAML

func YAML(content string) string

YAML returns content with syntax coloring applied as ANSI styling, using the active theme. The text itself is unchanged - every byte of the file is still there, in order - so the result is safe to scroll and to measure.

Colors come from appstyles.Active read fresh on each call, so a theme switch repaints the file on the next content load.

Types

This section is empty.

Jump to

Keyboard shortcuts

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