Liking cljdoc? Tell your friends :D

puget.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

puget.color.ansi

Coloring implementation that applies ANSI color codes to text designed to be output to a terminal.

Use with a :color-markup of :ansi.

Coloring implementation that applies ANSI color codes to text designed to be
output to a terminal.

Use with a `:color-markup` of `:ansi`.
raw docstring

puget.color.html

Coloring implementation that wraps text in HTML tags to apply color.

Supports the following modes for :color-markup:

  • :html-inline applies inline style attributes to the tags.
  • :html-classes adds semantic class attributes to the tags.
Coloring implementation that wraps text in HTML tags to apply color.

Supports the following modes for `:color-markup`:

- `:html-inline` applies inline `style` attributes to the tags.
- `:html-classes` adds semantic `class` attributes to the tags.
raw docstring

puget.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

puget.printer

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. If true, the pretty printer will sort all unordered collections before printing. If a number, counted collections will be sorted if they are smaller than the given size. Otherwise, collections are printed in their natural sort order. Sorted collections are always printed in their natural sort order.

: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.

:namespace-maps

Extract common keyword namespaces from maps using the namespace map literal syntax. See *print-namespace-maps*.

: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.

:coll-limit

If set to a positive number, then collections will only render at most the first n elements. This can help prevent unintentional printing of large collections. Note: :seq-limit has higher precendence than :coll-limit if both are set.

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 puget.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. If true, the pretty printer will sort
all unordered collections before printing. If a number, counted collections
will be sorted if they are smaller than the given size. Otherwise,
collections are printed in their natural sort order. Sorted collections are
always printed in their natural sort order.

`: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.

`:namespace-maps`

Extract common keyword namespaces from maps using the namespace map literal
syntax. See `*print-namespace-maps*`.

`: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.

`:coll-limit`

If set to a positive number, then collections will only render at most the
first n elements. This can help prevent unintentional printing of large
collections. Note: `:seq-limit` has higher precendence than `:coll-limit`
if both are set.

#### 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
`puget.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

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

× close