markdown

package
v0.0.197 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderString

func RenderString(content string, config Config) (string, error)

RenderString is a convenience helper for one-shot rendering.

Types

type ANSI

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

ANSI is the terminal markdown renderer implementation.

func NewANSI

func NewANSI(config Config) *ANSI

NewANSI creates a new terminal markdown renderer.

func (*ANSI) Render

func (r *ANSI) Render(source []byte) ([]byte, error)

Render renders markdown to ANSI bytes.

func (*ANSI) Resize

func (r *ANSI) Resize(width int)

Resize updates the renderer width for future renders.

type Config

type Config struct {
	Palette Palette

	// Width is the caller-visible width before any wrap offset is applied.
	Width int
	// WrapOffset preserves legacy call-site behaviour where some renderers use a
	// slightly smaller wrap width than the viewport width.
	WrapOffset int

	NormalizeTabs      bool
	NormalizeNewlines  bool
	TrimSpace          bool
	EnsureTrailingLine bool
}

Config controls how markdown is rendered for a specific caller.

type Palette

type Palette struct {
	Primary   string
	Secondary string
	Success   string
	Warning   string
	Muted     string
	Text      string
}

Palette describes the semantic colours used by the terminal renderer.

type Renderer

type Renderer interface {
	Render(source []byte) ([]byte, error)
	Resize(width int)
}

Renderer renders complete markdown content for a terminal target.

Jump to

Keyboard shortcuts

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