Skip to content

Conversation

@lesliehc
Copy link

@lesliehc lesliehc commented Dec 2, 2025

Type of changes

  • Bug fix
  • New feature
  • Documentation / docstrings
  • Tests
  • Other

AI?

  • AI was used to generate this PR

Description

This is tests-only. It documents and guards behavior around backslashes with Rich markup:

  • Ensure backslash-escaped brackets render literally and don’t cause mismatched tags:
    • r"[b]hello[/b]"
    • r"C:[bin]\tools"
    • r"C:\[bin]\tools"
    • r"[color(123,45,6)]x[/color]"
  • Add an xfail for a known issue where a raw backslash immediately before [ is swallowed:
    • r"C:[tmp]\file.txt"
    • Marked @pytest.mark.xfail(strict=False) so this turns green automatically when fixed.

No runtime code is changed.

Files changed

  • tests/test_markup_backslash_escape.py (new)

Local test evidence

poetry run pytest -q tests/test_markup_backslash_escape.py
6 passed, 1 xfailed in 0.04s

Issue link

Notes

  • Happy to split the xfail into a separate file or tweak parametrization if preferred.

Checklist

  • Ran black (default args) on new test file
  • Added tests
  • I accept that @willmcgugan may be pedantic in the code review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant