termtext

package
v0.7.5-dev.1 Latest Latest
Warning

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

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

Documentation

Overview

Package termtext prepares author text (a release guide's overview and key help, the Drafter's narration) for a terminal: cleaned of what a terminal would act on or hide, and set in a gutter so it cannot pass for the CLI's own lines.

Index

Constants

View Source
const Gutter = "  | "

Gutter starts every line of quoted author text. The CLI's own lines start at column 0 or with two spaces (a contract line, a list item), so a line behind the gutter cannot read as one of them.

Variables

This section is empty.

Functions

func Quote

func Quote(s string) string

Quote is s cleaned by Safe and set behind the Gutter, one line of s per line, with its surrounding blank lines trimmed. A blank line inside s keeps the gutter, so the quoted block reads as one.

func Safe

func Safe(s string) string

Safe is s as a terminal may show it: every control character but a newline or a tab, every C1 control, every format character (a bidi override, a zero-width space) and the Unicode line and paragraph separators becomes "?", so the text cannot send escape sequences (colours, cursor moves, a window title, a hyperlink) to the terminal it is printed on, or show other than what it says. The core refuses all of these in a guide already; this is the second defence, and the only one for text the core never validates.

Types

This section is empty.

Jump to

Keyboard shortcuts

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