Guide

Testing Markdown code blocks with mktestdocs

mktestdocs runs the Markdown code blocks your pytest test selects and fails when one raises. It matches fence labels exactly and compares no output.

Published
Updated
November 17, 2026
Reading time
9 min
Facts checked against
The mktestdocs PyPI page and repository README and source for 0.2.5, with every code block run on mktestdocs 0.2.5, pytest 9.2.0, bash and Python 3 (November 16, 2026)
Outlined documentation pages with a lime pulse line running out of the stack
On this pageThe short answerWhat mktestdocs doesBuild a pytest checkMatch labels exactlyCheck docstrings with an explicit languageFollow a deliberate API breakCompare coverage and triage findingsWhere DocsAlive fitsPasteable checklistThe sources we checkedFAQ

The short answer

Use mktestdocs from a pytest test you write to execute selected Markdown code blocks and fail when they raise. Choose exact fence labels, decide whether a page needs shared state, register executors for other labels, and put assertions in examples whose results matter. A pass means the selected code did not raise; it does not mean displayed output was compared.

In engine 0.6.3, DocsAlive uses one Python namespace per page, runs py fences, and runs bash blocks under set -e. In the example below, a JSON block after prose ending in “returns:” is recorded as expected output and is not validated. The engine compares printed output only in Python pycon and python-repl sessions, and never reads pytest test files. Use mktestdocs for the checks you configure in pytest and the scan for supported Markdown coverage in a clean page environment.

What mktestdocs does

mktestdocs is a small library for running pytest against Markdown files and docstrings. You write the pytest test that selects files and calls its functions. The project page demonstrates parametrizing over Markdown paths and calling check_md_file(fpath=...).

For Markdown, check_md_file defaults to memory=False and lang="python". By default, each selected Python block executes in a fresh namespace. With memory=True, it joins blocks of that language on the page into one script and runs it once. That distinction is important for tutorials in which a later block uses an import or variable introduced earlier.

A selected block passes if it does not raise. Assertions inside an example therefore provide meaningful checks. A print call alone can run successfully even when a displayed result elsewhere on the page is out of date.

Build a pytest check

The package names acme-slug and acme_slug used here are illustrative, not published packages. Install mktestdocs and pytest in an environment where the illustrative package can be imported:

python -m pip install mktestdocs pytest

This illustrative page has two dependent Python blocks, a bash block, a JSON body and a block labeled py:

# Usage

Make a slug:

```python
from acme_slug import slugify, truncate_slug

slug = slugify("Docs That Run Everywhere")
assert slug == "docs-that-run-everywhere"
```

Shorten it for a URL:

```python
short = truncate_slug(slug, 13)
assert short == "docs-that-run"
```

Check the package from a shell:

```bash
python -c "import acme_slug; print(acme_slug.slugify('Hello, World'))"
```

A response body the API returns:

```json
{"slug": "docs-that-run", "length": 13}
```

This one is labeled py, so mktestdocs does not pick it up:

```py
assert slugify("A B") == "a-b"
```

Start with the project’s parametrized pattern. This illustrative tests/test_docs.py uses the default settings:

import pathlib

import pytest
from mktestdocs import check_md_file

DOCS = sorted(pathlib.Path("docs").glob("**/*.md"))


@pytest.mark.parametrize("fpath", DOCS, ids=str)
def test_docs_python(fpath):
    check_md_file(fpath=fpath)

The checked run fails because the second Python block starts without the names defined in the first:

E   NameError: name 'truncate_slug' is not defined
FAILED tests/test_docs.py::test_docs_python[docs/usage.md] - NameError: name ...
1 failed in 0.02s

That failure does not necessarily mean the page is wrong. The page presents a sequence, while the default check isolates each block. Decide whether the reader is meant to carry state. If so, test the page as a sequence and make the ordering clear. If each block is meant to stand alone, include its prerequisites in each block instead.

Add memory and executors

The revised test uses memory=True for Python, checks bash separately, and registers json.loads as the executor for json:

import json
import pathlib

