Skip to content

Commit 128a6e7

Browse files
committed
feat: enabled katex to show latex symbols
1 parent 12821a9 commit 128a6e7

File tree

3 files changed

+273
-0
lines changed

3 files changed

+273
-0
lines changed

docusaurus.config.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import type { UserThemeConfig } from '@docusaurus/theme-common';
77
import { themes as prismThemes } from 'prism-react-renderer';
88
import autoprefixer from 'autoprefixer';
99
import tailwindcss from 'tailwindcss';
10+
import remarkMath from 'remark-math';
11+
import rehypeKatex from 'rehype-katex';
1012

1113
const lightCodeTheme = prismThemes.github;
1214
const darkCodeTheme = prismThemes.dracula;
@@ -59,6 +61,8 @@ const pluginDocs: [string, PluginDocsOptions] = [
5961
sidebarPath: './sidebars.ts',
6062
include: ['**/*.md', '**/*.mdx'],
6163
exclude: ['**/_*.{js,jsx,ts,tsx,md,mdx}', '**/_*/**', '**/.**'],
64+
remarkPlugins: [remarkMath],
65+
rehypePlugins: [rehypeKatex],
6266
},
6367
];
6468

@@ -250,6 +254,15 @@ const config: Config = {
250254
plugins: [pluginSVGR, pluginDocs, pluginTheme, pluginGTag, pluginTailwind],
251255
themes: ['@docusaurus/theme-mermaid'],
252256
themeConfig,
257+
stylesheets: [
258+
{
259+
href: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css',
260+
type: 'text/css',
261+
integrity:
262+
'sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM',
263+
crossorigin: 'anonymous',
264+
},
265+
],
253266
};
254267

255268
export default config;

package-lock.json

Lines changed: 258 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
"prism-react-renderer": "^2.1.0",
3737
"react": "^18.2.0",
3838
"react-dom": "^18.2.0",
39+
"rehype-katex": "^7.0.1",
40+
"remark-math": "^6.0.0",
3941
"tailwindcss": "^3.3.5",
4042
"typescript": "^5.1.6",
4143
"wrangler": "3.99.0"

0 commit comments

Comments
 (0)