Skip to content

Commit bef693b

Browse files
authored
feat: add mdx file support and configuration (#12)
* feat: add mdx file support and configuration
1 parent 9936900 commit bef693b

7 files changed

+99
-7
lines changed

app/[lang]/legal/index.module.css

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.blog_layout [data-toc] {
2+
position: sticky;
3+
padding-top: 100px !important;
4+
}

app/[lang]/legal/layout.tsx

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import Footer from '@/components/footer';
2+
import Header from '@/components/header';
3+
import { ReactNode } from 'react';
4+
import styles from './index.module.css';
5+
6+
export default function BlogLayout({
7+
params,
8+
children,
9+
}: {
10+
params: { lang: string };
11+
children: ReactNode;
12+
}) {
13+
return (
14+
<div className={`h-full ${styles.blog_layout}`}>
15+
<Header lang={params.lang} />
16+
<div className="custom-container min-h-screen pt-14">{children}</div>
17+
<Footer />
18+
</div>
19+
);
20+
}

app/[lang]/legal/page.mdx

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Test

mdx-components.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { MDXComponents } from 'mdx/types';
2+
3+
export function useMDXComponents(components: MDXComponents): MDXComponents {
4+
return {
5+
...components,
6+
};
7+
}

next.config.mjs

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ const withMDX = createMDX()
66
const config = {
77
output: 'standalone',
88
reactStrictMode: true,
9+
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'md', 'mdx'],
910
images: {
1011
unoptimized: true,
1112
},
1213
}
1314

14-
export default withMDX(config)
15+
export default withMDX(config)

package-lock.json

+62-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
"postinstall": "fumadocs-mdx"
1010
},
1111
"dependencies": {
12+
"@mdx-js/loader": "^3.1.0",
13+
"@mdx-js/react": "^3.1.0",
14+
"@next/mdx": "^15.2.0",
1215
"@radix-ui/react-icons": "^1.3.0",
1316
"@radix-ui/react-slot": "^1.1.0",
1417
"class-variance-authority": "^0.7.0",

0 commit comments

Comments
 (0)