mirror of https://github.com/Textualize/rich.git
docs
This commit is contained in:
parent
06279f7605
commit
1b43786646
|
@ -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!")
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue