Skip to content

Commit

Permalink
update query selector to only choose headings that have an id
Browse files Browse the repository at this point in the history
  • Loading branch information
royalfig authored Jul 5, 2023
1 parent 7e13153 commit 57d4ca8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion assets/js/app/toc.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function toc() {
return;
}

const headings = postContainer.querySelectorAll('h2, h3, h4, h5, h6');
const headings = postContainer.querySelectorAll(':where(h2,h3,h4,h5,h6)[id]');

// If there are fewer than 3 headings, don't show the table of contents.
if (headings.length < 3) {
Expand Down

0 comments on commit 57d4ca8

Please sign in to comment.