Liking cljdoc? Tell your friends :D

std.pretty

Enhanced printing functions for rendering Clojure values. The following options are available to control the printer:

General Rendering

:width

Number of characters to try to wrap pretty-printed forms at.

:print-meta

If true, metadata will be printed before values. Defaults to the value of *print-meta* if unset.

Collection Options

:sort-keys

Print maps and sets with ordered keys. Defaults to true, which will sort all collections. If a number, counted collections will be sorted up to the set size. Otherwise, collections are not sorted before printing.

:map-delimiter

The text placed between key-value pairs in a map.

:map-coll-separator

The text placed between a map key and a collection value. The keyword :line will cause line breaks if the whole map does not fit on a single line.

:seq-limit

If set to a positive number, then lists will only render at most the first n elements. This can help prevent unintentional realization of infinite lazy sequences.

Color Options

:print-color

When true, ouptut colored text from print functions.

:color-markup

:ansi for ANSI color text (the default), :html-inline for inline-styled html, :html-classes to use the names of the keys in the :color-scheme map as class names for spans so styling can be specified via CSS.

:color-scheme

Map of syntax element keywords to color codes.

Type Handling

:print-handlers

A lookup function which will return a rendering function for a given class type. This will be tried before the built-in type logic. See the std.pretty.dispatch namespace for some helpful constructors. The returned function should accept the current printer and the value to be rendered, returning a format document.

:print-fallback

Keyword argument specifying how to format unknown values. Puget supports a few different options:

  • :pretty renders values with the default colored representation.
  • :print defers to the standard print method by rendering unknown values using pr-str.
  • :error will throw an exception when types with no defined handler are encountered.
  • A function value will be called with the current printer options and the unknown value and is expected to return a formatting document representing it.
Enhanced printing functions for rendering Clojure values. The following
options are available to control the printer:

#### General Rendering

`:width`

Number of characters to try to wrap pretty-printed forms at.

`:print-meta`

If true, metadata will be printed before values. Defaults to the value of
`*print-meta*` if unset.

#### Collection Options

`:sort-keys`

Print maps and sets with ordered keys. Defaults to true, which will sort all
collections. If a number, counted collections will be sorted up to the set
size. Otherwise, collections are not sorted before printing.

`:map-delimiter`

The text placed between key-value pairs in a map.

`:map-coll-separator`

The text placed between a map key and a collection value. The keyword :line
will cause line breaks if the whole map does not fit on a single line.

`:seq-limit`

If set to a positive number, then lists will only render at most the first n
elements. This can help prevent unintentional realization of infinite lazy
sequences.

#### Color Options

`:print-color`

When true, ouptut colored text from print functions.

`:color-markup`

:ansi for ANSI color text (the default),
:html-inline for inline-styled html,
:html-classes to use the names of the keys in the :color-scheme map
as class names for spans so styling can be specified via CSS.

`:color-scheme`

Map of syntax element keywords to color codes.

#### Type Handling

`:print-handlers`

A lookup function which will return a rendering function for a given class
type. This will be tried before the built-in type logic. See the
`std.pretty.dispatch` namespace for some helpful constructors. The returned
function should accept the current printer and the value to be rendered,
returning a format document.

`:print-fallback`

Keyword argument specifying how to format unknown values. Puget supports a few
different options:

- `:pretty` renders values with the default colored representation.
- `:print` defers to the standard print method by rendering unknown values
  using `pr-str`.
- `:error` will throw an exception when types with no defined handler are
  encountered.
- A function value will be called with the current printer options and the
  unknown value and is expected to return a formatting document representing
  it.
raw docstring

std.pretty.color

Coloring multimethods to format text by adding markup.

Color Options

:print-color

When true, ouptut colored text from print functions.

:color-markup

  • :ansi for color terminal text (default)
  • :html-inline for inline-styled html
  • :html-classes for html with semantic classes

:color-scheme

Map of syntax element keywords to color codes.

Coloring multimethods to format text by adding markup.

#### Color Options

`:print-color`

When true, ouptut colored text from print functions.

`:color-markup`

- `:ansi` for color terminal text (default)
- `:html-inline` for inline-styled html
- `:html-classes` for html with semantic classes

`:color-scheme`

Map of syntax element keywords to color codes.
raw docstring

std.pretty.dispatch

Dispatch functions take a Class argument and return the looked-up value. This provides similar functionality to Clojure's protocols, but operates over locally-constructed logic rather than using a global dispatch table.

A simple example is a map from classes to values, which can be used directly as a lookup function.

Dispatch functions take a `Class` argument and return the looked-up value.
This provides similar functionality to Clojure's protocols, but operates over
locally-constructed logic rather than using a global dispatch table.

A simple example is a map from classes to values, which can be used directly
as a lookup function.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close