snippetcheck vs. Sphinx doctest
Sphinx's doctest extension has been solving a version of this problem well for Python documentation for years: a doctest block records the exact expected output of a real interactive session, and the extension runs it for real and diffs the output. That's a stronger, more literal guarantee than type-checking — it confirms the sample produces the exact text shown in the docs, not just that the shapes are compatible. For a Python project already using Sphinx, doctest is mature, well-integrated, and does not need anything like snippetcheck exists to provide.
The scope is different in two ways. Doctest runs inside the Sphinx build — it's a tool for a maintainer building their own docs, checked as part of that build, not something you point at an arbitrary published site. And it's Python-specific, tied to Python's own interactive-session output format; it has no equivalent notion of a TypeScript module's exported declarations. snippetcheck exists for the specific gap doctest doesn't cover: TypeScript and JavaScript documentation, checked from outside the docs' own build process, including documentation you don't maintain and weren't given any special access to.
| Sphinx doctest | snippetcheck | |
|---|---|---|
| Language | Python | TypeScript / JavaScript |
| What it checks | Exact output of a real interactive session, executed | Type shape against published declarations, not executed |
| Where it runs | Inside a Sphinx build you control | Against any published docs URL, from outside |
| Needs cooperation from the docs' maintainer | Yes — it's part of their build | No — reads published docs, installs the published package |
| Maturity | Long-established, part of core Sphinx | Early — see about |
If TypeScript ever gets a doctest-equivalent this literal — real execution, exact output diffing, built into a docs toolchain a maintainer already controls — it would be a stronger tool than snippetcheck for that maintainer's own docs, the same way doctest is for Sphinx's. snippetcheck is built for the case that leaves uncovered: checking documentation from the outside, including someone else's.
See how snippetcheck works for the full methodology.