首页 全部提示词 Coding

修复 LaTeX 美元符号

Fix LaTeX dollars

文本 @aldinei 581 字符 在 prompts.chat 查看 译文有问题?

中文译文

调查并修复 Markdown 内容中实际的 $ 用法。

这些 $ 分为三类:

  • 货币(需要转义)—— $1、$2 billion、R$ 549 → 这些成对出现会引发所有警告
  • 真正的数学(保持原样)—— $\rightarrow$、$O(1)\text{ streaming}$ → 有效,不会产生警告
  • Shell 代码(保持原样)—— $(curl…)、${ZSH_CUSTOM}、$HOME → 位于代码块内

分 4 步执行:

  • 调查——对内容执行 grep,将每个 $ 分类为货币 / 真正的数学 / shell 代码,并在做任何更改之前报告各类数量。
  • 应用——检查工作树是否干净,然后编写并运行经过测试的精确 Python 脚本(能识别代码围栏、行内代码、frontmatter 和数学跨度;通过 (?<!\) 后行断言实现幂等,因此重新运行绝不会重复转义)。
  • 验证 diff——安全网:执行 grep,对于真正的数学($\rightarrow$、\text)和 shell 变量($HOME、$(…)、${VAR})必须不输出任何内容。如果任何合法内容被改动,它会提示你执行 git checkout -- . 并停止。
  • 打印说明——输出构建验证以及提交/推送命令,供用户运行。

不要自主运行任何构建、提交或推送。

English original

Investigate and fix the actual $ usages in Markdown content.

The $ fall into three classes:

  • Currency (escape these) — $1, $2 billion, R$ 549 → these pairs cause all the warnings
  • Real math (leave alone) — $\rightarrow$, $O(1)\text{ streaming}$ → valid, no warnings
  • Shell code (leave alone) — $(curl…), ${ZSH_CUSTOM}, $HOME → inside code blocks

Execute in 4 steps:

  • Investigate — greps the content, classifies every $ into currency / real math / shell code, and reports counts before changing anything.
  • Apply — checks the tree is clean, then writes and runs the exact tested Python script (code-fence-, inline-code-, frontmatter-, and math-span-aware; idempotent via the (?<!\) lookbehind so re-running never double-escapes).
  • Verify the diff — the safety net: greps that must print nothing for real math ($\rightarrow$, \text) and shell vars ($HOME, $(…), ${VAR}). If anything legit was touched, it tells you to git checkout -- . and stops.
  • Print instructions — outputs the build-verify and commit/push commands for user to run.

Do not autonomously run any build, commit, or push.