Refactor to use Text.styled instead of Text.from_markup and escape

This is much more readable, and presumably more performant.
This commit is contained in:
Isaiah Odhner 2023-06-04 15:46:16 -04:00
parent cfe4104b6f
commit 89dadbf4b1

View File

@ -659,7 +659,10 @@ class NodeInfo(Container):
qualname = message_class.__qualname__
doc = inspect.getdoc(message_class) or '(No docstring)'
return Text.assemble(
Text.from_markup(f"[b]{escape(qualname)}[/b]\n[#808080]{escape(doc)}[/#808080]\n"),
Text.styled(qualname, "bold"),
"\n",
Text.styled(doc, "#808080"),
"\n",
usage_info,
"\n",
)