spruce/layout

ANSI-aware layout helpers for composing multiline text blocks.

Types

A position used for horizontal or vertical alignment.

pub type Pos {
  Start
  Center
  End
}

Constructors

  • Start
  • Center
  • End

Values

pub fn join_horizontal(pos: Pos, blocks: List(String)) -> String

Join blocks horizontally, aligning shorter blocks within the tallest block.

pub fn join_vertical(pos: Pos, blocks: List(String)) -> String

Stack blocks vertically, padding every line to the widest visual width.

pub fn place(
  width width: Int,
  height height: Int,
  horizontal h: Pos,
  vertical v: Pos,
  content content: String,
) -> String

Place content in a region, preserving content larger than the requested size.

Search Document