Skip to content

Commit 0c2c7ba

Browse files
committed
Object Inspector: Escape common html chars in argspec
- Some of them (like < and >) were interfering with the rest of html present in the page
1 parent 90640fb commit 0c2c7ba

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

spyderlib/utils/inspector/sphinxify.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import shutil
2424
import sys
2525
from tempfile import mkdtemp
26+
from xml.sax.saxutils import escape
2627

2728
# 3rd party imports
2829
from docutils.utils import SystemMessage as SystemMessage
@@ -177,7 +178,9 @@ def sphinxify(docstring, context, buildername='html'):
177178

178179
# Add a class to several characters on the argspec. This way we can
179180
# highlight them using css, in a similar way to what IPython does.
180-
argspec = context['argspec']
181+
# NOTE: Before doing this, we escape common html chars so that they
182+
# don't interfere with the rest of html present in the page
183+
argspec = escape(context['argspec'])
181184
for char in ['=', ',', '(', ')', '*', '**']:
182185
argspec = argspec.replace(char,
183186
'<span class="argspec-highlight">' + char + '</span>')

0 commit comments

Comments
 (0)