Liking cljdoc? Tell your friends :D

meme.emit.render

Wadler-Lindig document algebra and layout engine. Generic — no meme-specific knowledge. Reusable for any pretty-printing task.

Doc types form a small algebra: DocText — literal string DocLine — newline+indent (or flat-alt when flat) DocCat — concatenation DocNest — increase indent DocGroup — try flat, break if too wide DocIfBreak — conditional on flat/break mode

layout renders a Doc tree to a string at a given page width. Use ##Inf for single-line (flat) rendering.

Wadler-Lindig document algebra and layout engine.
Generic — no meme-specific knowledge. Reusable for any pretty-printing task.

Doc types form a small algebra:
  DocText     — literal string
  DocLine     — newline+indent (or flat-alt when flat)
  DocCat      — concatenation
  DocNest     — increase indent
  DocGroup    — try flat, break if too wide
  DocIfBreak  — conditional on flat/break mode

layout renders a Doc tree to a string at a given page width.
Use ##Inf for single-line (flat) rendering.
raw docstring

catclj/s

(cat)
(cat a)
(cat a b)
(cat a b & more)

Concatenate doc nodes. Nils are ignored.

Concatenate doc nodes. Nils are ignored.
sourceraw docstring

groupclj/s

(group doc)

Try to render doc flat; break to multi-line if too wide. Returns nil if doc is nil.

Try to render doc flat; break to multi-line if too wide. Returns nil if doc is nil.
sourceraw docstring

hardlineclj/s

Always breaks — never renders flat.

Always breaks — never renders flat.
sourceraw docstring

if-breakclj/s

(if-break break-doc flat-doc)

Render break-doc when broken, flat-doc when flat.

Render break-doc when broken, flat-doc when flat.
sourceraw docstring

layoutclj/s

(layout doc width)

Render a Doc tree as a string at the given page width. Use ##Inf for flat (single-line) rendering.

Render a Doc tree as a string at the given page width.
Use ##Inf for flat (single-line) rendering.
sourceraw docstring

lineclj/s

Space when flat, newline+indent when broken.

Space when flat, newline+indent when broken.
sourceraw docstring

line0clj/s

Empty when flat, newline+indent when broken.

Empty when flat, newline+indent when broken.
sourceraw docstring

nestclj/s

(nest i doc)

Increase indent by i for doc. Returns nil if doc is nil.

Increase indent by i for doc. Returns nil if doc is nil.
sourceraw docstring

textclj/s

(text s)

Literal string doc node. Returns nil for nil or empty string.

Literal string doc node. Returns nil for nil or empty string.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close