You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Go ahead and check this config option, you can load up remark and rehype plugins for generating TOC. If I remembered right, remark-extract-toc is able to extract TOC (and export it as a named object) from the .mdx file.
Then you might need to access the named exports. You can check this section for details.
Alternatively, implement a plugin yourself is not that hard. Try the following code:
consttoc=[]const{ code }=awaitbundleMDX({// ...other optionsmdxOptions: (options,frontmatter)=>{options.remarkPlugins=[
...(options.remarkPlugins||[]),[remarkToc,{exportRef: toc}],]returnoptions}})// now you can use `toc` to render the table of contents!
The structure of toc is what we described in the remarkToc plugin. It looks like this:
mdx-bundler
version: 8.0.node
version: v16.18.0npm
version: 8.19.2Problem description:
Thanks to a great project like mdx-bundler that helped me reduce my development workload.
I want to create a directory of articles in mdx-bundler, but so far I haven't found a way to do it. I don't know if you have any ideas
I found an article, but I don't know how to do it in mdx-bundler
A huge thank you
The text was updated successfully, but these errors were encountered: