|
@@ -26,6 +26,7 @@ r"""输出内容到用户浏览器
|
|
--------------
|
|
--------------
|
|
.. autofunction:: put_text
|
|
.. autofunction:: put_text
|
|
.. autofunction:: put_markdown
|
|
.. autofunction:: put_markdown
|
|
|
|
+.. autofunction:: put_html
|
|
.. autofunction:: put_code
|
|
.. autofunction:: put_code
|
|
.. autofunction:: put_table
|
|
.. autofunction:: put_table
|
|
.. autofunction:: table_cell_buttons
|
|
.. autofunction:: table_cell_buttons
|
|
@@ -161,11 +162,16 @@ def put_text(text, inline=False, anchor=None, before=None, after=None):
|
|
|
|
|
|
def put_html(html, anchor=None, before=None, after=None):
|
|
def put_html(html, anchor=None, before=None, after=None):
|
|
"""
|
|
"""
|
|
- 输出文本内容
|
|
|
|
|
|
+ 输出Html内容。
|
|
|
|
+
|
|
|
|
+ 与支持通过Html输出内容到 `Jupyter Notebook <https://nbviewer.jupyter.org/github/ipython/ipython/blob/master/examples/IPython%20Kernel/Rich%20Output.ipynb#HTML>` 的库兼容。
|
|
|
|
|
|
- :param str html: html内容
|
|
|
|
|
|
+ :param html: html字符串或 实现了 `IPython.display.HTML` 接口的类的实例
|
|
:param str anchor, before, after: 与 `put_text` 函数的同名参数含义一致
|
|
:param str anchor, before, after: 与 `put_text` 函数的同名参数含义一致
|
|
"""
|
|
"""
|
|
|
|
+ if hasattr(html, '__html__'):
|
|
|
|
+ html = html.__html__()
|
|
|
|
+
|
|
_put_content('html', content=html, anchor=anchor, before=before, after=after)
|
|
_put_content('html', content=html, anchor=anchor, before=before, after=after)
|
|
|
|
|
|
|
|
|