Skip to content

Commit 3d32b6c

Browse files
Copilothuangyiirene
andcommitted
Add remark-gfm, remark-math, and rehype-katex plugins
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
1 parent d557dde commit 3d32b6c

File tree

4 files changed

+226
-7
lines changed

4 files changed

+226
-7
lines changed

apps/site/app/layout.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import './globals.css';
2+
import 'katex/dist/katex.min.css';
23
import type { ReactNode } from 'react';
34
import { RootProvider } from 'fumadocs-ui/provider';
45

apps/site/package.json

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,26 @@
99
"lint": "next lint"
1010
},
1111
"dependencies": {
12+
"fumadocs-core": "^13.0.0",
13+
"fumadocs-mdx": "10.0.0",
14+
"fumadocs-ui": "^13.0.0",
15+
"katex": "^0.16.27",
1216
"next": "^14.2.0",
1317
"react": "^18.3.0",
1418
"react-dom": "^18.3.0",
15-
"fumadocs-core": "^13.0.0",
16-
"fumadocs-ui": "^13.0.0",
17-
"fumadocs-mdx": "10.0.0"
19+
"rehype-katex": "^7.0.1",
20+
"remark-gfm": "^4.0.1",
21+
"remark-math": "^6.0.0"
1822
},
1923
"devDependencies": {
2024
"@types/node": "^20.10.0",
2125
"@types/react": "^18.3.0",
2226
"@types/react-dom": "^18.3.0",
23-
"typescript": "^5.3.0",
27+
"autoprefixer": "^10.4.16",
2428
"eslint": "^8.0.0",
2529
"eslint-config-next": "^14.2.0",
30+
"postcss": "^8.4.32",
2631
"tailwindcss": "^3.4.0",
27-
"autoprefixer": "^10.4.16",
28-
"postcss": "^8.4.32"
32+
"typescript": "^5.3.0"
2933
}
3034
}

apps/site/source.config.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
11
import { defineDocs, defineConfig } from 'fumadocs-mdx/config';
2+
import { rehypeCode } from 'fumadocs-core/mdx-plugins';
3+
import remarkGfm from 'remark-gfm';
4+
import remarkMath from 'remark-math';
5+
import rehypeKatex from 'rehype-katex';
26

37
export const { docs, meta } = defineDocs({
48
dir: 'content/docs',
59
});
610

7-
export default defineConfig({});
11+
export default defineConfig({
12+
mdxOptions: {
13+
remarkPlugins: [
14+
remarkGfm, // GitHub Flavored Markdown (tables, strikethrough, task lists, etc.)
15+
remarkMath, // Math equations support
16+
],
17+
rehypePlugins: [
18+
rehypeKatex, // Render math equations
19+
[rehypeCode, {
20+
themes: {
21+
light: 'github-light',
22+
dark: 'github-dark',
23+
},
24+
}],
25+
],
26+
},
27+
});

0 commit comments

Comments
 (0)