-
Notifications
You must be signed in to change notification settings - Fork 100
Include JSX headings in table of contents field #140
Comments
hmm, I suppose we could accomplish this by rendering out the MDX content in full, converting back to mdast and then running get-table-of-content on it. Probably better than what we do today. |
If we are adding the |
This is awesome. I know I keep saying this, but this really is the last thing keeping me from shipping mdx integration with my company's new, Gatsby-built design system. Would love to see this added! |
Master now has a working |
@ChristopherBiscardi Trying to dig in and see if I can make this happen now that the gatsby-mdx/packages/gatsby-mdx/gatsby/extend-node-type.js Lines 192 to 206 in 3790904
The |
Looks like there is a utility for going from HAST to MDAST but I am not sure how to get the HTML string into HAST... |
You can use rehype-parse to get from HTML to hast |
Looks like that requires adding |
yeah, it's already a dependency of mdx and we're not moving away from unified anytime soon (or ever really). |
This might be possible in the future due to gatsbyjs/gatsby#13061 |
Right now, you can query an MDX node to get a table of contents that is built using the markdown headers in the MDX file.
It would be really nice if this would also include headers rendered inside of JSX. I have scenarios where I want to put a header inside of a React component, but right now that will break my table of contents because
gatsby-mdx
only picks up Markdown headers.The text was updated successfully, but these errors were encountered: