Skip to content

Inconsistent highlighting in help section #108

Closed
@km2023-4

Description

Dear authors, I recently started using rich-click and have to say it looks amazing.

While playing around with click's command help sections, though, I noticed some inconsistent colouring/highlighting:

image

It seems that the argument related regex in the OptionHighlighter class (rich_help_configuration.py) is not handling things consistenly. Removing the regex seems to be more pleasing on the eyes...

class OptionHighlighter(rich.highlighter.RegexHighlighter):
    """Highlights our special options."""

    highlights = [        
        r"(^|\W)(?P<switch>\-\w+)(?![a-zA-Z0-9])",
        r"(^|\W)(?P<option>\-\-[\w\-]+)(?![a-zA-Z0-9])",
        # r"(^|\W)(?P<argument>[A-Z0-9\_]+)(?![_a-zA-Z0-9])",        
        r"(?P<metavar>\<[^\>]+\>)",
        r"(?P<usage>Usage: )",
    ]

image

Do we really need to auto highlight words in capitals or numbers inside the help section?

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions