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

not work

Open zhaojiedi1992 opened this issue 7 months ago • 2 comments

Describe the bug

context When I do ___. Uncaught TypeError: Cannot read properties of undefined (reading 'appendChild') at HTMLDocument.addUtterances (000-开服简介.html:49:17)

expectation I expected ___ to occur. Uncaught TypeError: Cannot read properties of undefined (reading 'appendChild') at HTMLDocument.addUtterances (000-开服简介.html:49:17)

var addUtterances = () => { var script = document.createElement("script"); script.type = "text/javascript"; script.src = "https://utteranc.es/client.js"; script.async = "async";

script.setAttribute("repo", "zhaojiedi1992/My_Study_MC");
script.setAttribute("issue-term", "pathname");
script.setAttribute("theme", "github-light");
script.setAttribute("label", "💬 comment");
script.setAttribute("crossorigin", "anonymous");

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

}

bug But instead ___ happens Here's an error message I ran into...

$ jupyter-book build mybook
ERROR ...

problem This is a problem for people doing ___ because ___.

Reproduce the bug

my conf comments_config = { "utterances": { "repo": "zhaojiedi1992/My_Study_MC", "issue-term": "pathname", "theme": "github-light", "crossorigin": "anonymous" , } }

List your environment

No response

zhaojiedi1992 avatar Jul 07 '25 16:07 zhaojiedi1992

extensions = [ 'sphinx_comments', # ... 其他扩展 ]

zhaojiedi1992 avatar Jul 07 '25 16:07 zhaojiedi1992

sphinx-comments sphinx>=2 sphinx-rtd-theme sphinx-copybutton

zhaojiedi1992 avatar Jul 07 '25 16:07 zhaojiedi1992