Skip to content

Commit 4b92555

Browse files
authored
Merge pull request #99 from objectstack-ai/copilot/enable-fumadocs-features-plugins
2 parents d4c6530 + b3989de commit 4b92555

File tree

9 files changed

+323
-2
lines changed

9 files changed

+323
-2
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,29 @@ export default async function Page(props: {
1212
if (!page) notFound();
1313

1414
const MDX = (page.data as any)._exports?.default || (page.data as any).exports?.default;
15+
const githubPath = params.slug
16+
? `apps/site/content/docs/${params.slug.join('/')}.mdx`
17+
: 'apps/site/content/docs/index.mdx';
1518

1619
return (
1720
<DocsPage
1821
toc={(page.data as any).toc ?? []}
1922
full={false}
23+
footer={{
24+
children: (
25+
<a
26+
href={`https://github.com/objectstack-ai/objectos/blob/main/${githubPath}`}
27+
target="_blank"
28+
rel="noreferrer noopener"
29+
className="inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors"
30+
>
31+
<svg className="size-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
32+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" />
33+
</svg>
34+
Edit this page on GitHub
35+
</a>
36+
),
37+
}}
2038
>
2139
<DocsBody>
2240
<h1>{page.data.title}</h1>

apps/site/app/docs/layout.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ export default function Layout({ children }: { children: ReactNode }) {
99
<DocsLayout
1010
tree={pageTree}
1111
{...baseOptions}
12+
sidebar={{
13+
collapsible: true,
14+
defaultOpenLevel: 0,
15+
}}
1216
>
1317
{children}
1418
</DocsLayout>

apps/site/app/global.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@import 'tailwindcss';
22
@import 'fumadocs-ui/style.css';
3+
@import 'fumadocs-twoslash/twoslash.css';
34

45
@theme {
56
/* Colors - using CSS custom properties */

apps/site/app/layout.config.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const baseOptions: BaseLayoutProps = {
1414
<span className="font-bold">ObjectOS</span>
1515
</div>
1616
),
17+
transparentMode: 'top',
1718
},
1819
links: [
1920
{
@@ -29,6 +30,8 @@ export const baseOptions: BaseLayoutProps = {
2930
{
3031
text: 'GitHub',
3132
url: 'https://github.com/objectstack-ai/objectos',
33+
external: true,
3234
},
3335
],
36+
githubUrl: 'https://github.com/objectstack-ai/objectos',
3437
};

apps/site/app/layout.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,16 @@ export default function Layout({ children }: { children: ReactNode }) {
1111
return (
1212
<html lang="en" className={inter.className} suppressHydrationWarning>
1313
<body>
14-
<RootProvider>{children}</RootProvider>
14+
<RootProvider
15+
search={{
16+
enabled: true,
17+
options: {
18+
type: 'static',
19+
},
20+
}}
21+
>
22+
{children}
23+
</RootProvider>
1524
</body>
1625
</html>
1726
);

apps/site/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
},
1212
"dependencies": {
1313
"fumadocs-core": "^16.4.7",
14+
"fumadocs-docgen": "^3.0.5",
1415
"fumadocs-mdx": "^14.2.6",
16+
"fumadocs-twoslash": "^3.1.12",
1517
"fumadocs-ui": "^16.4.7",
1618
"lucide-react": "^0.562.0",
1719
"next": "^16.1.4",

apps/site/source.config.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { defineDocs, defineConfig, defineCollections } from 'fumadocs-mdx/config';
22
import { z } from 'zod';
3+
import { remarkInstall } from 'fumadocs-docgen';
4+
import { rehypeCodeDefaultOptions } from 'fumadocs-core/mdx-plugins';
5+
import { transformerTwoslash } from 'fumadocs-twoslash';
36

47
export const { docs, meta } = defineDocs({
58
dir: 'content/docs',
@@ -16,4 +19,18 @@ export const blog = defineCollections({
1619
type: 'doc',
1720
});
1821

19-
export default defineConfig();
22+
export default defineConfig({
23+
mdxOptions: {
24+
remarkPlugins: [remarkInstall],
25+
rehypeCodeOptions: {
26+
themes: {
27+
light: 'github-light',
28+
dark: 'github-dark',
29+
},
30+
transformers: [
31+
...(rehypeCodeDefaultOptions.transformers ?? []),
32+
transformerTwoslash(),
33+
],
34+
},
35+
},
36+
});

apps/site/tailwind.config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ const config: Config = {
99
'./lib/**/*.{ts,tsx}',
1010
'./mdx-components.{ts,tsx}',
1111
'./node_modules/fumadocs-ui/dist/**/*.js',
12+
'./node_modules/fumadocs-twoslash/dist/**/*.js',
13+
],
14+
plugins: [
15+
require('@tailwindcss/typography'),
1216
],
1317
};
1418

0 commit comments

Comments
 (0)