diff --git a/sphinx_comments/__init__.py b/sphinx_comments/__init__.py index 9faeff1..e70e4e5 100644 --- a/sphinx_comments/__init__.py +++ b/sphinx_comments/__init__.py @@ -77,8 +77,8 @@ def activate_comments(app, config): script.setAttribute("label", "{label}"); script.setAttribute("crossorigin", "{crossorigin}"); - sections = document.querySelectorAll("div.section"); - if (sections !== null) {{ + sections = document.querySelectorAll("section"); + if (sections !== null && sections.length > 0) {{ section = sections[sections.length-1]; section.appendChild(script); }}