This commit is contained in:
reonokiy 2025-08-22 14:48:00 +08:00 committed by GitHub
commit 752374ffda
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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()): if jupyter or (jupyter is None and is_in_jupyter()):
# return HTML rendered by IPython display() # return HTML rendered by IPython display()
# See #4840 for details on span wrapper to disable mathjax # 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 display(HTML('<span class="tex2jax_ignore">{}</span>'.format(html)))
return html return html

View File

@ -1452,7 +1452,7 @@ detecting the IPython kernel. Mainly used for the
> ```python > ```python
> html = "<h1>Hello world!</h1>" > html = "<h1>Hello world!</h1>"
> if util.is_in_jupyter(): > if util.is_in_jupyter():
> from IPython.core.display import display, HTML > from IPython.display import display, HTML
> display(HTML(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) ![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 and returns a Jupyter HTML object. If you were doing it manually, it'd look like
this: this:
```python ```python
from IPython.core.display import display, HTML from IPython.display import display, HTML
html = displacy.render(doc, style="dep") html = displacy.render(doc, style="dep")
display(HTML(html)) display(HTML(html))