highlighters

This commit is contained in:
Will McGugan 2020-09-09 16:20:42 +01:00
parent fcbc62429c
commit 2341b22458
7 changed files with 27 additions and 20 deletions

View file

@ -66,3 +66,5 @@ exclude_patterns = []
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
intersphinx_mapping = {"python": ("http://docs.python.org/3", None)}

View file

@ -53,6 +53,18 @@ The Console object will write to standard output (i.e. the terminal). You can al
error_console.print("[bold red]This is an error!")
Capturing output
----------------
There may be situations where you want to capture the output from a Console rather than writing it directly to the terminal. You can do this by setting the ``file`` argument to a :py:class:`io.StringIO` instance. Here's an example::
from io import StringIO
from rich.console import Console
console = Console(file=StringIO)
console.print("[bold red]Hello[/] World")
str_output = console.file.getvalue()
Terminal detection
------------------

View file

@ -5,7 +5,6 @@ Rich can apply styles to patterns in text which you :meth:`~rich.console.Console
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.
Custom Highlighters
-------------------

View file

@ -4,13 +4,14 @@ Reference
.. toctree::
:maxdepth: 3
reference/init.rst
reference/align.rst
reference/bar.rst
reference/color.rst
reference/columns.rst
reference/console.rst
reference/emoji.rst
reference/highlighter.rst
reference/highlighter.rst
reference/logging.rst
reference/markdown.rst
reference/markup.rst