Skip to content

Commit

Permalink
Detect only anchor links
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed May 1, 2024
1 parent e8282fa commit 529d195
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion background.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function generate() {
}
var toc = [];
for (let heading of headings) {
let anchor = heading.querySelector('a[href]') || heading.parentNode.querySelector('a.anchor[href]');
let anchor = heading.querySelector('a.anchor[href]') || heading.parentNode.querySelector('a.anchor[href]');
if (!anchor)
throw new Error(`Could not find out anchor for a heading: ${heading.textContent}`);
let href = anchor.getAttribute('href');
Expand Down

0 comments on commit 529d195

Please sign in to comment.