render

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTheme = "claude"

Variables

This section is empty.

Functions

func AccentColor

func AccentColor(theme string) string

AccentColor returns the primary accent (heading) color for the theme. Used for UI chrome — borders, filename label, etc.

func AvailableThemes

func AvailableThemes() []string

AvailableThemes returns the list of theme names recognized by the renderer.

func IsMarkdown

func IsMarkdown(filename string) bool

IsMarkdown reports whether filename has a Markdown extension. It is the switch between the glamour pipeline (markdown) and the chroma pipeline (everything else).

func LanguageFor

func LanguageFor(filename string) string

LanguageFor returns a human-readable lexer name for the file, e.g. "Python", "Docker", "JSON". Used for the TUI footer chrome.

func MutedColor

func MutedColor(theme string) string

MutedColor returns a dim secondary color for the theme. Used for the scroll percentage, secondary text.

func OpenInBrowser

func OpenInBrowser(filename, content string) error

func PostProcessLists

func PostProcessLists(markdown, rendered string) string

PostProcessLists rewrites Glamour's list output:

  • Unordered: per-depth bullet glyph
  • Ordered: hierarchical numbering from AST (1. / 1.1 / 1.2 / 2.)

func SourceToHTML

func SourceToHTML(filename, content string) ([]byte, error)

SourceToHTML renders content as a chroma-highlighted standalone HTML page for the browser open path.

func ToHTML

func ToHTML(filename, markdown string) ([]byte, error)

Types

type ANSI

type ANSI struct {
	// contains filtered or unexported fields
}

func NewANSI

func NewANSI(width int, theme string) (*ANSI, error)

func (*ANSI) Render

func (a *ANSI) Render(markdown string) (string, error)

func (*ANSI) Resize

func (a *ANSI) Resize(width int) error

type Source

type Source struct {
	// contains filtered or unexported fields
}

Source renders non-markdown files as ANSI-styled text for the TUI viewport.

func NewSource

func NewSource(width int, theme string) (*Source, error)

func (*Source) Render

func (s *Source) Render(filename, content string) (string, error)

Render syntax-highlights content for the terminal and prefixes each line with a dim line number.

func (*Source) Resize

func (s *Source) Resize(width int) error

Jump to

Keyboard shortcuts

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