mirror of https://github.com/Textualize/rich.git
fix typos
This commit is contained in:
parent
966ebdaae5
commit
bbac62114a
|
@ -1,5 +1,5 @@
|
|||
Higlighting
|
||||
===========
|
||||
Highlighting
|
||||
============
|
||||
|
||||
Rich can apply styles to patterns in text which you :meth:`~rich.console.Console.print` or :meth:`~rich.console.Console.log`. With the default settings, Rich will highlight things such as numbers, strings, collections, booleans, None, and a few more exotic patterns such as URLs and UUIDs.
|
||||
|
||||
|
@ -41,7 +41,7 @@ Setting the highlighter on the Console will apply highlighting to all text you p
|
|||
|
||||
While :class:`~rich.highlighter.RegexHighlighter` is quite powerful, you can also extend its base class :class:`~rich.highlighter.Highlighter` which you can use to implement any scheme for highlighting. It contains a single method :class:`~rich.highlighter.Highlighter.highlight` which is passed the :class:`~rich.text.Text` to highlight.
|
||||
|
||||
Here's an silly example that highlights every character with a different color::
|
||||
Here's a silly example that highlights every character with a different color::
|
||||
|
||||
from random import randint
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ Markdown
|
|||
Rich can render Markdown to the console. To render markdown, construct a :class:`~rich.markdown.Markdown` object then print it to the console. Markdown is a great way of adding rich content to your command line applications. Here's an example of use::
|
||||
|
||||
MARKDOWN = """
|
||||
# This is a h1
|
||||
# This is an h1
|
||||
|
||||
Rich can do a pretty *decent* job of rendering markdown.
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ Here's a simple example::
|
|||
Starting Tasks
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
When you add a task it is automatically *started* which means it will show a progress bar at 0% and the time remaining will be calculated from the current time. Occasionally this may not work well if there is a long delay before you can start updating progress, you may need to wait for a response from a server, or count files in a directory (for example) before you can begin tracking progress. In these cases you can call :meth:`~rich.progress.Progress.add_task` with ``start=False`` which will display the a pulsing animation that lets the user know something is working. When you have the number of steps you can call :meth:`~rich.progress.Progress.start_task` which will display the progress bar at 0%, then :meth:`~rich.progress.Progress.update` as normal.
|
||||
When you add a task it is automatically *started* which means it will show a progress bar at 0% and the time remaining will be calculated from the current time. Occasionally this may not work well if there is a long delay before you can start updating progress, you may need to wait for a response from a server, or count files in a directory (for example) before you can begin tracking progress. In these cases you can call :meth:`~rich.progress.Progress.add_task` with ``start=False`` which will display a pulsing animation that lets the user know something is working. When you have the number of steps you can call :meth:`~rich.progress.Progress.start_task` which will display the progress bar at 0%, then :meth:`~rich.progress.Progress.update` as normal.
|
||||
|
||||
|
||||
Updating Tasks
|
||||
|
|
|
@ -21,7 +21,7 @@ Alternatively, you can construct styled text by calling :meth:`~rich.text.Text.a
|
|||
text.append(" World!")
|
||||
console.print(text)
|
||||
|
||||
Since building Text instances from parts is a common requirement, Rich offers :meth:`~rich.text.Text.assemble` which will combine strings or pairs of string and Style, and return an Text instance. The follow example is equivalent to the code above::
|
||||
Since building Text instances from parts is a common requirement, Rich offers :meth:`~rich.text.Text.assemble` which will combine strings or pairs of string and Style, and return a Text instance. The follow example is equivalent to the code above::
|
||||
|
||||
text = Text.assemble(("Hello", "bold magenta"), " World!")
|
||||
console.print(text)
|
||||
|
|
Loading…
Reference in New Issue