Enhanced printing functions for rendering Clojure values. The following options are available to control the printer:
: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.
: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.
: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.
: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
hara.print.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.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 `hara.print.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.
Coloring multimethods to format text by adding markup.
: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.
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.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close