From 99b83f140ac70d6307382b2fd238844baaf5c957 2022-12-09 20:18:08 From: Jason Grout Date: 2022-12-09 20:18:08 Subject: [PATCH] Escape html text in inspect replies by default Otherwise, the default docstring was not displayed in html because it was acting as an html tag. --- diff --git a/IPython/core/oinspect.py b/IPython/core/oinspect.py index 43f6707..801cb88 100644 --- a/IPython/core/oinspect.py +++ b/IPython/core/oinspect.py @@ -16,6 +16,7 @@ __all__ = ['Inspector','InspectColors'] import ast import inspect from inspect import signature +import html import linecache import warnings import os @@ -531,7 +532,7 @@ class Inspector(Colorable): """ defaults = { 'text/plain': text, - 'text/html': '
' + text + '
' + 'text/html': '
' + html.escape(text) + '
' } if formatter is None: