diff --git a/IPython/core/oinspect.py b/IPython/core/oinspect.py index 801cb88..bcaa95c 100644 --- a/IPython/core/oinspect.py +++ b/IPython/core/oinspect.py @@ -531,8 +531,8 @@ class Inspector(Colorable): """ defaults = { - 'text/plain': text, - 'text/html': '
' + html.escape(text) + '
' + "text/plain": text, + "text/html": f"
{html.escape(text)}
", } if formatter is None: @@ -543,10 +543,7 @@ class Inspector(Colorable): if not isinstance(formatted, dict): # Handle the deprecated behavior of a formatter returning # a string instead of a mime bundle. - return { - 'text/plain': formatted, - 'text/html': '
' + formatted + '
' - } + return {"text/plain": formatted, "text/html": f"
{formatted}
"} else: return dict(defaults, **formatted)