html_compose.notebook

 1from html_compose.base_types import _HasHtml
 2
 3"""
 4Jupyter notebook helpers
 5"""
 6
 7
 8def render(html_string: str | _HasHtml):
 9    """
10    Renders the given HTML string as an IPython HTML object.
11    This is used by Jupyter notebooks to display HTML content.
12    """
13    from IPython.core.display import HTML
14
15    if isinstance(html_string, _HasHtml):
16        html_string = html_string.__html__()
17    return HTML(html_string)
def render(html_string: str | html_compose.base_types._HasHtml):
 9def render(html_string: str | _HasHtml):
10    """
11    Renders the given HTML string as an IPython HTML object.
12    This is used by Jupyter notebooks to display HTML content.
13    """
14    from IPython.core.display import HTML
15
16    if isinstance(html_string, _HasHtml):
17        html_string = html_string.__html__()
18    return HTML(html_string)

Renders the given HTML string as an IPython HTML object. This is used by Jupyter notebooks to display HTML content.