document.querySelector(`#main ${window.$docsify.toc.target}`)
If config like this:
{
tocMaxLevel: 6,
target: 'h1, h2, h3, h4, h5, h6'
}
The selector#main h1, h2, h3, h4, h5, h6 will get h2-h5 of whole document and h1 in #main
Therefore, the following code seems more reasonable
const mainElement = document.querySelector('#main')
headings = mainElement.querySelectorAll(window.$docsify.toc.target)