summaryrefslogtreecommitdiffstats
path: root/src/prompt_toolkit/formatted_text/__init__.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:35:31 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:35:31 +0000
commit4f1a3b5f9ad05aa7b08715d48909a2b06ee2fcb1 (patch)
treee5dee7be2f0d963da4faad6517278d03783e3adc /src/prompt_toolkit/formatted_text/__init__.py
parentInitial commit. (diff)
downloadprompt-toolkit-upstream.tar.xz
prompt-toolkit-upstream.zip
Adding upstream version 3.0.43.upstream/3.0.43upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/prompt_toolkit/formatted_text/__init__.py')
-rw-r--r--src/prompt_toolkit/formatted_text/__init__.py58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/prompt_toolkit/formatted_text/__init__.py b/src/prompt_toolkit/formatted_text/__init__.py
new file mode 100644
index 0000000..db44ab9
--- /dev/null
+++ b/src/prompt_toolkit/formatted_text/__init__.py
@@ -0,0 +1,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",
+]