Guide

Testing Markdown examples with phmdoctest

phmdoctest turns README examples into a pytest file and compares printed output exactly. Label sessions pycon so a scan reads them the same way.

Published
Updated
November 17, 2026
Reading time
10 min
Facts checked against
phmdoctest 1.4.0 docs on block roles, directives, options and configuration, plus Python doctest, with every code block run on phmdoctest 1.4.0, pytest 9.2.0 and Python 3 (November 16, 2026)
Outlined documentation pages with a lime pulse line running out of the stack
On this pageThe short answerWhy README examples go staleHow phmdoctest chooses testsDirectives and configurationTriage and coverageA checklist for your repositoryWhere DocsAlive fitsThe sources we checkedFAQ

The short answer

phmdoctest turns Python examples in Markdown into a pytest module. It identifies interactive sessions and Python code blocks, pairs eligible code blocks with expected output, and generates tests that pytest runs later. Regenerate that module whenever the Markdown changes, and run pytest with --doctest-modules so interactive sessions are collected. Use --report to inspect what phmdoctest found before relying on the result.

DocsAlive provides a complementary page scan, with important limits in engine 0.6.3. A py fence containing >>> prompts produces an invalid-syntax false positive; an output block after Python code is recognized but never compared; phmdoctest directives are ignored; Python blocks share one namespace per page; and generated .py tests are never scanned. Use phmdoctest for its test semantics and exact code/output comparisons, and use the scan for clean-sandbox execution and triage across supported page content.

Why README examples go stale

A README often contains the first example a reader copies. It can also contain an expected result written against an older release. The code may still execute successfully while the output below it is wrong. A test that only checks whether the script exits successfully will miss that discrepancy.

A generated test adds another maintenance step. If the Markdown changes but nobody regenerates the test module, pytest can pass against yesterday’s examples. Conversely, generating the module is insufficient if the pytest invocation omits --doctest-modules: interactive sessions stored in the generated module’s docstrings need that option for collection.

Selection also deserves review. A broad --skip pattern can silently remove blocks that happen to contain the chosen text. A passing run tells you about the tests that were collected, not about examples excluded before collection. Inspect the report and make the generated file part of the routine test workflow.

These concerns apply to README testing generally and to other approaches to Python documentation testing. The example below uses a small illustrative package. acme-slug and acme_slug are illustrative names and are not published packages.

How phmdoctest chooses tests

The phmdoctest 1.4.0 documentation describes a command-line program and Python library that creates a pytest module from GFM fenced blocks in Markdown, using commonmark to extract the blocks. A simple use case does not require changes to the Markdown. The generated tests run later under pytest.

A block is a session when its info string starts with py and its first line starts with >>>. A Python code block starts with python, python3 or py3 and does not start with that prompt. Extra text after the language in the info string is ignored. An immediately following fence with an empty info string is the output block for Python code.

phmdoctest creates one test function per session and per code/output pair. A Python code block without an output block still gets a test, but that test has no assertion. For code/output pairs, comparison is exact and line by line. --report lists fenced blocks, their lines and their roles, making it useful for checking both coverage and unexpected exclusions.

Start with the package and README

This illustrative package defines the functions used by the README. Its behavior is deliberately small enough that a mismatch in the documented result is easy to see.

"""Make URL slugs from titles."""
import re

__all__ = ["slugify", "truncate_slug"]


def slugify(title: str) -> str:
    """Lowercase a title and join its words with hyphens."""
    return re.sub(r"[^a-z0-9]+", "-", title.lower()).strip("-")


def truncate_slug(slug: str, max_len: int) -> str:
    """Shorten a slug to at most max_len characters without cutting a word."""
    if len(slug) <= max_len:
        return slug
    cut = slug[: max_len + 1]
    return cut[: cut.rfind("-")]

The first README is intentionally imperfect. Its first expected result is stale, and the planned feature uses an argument the illustrative package does not accept. It also demonstrates a session, shared names and a skipped block.

# acme-slug

Make URL slugs from titles.

```python
from acme_slug import slugify

print(slugify("Release notes: v2.0"))
```

Output:

