MCPcopy Index your code
hub / github.com/ipython/ipython / HTML

Class HTML

IPython/core/display.py:430–458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

428
429
430class HTML(TextDisplayObject):
431
432 def __init__(self, data=None, url=None, filename=None, metadata=None):
433 def warn():
434 if not data:
435 return False
436
437 #
438 # Avoid calling lower() on the entire data, because it could be a
439 # long string and we're only interested in its beginning and end.
440 #
441 prefix = data[:10].lower()
442 suffix = data[-10:].lower()
443 return prefix.startswith("<iframe ") and suffix.endswith("</iframe>")
444
445 if warn():
446 warnings.warn("Consider using IPython.display.IFrame instead")
447 super(HTML, self).__init__(data=data, url=url, filename=filename, metadata=metadata)
448
449 def _repr_html_(self):
450 return self._data_and_metadata()
451
452 def __html__(self):
453 """
454 This method exists to inform other HTML-using modules (e.g. Markupsafe,
455 htmltag, etc) that this object is HTML and does not need things like
456 special characters (<>&) escaped.
457 """
458 return self._repr_html_()
459
460
461class Markdown(TextDisplayObject):

Callers 2

htmlMethod · 0.90
_ipython_display_Method · 0.90

Calls

no outgoing calls

Tested by 1

_ipython_display_Method · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…