Guide

Testing Python docstring examples with xdoctest

xdoctest runs the examples in your docstrings, with a looser output checker than doctest. It never reads your Markdown guides, so check those pages separately.

Published
Updated
November 17, 2026
Reading time
11 min
Facts checked against
The xdoctest docs, README and directive reference plus the Python doctest docs, with every code block run on xdoctest 1.3.2, 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 answerWhat xdoctest testsSet up a small docstring exampleChoose a parsing style and check strictnessFollow an API change into the guidesCompare coverage and triage findingsWhere DocsAlive fitsPasteable checklistThe sources we checkedFAQ

The short answer

Use xdoctest to run examples embedded in Python docstrings, and use a separate Markdown scan to check published guides. Enable its pytest plugin explicitly if pytest is your test runner, review which examples were collected, and use assertions for behavior that must be checked strictly. A passing docstring test does not establish that a separate guide still calls the current API.

In engine 0.6.3, DocsAlive reads Markdown pages and never reads docstrings in .py files. A python fence containing >>> prompts is treated as a Python script and can produce an invalid-syntax false positive. Label interactive sessions pycon: the engine compares printed output in pycon and python-repl sessions. This makes the division of work concrete: xdoctest checks docstrings; the scan checks supported examples in Markdown guides.

What xdoctest tests

xdoctest is a rewrite of Python’s standard doctest module. It finds and runs doctests in Python module and package docstrings. Its parser uses Python’s ast module in place of the standard module’s regex-based parser.

The difference matters when examples include multi-line Python. xdoctest allows every line to use the >>> prefix, including lines in an indented body. Older continuation lines using ... still work, and multi-line strings need no prefix. It also allows top-level async code.

Execution is organized in blocks. A directive comment on its own line applies to following lines; an inline directive applies to its own line. A part without a want, or expected output, ignores both stdout and its final value. If a part has a want and ends with both a value and stdout, either matching is enough for the part to pass. One want can check output from several print calls.

These conveniences make docstrings easier to write, but they also make the meaning of a pass important. A test without a want may establish that a line ran without an error while checking none of its displayed behavior. A permissive want may accept differences you intended to catch.

Set up a small docstring example

The examples in this guide use the illustrative package names acme-slug and acme_slug; they are not published packages. The files demo_ws.py and demo_dir.py below are illustrative too. Install xdoctest and pytest in an environment where your own package can be imported:

python -m pip install xdoctest pytest

The following illustrative module contains a Google-style example and a freeform example. The loop deliberately uses >>> on every line to show the syntax xdoctest accepts:

"""Tiny slug helpers used to demonstrate xdoctest."""


def slugify(text, sep="-"):
    """Turn a title into a URL slug.

    Example:
        >>> from acme_slug import slugify
        >>> slugify("Hello, World")
        'hello-world'
        >>> words = ["Docs", "That", "Run"]
        >>> for w in words:
        >>>     print(slugify(w))
        docs
        that
        run
    """
    keep = "".join(c.lower() if c.isalnum() else " " for c in text)
    return sep.join(keep.split())


def truncate_slug(slug, limit):
    """Cut a slug at a word boundary.

    >>> truncate_slug("docs-that-run-everywhere", 13)
    'docs-that-run'
    """
    if len(slug) <= limit:
        return slug
    cut = slug[:limit + 1]
    return cut[:cut.rfind("-")] if "-" in cut else slug[:limit]

The native runner accepts a package or module followed by a command. List first to see what was found, then run all enabled doctests:

python -m xdoctest acme_slug list
python -m xdoctest acme_slug all

On the tested module, the list and the end of the run looked like this:

    python -m xdoctest acme_slug/__init__.py slugify:0
    python -m xdoctest acme_slug/__init__.py truncate_slug:0

2 / 2 passed
=== 2 passed in 0.00 seconds ===

Besides list and all, the native runner offers dump to convert examples for unit testing and accepts a callname to run one doctest. Zero-argument functions can be run by name, but all does not run them and list does not list them. Account for that distinction when using the native list as a coverage inventory.

Enable pytest collection

xdoctest’s pytest plugin is installed with the package but disabled by default because it replaces pytest’s built-in doctest plugin. Enable it with --xdoctest or --xdoc on the command line, or put the option in pytest’s addopts. This illustrative project configuration makes it part of each pytest run:

[project]
name = "acme-slug"
version = "0.1.0"

[tool.pytest.ini_options]
addopts = "--xdoctest"

With that setting, a verbose pytest run collected the two docstring examples as separate items:

acme_slug/__init__.py::slugify:0 PASSED                                  [ 50%]
acme_slug/__init__.py::truncate_slug:0 PASSED                            [100%]
============================== 2 passed in 0.02s ===============================

Node names have the form path/to/file.py::callname:num; a method can appear as file.py::ClassName::method:0. These names help you select a failing item and confirm that the intended module was collected. A green pytest run without those items is not evidence that the docstrings were tested.

Compare the standard parser

