I built a source-to-clipboard test for documentation code blocks
说明与用途
Snippet Fidelity 检查文档代码块复制的准确性,发现可能导致命令或配置错误的隐藏更改。
问题
Documentation code blocks often render correctly but the copied text can differ due to invisible characters, whitespace changes, or Unicode normalization, leading to broken commands or configurations.
结果
In a synthetic test suite, 1 of 6 snippets passed while 5 failed due to newline, indentation, tab/space, zero‑width character, or Unicode normalization issues.
工作流
- Install snippet‑fidelity and Playwright Chromium
- Run
npx snippet-fidelity audit <docs-url> - Snippet Fidelity drives Chromium, activates the copy button, records the clipboard payload, reads the browser clipboard, and compares both at Unicode code‑point precision
- Generate a report highlighting differences with fingerprints, lengths, and context
证据
Snippet Fidelity: 1/6 passed, 5 failed, 0 errors.
I have used the tool to validate copy-button work in two open upstream pull requests...
- 记录日期: 2026-09-06T18:21:33.292Z