From 2a372baa52215eb1a1f1b66580df14a8a89f52c3 Mon Sep 17 00:00:00 2001 From: Quentin Fortier Date: Sun, 24 Jul 2022 12:44:28 +0200 Subject: [PATCH] Fix utterance selector --- sphinx_comments/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); }}