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: Add a dynamic Table of Contents #18

Open
7 tasks
dance2die opened this issue Nov 16, 2019 · 0 comments
Open
7 tasks

feat: Add a dynamic Table of Contents #18

dance2die opened this issue Nov 16, 2019 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@dance2die
Copy link
Owner

dance2die commented Nov 16, 2019

To Dos

    • Add a direct link on headers during MDX transformation
    • Research on how to add id on each header element in gatsby-node.js.
    • Add a Scotch.io style ToC.
    • Lazily load the ToC component (for largest media query breakpoint, only).
    • It's a progressive enhancement: hidden except largest media query breakpoint.
    • Question: Create an NPM package out of it for others to benefit? 🤔
    • Style: Add a blob around headers
    • Create a blob SVG
    • CSS on h2 header only

Description

For easier navigation, add a fixed table of contents (ToC, hereafter) in Scotch.io style.
Example page: https://scotch.io/tutorials/building-a-video-blog-with-gatsby-and-markdown-mdx#toc-prerequisites

Demos

1. ToC on hover

hover toc

2. Direct link on headers

demo

3. Styled header with SVG blob.

blob image on header

Why?

  1. I found ToC helps readers to understand the context during reading as one can get lost easily what one's reading.
    • ToC solves the problem and can figure out where they are.
  2. A side effect of having to add link on each header makes it easy to share on other media such as website, slack, etc.
@dance2die dance2die self-assigned this Nov 16, 2019
@dance2die dance2die added the enhancement New feature or request label Nov 16, 2019
@dance2die dance2die pinned this issue Nov 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant