Liking cljdoc? Tell your friends :D

cider.inlined-deps.puget.v1v0v2.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. 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 cider.inlined-deps.puget.v1v0v2.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. 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
`cider.inlined-deps.puget.v1v0v2.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

*options*clj

Default options to use when constructing new printers.

Default options to use when constructing new printers.
sourceraw docstring

canonical-printerclj

(canonical-printer)
(canonical-printer handlers)

Constructs a new canonical printer with the given handler dispatch.

Constructs a new canonical printer with the given handler dispatch.
sourceraw docstring

clojure-handlersclj

Map of print handlers for 'primary' Clojure types. These should take precedence over the handlers in clojure-interface-handlers.

Map of print handlers for 'primary' Clojure types. These should take
precedence over the handlers in `clojure-interface-handlers`.
sourceraw docstring

clojure-interface-handlersclj

Fallback print handlers for other Clojure interfaces.

Fallback print handlers for other Clojure interfaces.
sourceraw docstring

color-textclj

(color-text element text)
(color-text options element text)

Produces text colored according to the active color scheme. This is mostly useful to clients which want to produce output which matches data printed by Puget, but which is not directly printed by the library. Note that this function still obeys the :print-color option.

Produces text colored according to the active color scheme. This is mostly
useful to clients which want to produce output which matches data printed by
Puget, but which is not directly printed by the library. Note that this
function still obeys the `:print-color` option.
sourceraw docstring

common-handlersclj

Print handler dispatch combining Java and Clojure handlers with inheritance lookups. Provides a similar experience as the standard Clojure pretty-printer.

Print handler dispatch combining Java and Clojure handlers with inheritance
lookups. Provides a similar experience as the standard Clojure
pretty-printer.
sourceraw docstring

cprintclj

(cprint value)
(cprint value opts)

Like pprint, but turns on colored output.

Like pprint, but turns on colored output.
sourceraw docstring

cprint-strclj

(cprint-str value)
(cprint-str value opts)

Pretty-prints a value to a colored string.

Pretty-prints a value to a colored string.
sourceraw docstring

format-docclj

(format-doc printer value)

Recursively renders a print document for the given value.

Recursively renders a print document for the given value.
sourceraw docstring

format-doc*clj

(format-doc* printer value)

Formats a document without considering metadata.

Formats a document without considering metadata.
sourceraw docstring

format-unknownclj

(format-unknown printer value)
(format-unknown printer value repr)
(format-unknown printer value tag repr)

Renders common syntax doc for an unknown representation of a value.

Renders common syntax doc for an unknown representation of a value.
sourceraw docstring

java-handlersclj

Map of print handlers for Java types. This supports syntax for regular expressions, dates, UUIDs, and futures.

Map of print handlers for Java types. This supports syntax for regular
expressions, dates, UUIDs, and futures.
sourceraw docstring

merge-optionsclj

(merge-options a b)

Merges maps of printer options, taking care to combine the color scheme correctly.

Merges maps of printer options, taking care to combine the color scheme
correctly.
sourceraw docstring

pprintclj

(pprint value)
(pprint value opts)

Pretty-prints a value to out. Options may be passed to override the default options map.

Pretty-prints a value to *out*. Options may be passed to override the
default *options* map.
sourceraw docstring

pprint-strclj

(pprint-str value)
(pprint-str value opts)

Pretty-print a value to a string.

Pretty-print a value to a string.
sourceraw docstring

pr-handlerclj

(pr-handler printer value)

Print handler which renders the value with pr-str.

Print handler which renders the value with `pr-str`.
sourceraw docstring

pretty-printerclj

(pretty-printer opts)

Constructs a new printer from the given configuration.

Constructs a new printer from the given configuration.
sourceraw docstring

render-outclj

(render-out printer value)

Prints a value using the given printer.

Prints a value using the given printer.
sourceraw docstring

render-strclj

(render-str printer value)

Renders a value to a string using the given printer.

Renders a value to a string using the given printer.
sourceraw docstring

tagged-handlerclj

(tagged-handler tag value-fn)

Generates a print handler function which renders a tagged-literal with the given tag and a value produced by calling the function.

Generates a print handler function which renders a tagged-literal with the
given tag and a value produced by calling the function.
sourceraw docstring

unknown-handlerclj

(unknown-handler printer value)

Print handler which renders the value using the printer's unknown type logic.

Print handler which renders the value using the printer's unknown type logic.
sourceraw docstring

with-colorcljmacro

(with-color & body)

Executes the given expressions with colored output enabled.

Executes the given expressions with colored output enabled.
sourceraw docstring

with-optionscljmacro

(with-options opts & body)

Executes the given expressions with a set of options merged into the current option map.

Executes the given expressions with a set of options merged into the current
option map.
sourceraw docstring

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

× close