diff --git a/next.config.ts b/next.config.ts
index 9ccea5c..3b1c083 100644
--- a/next.config.ts
+++ b/next.config.ts
@@ -1,5 +1,6 @@
import type { NextConfig } from 'next'
import createMDX from '@next/mdx'
+import rehypeSlug from 'rehype-slug'
const nextConfig: NextConfig = {
/* config options here */
@@ -8,6 +9,9 @@ const nextConfig: NextConfig = {
const withMDX = createMDX({
extension : /\.mdx?$/,
+ options: {
+ rehypePlugins: [rehypeSlug],
+ },
})
export default withMDX(nextConfig)
diff --git a/package-lock.json b/package-lock.json
index 354c513..e886aae 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -19,6 +19,7 @@
"radix-ui": "^1.4.3",
"react": "19.2.3",
"react-dom": "19.2.3",
+ "rehype-slug": "^6.0.0",
"tailwind-merge": "^3.5.0"
},
"devDependencies": {
@@ -7546,6 +7547,12 @@
"url": "https://github.com/privatenumber/get-tsconfig?sponsor=1"
}
},
+ "node_modules/github-slugger": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/github-slugger/-/github-slugger-2.0.0.tgz",
+ "integrity": "sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==",
+ "license": "ISC"
+ },
"node_modules/glob-parent": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
@@ -7716,6 +7723,19 @@
"node": ">= 0.4"
}
},
+ "node_modules/hast-util-heading-rank": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/hast-util-heading-rank/-/hast-util-heading-rank-3.0.0.tgz",
+ "integrity": "sha512-EJKb8oMUXVHcWZTDepnr+WNbfnXKFNf9duMesmr4S8SXTJBJ9M4Yok08pu9vxdJwdlGRhVumk9mEhkEvKGifwA==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/hast": "^3.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
"node_modules/hast-util-to-estree": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/hast-util-to-estree/-/hast-util-to-estree-3.1.3.tgz",
@@ -7771,6 +7791,19 @@
"url": "https://opencollective.com/unified"
}
},
+ "node_modules/hast-util-to-string": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/hast-util-to-string/-/hast-util-to-string-3.0.1.tgz",
+ "integrity": "sha512-XelQVTDWvqcl3axRfI0xSeoVKzyIFPwsAGSLIsKdJKQMXDYJS4WYrBNF/8J7RdhIcFI2BOHgAifggsvsxp/3+A==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/hast": "^3.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
"node_modules/hast-util-whitespace": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-3.0.0.tgz",
@@ -11535,6 +11568,23 @@
"url": "https://opencollective.com/unified"
}
},
+ "node_modules/rehype-slug": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/rehype-slug/-/rehype-slug-6.0.0.tgz",
+ "integrity": "sha512-lWyvf/jwu+oS5+hL5eClVd3hNdmwM1kAC0BUvEGD19pajQMIzcNUd/k9GsfQ+FfECvX+JE+e9/btsKH0EjJT6A==",
+ "license": "MIT",
+ "dependencies": {
+ "@types/hast": "^3.0.0",
+ "github-slugger": "^2.0.0",
+ "hast-util-heading-rank": "^3.0.0",
+ "hast-util-to-string": "^3.0.0",
+ "unist-util-visit": "^5.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/unified"
+ }
+ },
"node_modules/remark-mdx": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/remark-mdx/-/remark-mdx-3.1.1.tgz",
diff --git a/package.json b/package.json
index e48ee95..53d4e3f 100644
--- a/package.json
+++ b/package.json
@@ -21,6 +21,7 @@
"radix-ui": "^1.4.3",
"react": "19.2.3",
"react-dom": "19.2.3",
+ "rehype-slug": "^6.0.0",
"tailwind-merge": "^3.5.0"
},
"devDependencies": {
diff --git a/src/components/docs-layout.tsx b/src/components/docs-layout.tsx
index 75bf461..0b9324e 100644
--- a/src/components/docs-layout.tsx
+++ b/src/components/docs-layout.tsx
@@ -2,6 +2,7 @@
import { DocsSidebar } from '@/components/docs-sidebar'
import { SiteHeader } from '@/components/site-header'
+import { TableOfContents } from '@/components/toc'
interface DocsLayoutProps {
children: React.ReactNode
@@ -12,11 +13,14 @@ export function DocsLayout({ children }: DocsLayoutProps) {
diff --git a/src/components/docs-sidebar.tsx b/src/components/docs-sidebar.tsx
index 1e1458d..cae2d95 100644
--- a/src/components/docs-sidebar.tsx
+++ b/src/components/docs-sidebar.tsx
@@ -1,7 +1,9 @@
'use client'
+import * as React from 'react'
import Link from 'next/link'
import { usePathname } from 'next/navigation'
+import { ChevronRight } from 'lucide-react'
import { docsConfig, type NavItemWithChildren } from '@/config/docs'
import { cn } from '@/lib/utils'
@@ -9,7 +11,7 @@ export function DocsSidebar() {
const pathname = usePathname()
return (
-