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
I'm creating a blog using NextJs13 and MDX, I have added a table of contents to my pages using rehype-toc.
I want the table (so element) to be outside the article element, to do this I tried to use the position attribute in the plugin config, but it not worked as expected.
next.config.mjs
constwithMDX=createMDX({extension: /\.mdx?$/,options: {
...
[rehypeToc,{headings: ["h1"],// I suppose that TOC will be inserted after the article element// (so to be a child of the `<main>` element)position: "afterend"cssClasses: {toc: "toc not-prose",link: "toc-link"},}]}},})
page.tsx
constIndex: NextPage=({ params }: any)=>{const{ post }=paramsconstPostFile=dynamic(()=>import(`../posts/${post}.mdx`).catch(()=>notFound()))return(<main><articleclassName='prose prose-slate lg:prose-xl'><PostFile/></article></main>)}
If you need more information code is public on my GitHub (blog code is located in /app/blog).
The text was updated successfully, but these errors were encountered:
I'm creating a blog using NextJs13 and MDX, I have added a table of contents to my pages using rehype-toc.
I want the table (so element) to be outside the article element, to do this I tried to use the
position
attribute in the plugin config, but it not worked as expected.next.config.mjs
page.tsx
If you need more information code is public on my GitHub (blog code is located in
/app/blog
).The text was updated successfully, but these errors were encountered: