package text
Import Path
github.com/kr/text (on go.dev)
Dependency Relation
imports 3 packages, and imported by one package
Involved Source Files
Package text provides rudimentary functions for manipulating text in
paragraphs.
indent.go
wrap.go
Package-Level Type Names (only one, which is unexported)
Package-Level Functions (total 6, all are exported)
Indent inserts prefix at the beginning of each non-empty line of s. The
end-of-line marker is NL.
IndentBytes inserts prefix at the beginning of each non-empty line of b.
The end-of-line marker is NL.
NewIndentWriter makes a new write filter that indents the input
lines. Each line is prefixed in order with the corresponding
element of pre. If there are more lines than elements, the last
element of pre is repeated for each subsequent line.
Wrap wraps s into a paragraph of lines of length lim, with minimal
raggedness.
WrapBytes wraps b into a paragraph of lines of length lim, with minimal
raggedness.
WrapWords is the low-level line-breaking algorithm, useful if you need more
control over the details of the text wrapping process. For most uses, either
Wrap or WrapBytes will be sufficient and more convenient.
WrapWords splits a list of words into lines with minimal "raggedness",
treating each byte as one unit, accounting for spc units between adjacent
words on each line, and attempting to limit lines to lim units. Raggedness
is the total error over all lines, where error is the square of the
difference of the length of the line and lim. Too-long lines (which only
happen when a single word is longer than lim units) have pen penalty units
added to the error.
Package-Level Variables (total 2, neither is exported)
Package-Level Constants (only one, which is unexported)
The pages are generated with Golds v0.4.9. (GOOS=linux GOARCH=amd64)