Guide

Testing documentation examples with Sybil

Sybil runs doc examples as pytest items. Label sessions pycon, keep setup visible on scanned pages and know which Sybil comments a scan ignores.

Published
Updated
November 17, 2026
Reading time
13 min
Facts checked against
Sybil 10.1.0 docs on usage, Markdown parsers, test runner integration, concepts and the API, plus Python doctest, with every code block run on Sybil 10.1.0, pytest 9.2.0 and Python 3 (November 15, 2026)
Outlined documentation pages with a lime pulse line running out of the stack
On this pageThe short answerHow Sybil evaluates a documentWhy documentation examples drift even with SybilSet up the illustrative projectSee what the scan readsMake a shared page easier to scanCatch a real renameRunning both in CITriage findingsWhere DocsAlive fitsThe sources we checkedFAQ

The short answer

Run Sybil through pytest to check Python examples in documentation and docstrings as part of the normal test suite. Configure parsers for the document styles you use, make setup and skips deliberate, and inspect the collected results so a skipped region is not mistaken for a passing example.

Engine 0.6.3 of DocsAlive handles Sybil-style pages differently. A python fence containing a >>> session is run as a Python script and becomes an invalid-syntax false positive unless the session is labeled pycon. Invisible setup blocks are unseen, Sybil’s skip and clear-namespace comments are not honored, and Python source docstrings are not read. Use Sybil in pytest for those semantics and a scan for supported page blocks and triage; adapt shared pages deliberately.

How Sybil evaluates a document

Sybil parses examples from code and documentation and evaluates them in the normal test run. It divides each document into non-overlapping regions. Each region becomes an example evaluated in the document’s namespace and in document order. If one example fails, Sybil reports the failure and continues with the remaining examples. Separate documents do not share namespaces.

That model supports a page that introduces a name in one region and uses it later. It also means a later failure may follow an earlier failure: the later region can run without the setup it expected. Read the sequence before deciding that each failure has an independent cause.

Sybil provides pytest and unittest integrations. Its pytest integration uses a conftest.py collection hook, and its documentation recommends disabling pytest’s own doctest plugin. Fixtures can be requested through Sybil’s fixtures argument. The path parameter is ignored with pytest.

For Markdown, use the parsers appropriate to the source: Sybil documents CommonMark, GitHub Flavored Markdown and MyST, with separate MyST parsers. PythonCodeBlockParser checks Python fences, including doctest sessions inside fences labeled python. Invisible Python blocks can live in HTML-style comments. SkipParser supports a next-region skip, a start/end range, conditional skips and reasons; a reason makes an unconditional skip appear as a skipped test. ClearNamespaceParser clears the document namespace at its comment.

Sybil also exposes CodeBlockParser for other languages when you supply an evaluator. A Python parser does not automatically test every shell block on the page. Doctest comparison ignores trailing whitespace by default; Sybil documents NUMBER and KEEP_TRAILING_WHITESPACE option flags for cases that need them.

Why documentation examples drift even with Sybil

Sybil removes the biggest reason Python examples go stale: nobody runs them. Once the examples are pytest items, a rename or a changed return value fails the same build that fails a unit test. What remains are the places where the configuration and the page disagree about what should run.

Collection decides coverage. Sybil only sees files that match its patterns and only checks regions that a configured parser recognizes. A page outside the pattern, a fence label no parser knows, or a docstring in a module the docstring Sybil does not cover is silently out of scope. The test run is green because nothing was asked of those examples.

Setup can hide in comments. Invisible code blocks keep boilerplate out of the reader's way, which is their purpose. They also mean the page a reader copies from is not the page that was tested: the import or variable the visible block depends on lives in a comment the reader never sees.

Skips outlive their reason. A skip with a reason shows up in the test report, which is good practice, but an example skipped for a planned release keeps being skipped after the release unless someone removes the comment. A skip without a reason is reported as a pass in the default report, which is easy to misread.

Order matters inside a document. Regions run in document order in one namespace, so a failure early on a page often causes later failures that are only consequences. The probe below shows exactly that pattern after a rename.

Other languages need their own evaluator. A Python parser does not run the install command or the shell session next to the Python example. Those blocks are untested unless a parser and evaluator are added for them or another tool covers them.

Set up the illustrative project

The following files are illustrative. The package names acme-slug and acme_slug are illustrative and are not published packages. The probe used Sybil 10.1.0, pytest 9.2.0 and Python 3.13.

Install Sybil’s pytest extra and the illustrative package in editable mode in the test environment.

pip install "sybil[pytest]"
pip install -e .

The project configuration disables pytest’s own doctest plugin, following Sybil’s recommendation. The package metadata also gives the example project a small, explicit build configuration.

