Skip to content

gatsby-plugin-mdx v4 code in heading #36829

Answered by LekoArts
NickyMeuleman asked this question in Help
Discussion options

You must be logged in to vote

The ToC gets generated here:

tableOfContents: {
type: `JSON`,
args: {
maxDepth: {
type: `Int`,
default: 6,
},
},
async resolve(mdxNode, { maxDepth }) {
const [{ visit }, { toc }] = await Promise.all([
import(`unist-util-visit`),
import(`mdast-util-toc`),
])
const fileNode = getNode(mdxNode.parent) as FileSystemNode
if (!fileNode) {
return null
}
const result = await compileMDXWithCustomOptions(
{
source: mdxNode.body,
absolutePath: fileNode.absolutePath,
},
{
pluginOptions

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@LekoArts
Comment options

Answer selected by NickyMeuleman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants