mdrender

package
v0.2.17 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package mdrender turns markdown source into pre-wrapped, theme-styled terminal lines for skiff's read-only preview mode — the glow idea, rendered skiff-natively: goldmark parses (pure Go, dependency-free), the theme supplies every color, fenced code blocks run through the same Chroma path the editor highlights with, and wrapping walks grapheme clusters so CJK and emoji stay inside the budget.

The output contract mirrors the editor's own render idiom: a slice of line strings plus a parallel per-rune style grid, already wrapped to the requested width — the consumer draws them verbatim and never re-wraps. Rendering is pure (no screen, no app state), which is what keeps it testable and lets the app cache the result until the source or the width changes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(src []byte, width int, th theme.Theme) ([]string, [][]tcell.Style)

Render converts markdown source into terminal lines wrapped to width cells, with one tcell.Style per rune of every line. The theme drives all coloring; width under 4 is clamped so degenerate panes still get output instead of a panic.

Types

This section is empty.

Jump to

Keyboard shortcuts

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