mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-28 03:01:57 +02:00
Also prevent unknown roles from causing formatting to error
This commit is contained in:
@@ -204,7 +204,10 @@ def prettify(text: str) -> str:
|
|||||||
|
|
||||||
def sub(m: Match) -> str:
|
def sub(m: Match) -> str:
|
||||||
role, text = m.group(1, 2)
|
role, text = m.group(1, 2)
|
||||||
return str(role_map[role](text))
|
try:
|
||||||
|
return str(role_map[role](text))
|
||||||
|
except KeyError:
|
||||||
|
return str(text)
|
||||||
|
|
||||||
text = re.sub(r':([a-z]+):`([^`]+)`', sub, text)
|
text = re.sub(r':([a-z]+):`([^`]+)`', sub, text)
|
||||||
return text
|
return text
|
||||||
|
|||||||
Reference in New Issue
Block a user