Native LaTeX math formula renderer for Paseo desktop and mobile clients
npmjs · Paseo 0.9+
paseo plugin add npm:paseo-latex-renderer@0.1.0GitHub · Paseo 0.8 fallback
paseo plugin add lingluo831/paseo-latex-renderer --ref b9326e2f49d0cfd74cc1f522a6624da99a4e5ba4Git security status and fallback installation are pinned to commit b9326e2f49d0.
README
Paseo 的高性能原生 LaTeX 公式渲染插件,适用于 Paseo Desktop(Windows / Electron)、Web 和 Mobile。
专为研究人员和工程师设计,帮助你在 Paseo Agent 对话中直接阅读数学公式、控制理论、机器人学和科学论文中的复杂表达式。
English documentation: README.en.md
paseo-latex-renderer 是一个用于 Paseo 的客户端插件,可以在聊天内容中优雅地渲染 LaTeX 数学公式。
它支持行内公式、块级公式、多行数学环境、复杂分式、积分、求和、希腊字母等内容,同时保持良好的视觉体验和多端兼容性。
$E=mc^2$ 和 \(E=mc^2\)$$\dots$$ 和 \[\dots\]```math 和 ```latexaligned、align、cases、matrix、bmatrix、pmatrix、\frac、\sum、\int、\partial、下标、上标和希腊字母等$100、$100 and $200 等金额不会被误判为数学公式\$ 等转义分隔符会保持为普通文本python、ts 等编程代码块不会被错误解析paseo-latex-renderer/
├── paseo-plugin.json # Paseo 清单(插件 ID、依赖和构建配置)
├── package.json # 依赖项和构建/测试脚本
├── tsconfig.json # TypeScript 配置
├── vitest.config.ts # Vitest 单元测试配置
├── index.client.tsx # 插件客户端入口(Transformer 和 Renderer)
├── client/
│ ├── katex-css.ts # 内嵌 Base64 WOFF2 字体的 KaTeX CSS
│ ├── math-parser.ts # Markdown + LaTeX AST 分词器和语法检测器
│ ├── math-renderer.tsx # React Native 数学组件
│ ├── markdown-renderer.tsx # 完整 Markdown + Math 渲染器
│ └── web.tsx # Web/Electron KaTeX DOM 桥接和移动端安全回退
├── scripts/
│ └── inline-fonts.mjs # 将 KaTeX 字体内嵌到 CSS 的脚本
└── tests/
├── latex-renderer.test.ts # 31 个单元测试和集成测试
└── react-native-mock.ts # React Native 测试 mock
cd paseo-latex-renderer
npm install
npm run build # 将 KaTeX 字体内嵌到 client/katex-css.ts
npm run typecheck # 对 TypeScript 代码进行类型检查
npm run test # 使用 Vitest 运行 31 个单元测试
在运行 Paseo Daemon 的 Windows 主机上安装插件:
paseo plugin install "C:\path\to\paseo-latex-renderer"
也可以使用打包好的 CLI:
C:\ProgramData\paseo\resources\bin\paseo.cmd plugin install <path>
检查插件状态:
paseo plugin ls
如果 daemon 尚未启用插件:
确认 ~/.paseo/config.json 中设置了:
{
"pluginsEnabled": true
}
重新加载 daemon 配置:
paseo reload
插件状态应从 disabled 变为 running。
如果远程 Ubuntu 服务器正在运行 Paseo Daemon,可以按以下步骤安装:
将 paseo-latex-renderer 克隆或复制到 Ubuntu 主机,例如 /home/user/paseo-latex-renderer。
安装依赖并构建:
cd /home/user/paseo-latex-renderer
npm install
npm run build
npm run typecheck
将插件安装到 Ubuntu daemon:
paseo plugin install /home/user/paseo-latex-renderer
验证安装:
paseo plugin ls
当 Windows Paseo Desktop 连接到 Ubuntu Daemon 时,Windows 桌面端会自动接收并执行客户端包,从而提供原生 LaTeX 公式渲染能力。
修改插件代码后执行:
npm run typecheck
paseo plugin reload paseo-latex-renderer
paseo plugin disable paseo-latex-renderer
paseo plugin enable paseo-latex-renderer
paseo plugin remove paseo-latex-renderer
disabled:确认 ~/.paseo/config.json 中设置了 "pluginsEnabled": true,然后执行 paseo reload。$ 或 $$。未闭合公式会暂时保留为原始文本,以避免流式输出时闪烁。$E = mc^2$
\[
\int_0^1 x^2 \, dx = \frac{1}{3}
\]
```math
\sum_{i=1}^{n} i = \frac{n(n+1)}{2}
\begin{aligned}
\dot{x} &= Ax + Bu \\
\dot{y} &= Cx + Du
\end{aligned}
该插件特别适合以下场景:
本项目采用仓库中配置的开源许可证。详细信息请查看仓库中的 LICENSE 文件(如果存在)。
Scanned 21 Sep 2026, 06:03 UTC from lingluo831/paseo-latex-renderer.