Liking cljdoc? Tell your friends :D

bling.core


!?sgrclj/s

(!?sgr s)

Temporarily silences debugging of sgr code printing. Returns the value.

Temporarily silences debugging of sgr code printing.
Returns the value.
sourceraw docstring

?sgrclj/s

(?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.
sourceraw docstring

blingclj/s

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

consoleArray An array by Array.unshifting 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")).

args A ClojureScript vector of the original args.

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.

`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"))`.

`args`
A ClojureScript vector of the original args.

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"]))
sourceraw docstring

bling-dataclj/s

(bling-data coll)
source

bling-data-cssclj/s

(bling-data-css coll)
source

browser-calloutcljs

(browser-callout
  {:keys [value label callout-type pt padding-bottom padding-left data?] :as m})
source

calloutclj/s

(callout value)
(callout {:keys [label wrap? data? border-weight margin-top margin-bottom
                 margin-left padding-top padding-bottom padding-left]
          :as 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. The weight/intensity of this border is controlled by the :border-weight 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 bolded label is printed, by default, in the same color as the callout styling, 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:

KeyPredDescription
:labelany?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.
:typekeyword? or string?Controls the color of the border and label.<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.
:border-weightkeyword? or string?Controls the weight of the border. Can be one of :medium, :heavy, or :light. Defaults to :light, which renders default border with standard unicode, single-line box-drawing character.
:padding-topint?Amount of padding (in lines) at top of callout (inside callout block).<br/>Defaults to 0.
:padding-bottomint?Amount of padding (in lines) at bottom of callout (inside callout block).<br>Defaults to 0. In browser console, defaults to 1 in the case of callouts of type :warning or :error.
:padding-leftint?Amount of padding (in lines) at left of callout (inside callout block).<br>In console emulator, defaults to 1 when :border-weight is :light, and 2 when :border-weight is :medium or :heavy. In browser console, defaults to 0.
:margin-topint?Amount of margin (in lines) at top of callout (outside callout block).<br>Defaults to 1. Only applies to terminal emulator printing.
:margin-bottomint?Amount of margin (in lines) at bottom of callout (outside callout block).<br>Defaults to 0. Only applies to terminal emulator printing.
:margin-leftint?Amount of margin (in lines) at left of callout (outside callout block).<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. The weight/intensity of this border is controlled by
   the `:border-weight` 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 bolded label is
   printed, by default, in the same color as the callout styling, 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                                                  |
| :---------------  | -----------------       | ------------------------------------------------------------ |
| `: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. |
| `:type`           | `keyword?` or `string?` | Controls the color of the border and label.<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. |
| `:border-weight`  | `keyword?` or `string?` | Controls the weight of the border. Can be one of `:medium`, `:heavy`, or `:light`. Defaults to `:light`, which renders default border with standard unicode, single-line box-drawing character. |
| `:padding-top`    | `int?`                  | Amount of padding (in lines) at top of callout (inside callout block).<br/>Defaults to 0. |
| `:padding-bottom` | `int?`                  | Amount of padding (in lines) at bottom of callout (inside callout block).<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 lines) at left of callout (inside callout block).<br>In console emulator, defaults to `1` when `:border-weight` is `:light`, and `2` when `:border-weight` is `:medium` or `:heavy`. In browser console, defaults to `0`.|
| `:margin-top`     | `int?`                  | Amount of margin (in lines) at top of callout (outside callout block).<br>Defaults to `1`. Only applies to terminal emulator printing. |
| `:margin-bottom`  | `int?`                  | Amount of margin (in lines) at bottom of callout (outside callout block).<br>Defaults to `0`. Only applies to terminal emulator printing. |
| `:margin-left`    | `int?`                  | Amount of margin (in lines) at left of callout (outside callout block).<br>Defaults to `0`. Only applies to terminal emulator printing. |
| `:data?`          | `boolean?`              | Returns a data representation of result instead of printing it. |
sourceraw docstring

callout*clj/s

(callout* {:keys [label border-weight padding-left margin-top margin-bottom
                  margin-left data? color]
           :as m})
source

point-of-interestclj/s

(point-of-interest {:keys [line file column form header body margin-block]
                    squiggly-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.

KeyPredDescription
:filestring?File or namespace
:lineinteger?Line number
:columninteger?Column number
:formany?The form to draw attention to. Will be cast to string and truncated at 33 chars
:typekeyword or string?Controls the color of the squiggly underline. Should be one of: :error :warning, or :neutral. Defaults to :neutral
:headerany?Typically, a string. If multi-line, string should be composed with newlines as desired. In a browser context, can be an instance of bling.core/Enriched (produced by using bling.core/enriched)
:bodyany?Typically, a string. If multi-line, string should be composed with newlines as desired. In a browser context, can be an instance of bling.core/Enriched (produced by using bling.core/enriched)
:margin-blockint?Controls the number of blank lines above and below the diagram.<br/>Defaults to 1.
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                                                  |
| :--------       | -----------------      | ------------------------------------------------------------ |
| `:file`         | `string?`              | File or namespace                                            |
| `:line`         | `integer?`             | Line number                                                  |
| `:column`       | `integer?`             | Column number                                                |
| `:form`         | `any?`                 | The form to draw attention to. Will be cast to string and truncated at 33 chars |
| `:type`         | `keyword` or `string?` | Controls the color of the squiggly underline. Should be one of: `:error` `:warning`, or `:neutral`. Defaults to `:neutral` |
| `:header`       | `any?`                 | Typically, a string. If multi-line, string should be composed with newlines as desired. In a browser context, can be an instance of `bling.core/Enriched` (produced by using `bling.core/enriched`)|
| `:body`         | `any?`                 | Typically, a string. If multi-line, string should be composed with newlines as desired. In a browser context, can be an instance of `bling.core/Enriched` (produced by using `bling.core/enriched`)|
| `:margin-block` | `int?`                 | Controls the number of blank lines above and below the diagram.<br/>Defaults to 1.|
sourceraw docstring

clj
cljs
(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"]))
source (clj)source (cljs)raw docstring

stack-trace-previewclj/s

(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.
sourceraw docstring

with-label-and-borderclj/s

(with-label-and-border {:keys [label border-weight border-style border-left-str
                               pt padding-bottom padding-left-str
                               margin-left-str margin-top-str value]
                        :as m}
                       label-line)
source

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

× close