Skip to content

Commit 3a9349f

Browse files
Copilothuangyiirene
andcommitted
Enable advanced fumadocs UI features and enhanced navigation
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
1 parent 3d32b6c commit 3a9349f

File tree

5 files changed

+139
-1
lines changed

5 files changed

+139
-1
lines changed

apps/site/app/docs/[[...slug]]/page.tsx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,26 @@ export default async function Page({
1515
const MDX = page.data.body;
1616

1717
return (
18-
<DocsPage toc={page.data.toc} full={page.data.full}>
18+
<DocsPage
19+
toc={page.data.toc}
20+
full={page.data.full}
21+
lastUpdate={page.data.lastModified}
22+
tableOfContent={{
23+
enabled: true,
24+
footer: (
25+
<div className="flex flex-col gap-2 border-t pt-4 mt-4 text-xs">
26+
<a
27+
href={`https://github.com/objectstack-ai/objectql/blob/main/apps/site/content/docs/${params.slug?.join('/') || 'index'}.mdx`}
28+
target="_blank"
29+
rel="noopener noreferrer"
30+
className="text-muted-foreground hover:text-foreground transition-colors"
31+
>
32+
Edit this page on GitHub →
33+
</a>
34+
</div>
35+
),
36+
}}
37+
>
1938
<DocsTitle>{page.data.title}</DocsTitle>
2039
<DocsDescription>{page.data.description}</DocsDescription>
2140
<DocsBody>

apps/site/app/layout.config.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,28 @@ export const baseOptions: Omit<DocsLayoutProps, 'tree'> = {
1313
},
1414
],
1515
githubUrl: 'https://github.com/objectstack-ai/objectql',
16+
// Enable sidebar search
17+
sidebar: {
18+
defaultOpenLevel: 0,
19+
banner: (
20+
<div className="text-sm text-muted-foreground">
21+
ObjectQL Documentation
22+
</div>
23+
),
24+
},
25+
// Enable table of contents
26+
toc: {
27+
enabled: true,
28+
component: undefined,
29+
},
30+
// Enable last updated timestamp
31+
lastUpdate: {
32+
enabled: true,
33+
showTimestamp: true,
34+
},
35+
// Enable edit on GitHub
36+
editOnGithub: {
37+
enabled: true,
38+
base: 'https://github.com/objectstack-ai/objectql/blob/main/apps/site',
39+
},
1640
};

apps/site/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
"next": "^14.2.0",
1717
"react": "^18.3.0",
1818
"react-dom": "^18.3.0",
19+
"rehype-autolink-headings": "^7.1.0",
1920
"rehype-katex": "^7.0.1",
21+
"rehype-slug": "^6.0.0",
22+
"remark-frontmatter": "^5.0.0",
2023
"remark-gfm": "^4.0.1",
2124
"remark-math": "^6.0.0"
2225
},

apps/site/source.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { rehypeCode } from 'fumadocs-core/mdx-plugins';
33
import remarkGfm from 'remark-gfm';
44
import remarkMath from 'remark-math';
55
import rehypeKatex from 'rehype-katex';
6+
import rehypeSlug from 'rehype-slug';
7+
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
68

79
export const { docs, meta } = defineDocs({
810
dir: 'content/docs',
@@ -15,6 +17,8 @@ export default defineConfig({
1517
remarkMath, // Math equations support
1618
],
1719
rehypePlugins: [
20+
rehypeSlug, // Add IDs to headings
21+
[rehypeAutolinkHeadings, { behavior: 'wrap' }], // Add links to headings
1822
rehypeKatex, // Render math equations
1923
[rehypeCode, {
2024
themes: {

pnpm-lock.yaml

Lines changed: 88 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)