The all->>> loop is valid for xdoctest but not for the standard doctest parser used in this comparison:

UNEXPECTED EXCEPTION: IndentationError("expected an indented block after 'for' statement on line 1", ...)
FAILED acme_slug/__init__.py::acme_slug.slugify
========================= 1 failed, 1 passed in 0.02s ==========================

Choose the syntax for the runner you actually use. If a project must support both runners, verify examples with both rather than assuming a test accepted by one parser has the same meaning in the other.

Choose a parsing style and check strictness

The google style expects an Example: or Doctest: tag in a Google docblock and parses the code in that block as one doctest. freeform treats each contiguous block of >>> lines as its own test. The default auto style does both. The native runner’s --style option selects among them; the pytest equivalent is --xdoctest-style.

The got/want checker is permissive by default. It ignores whitespace differences, normalizes some Unicode, bytes and ANSI differences, and uses the doctest ellipsis matcher. The documented defaults have ELLIPSIS, NORMALIZE_WHITESPACE, NORMALIZE_REPR and REPORT_UDIFF on; SKIP and the other directives are off. The README warns that a check failing under doctest may pass under xdoctest and recommends assertions for system-critical code.

The illustrative demo_ws.py demonstrates two differences accepted by xdoctest:

def pair():
    """
    >>> print("a   b")
    a b
    >>> list(range(12))
    [0, 1, 2, ..., 11]
    """

In the checked run, xdoctest passed this example; the standard doctest run reported two failures. That result is useful when deciding how much output variation a reader can tolerate. It is not a reason to let a critical result vary silently: use an assertion when the precise property matters.

Apply directives deliberately

An inline +SKIP skips the relevant line. A standalone +REQUIRES(...) directive conditions following lines on a requirement. The illustrative demo_dir.py uses both:

def network_call():
    """
    Example:
        >>> import acme_missing_client  # xdoctest: +SKIP
        >>> print("still runs")
        still runs
        >>> # xdoctest: +REQUIRES(module:numpy)
        >>> import numpy as np
        >>> print(np.arange(3))
        [0 1 2]
    """

With NumPy absent in the checked environment, the required parts were skipped and the test passed. Advanced requirements can refer to platform tags, command-line flags, installed modules or environment variables. Review such conditions as coverage decisions: a passing item with a skipped part does not establish that the optional path works.

A directive can also turn a default off, such as # xdoctest: -ELLIPSIS. Native runner defaults can be set with --options; pytest has corresponding prefixed options such as --xdoctest-options. The directive reference describes the available settings.

The latest documentation describes REQUIRE_WANT, intended to require a want when a part prints or shows a value. The tested PyPI release, xdoctest 1.3.2, did not support it: it warned about an unknown directive and the test passed. It may arrive in a later release; do not rely on it with 1.3.2.

Follow an API change into the guides

The next change is broken on purpose for the existing examples. It changes the default separator and renames a function while updating that function’s own docstring:

--- a/acme_slug/__init__.py
+++ b/acme_slug/__init__.py
@@ -1,7 +1,7 @@
 """Tiny slug helpers used to demonstrate xdoctest."""


-def slugify(text, sep="-"):
+def slugify(text, sep="_"):
     """Turn a title into a URL slug.

     Example:
@@ -19,10 +19,10 @@
     return sep.join(keep.split())


-def truncate_slug(slug, limit):
+def shorten_slug(slug, limit):
     """Cut a slug at a word boundary.

