From 1b437866469bd5a05e0a14141dc5c17acd30c858 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Mon, 2 Mar 2020 17:32:47 +0000 Subject: [PATCH] docs --- docs/source/text.rst | 2 +- rich/text.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/source/text.rst b/docs/source/text.rst index 590619b9..3962ddc7 100644 --- a/docs/source/text.rst +++ b/docs/source/text.rst @@ -3,7 +3,7 @@ Rich Text Rich has a :class:`~rich.text.Text` class for text that may be marked up with color and style attributes. You can consider this class to be like a mutable string with style information. The methods on the Text() instance are similar to a Python ``str`` but are designed to preserve any style information. -One way to add a style to Text is the :meth:`~tich.text.Text.stylize` method which applies a style to a start and end offset. Here is an example:: +One way to add a style to Text is the :meth:`~rich.text.Text.stylize` method which applies a style to a start and end offset. Here is an example:: from rich.text import Text text = Text("Hello, World!") diff --git a/rich/text.py b/rich/text.py index 9fbde4d6..40e054b9 100644 --- a/rich/text.py +++ b/rich/text.py @@ -217,7 +217,7 @@ class Text: Args: start (int): Start offset. end (int): End offset. - style (str): Style name to apply. + style (Union[str, Style]): Style instance or style definition to apply. Returns: None: @@ -235,7 +235,8 @@ class Text: translated to styles. Args: - re_highlight (str): A regular expression + re_highlight (str): A regular expression. + style (Union[str, Style]): Optional style to apply to whole match. Returns: int: Number of regex matches