Help us shape the future of Go! Take the 2026 Go Developer Survey

prbody

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package prbody turns a pull request body (GitHub Markdown, which mixes in HTML) into short wrapped lines for the terminal: formatting becomes plain text, links keep only their text, images and comments go, and each <details> section collapses to its summary.

The lines are not safe to print as they are: the body is untrusted, so the caller still strips control characters.

Index

Constants

View Source
const MaxBody = 64 << 10

MaxBody is the most of a body Render reads (GitHub's own limit is 65536 characters). goldmark is slow on some hostile input (~2s at this size), so callers should render off the UI thread.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kind

type Kind int
const (
	Plain   Kind = iota
	Heading      // a heading's text
	Muted        // code blocks and rules
	Summary      // a collapsed <details> section: "▸ " + its summary
)

type Line

type Line struct {
	Kind Kind
	Text string
}

func Render

func Render(body string, width int) []Line

Render returns body as lines at most width cells wide (code lines may be longer; the caller cuts them). Blank lines separate blocks.

Jump to

Keyboard shortcuts

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