[project]
name = "acme-slug"
version = "1.0.0"
requires-python = ">=3.10"

[build-system]
requires = ["setuptools>=68"]
build-backend = "setuptools.build_meta"

[tool.setuptools]
packages = ["acme_slug"]

[tool.pytest.ini_options]
addopts = "-p no:doctest"

The illustrative package has doctest examples in a module docstring and a function docstring. Those examples exercise the public import and a function available in the module’s namespace.

"""Make URL slugs from titles.

>>> from acme_slug import slugify
>>> slugify("Hello, World!")
'hello-world'
"""
import re

__all__ = ["slugify", "truncate_slug"]


def slugify(title: str) -> str:
    """Turn a title into a URL slug.

    >>> slugify("Release notes: v2.0")
    'release-notes-v2-0'
    """
    return re.sub(r"[^a-z0-9]+", "-", title.lower()).strip("-")


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

The first conftest.py combines two Sybil instances: one for Markdown and one for docstrings. Their collection becomes one pytest integration. Combining them keeps each parser’s intended scope explicit.

from sybil import Sybil
from sybil.parsers.markdown import ClearNamespaceParser, PythonCodeBlockParser, SkipParser
from sybil.parsers.rest import DocTestParser

markdown_examples = Sybil(
    parsers=[PythonCodeBlockParser(), SkipParser(), ClearNamespaceParser()],
    patterns=["*.md"],
)
docstring_examples = Sybil(
    parsers=[DocTestParser()],
    patterns=["acme_slug/*.py"],
)

pytest_collect_file = (markdown_examples + docstring_examples).pytest()

For Python files, Sybil’s Python document imports the source as a module; its Python docstring document considers only docstrings. ReStructuredText and MyST parsers can work with docstrings. Choose patterns and parsers to reflect what your project publishes and tests, rather than assuming a Markdown parser covers source comments.

The first usage page follows a style Sybil supports. Its invisible block supplies setup, its visible Python fences contain both sessions and plain code, and comments control a planned example and a namespace reset.

# Usage

<!-- invisible-code-block: python
from acme_slug import slugify, truncate_slug
long_title = "Testing documentation examples with Sybil"
-->

A python fence can hold a doctest session:

```python
>>> slug = slugify(long_title)
>>> slug
'testing-documentation-examples-with-sybil'
```

Or plain code, which shares the page's namespace:

```python
short = truncate_slug(slug, 20)
assert short == "testing", short
```

<!-- skip: next "ascii_only arrives in 1.1" -->

Planned for the next release:

```python
>>> slugify("Ünïcode", ascii_only=True)
'unicode'
```

<!-- clear-namespace -->

```python
>>> "slug" in globals()
False
```

Run pytest with verbose reporting so the collected examples and the stated skip are visible.

pytest -v

The excerpt shows the usage-page regions and the overall result. The invisible setup is itself tested, and the planned feature appears as a skip with its reason. Across the project, the probe collected twelve items: eleven passed and one was skipped.

docs/usage.md::line:3,column:1 PASSED
docs/usage.md::line:11,column:1 PASSED
docs/usage.md::line:12,column:1 PASSED
docs/usage.md::line:18,column:1 PASSED
docs/usage.md::line:23,column:1 PASSED
docs/usage.md::line:28,column:1 SKIPPED (ascii_only arrives in 1.1)
docs/usage.md::line:32,column:1 PASSED
docs/usage.md::line:35,column:1 PASSED
======================== 11 passed, 1 skipped in 0.01s =========================

The configured Sybil parsers did not check the README’s shell fence. That is a scope decision, not a failure of the Python examples. Inventory the languages on each page and add an appropriate evaluator or another check for the blocks that matter.

See what the scan reads

The following command plans a scan; it does not itself execute the examples.

docsalive scan .

The plain-project plan found two pages and six blocks in docs/ plus the root README. In a separate engine-driver run with the package installed and the network off, the README install line was skipped and its Python block passed. Three Python fences containing sessions failed as invalid-syntax: the engine tried to run the prompts as a script. Those were false positives counted in a docs-bug category.

The plain Python block failed as depends-on-context because the import it needed was inside the invisible comment. The engine skipped that multiline comment. It also did not read the docstrings in the Python file. These differences are about how the two tools interpret the source, so a result from one should not be presented as coverage supplied by the other.

