目录 / DeepSeek 公式粘贴净化器(剪贴板)
DeepSeek 公式粘贴净化器(剪贴板)
修复「从 DeepSeek / KaTeX / MathJax 网页复制回答,粘进 Obsidian 后公式乱掉」的问题。 Symptoms this skill fixes: · formulas appear TWICE with no spaces (e.g. "15x+8y=4000015x+8y=40000") · formulas render as raw text, not as math · $...$ / $$...$$ delimiters never make it into the clipboard · UI buttons / icons ("复制", "ds-icon") leak into the pasted note · fractions collapse into bare digits — "\frac{9}{7}" pastes as "79", because numerator and denominator are stacked spans and read linearly · subscripts / superscripts / roots disappear, formulas get linearised Root cause: browsers put BOTH the katex-mathml layer (with the TeX source in <annotation encoding="application/x-tex">) and the duplicate katex-html visual layer onto the clipboard, and the delimiters only ever existed inside that annotation attribute — never in any text node. Worse: when you SELECT (drag over) a formula instead of using the page's copy button, the katex-mathml layer is CSS-clipped to 1px and falls outside the selection, so the clipboard HTML carries NO annotation at all — only the visual layer. The TeX source then has to be reconstructed from KaTeX's layout geometry (which span sits above the fraction line, etc.). Fix: a resident clipboard watcher (pure Python stdlib + ctypes Win32) that rewrites the clipboard ~0.25 s after Ctrl+C. It extracts TeX from the annotation when present; when the annotation is missing it reverses the katex-html visual layer back into LaTeX (\frac, ^/_ , \sqrt, cases, pmatrix, \binom, \vec …); then wraps it as $...$ / $$...$$, drops the duplicate layer, and clears the HTML format so the editor takes the plain-text path. Guarded: if no KaTeX is detected, NOT A SINGLE BYTE of the clipboard is touched (so pasting "$100 and $200" is safe). Triggers: 剪贴板净化, 复制粘贴格式乱, 公式重复两遍, 公式不渲染, DeepSeek 复制到 Obsidian, 复制过去格式有问题, KaTeX 乱码, clipboard cleaner, paste from web page into Obsidian broken, math formula duplicated on paste, delimiter missing.
这是模型对公开材料的总结,不是官方声明,请以原链内容为准。
存档时间线
| 版本 | 存档时间 | 内容哈希 | 内容 |
|---|---|---|---|
| v1 | 2026-09-21 19:32 | 21c6509e | 可取 |
版本索引永久保留;内容副本只保留最近 2 版,更早版本仅留索引与哈希(存档时间线的证据链不会因此断裂)。
提交举报 / 纠错
侵权举报经核验成立后,我们会即时下线该条目并删除已存的内容副本。