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

Right Hand Side Table of Content #104

Closed
wants to merge 13 commits into from
Closed

Right Hand Side Table of Content #104

wants to merge 13 commits into from

Conversation

AceTheCreator
Copy link

@AceTheCreator AceTheCreator commented Mar 30, 2022

This pull request resolves the LHS of issue #93

Details

Wrote a script to retrieve a table of content for every MD and save it in a final JSON (config/post.json), and then read the JSON in the js and render a React component(components/Toc.JS).

The Toc component uses react scroll-spy to navigate the right heading in the markdown...

Since the react-scrollspy library checks, if the heading actually exists in the content in other to scroll, we're using markdown for the site content in which the headings don't have IDs assigned to them. So, I wrote a custom heading in the MDX.js component to assign an id to specific headings which are called CustomHeading

Screenshot

screenshot (6)

@netlify
Copy link

netlify bot commented Mar 30, 2022

Deploy Preview for boring-fermat-22cb64 ready!

Name Link
🔨 Latest commit be031ca
🔍 Latest deploy log https://app.netlify.com/sites/boring-fermat-22cb64/deploys/6244823b894aee00083adfc7
😎 Deploy Preview https://deploy-preview-104--boring-fermat-22cb64.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@rufuspollock
Copy link
Member

rufuspollock commented Mar 30, 2022

@AceTheCreator could you provide a bit of detail in the PR descriptor e.g. what you did, how it provides it, maybe a screenshot of what it looks like etc.

Also when i visit a page i don't see any table of contents e.g. https://deploy-preview-104--boring-fermat-22cb64.netlify.app/concepts/bitcoin

@AceTheCreator
Copy link
Author

AceTheCreator commented Mar 31, 2022

@AceTheCreator could you provide a bit of detail in the PR descriptor e.g. what you did, how it provides it, maybe a screenshot of what it looks like etc.

Also when i visit a page i don't see any table of contents e.g. https://deploy-preview-104--boring-fermat-22cb64.netlify.app/concepts/bitcoin

@rufuspollock there's a table of content on the RHS that says on this page with an arrow. Should I make it open by default?

@rufuspollock
Copy link
Member

@AceTheCreator great - yes please make it open by default (we don't even need the open or closed part i think).

@AceTheCreator AceTheCreator changed the title Left Hand Side Table of Content Right Hand Side Table of Content Apr 4, 2022
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

Successfully merging this pull request may close these issues.

2 participants