-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
You may find a solution to your problem in the docs or issues.
Describe the bug
I use Rich for a toy language interpreter and it appears that something changed in the markdown escaping between v11.2
and v12.0
that is causing one of my unit tests to fail. I use "nil"
to represent the language's None
, which needs to be escaped if it's inside an array (e.g. "[nil]"
) otherwise Rich will treat it as a formatting directive.
I believe it may have been introduced by #1950 but I haven't had a chance to explore the changes.
rich=12.2.0
Python 3.10.2 (main, Jan 30 2022, 11:21:45) [Clang 12.0.5 (clang-1205.0.22.9)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import rich
>>> nils = "[nil, [nil]]"
>>> rich.print(rich.markup.escape(nils))
[nil, ]
vs rich=11.2.0
Python 3.10.2 (main, Jan 30 2022, 11:21:45) [Clang 12.0.5 (clang-1205.0.22.9)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import rich
>>> nils = "[nil, [nil]]"
>>> rich.print(rich.markup.escape(nils))
[nil, [nil]]
Platform
Click to expand
What platform (Win/Linux/Mac) are you running on? What terminal software are you using? Mac
I may ask you to copy and paste the output of the following commands. It may save some time if you do it now.
If you're using Rich in a terminal:
$ python -m rich.diagnose
╭───────────────────────── <class 'rich.console.Console'> ─────────────────────────╮
│ A high level console interface. │
│ │
│ ╭──────────────────────────────────────────────────────────────────────────────╮ │
│ │ <console width=150 ColorSystem.TRUECOLOR> │ │
│ ╰──────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ color_system = 'truecolor' │
│ encoding = 'utf-8' │
│ file = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> │
│ height = 19 │
│ is_alt_screen = False │
│ is_dumb_terminal = False │
│ is_interactive = True │
│ is_jupyter = False │
│ is_terminal = True │
│ legacy_windows = False │
│ no_color = False │
│ options = ConsoleOptions( │
│ size=ConsoleDimensions(width=150, height=19), │
│ legacy_windows=False, │
│ min_width=1, │
│ max_width=150, │
│ is_terminal=True, │
│ encoding='utf-8', │
│ max_height=19, │
│ justify=None, │
│ overflow=None, │
│ no_wrap=False, │
│ highlight=None, │
│ markup=None, │
│ height=None │
│ ) │
│ quiet = False │
│ record = False │
│ safe_box = True │
│ size = ConsoleDimensions(width=150, height=19) │
│ soft_wrap = False │
│ stderr = False │
│ style = None │
│ tab_size = 8 │
│ width = 150 │
╰──────────────────────────────────────────────────────────────────────────────────╯
╭─── <class 'rich._windows.WindowsConsoleFeatures'> ────╮
│ Windows features available. │
│ │
│ ╭───────────────────────────────────────────────────╮ │
│ │ WindowsConsoleFeatures(vt=False, truecolor=False) │ │
│ ╰───────────────────────────────────────────────────╯ │
│ │
│ truecolor = False │
│ vt = False │
╰───────────────────────────────────────────────────────╯
╭────── Environment Variables ───────╮
│ { │
│ 'TERM': 'xterm-256color', │
│ 'COLORTERM': 'truecolor', │
│ 'CLICOLOR': None, │
│ 'NO_COLOR': None, │
│ 'TERM_PROGRAM': 'vscode', │
│ 'COLUMNS': None, │
│ 'LINES': None, │
│ 'JPY_PARENT_PID': None, │
│ 'VSCODE_VERBOSE_LOGGING': None │
│ } │
╰────────────────────────────────────╯
platform="Darwin"
$ pip freeze | grep rich
rich==12.2.0