markdown

package
v0.74.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package markdown wraps Glamour for cached markdown-to-ANSI rendering with width-based revalidation, falling back to plain text wrapping for narrow terminals.

Index

Constants

View Source
const (
	// MinWidthForMarkdown is the minimum terminal width for markdown rendering.
	// Below this, falls back to plain text wrapping.
	MinWidthForMarkdown = 30

	// MaxCacheEntries is the maximum number of cached renders before eviction.
	MaxCacheEntries = 100
)

Variables

This section is empty.

Functions

func WrapText

func WrapText(text string, maxWidth int) []string

WrapText wraps text to fit within maxWidth. Used as fallback when terminal is too narrow for markdown rendering.

Types

type Renderer

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

Renderer wraps Glamour for markdown rendering with caching.

func NewRenderer

func NewRenderer() (*Renderer, error)

NewRenderer creates a new markdown renderer instance.

func (*Renderer) RenderContent

func (r *Renderer) RenderContent(content string, width int) []string

RenderContent renders markdown content to styled lines.

Jump to

Keyboard shortcuts

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