nested

fun PrettyPrintable.nested(indentationChange: Int = 4): Document

Returns a new document that is this with the nesting level (indentation after newlines) increased by indentationChange. Negative values for indentationChange are allowed, and decrease the nesting level accordingly.

>>> Document("hello") + (Document.lineBreak + "world").nested()
hello
world

Note that only newlines inside this document are affected. For example,

>>> Document("hello") + Document.lineBreak + (Document("world")).nested()
hello
world