Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Markup Escaping Regression #2187

Closed
sco1 opened this issue Apr 11, 2022 · 2 comments
Closed

[BUG] Markup Escaping Regression #2187

sco1 opened this issue Apr 11, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@sco1
Copy link

sco1 commented Apr 11, 2022

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
@willmcgugan willmcgugan added bug Something isn't working and removed Needs triage labels Apr 12, 2022
@willmcgugan
Copy link
Collaborator

Fixed in 12.3.0

@github-actions
Copy link

Did I solve your problem?

Why not buy the devs a coffee to say thanks?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants