One function

escape in Textualize/rich

The author described this change as fix at escape. It counts as a record because the check below fails on the code as it stood at 1d5152ef5 and passes on 4b1293e00, with nothing else changed between the two runs.

Fix saved2022-01-02
Sharing licenceMIT · LICENSE
Change size+1 1

What the code was meant to do, written into the code itself as a docstring

Escapes text so that it won't be interpreted as markup. Args: markup (str): Content to be inserted in to markup. Returns: str: Markup with square brackets escaped.

The change

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

The check that tells the two apart

failpass·tests/test_markup.py::test_escape

Check file tests/test_markup.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it1d5152ef52438f77db1d543beb03e972aa465962
Broken version dated2022-01-02
Modulerich.markup
Units changedescape
Fingerprintaf19d277f0c27ed1
Checked2026-08-17 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in Textualize/rich