render

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clean

func Clean(s string) string

Clean strips control characters (terminal escape sequences, bidi overrides) from untrusted text, keeping newlines and tabs.

func Fence

func Fence(id, body string) string

Fence wraps untrusted body text in BEGIN/END markers. Any marker-like line inside the body is defused so a message cannot close the fence early.

func HTMLToText

func HTMLToText(src string) (text string, removed bool)

HTMLToText converts an HTML body to plain text, dropping content a human reader would not see (display:none, visibility:hidden, zero/tiny font size, zero opacity, text coloured like its background, off-screen indents, hidden attribute, mso-hide). This is the defence against "white text" prompt injection: the model should read what the human reads.

removed reports whether any non-whitespace hidden text was dropped.

func ListText

func ListText(w io.Writer, msgs []provider.Message)

ListText prints one line per message: id, date, from, flags, subject.

func MessageText

func MessageText(w io.Writer, m *provider.Message) error

func Write

func Write(w io.Writer, v any, o Options) error

Write renders v. --jq applies to the JSON form regardless of --format; string results are printed raw (like gh --jq).

Types

type Format

type Format string
const (
	FormatJSON Format = "json"
	FormatText Format = "text"
	FormatID   Format = "id"
)

func ParseFormat

func ParseFormat(s string) (Format, error)

type Options

type Options struct {
	Format Format
	JQ     string
}

type TextWriter

type TextWriter interface {
	WriteText(w io.Writer) error
}

TextWriter is implemented by result types that know how to print themselves.

Jump to

Keyboard shortcuts

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