Skip to content

Commit

Permalink
minor refactor toc loop
Browse files Browse the repository at this point in the history
  • Loading branch information
nemanjam committed Jun 22, 2024
1 parent 6048575 commit e8af2be
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/modules/post/table-of-contents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@ export const getHeadingsForTableOfContents = (postHeadings: MarkdownHeading[]):
// take only depth 3
if (postHeadings[index].depth !== 3) continue;

subHeadings.push({
slug: postHeadings[index].slug,
text: postHeadings[index].text,
headings: [],
});
const { slug, text } = postHeadings[index];
subHeadings.push({ slug, text, headings: [] });
}

headings.push({ slug, text, headings: subHeadings });
Expand Down

0 comments on commit e8af2be

Please sign in to comment.