linewrap

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: Apache-2.0 Imports: 5 Imported by: 6

README

Package cloudeng.io/text/linewrap

import cloudeng.io/text/linewrap

Package linewrap provides basic support for wrapping text to a given width.

Functions

Func Block
func Block(indent, width int, text string) string

Block wraps the supplied text to width indented by indent spaces.

Func Comment
func Comment(indent, width int, comment, text string) string

Comment wraps the supplied text to width indented by indent spaces with each line starting with the supplied comment string. It is intended for formatting source code comments.

Func Paragraph
func Paragraph(initial, indent, width int, text string) string

Paragraph wraps the supplied text as a 'paragraph' with separate indentation for the initial and subsequent lines to the specified width.

Func Prefix
func Prefix(indent int, prefix, text string) string

Prefix returns the supplied text with each nonempty line prefixed by indent spaces and the supplied prefix.

Func Verbatim
func Verbatim(indent int, text string) string

Verbatim returns the supplied text with each nonempty line prefixed by indent spaces.

Documentation

Overview

Package linewrap provides basic support for wrapping text to a given width.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Block added in v0.0.7

func Block(indent, width int, text string) string

Block wraps the supplied text to width indented by indent spaces.

func Comment added in v0.0.7

func Comment(indent, width int, comment, text string) string

Comment wraps the supplied text to width indented by indent spaces with each line starting with the supplied comment string. It is intended for formatting source code comments.

func Paragraph added in v0.0.7

func Paragraph(initial, indent, width int, text string) string

Paragraph wraps the supplied text as a 'paragraph' with separate indentation for the initial and subsequent lines to the specified width.

func Prefix added in v0.0.12

func Prefix(indent int, prefix, text string) string

Prefix returns the supplied text with each nonempty line prefixed by indent spaces and the supplied prefix.

func Verbatim added in v0.0.12

func Verbatim(indent int, text string) string

Verbatim returns the supplied text with each nonempty line prefixed by indent spaces.

Types

This section is empty.

Jump to

Keyboard shortcuts

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