-    >>> truncate_slug("docs-that-run-everywhere", 13)
+    >>> shorten_slug("docs-that-run-everywhere", 13)
     'docs-that-run'
     """
     if len(slug) <= limit:

The pytest run catches the changed separator in the unchanged want. The updated docstring for the renamed function passes:

Expected:
    'hello-world'
Got:
    'hello_world'
...
FAILED acme_slug/__init__.py::slugify:0
1 failed, 1 passed in 0.01s

That result illustrates both the value and the boundary of a docstring test. It catches a mismatch in the docstring that remained behind. It cannot tell you whether a separate page still imports the old function name.

This illustrative Markdown page contains a pycon session, an all-prompt loop pasted into a python fence, and a plain Python example:

# Usage

Make a slug in an interactive session:

```pycon
>>> from acme_slug import slugify
>>> slugify("Hello, World")
'hello-world'
```

The same example pasted from the docstring, all lines prefixed:

```python
>>> words = ["Docs", "That", "Run"]
>>> for w in words:
>>>     print(slugify(w))
```

Shorten a slug:

```python
from acme_slug import truncate_slug
print(truncate_slug("docs-that-run-everywhere", 13))
```

Pointing xdoctest at this page does not turn it into a Markdown test. In the checked run it warned, ran no tests and exited successfully:

UserWarning: Cannot parse module=docs/usage.md.
Caused by: invalid syntax (<unknown>, line 3)
...
=== 1 warnings in 0.00 seconds ===

pytest with --xdoctest did not collect the Markdown page either. xdoctest does not read Markdown or reStructuredText pages. Its README identifies related tools for those formats, including Sybil; see the Sybil guide and Markdown testing with mktestdocs.

With the intact package, engine 0.6.3 passed the pycon block and the plain Python block. It reported the prompt-prefixed loop as invalid syntax because the fence labels it as a Python script. That is a false positive for this presentation; use a pycon label for an interactive session. After the API change, the scan flagged the pycon block as output-differs (a warning), still reported the prompt-prefixed loop as invalid syntax, and failed the plain Python block as api-drift: truncate_slug no longer exists in acme_slug. xdoctest could not report that break, because it reads only docstrings.

Compare coverage and triage findings

xdoctest feature What xdoctest does What the engine does in 0.6.3
Python docstrings Finds doctests in modules and packages Never reads .py docstrings
All->>> syntax Accepts it in a doctest Treats it as invalid Python syntax in a python fence
Directives Applies supported directives according to scope Has no notion of xdoctest directives
Wants Uses its permissive got/want checker Compares printed output in pycon and python-repl sessions
Markdown pages Does not read them Reads .md, .mdx and .markdown pages in scan scope
Page state Tests docstring examples Runs Python fences in page order with a shared namespace
Finding Likely cause What to do
pytest passes with no expected docstring items Plugin not enabled or module not collected Enable --xdoctest and inspect node names
A meaningful output change passes No want, or a permissive want Add an assertion for the critical property and review directives
A conditional example passes without its optional path A requirement was unmet Run a separate environment that satisfies the requirement
Markdown loop is marked invalid syntax >>> session is labeled python Label the session pycon and rerun
Guide imports an old name Docstring was updated while the guide was not Update the guide and check other published pages
A later block needs a missing name An earlier step failed or setup is absent Fix the first failure and inspect the reader’s setup

A scan finding is evidence to investigate in context. The engine classifies api-drift and invalid-syntax as likely documentation bugs; depends-on-context is not automatically a docs bug. The fence-label false positive above shows why the category still needs review. Findings and their limits are described in the findings reference.

Where DocsAlive fits

Run xdoctest where the source docstrings live. Run the Markdown scan against the guide pages readers visit, using a clean checkout and the package setup appropriate to those pages. The engine uses a fresh container per page and preserves Python state within that page. It does not infer that a passing docstring proves a guide is current.

A clean scan also exposes setup differences. A package installed on a developer machine may be absent from the page container. Decide whether installation belongs in the documented reader path or in declared test setup. For broader approaches, see Python docs testing, testing pdoc documentation and GitHub Actions docs testing.

One engine limitation deserves a separate coverage check: an unknown fence label can be reported as passing without being run or parsed. Check the language and skip reasons in the report rather than interpreting every green result as execution. The CLI reference covers scan options, and the health check provides a one-off report for an eligible public repository.

Pasteable checklist

[ ] Enable the xdoctest pytest plugin or run the native runner.
[ ] List or inspect collected docstring examples and node names.
[ ] Choose the parsing style for the project's docstrings.
[ ] Add assertions for behavior that needs a strict check.
[ ] Review wants, default matching and directive scope.
[ ] Run conditional examples in environments that meet their requirements.
[ ] Check Markdown guides separately from Python docstrings.
[ ] Label interactive Python sessions pycon.
[ ] Review skipped, unsupported and context-dependent findings.
[ ] Run the checks when the API or documentation changes.

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
xdoctest documentation Runner, parsing styles and pytest integration
xdoctest directives Directive defaults and conditional execution
xdoctest repository Project README and comparison with doctest
Python doctest documentation Standard library doctest

FAQ

What does xdoctest test?

It finds and runs doctests in Python module and package docstrings. It does not read Markdown or reStructuredText pages, so test separately published guides with a tool that supports those files.

Does pytest run xdoctest automatically?

No. Its plugin is installed with xdoctest but disabled by default. Enable it with --xdoctest or --xdoc, or add an option to pytest addopts, and inspect the collected items.

Why did an output difference pass?

The default checker normalizes several kinds of differences and enables ellipsis matching. A part with no want also ignores stdout and its final value. Use assertions for critical behavior and review the directive defaults.

Can I use REQUIRE_WANT with version 1.3.2?

The tested PyPI release did not support it: it warned about an unknown directive and passed the test. The latest documentation describes the directive, which may arrive in a later release.

What does DocsAlive check alongside xdoctest?

Engine 0.6.3 reads Markdown pages and never reads docstrings in .py files. A python fence containing prompts can produce an invalid-syntax false positive; use a pycon fence for an interactive session, whose printed output the engine compares.

Does a passing docstring mean the published guide is current?

No. A docstring can be updated when an API changes while a separate guide keeps the old import or result. Run both the docstring tests and a check of the published Markdown pages.

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 examples with phmdoctest

Test Python examples in README and Markdown files with phmdoctest: sessions, output blocks, directives, --report, generated pytest files and pycon fences.

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 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.