Skip to content

Commit df4eabb

Browse files
authored
Merge pull request #141 from objectstack-ai/copilot/enable-fumadocs-features-plugins
2 parents 50c3ca4 + edd23d1 commit df4eabb

File tree

6 files changed

+361
-8
lines changed

6 files changed

+361
-8
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@ 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+
>
1923
<DocsTitle>{page.data.title}</DocsTitle>
2024
<DocsDescription>{page.data.description}</DocsDescription>
2125
<DocsBody>

apps/site/app/layout.config.tsx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,39 @@ 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+
footer: (
29+
<div className="flex flex-col gap-2 border-t pt-4 mt-4 text-xs">
30+
<a
31+
href="https://github.com/objectstack-ai/objectql/blob/main/apps/site"
32+
className="text-muted-foreground hover:text-foreground transition-colors inline-flex items-center gap-1"
33+
target="_blank"
34+
rel="noopener noreferrer"
35+
>
36+
Edit this page on GitHub →
37+
</a>
38+
</div>
39+
),
40+
},
41+
// Enable last updated timestamp
42+
lastUpdate: {
43+
enabled: true,
44+
showTimestamp: true,
45+
},
46+
// Enable edit on GitHub
47+
editOnGithub: {
48+
enabled: true,
49+
base: 'https://github.com/objectstack-ai/objectql/blob/main/apps/site',
50+
},
1651
};

apps/site/app/layout.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import './globals.css';
2+
import 'katex/dist/katex.min.css';
23
import type { ReactNode } from 'react';
34
import { RootProvider } from 'fumadocs-ui/provider';
45

apps/site/package.json

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,29 @@
99
"lint": "next lint"
1010
},
1111
"dependencies": {
12+
"fumadocs-core": "^13.0.0",
13+
"fumadocs-mdx": "10.0.0",
14+
"fumadocs-ui": "^13.0.0",
15+
"katex": "^0.16.27",
1216
"next": "^14.2.0",
1317
"react": "^18.3.0",
1418
"react-dom": "^18.3.0",
15-
"fumadocs-core": "^13.0.0",
16-
"fumadocs-ui": "^13.0.0",
17-
"fumadocs-mdx": "10.0.0"
19+
"rehype-autolink-headings": "^7.1.0",
20+
"rehype-katex": "^7.0.1",
21+
"rehype-slug": "^6.0.0",
22+
"remark-frontmatter": "^5.0.0",
23+
"remark-gfm": "^4.0.1",
24+
"remark-math": "^6.0.0"
1825
},
1926
"devDependencies": {
2027
"@types/node": "^20.10.0",
2128
"@types/react": "^18.3.0",
2229
"@types/react-dom": "^18.3.0",
23-
"typescript": "^5.3.0",
30+
"autoprefixer": "^10.4.16",
2431
"eslint": "^8.0.0",
2532
"eslint-config-next": "^14.2.0",
33+
"postcss": "^8.4.32",
2634
"tailwindcss": "^3.4.0",
27-
"autoprefixer": "^10.4.16",
28-
"postcss": "^8.4.32"
35+
"typescript": "^5.3.0"
2936
}
3037
}

apps/site/source.config.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,31 @@
11
import { defineDocs, defineConfig } from 'fumadocs-mdx/config';
2+
import { rehypeCode } from 'fumadocs-core/mdx-plugins';
3+
import remarkGfm from 'remark-gfm';
4+
import remarkMath from 'remark-math';
5+
import rehypeKatex from 'rehype-katex';
6+
import rehypeSlug from 'rehype-slug';
7+
import rehypeAutolinkHeadings from 'rehype-autolink-headings';
28

39
export const { docs, meta } = defineDocs({
410
dir: 'content/docs',
511
});
612

7-
export default defineConfig({});
13+
export default defineConfig({
14+
mdxOptions: {
15+
remarkPlugins: [
16+
remarkGfm, // GitHub Flavored Markdown (tables, strikethrough, task lists, etc.)
17+
remarkMath, // Math equations support
18+
],
19+
rehypePlugins: [
20+
rehypeSlug, // Add IDs to headings
21+
[rehypeAutolinkHeadings, { behavior: 'wrap' }], // Add links to headings
22+
rehypeKatex, // Render math equations
23+
[rehypeCode, {
24+
themes: {
25+
light: 'github-light',
26+
dark: 'github-dark',
27+
},
28+
}],
29+
],
30+
},
31+
});

0 commit comments

Comments
 (0)