Sybil feature What Sybil does What the engine does in 0.6.3
Session in a python fence Parses and evaluates the doctest session Runs the fence as a script; prompts cause an invalid-syntax false positive
Invisible setup Evaluates the configured invisible Python block Skips the multiline HTML comment
Skip comment Skips the selected region; a reason can appear in results Does not honor the comment
Clear-namespace comment Clears the document namespace Does not honor the comment
Python docstring Can collect examples with a suitable document and parser Does not read docstrings in .py files
Other language Can evaluate it with CodeBlockParser and a custom evaluator Handles supported fence types according to its own planner
Document state Evaluates regions in order in one document namespace Python blocks share a page namespace; separate pages start fresh

Make a shared page easier to scan

A pycon label tells the engine that a fence contains a session. The following verified subclass lets Sybil 10.1.0 check that label in the same way as its Python fences. The file is illustrative and should be tested in your own project.

from sybil import Sybil
from sybil.evaluators.python import PythonEvaluator
from sybil.parsers.markdown import (
    ClearNamespaceParser,
    CodeBlockParser,
    PythonCodeBlockParser,
    SkipParser,
)
from sybil.parsers.rest import DocTestParser


class PyconCodeBlockParser(PythonCodeBlockParser):
    """Check pycon fences the same way Sybil checks python fences."""

    def __init__(self) -> None:
        super().__init__()
        self.codeblock_parser = CodeBlockParser("pycon", PythonEvaluator())


markdown_examples = Sybil(
    parsers=[
        PythonCodeBlockParser(),
        PyconCodeBlockParser(),
        SkipParser(),
        ClearNamespaceParser(),
    ],
    patterns=["*.md"],
)
docstring_examples = Sybil(
    parsers=[DocTestParser()],
    patterns=["acme_slug/*.py"],
)

pytest_collect_file = (markdown_examples + docstring_examples).pytest()

This subclass sets codeblock_parser, an attribute Sybil 10.1.0 uses internally rather than a documented option. Pin the Sybil version and rerun the tests after an upgrade. Treat the subclass as project code that needs maintenance, not as a guarantee about future Sybil releases.

The following illustrative change labels sessions pycon and moves setup into the first visible session. It leaves the skip and namespace comments in place so their different interpretation remains visible.

@@ -1,19 +1,15 @@
 # Usage

-<!-- invisible-code-block: python
-from acme_slug import slugify, truncate_slug
-long_title = "Testing documentation examples with Sybil"
--->
+A pycon fence holds a doctest session:

-A python fence can hold a doctest session:
-
-```python
->>> slug = slugify(long_title)
+```pycon
+>>> from acme_slug import slugify, truncate_slug
+>>> slug = slugify("Testing documentation examples with Sybil")
 >>> slug
 'testing-documentation-examples-with-sybil'
 ```

-Or plain code, which shares the page's namespace:
+Plain code in a python fence shares the page's namespace:

 ```python
 short = truncate_slug(slug, 20)
@@ -24,14 +20,14 @@

 Planned for the next release:

-```python
+```pycon
 >>> slugify("Ünïcode", ascii_only=True)
 'unicode'
 ```

 <!-- clear-namespace -->

-```python
+```pycon
 >>> "slug" in globals()
 False
 ```

Run pytest again and plan the scan again. For execution, install the package in the scan environment and use the relevant execution options from the CLI reference.

pytest -v
docsalive scan .

Pytest again produced eleven passes and one skip. In the engine-driver probe, the first session passed and the plain Python block passed. The engine compares printed output only in Python pycon (>>>) sessions, which is why the session label matters.

Two mismatches remained. The engine ignored the skip comment and ran the planned-feature session, producing an api-drift finding counted as a likely docs bug. It also ignored the clear-namespace comment, so the final session produced a warning for differing printed output. Both were false results for this repository’s intended Sybil semantics.

Keep planned features out of scanned current-version pages, or use --include to select pages that are suitable for the scan. A visible setup block helps both the reader and the scanner, but it does not make Sybil’s control comments meaningful to the engine.

Catch a real rename

The following change is broken on purpose. It renames the public function and leaves the documentation unchanged.

-__all__ = ["slugify", "truncate_slug"]
+__all__ = ["slugify", "shorten_slug"]
@@
-def truncate_slug(slug: str, max_len: int) -> str:
+def shorten_slug(slug: str, max_len: int) -> str:

Pytest reported two failures, nine passes and one skip. The first failed import also explains why the later region lacked the function; Sybil continued and reported that later failure too.

FAILED docs/usage.md::line:6,column:1
    ImportError: cannot import name 'truncate_slug' from 'acme_slug'
FAILED docs/usage.md::line:14,column:1 - NameError: name 'truncate_slug' is not defined
2 failed, 9 passed, 1 skipped

In the scan probe, the first session failed as api-drift, while the later Python block was classified as depends-on-context. Fix the public API or update the page according to the intended release, then rerun both checks. The Python documentation testing guide covers broader Python setup and execution choices.

