Skip to content

Commit

Permalink
trailing slash fix
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Jul 29, 2023
1 parent 2dc8398 commit 58f54ca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Fixed Text.expand_tabs not expanding spans.
- Fixed TimeElapsedColumn from showing negative.
- Fix for escaping strings with a trailing backslash https://github.com/Textualize/rich/issues/2987

### Added

Expand Down
3 changes: 2 additions & 1 deletion rich/markup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,9 @@ def escape_backslashes(match: Match[str]) -> str:
return f"{backslashes}{backslashes}\\{text}"

markup = _escape(escape_backslashes, markup)
if markup.endswith("\\"):
if markup.endswith("\\") and not markup.endswith("\\\\"):
return markup + "\\"

return markup


Expand Down

0 comments on commit 58f54ca

Please sign in to comment.