diff --git a/kitty/cli.py b/kitty/cli.py index a9fcc9e3f..3bfeda8e2 100644 --- a/kitty/cli.py +++ b/kitty/cli.py @@ -224,12 +224,12 @@ def parse_option_spec(spec: Optional[str] = None) -> Tuple[OptionSpecSeq, Option def prettify(text: str) -> str: + def identity(x: str) -> str: + return x + def sub(m: Match) -> str: role, text = m.group(1, 2) - try: - return str(role_map[role](text)) - except KeyError: - return str(text) + return role_map.get(role, identity)(text) text = re.sub(r':([a-z]+):`([^`]+)`', sub, text) return text