Running both in CI

A workable split, offered as advice rather than a rule, keeps each tool on the job it does well.

  • Run pytest with Sybil on every pull request. It is fast, it runs in the same environment as the unit tests, and it covers docstrings and the control comments the page author chose.
  • Run the scan in CI as well, or on a schedule, so the pages are executed in a clean sandbox where only the documented install steps and the setup you pass with the scan are present. That catches an import that works on a developer machine only because the package is already installed. The GitHub Actions guide shows where such a job fits.
  • Keep one labeling convention for doctest sessions in Markdown, the pycon label with the parser subclass above, so the two tools agree on what a block is.
  • Decide page by page whether invisible setup is acceptable. On pages that are also scanned, prefer a short visible setup block; readers benefit from seeing the import too.
  • Review skipped and not-judged results as part of the release checklist rather than treating a green run as full coverage. The docs testing checklist has a release-time list.

Triage findings

Finding Likely cause What to do
invalid-syntax on a session Prompts are in a python fence that the engine runs as a script Use pycon for shared pages and configure Sybil to evaluate it
Missing name after invisible setup The engine did not read the comment Put reader-relevant setup in a visible first block
Planned API reported as drift The engine did not honor a Sybil skip Keep the planned example out of scanned pages or select another scope
Namespace result differs The engine did not clear state at the comment Interpret the warning in light of Sybil’s separate semantics
A later Sybil region fails after an earlier one Required state was not created because the earlier example failed Fix and rerun from the first failure
Docstring change is absent from the scan Source docstrings are outside the engine’s page selection Keep docstring collection in Sybil
Shell instructions lack Sybil coverage No evaluator was configured for them Add an appropriate check and record its scope

Where DocsAlive fits

Run Sybil in pytest locally and in CI for Python examples, document ordering, docstrings and the configured control comments. Use DocsAlive alongside it for clean-sandbox runs of supported page blocks, other supported block types and categorized findings. A fresh page environment can reveal an undeclared dependency, but setup supplied to the scan should still be compared with the instructions a reader sees.

The engine reads .md, .mdx and .markdown pages. In a plain project with a top-level docs/ directory, its default scope is that directory plus the root README. It does not read source-file docstrings. See framework support and finding categories when deciding what a report establishes.

For projects that publish through Sphinx or pdoc, see the Sphinx guide and pdoc guide. The pre-commit guide covers placing fast checks close to an edit. For lighter Markdown-only runners, see phmdoctest and pytest-markdown-docs.

Sybil documentation test checklist

[ ] Install the project and Sybil's pytest integration in the test environment.
[ ] Disable pytest's own doctest plugin as Sybil recommends.
[ ] Select the right parsers and document patterns.
[ ] Collect Markdown examples and source docstrings deliberately.
[ ] Review the order and namespace dependencies within each document.
[ ] Give unconditional skips a reason and review planned features.
[ ] Label shared doctest sessions pycon and test the compatibility parser.
[ ] Keep reader-relevant setup visible when the page is also scanned.
[ ] Remember that the scan ignores Sybil skip and clear-namespace comments.
[ ] Run pytest and the scan, then review skips and findings in context.

The sources we checked

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

Source What it covers
Sybil documentation The project and supported integrations
Using Sybil Configuring a documentation test run
Sybil Markdown parsers Code blocks, invisible setup, skips and namespace controls
Sybil integrations pytest and unittest integration
Sybil concepts Documents, regions, examples and namespaces
Sybil API Configuration and parser interfaces
Python doctest Interactive examples and expected printed results

FAQ

What does Sybil test?

Sybil parses examples from configured documents and code, then evaluates them as part of a test run. Its behavior depends on the document types, patterns and parsers you configure.

How does DocsAlive handle Sybil-style pages?

Engine 0.6.3 treats a python fence containing prompts as a script, causing an invalid-syntax false positive unless the session is labeled pycon. It does not see invisible blocks, honor skip or clear-namespace comments, or read source docstrings.

Do Sybil examples share state?

Examples in one document run in document order in that document's namespace. Separate documents do not share a namespace. Sybil reports a failure and continues with remaining examples.

Why disable pytest's doctest plugin?

Sybil's pytest documentation recommends disabling it when using Sybil's integration. Configure collection deliberately so the intended tool evaluates each example.

Can both tools check a pycon fence?

Yes, with the illustrated Sybil 10.1.0 subclass and a pycon label. The subclass relies on an internal attribute, so pin Sybil and rerun the tests after upgrades.

Does a Sybil skip also skip a scan?

No. The engine does not honor that comment in 0.6.3. Keep planned examples out of scanned pages or use page selection, and review remaining mismatches.

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