refactor: various TOC improvements (#5627)

This commit is contained in:
Alexey Pyltsyn 2021-09-30 13:22:32 +03:00 committed by GitHub
parent 725e7e3da1
commit 4dbc458a22
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 13 deletions

View file

@ -38,11 +38,12 @@ function getAnchors({
}) {
const selectors = [];
for (let i = minHeadingLevel; i <= maxHeadingLevel; i += 1) {
selectors.push(`.anchor.anchor__h${i}`);
selectors.push(`h${i}.anchor`);
}
const selector = selectors.join(', ');
return Array.from(document.querySelectorAll(selector)) as HTMLElement[];
return Array.from(
document.querySelectorAll(selectors.join()),
) as HTMLElement[];
}
function getActiveAnchor(