Textualize / rich

Rich is a Python library for rich text and beautiful formatting in the terminal.
https://rich.readthedocs.io/en/latest/
MIT License
48.13k stars 1.69k forks source link

[BUG] unexpected colored if there's hyphen with number behind #3306

Closed nofacer closed 3 months ago

nofacer commented 3 months ago

Describe the bug If there's number after hyphen it will be colored even I've escaped it.

from rich.console import Console
from rich.markup import escape

Console().rule(f"[on black]{escape('A-2')}[/on black]")
Console().rule(f"[on black]{escape('A2')}[/on black]")
Console().rule(f"[on black]{escape('A-A')}[/on black]")

image

Platform Windows, rich==13.7.1

github-actions[bot] commented 3 months ago

We found the following entry in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

nofacer commented 3 months ago

disable highlight solves this highlight=False

github-actions[bot] commented 3 months ago

I hope we solved your problem.

If you like using Rich, you might also enjoy Textual