Permalinks missing?
AAverin opened this issue · comments
Even though it's possible to request tableOfContent
in allMdx
and it's properly generated, permalinks seem to be missing on all headline elements.
This could be related to my custom MDXProvider with custom components. Anything special I need to write there? Here is my current state
import { MDXProvider } from '@mdx-js/react'
import React from 'react'
import { H1, H2, H3, PM} from '@src/style/mdxStyle'
import styled, { css } from 'styled-components'
export default ({ children }) => (
<MDXProvider
components={{
// Map HTML element tag to React component
h1: H1,
h2: H2,
h3: H3,
p: PM,
li: styled.li`
${props => props.theme.typography.paragraph.M}
`
}}
>
{children}
</MDXProvider>
)
I check props for the component and there are only children
FYI, for regular .md in Gatsby, every headline also generates a small anchor inside with the '#link' for permalink support and those links are then later used in table of contents
It's the same problem in kitchen-sink
example
https://gatsby-mdx-kitchen-sink.netlify.com/posts/non-page-basic-toc#something-iffi
Links are there in the table of contents but there are not present on the headlines in the generated text
Is this PR the solution?
#389
Also #396
Closing as a duplicate, let's follow #396 instead