File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88from logging import getLogger
99
1010from docutils .core import publish_parts
11+ from docutils .writers .html5_polyglot import Writer as HTML5Writer
1112from traitlets import TraitError
1213from traitlets .config import Configurable
1314
@@ -250,12 +251,13 @@ def _repr_html_(self):
250251 """nice HTML rep, with blue for non-default values"""
251252 traits = self .traits ()
252253 name = self .__class__ .__name__
253- docstring = (
254- publish_parts (cleandoc (self .__class__ .__doc__ ), writer_name = "html" )[
255- "html_body"
256- ]
257- or "Undocumented"
258- )
254+
255+ if not self .__class__ .__doc__ :
256+ docstring = "Undocumented"
257+ else :
258+ clean_doc = cleandoc (self .__class__ .__doc__ )
259+ writer = HTML5Writer ()
260+ docstring = publish_parts (clean_doc , writer = writer )["html_body" ]
259261 lines = [
260262 '<div style="border:1px solid black; max-width: 700px; padding:2em; word-wrap:break-word;">' ,
261263 f"<b>{ name } </b>" ,
You can’t perform that action at this time.
0 commit comments