Skip to content

Commit c91d2d9

Browse files
author
Thomaz Leite
committed
Add documentation for ANSIDocs printing functions
1 parent f82fbdc commit c91d2d9

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

lib/iex/lib/iex/ansi_docs.ex

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,31 @@ defmodule IEx.ANSIDocs do
1111
doc_bold: "bright",
1212
doc_underline: "underline" ]
1313

14+
@shared_print_doc """
15+
In addition to the priting string, takes a truth value for whether to use ANSI
16+
escape codes, and a keyword list for the printing color settings. Supported
17+
keys for the color settings are:
18+
19+
* `:enabled` - toggles coloring on and off (true)
20+
* `:doc_code` - code blocks (cyan, bright)
21+
* `:doc_inline_code` - inline code (cyan)
22+
* `:doc_headings` - h1 and h2 headings (yellow, bright)
23+
* `:doc_title` - top level heading (reverse, yellow, bright)
24+
* `:doc_bold` - bold text (bright)
25+
* `:doc_underline` - underlined text (underline)
26+
27+
Values for the color settings are strings with comma-separated attributes.
28+
Supported attributes are:
29+
30+
* Colors: `black red green yellow blue magenta cyan white`
31+
* Intensity: `normal bright`
32+
* Decoration: `underline reverse`
33+
"""
34+
1435
@doc """
15-
Prints the head of the documentation (i.e. the function signature)
36+
Prints the head of the documentation (i.e. the function signature).
37+
38+
#{@shared_print_doc}
1639
"""
1740
def print_heading(string, use_ansi // IO.ANSI.terminal?, colors // @default_colors) do
1841
if use_ansi do
@@ -33,6 +56,8 @@ defmodule IEx.ANSIDocs do
3356

3457
@doc """
3558
Prints the documentation body.
59+
60+
#{@shared_print_doc}
3661
"""
3762
def print(doc, use_ansi // IO.ANSI.terminal?, colors // @default_colors) do
3863
if use_ansi do

0 commit comments

Comments
 (0)