```
release-notes-v2.0
```

A doctest session:

```py
>>> from acme_slug import truncate_slug
>>> truncate_slug("testing-docs-examples-with-phmdoctest", 20)
'testing-docs'
```

Names shared with the next block:

<!--phmdoctest-share-names-->
```python
from acme_slug import slugify, truncate_slug

titles = ["Install", "Configure the CLI", "Upgrade from 1.x"]
```

```python
for title in titles:
    print(truncate_slug(slugify(title), 12))
```

Output:

```
install
configure
upgrade-from
```

Planned for the next release:

<!--phmdoctest-skip-->
```python
print(slugify("Ünïcode", ascii_only=True))
```

Install the test tools and ask phmdoctest to report its interpretation before generating the test file:

python -m pip install phmdoctest pytest
phmdoctest README.md --report

The report identifies four test cases, one skipped code block and one code block without an output block. The share-names directive affects the relationship between the two examples; the skip keeps the planned feature out of phmdoctest’s tests.

             README.md fenced blocks
--------------------------------------------------
block     line  test       TEXT or directive
type    number  role       quoted and one per line
--------------------------------------------------
python       6  code
            14  output
py          20  session
python      29  code       -share-names
python      35  code
            42  output
python      51  skip-code  -skip
--------------------------------------------------
4 test cases.
1 skipped code blocks.
1 code blocks with no output block.

Generate the module and run pytest. The session is represented as a doctest in the generated module, which is why the collection option matters.

phmdoctest README.md --outfile tests/test_readme.py
python -m pytest --doctest-modules -v tests

The first run catches the stale output: one test fails and three pass. The generated test name identifies the code and output lines, which helps locate the pair in the Markdown.

----------------------------- Captured stdout call -----------------------------
- release-notes-v2.0
?                 ^

+ release-notes-v2-0
?                 ^

=========================== short test summary info ============================
FAILED tests/test_readme.py::test_code_6_output_14 - AssertionError
1 failed, 3 passed in 0.01s

Compare the page scan

This command plans a scan of the illustrative repository. In the recorded execution, the package was importable and the network was off.

docsalive scan .

The stale Python/output pair passed the scan because the separate output block was skipped, not compared. The py session produced an invalid-syntax false positive. The two blocks using shared names passed because the engine shares a namespace for the page. The planned feature ran despite the directive and failed as api-drift.

Change the output, label the session pycon, and remove the planned feature from the tested page. phmdoctest still recognizes pycon as a session because its info string starts with py.

--- a/README.md
+++ b/README.md
@@ -11,12 +11,12 @@
 Output:

 ```
-release-notes-v2.0
+release-notes-v2-0
 ```

 A doctest session:

-```py
+```pycon
 >>> from acme_slug import truncate_slug
 >>> truncate_slug("testing-docs-examples-with-phmdoctest", 20)
 'testing-docs'