import pytest
from mktestdocs import check_md_file, register_executor

DOCS = sorted(pathlib.Path("docs").glob("**/*.md"))
register_executor("json", json.loads)


@pytest.mark.parametrize("fpath", DOCS, ids=str)
@pytest.mark.parametrize("lang", ["python", "bash", "json"])
def test_docs(fpath, lang):
    check_md_file(fpath=fpath, memory=(lang == "python"), lang=lang)

The checked run passed all three parametrized tests:

tests/test_docs.py::test_docs[python-docs/usage.md] PASSED               [ 33%]
tests/test_docs.py::test_docs[bash-docs/usage.md] PASSED                 [ 66%]
tests/test_docs.py::test_docs[json-docs/usage.md] PASSED                 [100%]
============================== 3 passed in 0.03s ===============================

The register_executor function receives a language label and a function; that function receives each block’s text. Here, parsing JSON can raise on invalid input. The check is still limited to what the registered function does: parsing a body does not establish that its values match a live service.

mktestdocs supports bash blocks. Each runs in a new bash -e -u -c subprocess, so a failing command or an unset variable fails the block. That is a different state boundary from joining Python blocks with memory=True. Do not assume a shell variable set in one bash block remains available in another.

Match labels exactly

In mktestdocs 0.2.5, the text after the opening three backticks must exactly equal the selected lang. The illustrative page.md below contains three blocks that would stop the check if run, but none matches the default python label:

```py
raise SystemExit("py label ran")
```

```python title="example.py"
raise SystemExit("title label ran")
```

```Python
raise SystemExit("capital label ran")
```

A passing test over this page is therefore not evidence that those blocks ran. If mktestdocs is your gate for Python, label each intended block exactly python, without title text or a capital letter, and review the labels whenever the documentation format changes. Alternatively, configure a separate check for another exact label where appropriate.

The 0.2.5 parser also toggles a block on any line containing three backticks, so nested fences inside four-backtick blocks are not handled. This matters for documentation that teaches Markdown itself. Check such pages with a method suited to their structure instead of assuming the normal extraction path applies.

Check docstrings with an explicit language

check_docstring checks Markdown code blocks in an object’s docstring. Its default lang is an empty string; with that default, every fenced block in the docstring is run as Python. The following illustrative function contains bash, so the call explicitly selects bash:

from mktestdocs import check_docstring


def roar():
    """Roar.

    ```bash
    echo roar
    ```
    """


check_docstring(roar, lang="bash")

In the checked run, the default raised a syntax error on that bash block; lang="bash" ran it. get_codeblock_members(*classes) can return members whose docstrings contain code blocks. As with file checks, define which members and languages your test covers and examine what was actually selected.

For prompt-style docstring examples, xdoctest provides a different approach. For Markdown pages, compare the selection and state rules of each tool before using a passing result as a release signal.

Follow a deliberate API break

The following change is broken on purpose for the existing page. The default separator changes and the old shortening function is renamed:

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

With the revised pytest test, the Python run stops at the import. The bash and JSON tests still pass:

E   ImportError: cannot import name 'truncate_slug' from 'acme_slug' (.../acme_slug/__init__.py)
FAILED tests/test_docs.py::test_docs[python-docs/usage.md] - ImportError: can...
1 failed, 2 passed in 0.03s

Fix the first failure and rerun to learn whether later assertions also need attention. The passing bash and JSON checks cover their selected blocks under their own rules; they do not establish that the Python sequence works.

On the intact page, engine 0.6.3 ran the Python blocks with a shared page namespace, so the dependency passed. It ran the bash block under set -e, and it ran the py block that the default mktestdocs selection omitted. The JSON block immediately after prose ending in “returns:” was recorded as an expected-output block and skipped; it was not validated.

After the deliberate change, the engine classified the first Python block as API drift and the second as context-dependent. The py assertion failed as a runtime error needing review. This is a useful difference in coverage, but the skipped JSON block remains a gap that the registered mktestdocs executor can address.

Compare coverage and triage findings

