Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: "Navigation guide" #117

Open
n1ckisthereu opened this issue Jul 3, 2024 · 2 comments
Open

Feat: "Navigation guide" #117

n1ckisthereu opened this issue Jul 3, 2024 · 2 comments

Comments

@n1ckisthereu
Copy link
Contributor

Well, I don't know about the design decisions chosen for this theme (which are incredible) but I believe it would be cool if when opening a post, we would have a kind of navigation tab, something like this:

image

basically implementing the topics created on the page in this new "menu".

@davidvkimball
Copy link

I think something like this might suit your needs:

Readme Card

@davidvkimball
Copy link

In case you're still interested in adding this, all you have to do is use pnpm add remark-toc and add it to your Astro config file, and you're done! Each time you want a table of contents, just create a heading called ## Contents and it will automatically generate it for you.

I just added this new line and modified the remarkPlugins line in my astro.config.mjs file:

import remarkToc from "remark-toc"
remarkPlugins: [remarkMath, remarkReadingTime, remarkDirective, parseDirectiveNode, [remarkToc, { maxDepth: 2 }]],

I gave it a maxDepth of 2 because I only wanted to display H2 headings. By default it goes all the way to 6, and I found displaying even just H3s and H4s to be a bit too much. But if you want to see it in action, here it is on my blog.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants