Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Same unique id for each div generated by display_javascript() #1759

Closed
simzer opened this issue Apr 11, 2022 · 0 comments · Fixed by #1761
Closed

Same unique id for each div generated by display_javascript() #1759

simzer opened this issue Apr 11, 2022 · 0 comments · Fixed by #1761

Comments

@simzer
Copy link

simzer commented Apr 11, 2022

After converting the attached notebook idtest.ipynb.txt
containing this content:

from IPython.display import display_javascript
display_javascript("console.log(element.id)", raw=True)`
display_javascript("console.log(element.id)", raw=True)`

with the following command to html:

jupyter nbconvert --to html --execute idtest.ipynb 

the generated output idtest.html.txt contains a <div> for each display_javascript() call with the same id:

<div id="dd594bf5-4609-4eb6-92a7-5521f50e2bfe" class="jp-RenderedJavaScript jp-OutputArea-output " data-mime-type="application/javascript">
...
<div id="dd594bf5-4609-4eb6-92a7-5521f50e2bfe" class="jp-RenderedJavaScript jp-OutputArea-output " data-mime-type="application/javascript">

According to the template in base.html.j2 the <div>s' ids are intended to be unique:

{% set div_id = uuid4() %}
<div id="{{ div_id }}" class="output_subarea output_javascript {{ extra_class }}">

Nbconvert version: 6.4.5

blink1073 pushed a commit that referenced this issue Jun 10, 2022
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
blink1073 pushed a commit that referenced this issue Aug 19, 2022
…fixed #1759) (#1839)

Co-authored-by: David Vegh <61405792+veghdev@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant