markdown

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package markdown renders GFM (produced by internal/adf) for the TUI through glamour, with a style derived from the active clib theme so issue bodies and comments match the rest of the dashboard. Rendering is cached per issue+width because glamour is too slow to run on every View frame.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorToken added in v0.8.0

func ColorToken(c color.Color) string

ColorToken converts a theme color to the string form glamour accepts. ANSI palette indexes pass through as their index ("4", "212"), so the terminal's own palette renders them exactly like the rest of the chrome — round-tripping an indexed color through RGBA would bake in the standard VGA value and visibly drift from the themed UI around it.

func StyleFromTheme

func StyleFromTheme(t *clibtheme.Theme) ansi.StyleConfig

StyleFromTheme derives a glamour style from the clib palette: headings in the chrome blue (H1 magenta, matching detail headers), links blue, inline code yellow, quotes and rules dim. The base config — which supplies everything not overridden here, notably the code-block chroma palette — follows the theme's declared background so a light theme never renders on glamour's dark defaults. Margins are zeroed — the panes own their padding.

Types

type Renderer

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

Renderer is a width-aware, cached glamour renderer. Not safe for concurrent use; the TUI renders from a single goroutine.

func NewRenderer

func NewRenderer(style ansi.StyleConfig) *Renderer

NewRenderer builds a Renderer with the given glamour style.

func (*Renderer) Render

func (r *Renderer) Render(id string, width int, md string) string

Render returns md rendered at the given wrap width, cached under id+width and invalidated when the content changes (a refresh can rewrite an issue). On any glamour failure the raw markdown comes back — text always beats a blank pane.

Jump to

Keyboard shortcuts

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