Output HTML content :param html: html string :param bool sanitize: Whether to use `DOMPurify `_ to filter the content to prevent XSS attacks. :param int scope, position: Those arguments have the same meaning as for `put_text()`
(html: Any, sanitize: bool = False, scope: str = None, position: int = OutputPosition.BOTTOM)
| 460 | # declare argument `html` to type `str` will cause type check error |
| 461 | # so leave this argument's type `Any` |
| 462 | def put_html(html: Any, sanitize: bool = False, scope: str = None, position: int = OutputPosition.BOTTOM) -> Output: |
| 463 | """ |
| 464 | Output HTML content |
| 465 | |
| 466 | :param html: html string |
| 467 | :param bool sanitize: Whether to use `DOMPurify <https://github.com/cure53/DOMPurify>`_ to filter the content to prevent XSS attacks. |
| 468 | :param int scope, position: Those arguments have the same meaning as for `put_text()` |
| 469 | """ |
| 470 | |
| 471 | # Compatible with ipython rich output |
| 472 | # See: https://ipython.readthedocs.io/en/stable/config/integrating.html?highlight=Rich%20display#rich-display |
| 473 | if hasattr(html, '__html__'): |
| 474 | html = html.__html__() |
| 475 | elif hasattr(html, '_repr_html_'): |
| 476 | html = html._repr_html_() |
| 477 | |
| 478 | spec = _get_output_spec('html', content=html, sanitize=sanitize, scope=scope, position=position) |
| 479 | return Output(spec) |
| 480 | |
| 481 | |
| 482 | def put_code(content: str, language: str = '', rows: int = None, scope: str = None, |
no test coverage detected
searching dependent graphs…