*doc-color* (keyword)
*doc-color* is bound to the keyword :doc-color—it can be used in place of
:doc-color in a call to dyn, setdyn, or with-dyns and is preferable
to using the keyword directly. When truthy, the binding indicates that the
doc-format function should decorate the given documentation with ANSI
escape codes.
repl> (root-env '*doc-color*)
@{:doc "Whether or not to colorize documentation printed with `doc-format`."
:dyn true
:source-map ("boot.janet" 3239 1)
:value :doc-color}
Things I Learned
- The
doc-formatfunction supports a subset of Markdown. - The name
:doc-coloris a little misleading. When the dynamic binding is truthy, text between a pair of backtick characters will be printed in bright white (intended for code snippets), text between a single pair of asterisks will be underlined (not italicized as the Markdown semantics imply), and text between a double pair of asterisks will be bold. Using underline rather than italics is likely a tradeoff for compatibility; historically, the italic attribute has not been widely supported by terminal emulators.
`(code snippet)`
*underline*
**bold**
- Colorization is enabled by default.
- No docstrings in the core API take advantage of the bold or underline formatting.
- As a result, you may not see any difference in the doc formatting if your terminal theme uses the same hue for white and bright white (a few terminals that I tested on Linux make no distinction between the two colors in their default configuration).