replace empty fixture with one that works.
[sgn.git] / docs / libs / anchor-sections-1.1.0 / anchor-sections.js
blobfee005d95b8c886705fd4ed8e9b8dca5a416bc9b
1 document.addEventListener('DOMContentLoaded', function () {
2 // If section divs is used, we need to put the anchor in the child header
3 const headers = document.querySelectorAll("div.hasAnchor.section[class*='level'] > :first-child")
5 headers.forEach(function (x) {
6 // Add to the header node
7 if (!x.classList.contains('hasAnchor')) x.classList.add('hasAnchor')
8 // Remove from the section or div created by Pandoc
9 x.parentElement.classList.remove('hasAnchor')