render

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package render turns a single mdparse block into styled screen lines. It is a pure function of (block content, Width): given the same inputs it returns the same output, so the editor can cache results keyed on that pair. Every returned line's printable width is at most Context.Width cells (measured on ANSI-stripped text), and every block yields at least one line.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Block

func Block(res mdparse.Result, i int, ctx Context) []string

Block renders block i of res into screen lines, each at most ctx.Width cells wide. A Blank block renders as []string{""}; the result always has length >= 1.

Types

type Context

type Context struct {
	Width int
	Theme theme.Theme
	// IsBroken reports whether a wikilink target has no backing note. A nil
	// IsBroken means links are never treated as broken.
	IsBroken func(target string) bool
}

Context carries everything a render needs beyond the block itself.

Jump to

Keyboard shortcuts

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