Notes → PNG (KaTeX + headless Brave)
Core rule
- - Default: reply as normal text
- Render a PNG only when explicitly requested ("as an image", "KaTeX skill", "нормально записанное решение") or when high-quality formula layout is needed
- If using this skill → write formulas in LaTeX (
$...$, $$...$$), not ASCII approximations - Inside the PNG: Markdown headings (
#, ##) are NOT parsed. Use --title="..." for the page title; use plain text for section headers (e.g., 1) ...)
Input format
- - Save a UTF-8 text file (e.g.
out/_scratch/notes/note.md) - Inline math: INLINECODE7
- Display math: blocks between lines containing INLINECODE8
Details: INLINECODE9
Render to PNG
Scripts:
- -
scripts/render_note_png.js — single-page PNG - INLINECODE11 — multi-page (splits into multiple PNGs)
Single-page steps:
1) Write your note (e.g. out/_scratch/notes/note.md)
2) Render (keep outputs in out/ to avoid cluttering repo root):
- node skills/math-notes-katex/scripts/render_note_png.js out/_scratch/notes/note.md out/katex/note.png --title="Topic" --brave=/usr/bin/brave-browser
3) Send INLINECODE15
Multi-page (when the note does not fit well into one image):
CODEBLOCK0
This produces:
- -
out/katex/note_pages/page-001.png, page-002.png, ...
Important: KaTeX CSS/fonts
- - KaTeX needs
katex.min.css + fonts (fonts/...) - This skill links KaTeX CSS via a local
file:///.../katex.min.css path so relative fonts/ resolve correctly
If formulas look broken: INLINECODE22
技能名称: math-notes-katex
详细描述:
笔记 → PNG(KaTeX + 无头 Brave)
核心规则
- - 默认:以普通文本回复
- 仅在明确要求时(如以图片形式、KaTeX 技能、正常书写的解答)或需要高质量公式排版时渲染 PNG
- 若使用此技能 → 公式需用 LaTeX 编写($...$、$$...$$),而非 ASCII 近似符号
- 在 PNG 内部:Markdown 标题(#、##)不会被解析。请使用 --title=... 设置页面标题;章节标题使用纯文本(例如 1) ...)
输入格式
- - 保存为 UTF-8 文本文件(例如 out/_scratch/notes/note.md)
- 行内公式:$...$
- 展示公式:位于包含 $$ 的行之间的代码块
详情请参阅:references/formatting.md
渲染为 PNG
脚本:
- - scripts/rendernotepng.js — 单页 PNG
- scripts/rendernotepages.sh — 多页(分割为多个 PNG)
单页步骤:
1) 编写笔记(例如 out/_scratch/notes/note.md)
2) 渲染(将输出保留在 out/ 中,避免仓库根目录混乱):
- node skills/math-notes-katex/scripts/rendernotepng.js out/_scratch/notes/note.md out/katex/note.png --title=主题 --brave=/usr/bin/brave-browser
3) 发送 out/katex/note.png
多页(当笔记无法在一张图片中完整显示时):
bash
skills/math-notes-katex/scripts/rendernotepages.sh \
out/scratch/notes/note.md out/katex/notepages 主题 /usr/bin/brave-browser
这将生成:
- - out/katex/note_pages/page-001.png、page-002.png、...
重要提示:KaTeX CSS/字体
- - KaTeX 需要 katex.min.css + 字体(fonts/...)
- 此技能通过本地 file:///.../katex.min.css 路径链接 KaTeX CSS,以便正确解析相对路径下的 fonts/
若公式显示异常:请参阅 references/troubleshooting.md