chore(ipython): import from IPython.display instead of IPython.core.display

This commit is contained in:
reonokiy 2025-08-22 14:44:43 +08:00
parent 41e07772dc
commit f767ab90cd
No known key found for this signature in database
3 changed files with 4 additions and 4 deletions

View File

@ -66,7 +66,7 @@ def render(
if jupyter or (jupyter is None and is_in_jupyter()):
# return HTML rendered by IPython display()
# See #4840 for details on span wrapper to disable mathjax
from IPython.core.display import HTML, display
from IPython.display import HTML, display
return display(HTML('<span class="tex2jax_ignore">{}</span>'.format(html)))
return html

View File

@ -1452,7 +1452,7 @@ detecting the IPython kernel. Mainly used for the
> ```python
> html = "<h1>Hello world!</h1>"
> if util.is_in_jupyter():
> from IPython.core.display import display, HTML
> from IPython.display import display, HTML
> display(HTML(html))
> ```

View File

@ -254,12 +254,12 @@ rendering if auto-detection fails.
![displaCy visualizer in a Jupyter notebook](/images/displacy_jupyter.jpg)
Internally, displaCy imports `display` and `HTML` from `IPython.core.display`
Internally, displaCy imports `display` and `HTML` from `IPython.display`
and returns a Jupyter HTML object. If you were doing it manually, it'd look like
this:
```python
from IPython.core.display import display, HTML
from IPython.display import display, HTML
html = displacy.render(doc, style="dep")
display(HTML(html))