(!?sgr s)
Temporarily silences debugging of sgr code printing. Returns the value.
Temporarily silences debugging of sgr code printing. Returns the value.
(?sgr s)
For debugging of sgr code printing.
Prints the value with escaped sgr codes so you can read them in terminal emulators (otherwise text would just get colored).
Returns the value.
For debugging of sgr code printing. Prints the value with escaped sgr codes so you can read them in terminal emulators (otherwise text would just get colored). Returns the value.
(bling & coll)
In a terminal emulator context, returns a string tagged with SGR codes to style the text as desired.
In a browser context, returns an object, which is an instance of
bling.core/Enriched
, a js object with the the following fields:
tagged
A string with the appropriate tags for styling in browser consoles
css
An array of styles that sync with the tagged string.
args
A ClojureScript vector of the original args.
consoleArray
An array by Array.unshift
ing the tagged string onto the css array.
This is the format that is needed for printing in a browser console, e.g.
(.apply js/console.log js/console (goog.object/get o "consoleArray"))
.
For browser usage, sugar for the above .apply
call is provided with
bling.core/print-bling
. You can use it like this:
(print-bling (bling [:bold.blue "my blue text"]))
In a terminal emulator context, returns a string tagged with SGR codes to style the text as desired. In a browser context, returns an object, which is an instance of `bling.core/Enriched`, a js object with the the following fields: `tagged` A string with the appropriate tags for styling in browser consoles `css` An array of styles that sync with the tagged string. `args` A ClojureScript vector of the original args. `consoleArray` An array by `Array.unshift`ing the tagged string onto the css array. This is the format that is needed for printing in a browser console, e.g. `(.apply js/console.log js/console (goog.object/get o "consoleArray"))`. For browser usage, sugar for the above `.apply` call is provided with `bling.core/print-bling`. You can use it like this: `(print-bling (bling [:bold.blue "my blue text"]))`
(browser-callout
{:keys [value label warning? error? padding-bottom padding-top data?] :as m})
(callout x)
(callout opts value)
Prints a message to the console with a block-based coloring motif controlled
by the :type
option. Returns nil.
If the :data?
option is set to true
, it does not print anything, and
returns a data representation of the formatting and styling, which is will be
different depending on whether the context is a terminal emulator or a
browser dev console.
In terminal emulator consoles, this will print a colored bounding border in
the inline start position. The color of the border is determined by the value
of the :type
option, or the :colorway
option. The characteristics of this
border are controlled by the :theme
option.
In browser consoles, a border is not used, as the background and foreground
text of the message block is automatically colored by the browser dev tools
logging mechanism based on the type of logging function that is used. However,
this automatic styling only applies to the callout :type
options of :error
and :warn
.
For callouts of the type :error
, :warning
, or :info
, a label is
printed in the block start postion. If a :type option is set, the label
string will default to an uppercased version of that string, e.g.
{:type :INFO} => "INFO". If a :label
option is supplied, that value is
used instead. When you want to omit label for callouts of the type :error
,
:warning
, or :info
, you must explicitly set the :label option to an empty
string.
The amount of vertical padding (in number of lines) within the bounds of the
message body can be controlled the padding-top
and padding-bottom
options.
The amount of space (in number of lines) above and below the message block can
be controlled the margin-top
and margin-bottom
options. Margins are only
applicable to callouts formatted for the terminal emulator.
If two arguments are provided, the first should be a map with the follwoing optional keys:
Key | Pred | Description |
---|---|---|
:type | keyword? or string? | Should be one of: :error , :warning , or :info . <br>Will set the label text (unless provided via :label ). Will also set the :colorway , and override any provided :colorway value. |
:colorway | keyword? or string? | The color of the sideline border, or gutter, depending on the value of :theme .<br />Should be one of: :error , :warning , :info , :positive , or :subtle . <br>Can also be any one of the pallete colors such as :magenta , :green , :negative , :neutral , etc. |
:theme | keyword? or string? | Theme of callout. Can be one of :sideline , :sideline-bold , or :gutter . Defaults to :sideline . |
:label | any? | Labels the callout. In a terminal emulator context, the value will be cast to a string. In a browser context, the label can be an instance of bling.core/Enriched , or any other value (which will be cast to a string). <br>In the case of a callout :type of :warning , :error , or :info , the value of the label will default to WARNING , ERROR , or INFO , respectively. |
:label-theme | keyword? or string? | Theme of label. Can be one of :marquee or :minimal . Defaults to :minimal . |
:padding-top | int? | Amount of padding (in newlines) at top, inside callout.<br/>Defaults to 0 . |
:padding-bottom | int? | Amount of padding (in newlines) at bottom, inside callout.<br>Defaults to 0 . In browser console, defaults to 1 in the case of callouts of type :warning or :error . |
:padding-left | int? | Amount of padding (in blank character spaces) at left, inside callout.<br>In console emulator, defaults to 2 . In browser console, defaults to 0 . |
:margin-top | int? | Amount of margin (in newlines) at top, outside callout.<br>Defaults to 1 . Only applies to terminal emulator printing. |
:margin-bottom | int? | Amount of margin (in newlines) at bottom, outside callout.<br>Defaults to 0 . Only applies to terminal emulator printing. |
:margin-left | int? | Amount of margin (in blank character spaces) at left, outside callout.<br>Defaults to 0 . Only applies to terminal emulator printing. |
:data? | boolean? | Returns a data representation of result instead of printing it. |
Prints a message to the console with a block-based coloring motif controlled by the `:type` option. Returns nil. If the `:data?` option is set to `true`, it does not print anything, and returns a data representation of the formatting and styling, which is will be different depending on whether the context is a terminal emulator or a browser dev console. In terminal emulator consoles, this will print a colored bounding border in the inline start position. The color of the border is determined by the value of the `:type` option, or the `:colorway` option. The characteristics of this border are controlled by the `:theme` option. In browser consoles, a border is not used, as the background and foreground text of the message block is automatically colored by the browser dev tools logging mechanism based on the type of logging function that is used. However, this automatic styling only applies to the callout `:type` options of `:error` and `:warn`. For callouts of the type `:error`, `:warning`, or `:info`, a label is printed in the block start postion. If a :type option is set, the label string will default to an uppercased version of that string, e.g. {:type :INFO} => "INFO". If a `:label` option is supplied, that value is used instead. When you want to omit label for callouts of the type `:error`, `:warning`, or `:info`, you must explicitly set the :label option to an empty string. The amount of vertical padding (in number of lines) within the bounds of the message body can be controlled the `padding-top` and `padding-bottom` options. The amount of space (in number of lines) above and below the message block can be controlled the `margin-top` and `margin-bottom` options. Margins are only applicable to callouts formatted for the terminal emulator. If two arguments are provided, the first should be a map with the follwoing optional keys: | Key | Pred | Description | | :--------------- | ----------------------- | ------------------------------------------------------------ | | `:type` | `keyword?` or `string?` | Should be one of: `:error`, `:warning` , or `:info`. <br>Will set the label text (unless provided via `:label`). Will also set the `:colorway`, and override any provided `:colorway` value. | | `:colorway` | `keyword?` or `string?` | The color of the sideline border, or gutter, depending on the value of `:theme`.<br />Should be one of: `:error`, `:warning` , `:info` , `:positive`, or `:subtle`. <br>Can also be any one of the pallete colors such as `:magenta`, `:green`, `:negative`, `:neutral`, etc. | | `:theme` | `keyword?` or `string?` | Theme of callout. Can be one of `:sideline`, `:sideline-bold`, or `:gutter`. Defaults to `:sideline`. | | `:label` | `any?` | Labels the callout. In a terminal emulator context, the value will be cast to a string. In a browser context, the label can be an instance of `bling.core/Enriched`, or any other value (which will be cast to a string). <br>In the case of a callout `:type` of `:warning`, `:error`, or `:info`, the value of the label will default to `WARNING`, `ERROR`, or `INFO`, respectively. | | `:label-theme` | `keyword?` or `string?` | Theme of label. Can be one of `:marquee` or `:minimal`. Defaults to `:minimal`. | | `:padding-top` | `int?` | Amount of padding (in newlines) at top, inside callout.<br/>Defaults to `0`. | | `:padding-bottom` | `int?` | Amount of padding (in newlines) at bottom, inside callout.<br>Defaults to `0`. In browser console, defaults to `1` in the case of callouts of type `:warning` or `:error`.| | `:padding-left` | `int?` | Amount of padding (in blank character spaces) at left, inside callout.<br>In console emulator, defaults to `2`. In browser console, defaults to `0`.| | `:margin-top` | `int?` | Amount of margin (in newlines) at top, outside callout.<br>Defaults to `1`. Only applies to terminal emulator printing. | | `:margin-bottom` | `int?` | Amount of margin (in newlines) at bottom, outside callout.<br>Defaults to `0`. Only applies to terminal emulator printing. | | `:margin-left` | `int?` | Amount of margin (in blank character spaces) at left, outside callout.<br>Defaults to `0`. Only applies to terminal emulator printing. | | `:data?` | `boolean?` | Returns a data representation of result instead of printing it. |
(concatv & xs)
Concatenate xs
and return the result as a vector.
Concatenate `xs` and return the result as a vector.
(point-of-interest {:keys [line file column form header body margin-block
text-decoration-color type]
:as opts})
A namespace info diagram which identifies a specific form. This provides the namespace, column, and line number, and a bolded, potentially truncated, representation of the specific form of interest. This form representation is accented with a squiggly underline.
The :line
, :column
, :form
, and :file
options must all be present in
order for the namespece info diagram to be rendered. If the :form
option is
supplied, but any of the others are omitted, only the form will be rendered
(with a squiggly underline and no stacktrace diagram).
By default, the diagram is created with a leading and trailing newlines.
This can be set to zero, or increased, with the :margin-block
option.
Key | Pred | Description |
---|---|---|
:type | #{keyword? string? } | Should be one of: :error , :warning , or :info . <br>Will set the label text (unless provided via :label ). Will also set the :colorway , and override any provided :colorway value. |
:colorway | #{keyword? string? } | The color of the sideline border, or gutter, depending on the value of :theme .<br />Should be one of: :error , :warning , :info , :positive , or :subtle . <br>Can also be any one of the pallete colors such as :magenta , :green , :negative , :neutral , etc. |
:theme | #{keyword? string? } | Theme of callout. Can be one of :sideline , :sideline-bold , or :gutter . Defaults to :sideline . |
:label | any? | Labels the callout. In a terminal emulator context, the value will be cast to a string. In a browser context, the label can be an instance of bling.core/Enriched , or any other value (which will be cast to a string). <br>In the case of a callout :type of :warning , :error , or :info , the value of the label will default to WARNING , ERROR , or INFO , respectively. |
:label-theme | #{keyword? string? } | Theme of label. Can be one of :marquee or :minimal . Defaults to :minimal . |
:padding-top | int? | Amount of padding (in newlines) at top, inside callout.<br/>Defaults to 0 . |
:padding-bottom | int? | Amount of padding (in newlines) at bottom, inside callout.<br>Defaults to 0 . In browser console, defaults to 1 in the case of callouts of type :warning or :error . |
:padding-left | int? | Amount of padding (in blank character spaces) at left, inside callout.<br>In console emulator, defaults to 2 . In browser console, defaults to 0 . |
:margin-top | int? | Amount of margin (in newlines) at top, outside callout.<br>Defaults to 1 . Only applies to terminal emulator printing. |
:margin-bottom | int? | Amount of margin (in newlines) at bottom, outside callout.<br>Defaults to 0 . Only applies to terminal emulator printing. |
:margin-left | int? | Amount of margin (in blank character spaces) at left, outside callout.<br>Defaults to 0 . Only applies to terminal emulator printing. |
:data? | boolean? | Returns a data representation of result instead of printing it. |
A namespace info diagram which identifies a specific form. This provides the namespace, column, and line number, and a bolded, potentially truncated, representation of the specific form of interest. This form representation is accented with a squiggly underline. The `:line`, `:column`, `:form`, and `:file` options must all be present in order for the namespece info diagram to be rendered. If the `:form` option is supplied, but any of the others are omitted, only the form will be rendered (with a squiggly underline and no stacktrace diagram). By default, the diagram is created with a leading and trailing newlines. This can be set to zero, or increased, with the `:margin-block` option. | Key | Pred | Description | | :--------------- | ----------------- | ------------------------------------------------------------ | | `:type` | #{`keyword?` `string?`} | Should be one of: `:error`, `:warning` , or `:info`. <br>Will set the label text (unless provided via `:label`). Will also set the `:colorway`, and override any provided `:colorway` value. | | `:colorway` | #{`keyword?` `string?`} | The color of the sideline border, or gutter, depending on the value of `:theme`.<br />Should be one of: `:error`, `:warning` , `:info` , `:positive`, or `:subtle`. <br>Can also be any one of the pallete colors such as `:magenta`, `:green`, `:negative`, `:neutral`, etc. | | `:theme` | #{`keyword?` `string?`} | Theme of callout. Can be one of `:sideline`, `:sideline-bold`, or `:gutter`. Defaults to `:sideline`. | | `:label` | `any?` | Labels the callout. In a terminal emulator context, the value will be cast to a string. In a browser context, the label can be an instance of `bling.core/Enriched`, or any other value (which will be cast to a string). <br>In the case of a callout `:type` of `:warning`, `:error`, or `:info`, the value of the label will default to `WARNING`, `ERROR`, or `INFO`, respectively. | | `:label-theme` | #{`keyword?` `string?`} | Theme of label. Can be one of `:marquee` or `:minimal`. Defaults to `:minimal`. | | `:padding-top` | `int?` | Amount of padding (in newlines) at top, inside callout.<br/>Defaults to `0`. | | `:padding-bottom` | `int?` | Amount of padding (in newlines) at bottom, inside callout.<br>Defaults to `0`. In browser console, defaults to `1` in the case of callouts of type `:warning` or `:error`.| | `:padding-left` | `int?` | Amount of padding (in blank character spaces) at left, inside callout.<br>In console emulator, defaults to `2`. In browser console, defaults to `0`.| | `:margin-top` | `int?` | Amount of margin (in newlines) at top, outside callout.<br>Defaults to `1`. Only applies to terminal emulator printing. | | `:margin-bottom` | `int?` | Amount of margin (in newlines) at bottom, outside callout.<br>Defaults to `0`. Only applies to terminal emulator printing. | | `:margin-left` | `int?` | Amount of margin (in blank character spaces) at left, outside callout.<br>Defaults to `0`. Only applies to terminal emulator printing. | | `:data?` | `boolean?` | Returns a data representation of result instead of printing it. |
(print-bling o)
(print-bling o f)
For browser usage, sugar for the the following:
(.apply js/console.log js/console (goog.object/get o "consoleArray"))
Example: `(print-bling (bling [:bold.blue "my blue text"]))
For browser usage, sugar for the the following: `(.apply js/console.log js/console (goog.object/get o "consoleArray"))` Example: `(print-bling (bling [:bold.blue "my blue text"]))
(stack-trace-preview {:keys [error regex depth header]})
Creates a user-friendly stack-trace preview, limited to the frames which
contain a match with the supplied regex, up to the depth
value, if supplied.
depth
defaults to 7.
Creates a user-friendly stack-trace preview, limited to the frames which contain a match with the supplied regex, up to the `depth` value, if supplied. `depth` defaults to 7.
(text-underline {:keys [form text-decoration-index text-decoration-style]
:as m})
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close