Document

sealed class Document : PrettyPrintable

Represents a pretty printed document.

More specifically, a Document represents a non-empty set of possible layouts of a document. The print functions select one of these possibilities, taking into account things like the width of the output document.

Documents are created using the invoke functions, but the main interface is through PrettyPrintable.

Types

Companion
Link copied to clipboard
object Companion

Functions

print
Link copied to clipboard
fun print(lineWidth: Int = DEFAULT_LINE_WIDTH): String

Renders the document as a String.

fun print(output: PrintStream, lineWidth: Int = DEFAULT_LINE_WIDTH, ansi: Boolean = false)

Renders this document as a string and writes it to output. Each line of the output will be under lineWidth characters if possible. If ansi is true, ANSI escape codes are output to style the document according to the Style annotations in the document.

toDocument
Link copied to clipboard
open override fun toDocument(): Document

Returns this object.

toString
Link copied to clipboard
override fun toString(): String

Do not use toString; use print instead.