Skip to content

Commit 4b6fe15

Browse files
committed
Press: pass config from Vite plugin
1 parent 702305e commit 4b6fe15

File tree

15 files changed

+105
-78
lines changed

15 files changed

+105
-78
lines changed

examples/fp/content/(home)/home.mdx

Lines changed: 0 additions & 10 deletions
This file was deleted.

examples/fp/content/docs/index.mdx

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
title: Hello World
3+
description: |
4+
Your first `document`
5+
You'll love it!
6+
---
7+
8+
Hey there! Fumadocs is the docs framework that also works on React Router!
9+
10+
## Heading
11+
12+
Hello World
13+
14+
<Cards>
15+
<Card title="Learn more about React Router" href="https://reactrouter.com" />
16+
<Card title="Learn more about Fumadocs" href="https://fumadocs.dev" />
17+
</Cards>
18+
19+
```ts
20+
console.log('I love React!');
21+
```
22+
23+
### Heading
24+
25+
#### Heading
26+
27+
| Head | Description |
28+
| ------------------------------- | ----------------------------------- |
29+
| `hello` | Hello World |
30+
| very **important** | Hey |
31+
| _Surprisingly_ | Fumadocs |
32+
| very long text that looks weird | hello world hello world hello world |

examples/fp/content/docs/meta.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"icon": "\uD83D\uDCDA",
3+
"root": true
4+
}
File renamed without changes.
File renamed without changes.

examples/fp/content/index.mdx

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,10 @@
11
---
2-
title: Hello World
3-
description: |
4-
Your first `document`
5-
You'll love it!
2+
title: Home
3+
layout: home
64
---
75

8-
Hey there! Fumadocs is the docs framework that also works on React Router!
9-
10-
## Heading
11-
12-
Hello World
13-
14-
<Cards>
15-
<Card title="Learn more about React Router" href="https://reactrouter.com" />
16-
<Card title="Learn more about Fumadocs" href="https://fumadocs.dev" />
17-
</Cards>
6+
Welcome to Fumapress! Open [docs](/docs).
187

198
```ts
20-
console.log('I love React!');
9+
console.log('Hello World');
2110
```
22-
23-
### Heading
24-
25-
#### Heading
26-
27-
| Head | Description |
28-
| ------------------------------- | ----------------------------------- |
29-
| `hello` | Hello World |
30-
| very **important** | Hey |
31-
| _Surprisingly_ | Fumadocs |
32-
| very long text that looks weird | hello world hello world hello world |

examples/fp/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"fumadocs-mdx": "workspace:*",
1414
"fumadocs-ui": "workspace:*",
1515
"fumapress": "workspace:*",
16-
"isbot": "^5.1.31",
1716
"react": "^19.2.0",
1817
"react-dom": "^19.2.0",
1918
"react-router": "^7.9.3"
@@ -29,7 +28,6 @@
2928
"react-router-devtools": "^5.1.3",
3029
"tailwindcss": "^4.1.14",
3130
"typescript": "^5.9.3",
32-
"vite": "^7.1.9",
33-
"vite-tsconfig-paths": "^5.1.4"
31+
"vite": "^7.1.9"
3432
}
3533
}

examples/fp/tsconfig.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
"moduleResolution": "bundler",
99
"jsx": "react-jsx",
1010
"baseUrl": ".",
11-
"paths": {
12-
"@/*": ["./app/*"]
13-
},
1411
"esModuleInterop": true,
1512
"verbatimModuleSyntax": true,
1613
"noEmit": true,

packages/press/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"zod": "^4.1.11"
3434
},
3535
"devDependencies": {
36+
"@mdx-js/mdx": "^3.1.1",
3637
"@types/mdx": "^2.0.13",
3738
"@types/node": "^24.6.2",
3839
"@types/react": "^19.2.0",
Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,43 @@
1+
import type { DefaultMDXOptions } from 'fumadocs-mdx/config';
12
import {
23
defineConfig,
34
defineDocs,
45
frontmatterSchema,
6+
metaSchema,
57
} from 'fumadocs-mdx/config';
68
import { z } from 'zod';
9+
import type { FumapressConfig } from './global';
10+
import type { ProcessorOptions } from '@mdx-js/mdx';
711

8-
export const docs = defineDocs({
9-
dir: 'content',
10-
docs: {
11-
schema: frontmatterSchema.extend({
12-
layout: z.string().default('docs'),
12+
export interface ContentConfig {
13+
mdx?:
14+
| ({
15+
preset?: 'fumadocs';
16+
} & DefaultMDXOptions)
17+
| ({
18+
preset: 'minimal';
19+
} & ProcessorOptions);
20+
}
21+
22+
export async function createContentConfig(config: FumapressConfig) {
23+
return {
24+
docs: defineDocs({
25+
dir: 'content',
26+
docs: {
27+
schema: frontmatterSchema
28+
.extend({
29+
layout: z.string().default('docs'),
30+
})
31+
.loose(),
32+
},
33+
meta: {
34+
schema: metaSchema.loose(),
35+
},
36+
}),
37+
default: defineConfig({
38+
mdxOptions: config.content?.mdx,
1339
}),
14-
},
15-
});
40+
};
41+
}
1642

17-
export default defineConfig();
43+
export type FumadocsMDXConfig = Awaited<ReturnType<typeof createContentConfig>>;

0 commit comments

Comments
 (0)