@@ -43,10 +43,3 @@
 configure
 upgrade-from
 ```
-
-Planned for the next release:
-
-<!--phmdoctest-skip-->
-```python
-print(slugify("Ünïcode", ascii_only=True))
-```

After regeneration, all four phmdoctest tests passed. The new scan also passed every executed block; the pycon session ran line by line with its printed output compared.

tests/test_readme.py::test_readme.session_00001_line_20 PASSED           [ 25%]
tests/test_readme.py::test_code_6_output_14 PASSED                       [ 50%]
tests/test_readme.py::test_code_29 PASSED                                [ 75%]
tests/test_readme.py::test_code_35_output_42 PASSED                      [100%]

============================== 4 passed in 0.02s ===============================

The next change is broken on purpose: it renames a public function while leaving the README unchanged.

--- a/acme_slug/__init__.py
+++ b/acme_slug/__init__.py
@@ -1,7 +1,7 @@
 """Make URL slugs from titles."""
 import re

-__all__ = ["slugify", "truncate_slug"]
+__all__ = ["slugify", "shorten_slug"]


 def slugify(title: str) -> str:
@@ -9,7 +9,7 @@
     return re.sub(r"[^a-z0-9]+", "-", title.lower()).strip("-")


-def truncate_slug(slug: str, max_len: int) -> str:
+def shorten_slug(slug: str, max_len: int) -> str:
     """Shorten a slug to at most max_len characters without cutting a word."""
     if len(slug) <= max_len:
         return slug

After regeneration, pytest reported three failures and one pass. The scan classified the session and shared-name block as api-drift; the following block was depends-on-context because the earlier failure prevented titles from being defined. The first block passed.

FAILED tests/test_readme.py::test_readme.session_00001_line_20
FAILED tests/test_readme.py::test_code_29 - ImportError: cannot import name '...
FAILED tests/test_readme.py::test_code_35_output_42 - NameError: name 'titles...
3 failed, 1 passed in 0.02s

Generate into a scratch directory as part of CI so the test module reflects the current README. This follows the shape suggested by the project README.

mkdir -p tests/tmp
phmdoctest README.md --report --outfile tests/tmp/test_readme.py
python -m pytest --doctest-modules -vv tests

Directives and configuration

Directives are HTML comments immediately before a fenced block. skip can apply to code, a session or output; on an output block it prevents comparison. label names the test function or labels a block for retrieval with phmdoctest.tool.FCBChooser. mark.skip and mark.skipif add pytest decorators, while mark.ATTRIBUTE supplies a custom pytest marker.

setup and teardown each designate one code block. Names assigned by setup are visible to other code blocks. share-names copies names assigned by a block to module globals after it runs, so later code blocks can use them; more than one block can use it. clear-names deletes shared and setup names after its block runs. These choices affect test isolation, so review them when a later example depends on earlier state.

The --skip TEXT option searches Python code for a substring; FIRST, SECOND and LAST select blocks, and -s is its short form. The command also offers --setup, --teardown and --fail-nocode; the last makes the generated file fail when no code or session blocks are found. Inline phmdoctest:omit and phmdoctest:pass annotations comment out code. A .ini, .cfg or .toml configuration file with a [tool.phmdoctest] section can select many Markdown files and an output directory. The separate pytest-phmdoctest plugin is also available.

phmdoctest feature What phmdoctest does What the engine does in 0.6.3
py session Generates a doctest session Treats the fence as Python; prompts cause an invalid-syntax false positive
pycon session Recognizes a session Runs the session and compares printed output
Python and output pair Compares output exactly, line by line Runs Python and skips the recognized output block without comparing it
Directives Applies the directive to the generated tests Ignores directives
Shared names Shares names when directed Shares one Python namespace per page; does not honor clear-names
Generated module pytest runs its tests Does not scan .py files

A teardown block in a scanned page simply runs in page order. A passing scan therefore cannot establish that phmdoctest’s setup, cleanup or skip behavior was applied. For another Markdown-oriented approach, see pytest-markdown-docs and Sybil.

Triage and coverage

Finding Likely cause What to do
Output assertion fails The documented result or implementation changed Reproduce with the intended package version and update the incorrect side
Session absent from pytest Collection omitted --doctest-modules Add the option and verify the collected tests
Fewer blocks than expected A skip directive or --skip pattern excluded them Inspect --report and narrow the exclusion
Scan reports invalid syntax at a prompt A py session was interpreted as a script Use pycon and rerun both checks
Scan reports api-drift on a skipped plan The engine ignored the directive Keep planned features off tested pages and retain the phmdoctest check
Later name is undefined An earlier import or setup failed Fix the first failure and rerun before judging dependent blocks
Tests pass after a README edit Generated module may be stale Regenerate it during the test run

Use a clean checkout for scans: a local .pytest_cache/README.md can otherwise appear as a page. Also review reported skips and unsupported content. In 0.6.3, an unknown fence label can be reported as passing without being run or parsed, a known limitation. A green result alone is not proof that every block was checked.

A checklist for your repository

[ ] Identify the Markdown files and Python versions to test.
[ ] Run phmdoctest --report and review every block role and skip.
[ ] Check that output blocks immediately follow their Python blocks.
[ ] Regenerate the pytest module after Markdown changes.
[ ] Run pytest with --doctest-modules.
[ ] Review broad --skip patterns and blocks without assertions.
[ ] Use pycon for sessions intended for both tools.
[ ] Keep planned features off tested pages.
[ ] Run a clean-checkout page scan and review its findings and skips.
[ ] Run the checks on pull requests and for releases.

Where DocsAlive fits

Use phmdoctest locally and in CI to enforce the README’s own session and code/output contracts. Use DocsAlive alongside it to run supported page examples in fresh containers, preserve Python state in page order, and classify findings so a missing prerequisite is distinguishable from likely API drift. The scan can also cover supported shell and structured blocks on the same pages.

Review the report instead of treating every failure as a documentation defect. The findings reference explains categories, and the CLI reference describes scan options. For automation around pull requests, see GitHub Actions docs testing.

The sources we checked

These sources were read on November 16, 2026. Engine behavior was checked against engine 0.6.3 on the same day.

Source What it covers
phmdoctest documentation Block roles, directives, configuration and generated tests
phmdoctest repository Project usage and CI example
Python doctest documentation Interactive-session testing

FAQ

What does phmdoctest generate?

It generates a pytest Python module from eligible fenced Markdown examples. pytest runs the generated tests later; regenerate the module when the Markdown changes.

Why do I need --doctest-modules?

Sessions become doctests in generated module docstrings. The option makes pytest collect those sessions.

Does every Python block have an output assertion?

No. A Python code block without an immediately following untagged output fence gets a test with no assertion. Use the report to inspect the role of each block.

What does DocsAlive do with these examples in 0.6.3?

A py fence containing prompts produces an invalid-syntax false positive. Output blocks after Python code are recognized but not compared, directives are ignored, one namespace is shared per page, and generated .py tests are never scanned. Keep phmdoctest for its own semantics and exact code/output checks.

Can both tools read the same session?

Yes. A pycon fence is recognized as a session by phmdoctest and by the engine. Verify both tools against the versions in your workflow.

Why review the first failure before later failures?

A failed import or setup block can leave later names undefined. Fixing the earlier issue and rerunning helps distinguish the original defect from dependent findings.

Keep reading
Outlined documentation pages with a lime pulse line running out of the stackGuide

Docs Testing: How to Test the Code Samples in Your Docs

Why code examples in documentation break, the ways teams test them (doctest, docs-as-tests, CI runners) and how to run every sample on each release.

Two lenses held over the same documentation page, each bringing a different layer into focusComparison

Vale vs markdownlint: What Each Docs Linter Catches

Vale checks prose style; markdownlint checks Markdown structure. What each catches, sample configs, running both in CI and what neither one tests.

Blueprint of two documentation pages: one with a handwritten test script, one whose code blocks are framed and checkedComparison

Doc Detective vs DocsAlive: Testing the Code in Your Docs

Doc Detective is a free, open-source docs-as-tests framework; DocsAlive is a hosted docs CI for code examples. Features, price, setup and when to use each.

A machine blueprint above a ruled documentation page, with a caliper measuring between themComparison

Promptless Alternative: Promptless vs DocsAlive Compared

Promptless drafts docs updates from what you ship; DocsAlive runs the code examples you've published. Features, pricing, security and when to use each.

A long workbench of outlined testing instruments, each with a small lime light, beside a stack of documentation pagesGuide

Best Free Tools to Test Code Examples in Documentation

Free, open-source tools that run the code examples in your docs: rustdoc, Go examples, doctest, pytest plugins, Sphinx doctest, Doc Detective and byexample.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing SDK Docs Before Every Release: A Release-Gate Guide

Test SDK and client-library docs against the package you ship: build the wheel or npm tarball, install it clean, run every example, and gate the release in CI.

Outlined documentation pages with a lime pulse line running out of the stackGuide

How to Test Quickstarts and Tutorials in Your Docs

Test the onboarding path a new reader follows: run quickstarts in a clean environment, in page order, sort real bugs from credentials and fragments, and wire it into CI.

Outlined documentation pages with a lime pulse line running out of the stackGuide

How to Test CLI Documentation: Commands, Flags and Output

Test the commands a CLI page promises: install in a clean container, run examples in order, compare flags with --help, check exit codes and output, and run it in CI.

Outlined documentation pages with a lime pulse line running out of the stackGuide

How to Test API Reference Docs: Requests, Responses and SDKs

Test API reference pages against the contract they publish: methods, parameters, request and response examples, SDK snippets, status codes and OpenAPI samples.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Docs testing for API-first companies

Keep API quickstarts, SDK snippets and curl examples working across releases.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Docs testing for CLI and developer-tool vendors

Test developer-tool install paths, package managers and command examples across releases.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing README Code Examples: Install, Usage and CI

Keep README install commands and usage examples working with clean environments, output checks and CI.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Notebooks and Executable Docs: Cells, Kernels and Output

Test notebooks in fresh kernels, check meaningful output and manage dependencies, data and drift in CI.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Docs in GitHub Actions: Pull Requests and Scheduled Checks

Run documentation example checks in GitHub Actions with practical guidance on schedules, path filters, caching, secrets and reports.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Code Examples in MkDocs, Docusaurus and Sphinx Sites

Find and test documentation examples in Markdown, MDX and reStructuredText, alongside site builds and link checks.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Python Docs Testing: Doctest, Pytest and Markdown

Test Python documentation with doctest, pytest, Markdown example execution and isolated environments.

Outlined documentation pages with a lime pulse line running out of the stackGuide

JavaScript Docs Testing: Node, TypeScript and Modules

Test Node and TypeScript documentation examples across module formats, package versions and type checks.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Go documentation examples

Test Go example functions and Markdown snippets against the intended module versions in clean environments.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Sphinx Docs Testing: doctest, code-block and MyST

Test Sphinx documentation examples: what the doctest and linkcheck builders prove, code-block and literalinclude, MyST fences, and what a Markdown scan covers.

Outlined documentation pages with a lime pulse line running out of the stackGuide

ReadMe Docs Testing: CLI, OpenAPI and Code Examples

Test ReadMe documentation examples: docs-as-code and bi-directional sync, what lint and oas:validate prove, Tabs variants and runnable code.

Outlined documentation pages with a lime pulse line running out of the stackGuide

TypeScript Docs Testing: tsc --noEmit and Runtime

Test TypeScript documentation examples: type-check snippets with tsc --noEmit in a consumer project, then run them, and what each check proves.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Docusaurus Docs Testing: Code Blocks, Tabs and MDX

Test Docusaurus documentation examples: builds vs runnable code, code block metadata, Tabs install variants, MDX pages and clean-container runs.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Mintlify Docs Testing: CodeGroup, Tabs and the CLI

Test Mintlify documentation examples: docs.json, MDX pages, CodeGroup and Tabs variants, what mint broken-links and mint validate prove, and clean runs.

Outlined documentation pages with a lime pulse line running out of the stackGuide

MkDocs Docs Testing: Code Examples, Tabs and Snippets

Test MkDocs documentation examples: strict builds, Material tabs, Snippets includes, mkdocstrings pages and clean-container runs.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Installation Instructions: pip, npm and Containers

Test documented install steps in clean environments: pip and extras, venv, npm install vs npm ci, containers and the first import.

Outlined documentation pages with a lime pulse line running out of the stackGuide

AI SDK Docs Testing: LLM Examples, Keys and Drift

Test AI and LLM SDK documentation examples: requests, responses, streaming, tool calls, credentials, model retirements and CI.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing migration guides and changelog examples

Test before and after examples against the right releases and make migration documentation part of the release gate.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Docs Testing Checklist: Code Examples Before Release

A practical pre-release checklist for testing documentation examples, reviewing gaps and verifying published packages.

Outlined documentation pages with a lime pulse line running out of the stackGuide

The Cost of Broken Code Examples in Documentation

Understand how broken documentation examples create friction in developer adoption and support, and how to reduce it.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Rust documentation examples

Test Rust rustdoc examples and cargo documentation tests, and keep native Rust checks because compiled Rust fences are recognized but not executed.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing VitePress documentation examples

Test VitePress Markdown examples separately from the site build, including code groups, includes and what a plain Markdown scan covers.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing docs in GitLab CI

Run documentation example checks in GitLab CI jobs, keep site builds separate from execution, and review what a scan covers and skips.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing JSON, TOML and YAML examples in docs

Test JSON, TOML and YAML config examples in documentation: parse, schema and tool checks, honest fence labels, fragments, CI jobs and what a scan covers.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Java documentation examples

Test Java examples in READMEs, SDK docs and Javadoc: the source launcher, javac, JShell scripts, assertions, @snippet files, CI and what a scan covers.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing PHP documentation examples

Test PHP examples in docs: php -l lint, clean-directory runs, assertions with zend.assertions, Composer scratch projects, PHPUnit, CI and scan coverage.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing C# documentation examples

Test C# examples in docs: .NET 10 file-based apps, dotnet build with warnings as errors, test projects, XML doc comments, CI and scan coverage.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Ruby documentation examples

Test Ruby examples in docs: ruby -c syntax checks, clean-directory runs, bundler/inline, minitest assertions, YARD examples, CI and scan coverage.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Kotlin documentation examples

Test Kotlin examples in docs: kotlinc runnable JARs and scripts, -Werror, KDoc @sample in compiled source, kotlinx-knit, fence labels, CI and scan coverage.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Swift documentation examples

Test Swift examples in docs: swift scripts, swiftc -typecheck, DocC snippets compiled by swift build, Swift Testing assertions, CI containers and scan coverage.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing curl and HTTP examples in API docs

Test curl examples in API docs: --fail-with-body, status and JSON checks against a local stub, http fences, credentials and what a docs scan checks.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Astro Starlight documentation examples

Test code examples in Astro Starlight docs: src/content/docs inventory, Tabs and Expressive Code, Markdoc pages, a Node check script, CI and scan coverage.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Nextra documentation examples

Test code examples in Nextra docs: content/ and app/ sources, fence metadata, Tabs and npm2yarn, a Node check script, CI and an honest scan limitation.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Docs testing for open-source projects

Test the code examples in open-source docs and READMEs: pull requests from forks, release and scheduled checks, contributor guidelines, triage and the Open source plan.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Docs testing for technical writers and docs teams

How technical writers and docs teams test the code examples they publish: docs-as-code checks, style-guide rules, reading a report, routing findings to engineers.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Docs testing for DevRel teams

How developer advocates test quickstarts, tutorials, workshops and sample READMEs: an inventory, a launch and release cadence, reading a report, and honest reporting.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Hugo documentation examples

Test the code examples in Hugo docs: fences with brace options, the highlight shortcode, Docsy tabs, drafts and theme example sites, scan scope and CI.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing GitBook documentation examples

Test the code examples in GitBook docs synced to Git: the space root, code tags, tabs, reusable includes, invisible characters, scan scope and CI.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing SQL examples in documentation

Test SQL examples in docs: run fences in page order on a fresh database, assert results, handle dialects, SQLite STRICT typing, psql ON_ERROR_STOP and CI.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing mdBook documentation examples

Test the code in an mdBook: what mdbook test covers, rust attributes, hidden lines, include directives, untagged output fences and a scan-ready copy for CI.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Docsify documentation examples

Test the code examples in Docsify docs: embedded code files and fragments, docsify-tabs tab sets, Prism grammars, scan scope and a CI check.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Jekyll documentation examples

Test the code examples in Jekyll docs: include tags, site variables, highlight tags, posts and _site copies, a scan-ready copy and Ruby hooks.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Antora and AsciiDoc documentation examples

Test the code examples in Antora docs: example includes, tagged regions, attributes, failing the build on missing includes and a Markdown copy to scan.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Fumadocs documentation examples

Test the code examples in Fumadocs docs: npm fences and package-manager tabs, tab groups, the Tabs component, includes, pycon highlighting and a scan-ready copy.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing versioned Docusaurus docs

Test every Docusaurus version readers can reach: versioned_docs copies, versions.json, partials, tabs, per-version scans and old-version triage.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Read the Docs documentation examples

Test the code examples on a Read the Docs site: .readthedocs.yaml build jobs, a pycon gate, latest and stable versions, Sphinx, MyST and .rst coverage.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Eleventy documentation examples

Test the code examples in Eleventy docs: Liquid pre-processing, global data, include tags, ignored drafts, raw tags and a rendered copy to scan.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Zola documentation examples

Test the code examples in Zola docs: Tera content templating, raw tags, config values, hide_lines, drafts, blog posts and a scan-ready copy.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Quarto documentation examples

Test the code examples in Quarto docs: executable cells, display-only fences, freeze and _freeze, a CI profile, cell options and a copy to scan.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Hexo documentation examples

Test the code examples in Hexo docs: posts, drafts, scaffolds, codeblock and include_code tags, a build check and a scan-ready copy.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing pdoc documentation examples

Test the code examples in pdoc docs: doctest for >>> sessions, fenced docstring examples, the README, private items and a copy to scan.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Doxygen documentation examples

Test the code examples in Doxygen docs: compiled example files, snippets, Markdown pages, WARN_AS_ERROR and what a scan can and cannot check.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing TypeDoc documentation examples

Test the code examples in TypeDoc docs: example tags, includeCode regions, project documents, a compiler check of extracted examples and a scan.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing JSDoc documentation examples

Test the code examples in JSDoc docs: example tags, captions, source patterns, tutorials, a doclet export and a scan-ready copy with assertions.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing docs examples with pre-commit hooks

Check docs code examples with pre-commit: local hooks, files filters, always_run, pass_filenames, SKIP and --no-verify, and what to leave for CI.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing documentation examples with Deno

Run docs code examples with deno test --doc: JSDoc and Markdown examples, imports, hashbang permissions, ignored blocks and deno check --doc-only.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing documentation examples with Sybil

Test Python docs examples with Sybil and pytest: Markdown parsers, invisible setup, skips, clear-namespace, docstrings and pycon fences a scan can read.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Markdoc documentation examples

Test the code examples in Markdoc docs: variables in fences, partials, if/else, custom tabs, validate in CI and a scan-ready copy from transform.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Markdown code blocks with pytest-markdown-docs

Run Markdown python fences as pytest tests with pytest-markdown-docs: globals hook, fixtures, continuation, notest, retry and pinning the released version.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing command line docs with prysk and Cram

Test CLI docs with prysk and Cram: .t transcripts, exit statuses, (re) and (glob) matches, and generating tests from the console blocks in your Markdown.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Python docstring examples with xdoctest

Run docstring examples with xdoctest: the pytest plugin, google and freeform parsing, permissive output matching, directives, and what it does not check.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing multi-language docs examples with byexample

Test docs examples with byexample: prompt-based language detection, the -l selection, +pass, +skip and timeouts, capture tags, and hidden setup in comments.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Markdown code blocks with mktestdocs

Run Markdown code blocks under pytest with mktestdocs: exact fence labels, memory=True for shared state, bash blocks, custom executors and docstring checks.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing README code blocks with pytest-codeblocks

Run README and Markdown code blocks with pytest-codeblocks: exact python, sh and bash labels, cont, skip and xfail markers, expected output, and gaps.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Markdown code examples in any language with txm

Test annotated Markdown examples with txm: program, in, out, err, check and exit annotations, TAP output, exact matching, and blocks it never runs.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing Sphinx docs examples with sphinx.ext.doctest

Run Sphinx doctest, testcode and testoutput directives in reStructuredText or MyST pages: groups, hidden setup, global setup and what is never run.

Outlined documentation pages with a lime pulse line running out of the stackGuide

Testing docs examples that need API keys

Test credential-gated docs examples: honest placeholders, offline stubs and fixtures, live sandbox jobs, CI secrets and fork rules, and how a scan classifies them.

A machine blueprint above a ruled documentation page, with a caliper measuring between themGuide

Documentation Drift: How to Detect It Before Users Do

What documentation drift is, why code examples drift first, and practical ways to detect it: ownership, release checks, link and execution tests.

See which of your code samples still run.

Send us a public repository. Our team runs DocsAlive on its docs and emails you the real report within 2 business days. Free, no signup.