diff --git a/rich/highlighter.py b/rich/highlighter.py index 8afdd017..e2ef9d7b 100644 --- a/rich/highlighter.py +++ b/rich/highlighter.py @@ -81,7 +81,7 @@ class ReprHighlighter(RegexHighlighter): base_style = "repr." highlights = [ - r"(?P\<)(?P[\w\-\.\:]*)(?P[\w\W]*?)(?P\>)", + r"(?P\<)(?P[\w\-\.\:\|]*)(?P[\w\W]*?)(?P\>)", r"(?P[\w_]{1,50})=(?P\"?[\w_]+\"?)?", r"(?P[\{\[\(\)\]\}])", _combine_regex( diff --git a/tests/test_highlighter.py b/tests/test_highlighter.py index 99793723..c5303b5c 100644 --- a/tests/test_highlighter.py +++ b/tests/test_highlighter.py @@ -40,6 +40,16 @@ highlight_tests = [ Span(4, 9, "repr.str"), ], ), + ( + "", + [ + Span(0, 1, "repr.tag_start"), + Span(1, 23, "repr.tag_name"), + Span(23, 25, "repr.tag_contents"), + Span(25, 26, "repr.tag_end"), + Span(24, 25, "repr.number"), + ], + ), ("( )", [Span(0, 1, "repr.brace"), Span(2, 3, "repr.brace")]), ("[ ]", [Span(0, 1, "repr.brace"), Span(2, 3, "repr.brace")]), ("{ }", [Span(0, 1, "repr.brace"), Span(2, 3, "repr.brace")]),