markdown

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package markdown renders markdown as styled terminal text.

Almost everything a terminal application shows that a person wrote is markdown — a description, a comment, a release note — and showing it raw means showing the syntax instead of the emphasis. This is one renderer, cached by width, for all of it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(body string, width int) (string, bool)

Render lays out body at the given width, reporting false when there was nothing to render.

If glamour cannot render — an unusual width, a malformed document — the raw text is returned. A description is worth showing plainly; it is never worth failing a page over.

Types

type Renderer

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

Renderer lays out markdown at a width, keeping the renderer it built.

The zero value is ready to use, and Default is the one most applications want: building a renderer parses the whole style definition, which is far too much work to repeat on a keystroke-triggered redraw.

var Default Renderer

Default is the shared renderer. An application that wants a different style for one pane makes its own.

func (*Renderer) Render

func (r *Renderer) Render(body string, width int) (string, bool)

Render is the same, on a renderer of your own.

func (*Renderer) WithStyle

func (r *Renderer) WithStyle(style string) *Renderer

WithStyle names a glamour standard style — "dark", "light", "notty" — instead of choosing one from the terminal's background.

Jump to

Keyboard shortcuts

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