pypi rich 5.0.0
Markup format change

latest releases: 13.7.1, 13.7.0, 13.6.0...
3 years ago

Console markup syntax has been tweaked to not overlap with Python data structures.

Prior to 5.0.0 if you stringified a list it would typically be removed from the output as Rich would interpret it as a markup tag. This surprised people when printing lists in an f-string.

For instance, prior to 5.0.0 the following would not print as you might expect:

>>> my_list = [1,2,3]
>>> print(f"my_list={my_list}")
my_list=

With 5.0.0 it prints this following::

my_list = [1, 2, 3]

Which is less astonishing.

This change required some changes to the console markup syntax, which is the reason for the major version bump.

You can no longer use a number between 0 and 255 to provide a color, now it must be wrapped with color(NUMBER). So "[4]Red[/]" becomes "[color(4)]Red[/]". From an extensive search of Github, most people never used this syntax anyway and would prefer to use friendly color names.

Additionally escaping has changed. Prior to 5.0.0 you could escape square brackets by doubling them up. From 5.0.0 you can escape a tag with backslash.

[5.0.0] - 2020-08-02

Changed

  • Change to console markup syntax to not parse Python structures as markup, i.e. [1,2,3] is treated as a literal, not a tag.
  • Standard color numbers syntax has changed to "color(<number>)" so that [5] (for example) is considered a literal.
  • Markup escape method has changed from double brackets to preceding with a backslash, so foo[[]] would be foo\[bar]

Don't miss a new rich release

NewReleases is sending notifications on new releases.