mirror of
https://github.com/Textualize/rich.git
synced 2025-08-04 18:18:22 +00:00
markup syntax
This commit is contained in:
parent
1f09278776
commit
7da3ee6299
4 changed files with 43 additions and 19 deletions
|
@ -38,17 +38,14 @@ If your terminal software supports hyperlinks, you will be able to click the wor
|
|||
Escaping
|
||||
~~~~~~~~
|
||||
|
||||
Occasionally you may want to print something that Rich would interpret as markup. You can *escape* square brackets by doubling them up. Here's an example::
|
||||
Occasionally you may want to print something that Rich would interpret as markup. You can *escape* a tab by preceding it with backslash. Here's an example::
|
||||
|
||||
>>> from rich import print
|
||||
>>> print("foo[[bar]]")
|
||||
>>> print("foo\[bar]")
|
||||
foo[bar]
|
||||
|
||||
The function :func:`~rich.markup.escape` will handle escape of text for you.
|
||||
|
||||
.. warning::
|
||||
Be careful when using f-strings with console markup. You will need to escape any variables if they could contain square brackets.
|
||||
|
||||
Rendering Markup
|
||||
----------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue