Add Table of Contents for posts#137
Open
eXpl0it3r wants to merge 1 commit into
Open
Conversation
eXpl0it3r
commented
Nov 26, 2025
kunman93
suggested changes
May 8, 2026
kunman93
left a comment
There was a problem hiding this comment.
Good foundation! The TOC feature works end-to-end and the responsive sidebar layout is a nice touch. A few things to address before this is ready:
Functional issues
- The
convertToUlhast mutation is redundant — the CSS.toc-sidebar ol { list-style: none }already handles this visually, and removing the JS conversion makes that CSS rule live again (see inline comments). h1is included in the heading list but article bodies almost certainly don't use# h1, so removing it avoids surprising TOC entries.- The
<nav>created bycustomizeTOCis missing anaria-label, which breaks accessibility when more than one<nav>is on the page.
CSS
- There is a ~160px gap between the
max-width: 1279px(mobile) andmin-width: 90rem(1440px desktop) breakpoints where neither layout rule fires.
Minor
- Indentation inside
rehypePluginsis inconsistent with the rest of the config. mb-16removal affects posts without headings (no TOC rendered), which may look odd.
The VS Code TypeScript error you mentioned is likely caused by rehype-toc being a thin re-export of @jsdevtools/rehype-toc without proper ESM type declarations. You could suppress it with // @ts-ignore above the import, or switch to importing @jsdevtools/rehype-toc directly (it's already installed as a transitive dependency).
706a1d7 to
2e0dd67
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #123
Using rehype slug & autolink-headings & toc we can automatically add a Table of Contents to every blog post.
I marked this as draft, as I feel like it could use some more work:
Not sure if/when I have the time to fix this, but the draft PR could also just serve as inspiration for someone else.
Desktop view
Responsive "tablet" / mobile view