MCPcopy Create free account
hub / github.com/ipython/ipython / HTML

Class HTML

IPython/core/display.py:701–729  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

699
700
701class HTML(TextDisplayObject):
702
703 def __init__(self, data=None, url=None, filename=None, metadata=None):
704 def warn():
705 if not data:
706 return False
707
708 #
709 # Avoid calling lower() on the entire data, because it could be a
710 # long string and we're only interested in its beginning and end.
711 #
712 prefix = data[:10].lower()
713 suffix = data[-10:].lower()
714 return prefix.startswith("<iframe ") and suffix.endswith("</iframe>")
715
716 if warn():
717 warnings.warn("Consider using IPython.display.IFrame instead")
718 super(HTML, self).__init__(data=data, url=url, filename=filename, metadata=metadata)
719
720 def _repr_html_(self):
721 return self._data_and_metadata()
722
723 def __html__(self):
724 """
725 This method exists to inform other HTML-using modules (e.g. Markupsafe,
726 htmltag, etc) that this object is HTML and does not need things like
727 special characters (<>&) escaped.
728 """
729 return self._repr_html_()
730
731
732class Markdown(TextDisplayObject):

Callers 1

htmlMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected