Skip to content

Commit 4b1293e

Browse files
committed
fix at escape
1 parent 1d5152e commit 4b1293e

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [10.16.2] - 2021-01-02
9+
10+
### Fixed
11+
12+
- Fixed @ not being escaped in markup
13+
814
## [10.16.1] - 2021-12-15
915

1016
### Fixed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "rich"
33
homepage = "https://github.com/willmcgugan/rich"
44
documentation = "https://rich.readthedocs.io/en/latest/"
5-
version = "10.16.1"
5+
version = "10.16.2"
66
description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"
77
authors = ["Will McGugan <[email protected]>"]
88
license = "MIT"

rich/markup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def markup(self) -> str:
4747

4848

4949
def escape(
50-
markup: str, _escape: _EscapeSubMethod = re.compile(r"(\\*)(\[[a-z#\/].*?\])").sub
50+
markup: str, _escape: _EscapeSubMethod = re.compile(r"(\\*)(\[[a-z#\/@].*?\])").sub
5151
) -> str:
5252
"""Escapes text so that it won't be interpreted as markup.
5353

tests/test_markup.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ def test_escape():
3232
assert escape("[5]") == "[5]"
3333
assert escape("\\[5]") == "\\[5]"
3434

35+
# Test @ escape
36+
assert escape("[@foo]") == "\\[@foo]"
37+
assert escape("[@]") == "\\[@]"
38+
3539

3640
def test_render_escape():
3741
console = Console(width=80, color_system=None)

0 commit comments

Comments
 (0)