docs and rule

This commit is contained in:
Will McGugan 2020-06-10 15:21:07 +01:00
parent 6d7ba589e2
commit f9ac1c2f54
8 changed files with 21 additions and 13 deletions

View file

@ -39,7 +39,7 @@ Setting the highlighter on the Console will apply highlighting to all text you p
console.print(highlight_emails("Send funds to money@example.org"))
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.
While :class:`~rich.highlighter.RegexHighlighter` is quite powerful, you can also extend its base class :class:`~rich.highlighter.Highlighter` to implement a custom 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 a silly example that highlights every character with a different color::