diff --git a/docs/mdx-components.tsx b/docs/mdx-components.tsx
index 0c1120f..d43f4bc 100644
--- a/docs/mdx-components.tsx
+++ b/docs/mdx-components.tsx
@@ -27,13 +27,32 @@ function extractText(children: React.ReactNode): string {
export function useMDXComponents(components: MDXComponents): MDXComponents {
return {
...components,
+ h1: ({ children }: { children?: React.ReactNode }) => {
+ const id = slugify(extractText(children));
+ return (
+
+ {children}
+ #
+
+ );
+ },
h2: ({ children }: { children?: React.ReactNode }) => {
const id = slugify(extractText(children));
- return {children}
;
+ return (
+
+ {children}
+ #
+
+ );
},
h3: ({ children }: { children?: React.ReactNode }) => {
const id = slugify(extractText(children));
- return {children}
;
+ return (
+
+ {children}
+ #
+
+ );
},
a: ({
href,
diff --git a/docs/src/app/globals.css b/docs/src/app/globals.css
index 843d35f..846a158 100644
--- a/docs/src/app/globals.css
+++ b/docs/src/app/globals.css
@@ -201,6 +201,27 @@ pre:not(.shiki) {
color: var(--foreground);
}
+.prose .heading-anchor {
+ position: relative;
+}
+
+.prose .heading-anchor > a {
+ opacity: 0;
+ margin-left: 0.375rem;
+ color: var(--muted-foreground);
+ text-decoration: none;
+ font-weight: 400;
+ transition: opacity 0.15s ease;
+}
+
+.prose .heading-anchor:hover > a {
+ opacity: 1;
+}
+
+.prose .heading-anchor > a:hover {
+ color: var(--foreground);
+}
+
.prose p {
margin-bottom: 1rem;
line-height: 1.65;