-
Notifications
You must be signed in to change notification settings - Fork 0
Enable fumadocs search, dual-theme highlighting, and UX enhancements #99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
c1adc93
f3fcb6b
84ef145
f745310
591d92a
408aa72
b3989de
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,11 +12,29 @@ export default async function Page(props: { | |
| if (!page) notFound(); | ||
|
|
||
| const MDX = (page.data as any)._exports?.default || (page.data as any).exports?.default; | ||
| const githubPath = params.slug | ||
| ? `apps/site/content/docs/${params.slug.join('/')}.mdx` | ||
| : 'apps/site/content/docs/index.mdx'; | ||
|
|
||
| return ( | ||
| <DocsPage | ||
| toc={(page.data as any).toc ?? []} | ||
| full={false} | ||
| footer={{ | ||
| children: ( | ||
| <a | ||
| href={`https://github.com/objectstack-ai/objectos/blob/main/${githubPath}`} | ||
|
||
| target="_blank" | ||
| rel="noreferrer noopener" | ||
| className="inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors" | ||
| > | ||
| <svg className="size-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"> | ||
| <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" /> | ||
| </svg> | ||
|
Comment on lines
+31
to
+33
|
||
| Edit this page on GitHub | ||
| </a> | ||
| ), | ||
| }} | ||
| > | ||
| <DocsBody> | ||
| <h1>{page.data.title}</h1> | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -14,6 +14,7 @@ export const baseOptions: BaseLayoutProps = { | |||||||||||
| <span className="font-bold">ObjectOS</span> | ||||||||||||
| </div> | ||||||||||||
| ), | ||||||||||||
| transparentMode: 'top', | ||||||||||||
| }, | ||||||||||||
| links: [ | ||||||||||||
| { | ||||||||||||
|
|
@@ -29,6 +30,8 @@ export const baseOptions: BaseLayoutProps = { | |||||||||||
| { | ||||||||||||
| text: 'GitHub', | ||||||||||||
| url: 'https://github.com/objectstack-ai/objectos', | ||||||||||||
| external: true, | ||||||||||||
| }, | ||||||||||||
|
Comment on lines
30
to
34
|
||||||||||||
| { | |
| text: 'GitHub', | |
| url: 'https://github.com/objectstack-ai/objectos', | |
| external: true, | |
| }, |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,8 @@ | ||
| import { defineDocs, defineConfig, defineCollections } from 'fumadocs-mdx/config'; | ||
| import { z } from 'zod'; | ||
| import { remarkInstall } from 'fumadocs-docgen'; | ||
| import { rehypeCodeDefaultOptions } from 'fumadocs-core/mdx-plugins'; | ||
| import { transformerTwoslash } from 'fumadocs-twoslash'; | ||
|
|
||
| export const { docs, meta } = defineDocs({ | ||
| dir: 'content/docs', | ||
|
|
@@ -16,4 +19,18 @@ export const blog = defineCollections({ | |
| type: 'doc', | ||
| }); | ||
|
|
||
| export default defineConfig(); | ||
| export default defineConfig({ | ||
| mdxOptions: { | ||
| remarkPlugins: [remarkInstall], | ||
| rehypeCodeOptions: { | ||
| themes: { | ||
| light: 'github-light', | ||
| dark: 'github-dark', | ||
| }, | ||
| transformers: [ | ||
| ...(rehypeCodeDefaultOptions.transformers ?? []), | ||
| transformerTwoslash(), | ||
| ], | ||
| }, | ||
| }, | ||
|
Comment on lines
+22
to
+35
|
||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The GitHub edit link construction assumes all documentation files use the .mdx extension, but this may not always be accurate if some files use .md extension instead. Consider checking the actual file extension from the page metadata or handling both .md and .mdx extensions to avoid potential 404 errors when users click the "Edit this page" link.