katex-formula-view
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "katex-formula-view" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-f0cc534de37b69223977ad14f5d0b1ce15c6efc8266698f0aadf9c86313a3f61. Verify the upstream source and version against https://skillhub.cn/skills/user_f1b049da/mzv20266319 before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
KaTeX Formula View: Render mathematical formulas in the browser using KaTeX to display pricing, commission, and related formulas on reports and reconciliation pages.
Introduction source: third_party · user_f1b049da · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: katex-formula-view
slug: mzv20266319
displayName: 公式渲染
version: 1.0.0
summary: 用 KaTeX 在报告页本地渲染计价与分成公式,清晰可读。
license: MIT
description: 用 KaTeX 在浏览器内渲染计价、分成等数学公式,便于报告与对账页展示。当用户需要公式渲染、KaTeX、提成公式展示、LaTeX 公式时使用。公式渲染(KaTeX)
灵感:能力工具箱 katex-math(pkg: katex)。
在报告/对账页用 KaTeX 把「基数 × 提点」一类公式排得像课本一样清楚,本地渲染、不求远程排版服务。
何时使用
- 提成/分成说明旁展示公式
- 报价计价规则可视化
- 需要 LaTeX 子集公式且要快
硬约束
- 依赖
katex(及官方 CSS);用katex.render/renderToString。 - 公式字符串来自可信配置或转义后的业务模板,禁止把未消毒的用户输入直接当任意 HTML 插入。
- 提供「源码 / 渲染」切换或旁注,便于对账核对。
- 渲染失败给中文提示,不白屏。
- 实现要点可标 小四原创。
实现要点(小四原创)
import katex from 'katex'
import 'katex/dist/katex.min.css'
// 小四原创:安全渲染一行分成公式
export function renderShareFormula(
el: HTMLElement,
opts: { base: string; ratePercent: number },
) {
const tex = `\\text{金额} = ${opts.base} \\times ${opts.ratePercent}\\%`
try {
katex.render(tex, el, { throwOnError: false, displayMode: true })
} catch {
el.textContent = '公式渲染失败'
}
}
// 小四原创:管理双轨示意(不写具体职级名)
export const MANAGE_DUAL_TEX =
String.raw`C_{m} = N \times 4\% \;(\text{上级}) + N \times 4\% \;(\text{二级管理,可合并})`
Agent 步骤
- 安装
katex,封装renderShareFormula。 - 挂到报告卡片;自测 20%/4% 展示正确。
- 打印页确认 CSS 已打进样式或打印模板。
附加
Current listing version
1.0.0
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 解决提成、分成、计价等公式在报告与对账页的可视化刚需
- 本地渲染,不依赖远程排版服务,性能与隐私兼顾
Highlights
- 触发词覆盖完整,包含 KaTeX、提成公式、LaTeX 等关键场景
Areas to improve
-
缺少完整端到端示例 Reported severity: Minor
文档提供了函数实现片段,但缺少完整 HTML 使用示例(如挂载到 DOM 的完整流程)
Recommendation: 补充一个完整的使用示例,展示如何在页面中引入并调用 renderShareFormula
Highlights
- 结构清晰,包含硬约束、实现要点、Agent 步骤等必要章节
Highlights
- 工具来源明确(katex 官方包),参数使用规范
- 覆盖渲染失败异常并给出中文提示,避免白屏
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.