mktestdocs feature What mktestdocs does What the engine does in 0.6.3
Python state Isolates blocks by default; memory=True joins selected blocks Uses one Python namespace per page
py label Does not match default lang="python" Runs py fences as Python
Label with title Does not match python exactly Uses the first word of the info string
Bash Runs each block in a new bash -e -u -c subprocess Runs shell blocks under set -e
Registered JSON executor Calls the registered function for selected JSON blocks The illustrated block after “returns:” is skipped as expected output
Docstrings Can check fenced blocks through check_docstring Never reads .py docstrings
pytest test file Runs the test and its configured checks under pytest Never reads pytest test files
Finding Likely cause What to do
Later Python block raises a name error Default fresh namespace for each block Use memory=True for an intentional sequence, or make blocks independent
Test passes but a block was not checked Fence label did not match exactly Audit labels and selected languages
A language is absent from the test No executor or parametrized run was added Register and run an appropriate executor
A changed result passes Example has no assertion and no error Assert the important property
JSON is skipped by the scan It was identified as an expected-output block Validate it separately when validation is required
Later scan block depends on context An earlier import or setup failed Fix the first failure and rerun the page

A passing result must be read with its scope. mktestdocs checks the blocks selected by your test, using the executor you configured. The engine similarly has known coverage limits: an unknown fence label can be reported as passing without being run or parsed. Review labels and report details, especially on pages containing several languages.

Where DocsAlive fits

Run mktestdocs in pytest when you want explicit, repository-owned checks and assertions. Use DocsAlive to scan supported Markdown examples in fresh page containers and classify findings. The engine preserves Python state within a page, so its result can differ from mktestdocs’ default isolated blocks.

The engine does not read the pytest test that registers your JSON executor or sets memory=True. Keep both configurations visible to maintainers. If a JSON block is recorded as expected output, the scan does not validate it; a separate parser or test remains necessary. Consult the findings reference for categories and the CLI reference for scan configuration.

For related workflows, see MkDocs docs testing, Python docs testing, pytest Markdown docs testing and phmdoctest docs testing. byexample is another option for prompt-based multi-language sessions.

Pasteable checklist

[ ] Parametrize the pytest test over the intended Markdown paths.
[ ] Audit exact fence labels for every selected language.
[ ] Decide whether Python blocks are independent or sequential.
[ ] Use memory=True when a page intentionally shares Python state.
[ ] Add a separate bash check where bash blocks matter.
[ ] Register executors for other labels that need checks.
[ ] Put assertions around important behavior.
[ ] Set check_docstring language explicitly for non-Python blocks.
[ ] Review skipped output blocks and validate data separately.
[ ] Rerun after fixing the first failure in a sequence.

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
mktestdocs on PyPI Package, pytest pattern and documented usage
mktestdocs repository README and implementation details for version 0.2.5

FAQ

Does mktestdocs run automatically when pytest runs?

You write a pytest test that selects paths and calls mktestdocs. Parametrizing the paths makes each selected page visible in pytest results.

Why does a later Python block fail with a name error?

By default, check_md_file runs each selected Python block in a fresh namespace. Use memory=True for a page intentionally written as a sequence, or give each block its own setup.

Will a py fence run under the default settings?

No. Version 0.2.5 matches the text after the opening backticks exactly against the selected language. The default is python, so py, a title after python, and Python with a capital letter do not match.

Does a passing mktestdocs test compare displayed output?

No. A selected block passes when it does not raise. Add assertions for behavior that needs verification and use an appropriate separate check for displayed results.

How does DocsAlive handle the same page?

Engine 0.6.3 shares a Python namespace per page, runs py fences, and runs bash under set -e. In the illustrated page, the JSON block after prose ending in returns is recorded as expected output and not validated. Only pycon or python-repl printed output is compared, and pytest test files are never read.

How are bash blocks checked by mktestdocs?

Each selected bash block runs in a new bash -e -u -c subprocess. A failing command or an unset variable fails that block, and separate bash blocks do not share a shell session.

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