summaryrefslogtreecommitdiffstats
path: root/src/prompt_toolkit/formatted_text/__init__.py
blob: db44ab9266c6d407335d2ed5d583b2a729d69f04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
"""
Many places in prompt_toolkit can take either plain text, or formatted text.
For instance the :func:`~prompt_toolkit.shortcuts.prompt` function takes either
plain text or formatted text for the prompt. The
:class:`~prompt_toolkit.layout.FormattedTextControl` can also take either plain
text or formatted text.

In any case, there is an input that can either be just plain text (a string),
an :class:`.HTML` object, an :class:`.ANSI` object or a sequence of
`(style_string, text)` tuples. The :func:`.to_formatted_text` conversion
function takes any of these and turns all of them into such a tuple sequence.
"""
from __future__ import annotations

from .ansi import ANSI
from .base import (
    AnyFormattedText,
    FormattedText,
    OneStyleAndTextTuple,
    StyleAndTextTuples,
    Template,
    is_formatted_text,
    merge_formatted_text,
    to_formatted_text,
)
from .html import HTML
from .pygments import PygmentsTokens
from .utils import (
    fragment_list_len,
    fragment_list_to_text,
    fragment_list_width,
    split_lines,
    to_plain_text,
)

__all__ = [
    # Base.
    "AnyFormattedText",
    "OneStyleAndTextTuple",
    "to_formatted_text",
    "is_formatted_text",
    "Template",
    "merge_formatted_text",
    "FormattedText",
    "StyleAndTextTuples",
    # HTML.
    "HTML",
    # ANSI.
    "ANSI",
    # Pygments.
    "PygmentsTokens",
    # Utils.
    "fragment_list_len",
    "fragment_list_width",
    "fragment_list_to_text",
    "split_lines",
    "to_plain_text",
]