数学公式
让你的 VitePress 站点中的 Markdown 文件支持
配置
在项目中安装相关的
bash
$ pnpm add -D markdown-it-mathjax3bash
$ npm add -D markdown-it-mathjax3bash
$ yarn add -D markdown-it-mathjax3bash
$ bun add -D markdown-it-mathjax3之后启用它:
ts
import { defineConfig } from 'vitepress-theme-niansi'
export default defineConfig({
markdown: {
math: true,
}
})案例
输入
When
Demo
md
When $a \ne 0$, there are two solutions to $(ax^2 + bx + c = 0)$ and they are
$$ x = {-b \pm \sqrt{b^2-4ac} \over 2a} $$更新日志
2026-04-18 23:33
查看所有更新日志