sphinx-comments icon indicating copy to clipboard operation
sphinx-comments copied to clipboard

No longer working with recent versions of Jupyter Book

Open anjackson opened this issue 1 year ago • 0 comments

Describe the bug

context When I enable utterances as per the instructions.

expectation I expected the comment UI to show up.

bug But instead nothing appears to happen. Here's a Firefox browser console error message I ran into...

Uncaught TypeError: section is undefined

At this part of the page source (at line 4):

    sections = document.querySelectorAll("div.section");
    if (sections !== null) {
        section = sections[sections.length-1];
        section.appendChild(script);
    }

This seems to be because Jupyter Book uses <section> elements, not <div class="section"> elements (as I am guessing it used to do in the past).

problem This is a problem for people doing fun things in Jupyter Books with comments.

Reproduce the bug

  1. Set up a new Jupyter Book (or upgrade an older one, in my case).
  2. Configure and enable utterances.
  3. Check if it shows up.

List your environment

❯ jupyter-book --version
Jupyter Book      : 1.0.3
External ToC      : 1.0.1
MyST-Parser       : 2.0.0
MyST-NB           : 1.1.2
Sphinx Book Theme : 1.1.3
Jupyter-Cache     : 1.0.0
NbClient          : 0.10.0
❯ pip list | grep sphinx-comments
sphinx-comments               0.0.3
❯ python --version
Python 3.10.12
❯ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.4 LTS
Release:        22.04
Codename:       jamm

anjackson avatar Oct 17 '24 10:10 anjackson