Skip to content

Commit 42d68a6

Browse files
committed
TypeScript: Support remarkAutoTypeTable plugin
1 parent 521a7ef commit 42d68a6

File tree

20 files changed

+398
-166
lines changed

20 files changed

+398
-166
lines changed

.changeset/open-mangos-stick.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'fumadocs-typescript': minor
3+
---
4+
5+
Support `remarkAutoTypeTable` plugin, deprecate MDX generator in favour of new remark plugin

apps/docs/app/(home)/page.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ function Feedback() {
501501
alt="avatar"
502502
width="32"
503503
height="32"
504+
unoptimized
504505
className="size-8 rounded-full"
505506
/>
506507
<div>

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ function PreviewRenderer({ preview }: { preview: string }): ReactNode {
4040
return null;
4141
}
4242

43-
export const dynamicParams = false;
4443
export const revalidate = false;
4544

4645
export default async function Page(props: {
@@ -134,6 +133,6 @@ export async function generateMetadata(props: {
134133
);
135134
}
136135

137-
export function generateStaticParams(): { slug: string[] }[] {
136+
export function generateStaticParams() {
138137
return source.generateParams();
139138
}

apps/docs/content/docs/ui/components/auto-type-table.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export interface MyInterface {
119119

120120
### References
121121

122-
<AutoTypeTable path="./content/docs/ui/props.ts" name="AutoTypeTableProps" />
122+
<auto-type-table path="../props.ts" name="AutoTypeTableProps" />
123123

124124
### File System
125125

apps/docs/content/docs/ui/navigation.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ Using Next.js Route Group, you can still access the same page with same URL. For
267267
</Folder>
268268
</Files>
269269

270-
<Callout title="warn">
270+
<Callout type="warn">
271271
Ensure **there's no duplicated page** with the same URL in the catch-all route
272272
`[[...slug]]/page.tsx`. In the above example, a MDX file with the path
273273
`content/docs/index.mdx` will produce errors.

apps/docs/source.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
import rehypeKatex from 'rehype-katex';
1717
import { z } from 'zod';
1818
import { rehypeCodeDefaultOptions } from 'fumadocs-core/mdx-plugins';
19+
import { remarkAutoTypeTable } from 'fumadocs-typescript';
1920

2021
export const docs = defineDocs({
2122
docs: {
@@ -82,6 +83,7 @@ export default defineConfig({
8283
},
8384
remarkPlugins: [
8485
remarkMath,
86+
remarkAutoTypeTable,
8587
[remarkInstall, { persist: { id: 'package-manager' } }],
8688
[remarkDocGen, { generators: [fileGenerator()] }],
8789
remarkTypeScriptToJavaScript,

packages/typescript/package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,18 @@
3535
"types:check": "tsc --noEmit"
3636
},
3737
"dependencies": {
38+
"estree-util-value-to-estree": "^3.3.2",
3839
"fast-glob": "^3.3.3",
40+
"hast-util-to-estree": "^3.1.2",
3941
"hast-util-to-jsx-runtime": "^2.3.5",
4042
"remark": "^15.0.1",
4143
"remark-rehype": "^11.1.1",
4244
"shiki": "^3.1.0",
43-
"ts-morph": "^25.0.1"
45+
"ts-morph": "^25.0.1",
46+
"unist-util-visit": "^5.0.0"
4447
},
4548
"devDependencies": {
49+
"@mdx-js/mdx": "^3.1.0",
4650
"@types/estree": "^1.0.6",
4751
"@types/hast": "^3.0.4",
4852
"@types/mdast": "^4.0.3",
@@ -53,7 +57,8 @@
5357
"fumadocs-core": "workspace:*",
5458
"fumadocs-ui": "workspace:*",
5559
"tsconfig": "workspace:*",
56-
"typescript": "^5.7.3"
60+
"typescript": "^5.7.3",
61+
"unified": "^11.0.5"
5762
},
5863
"peerDependencies": {
5964
"typescript": "*"

packages/typescript/src/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
export * from './generate/base';
2-
export * from './generate/mdx';
3-
export * from './generate/file';
1+
export * from '@/lib/base';
2+
export * from '@/lib/mdx';
3+
export * from '@/lib/file';
44
export { renderMarkdownToHast } from './markdown';
55
export { getProject } from './get-project';
6+
export * from '@/lib/remark-auto-type-table';

0 commit comments

Comments
 (0)