// 目次を生成 function generateTableOfContents() { var headings = document.querySelectorAll("h2"); var tableOfContents = document.createElement("div"); tableOfContents.innerHTML = "目次"; headings.forEach(function(heading, index) { var text = heading.textContent; heading.id = "section" + (index + 1); table…