Add Iso8601Highlighter

Add ability to highlight date and time strings according to ISO8601 [1]

[1] https://en.wikipedia.org/wiki/ISO_8601
This commit is contained in:
Tomer Shalev 2022-05-26 21:59:46 +03:00
parent aa7926c143
commit 2707a73435
6 changed files with 326 additions and 1 deletions

View file

@ -4,6 +4,7 @@ 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 file paths, URLs and UUIDs.
Additional non-default highlighter are available, such as :class:`~rich.highlighter.ISO8601Highlighter` to highlight date and time.
You can disable highlighting either by setting ``highlight=False`` on :meth:`~rich.console.Console.print` or :meth:`~rich.console.Console.log`, or by setting ``highlight=False`` on the :class:`~rich.console.Console` constructor which disables it everywhere. If you disable highlighting on the constructor, you can still selectively *enable* highlighting with ``highlight=True`` on print/log.