Guide

Testing TypeDoc documentation examples

TypeDoc renders examples but never compiles or runs them. Extract them from its JSON, type-check them with tsc and scan what can run.

Published
Updated
November 17, 2026
Reading time
14 min
Facts checked against
TypeDoc docs on the example and include tags, external documents, input and validation options, plus Node package self-reference, with every code block run on TypeDoc 0.28.20, TypeScript 6.0.3, Node and Python 3 (November 15, 2026)
Outlined documentation pages with a lime pulse line running out of the stack
On this pageThe short answerWhere TypeDoc examples liveBuild a small referenceCheck an include failureScan the Markdown pagesExtract examples for the compiler and scanTest a renamed exportTriage and coverageThe sources we checkedFAQ

The short answer

Use TypeDoc to build and validate the reference, TypeScript to check extracted examples, and a docs scan to run supported examples and triage failures. TypeDoc renders examples but does not compile or run them. In engine 0.6.3, DocsAlive does not detect TypeDoc as a framework or read source doc comments. For this project it scans docs/ plus the root README, strips simple TypeScript annotations and runs the result with Node; richer syntax is skipped as not judged. A renamed export in a ts fence is reported as not judged, while the same missing export in a js fence is reported as invalid-syntax.

That division matters because a successful reference build proves that TypeDoc could produce the documentation, not that a reader can import the names shown in it. The example workflow below uses TypeDoc’s own JSON to make comment examples available to a compiler and a scan. It also keeps a separate scan of the original project documents.

The package acme-version is illustrative and is not a published package. The files below form a small example project; adapt the paths and exported names to your repository. For the broader JavaScript and TypeScript context, see testing TypeScript documentation examples and testing JavaScript documentation examples.

Where TypeDoc examples live

An example tag marks the text after it as an example. A tag can contain a fenced code block with explanatory text outside the fence. If there is no code block in the tag, TypeDoc treats the whole tag as a code block. That bare form is recognized by VS Code even though it is not valid TSDoc. A checker that searches only Markdown fences in source files can therefore miss both comment examples and bare examples.

An inline includeCode tag inserts an external file inside a code block and uses the file suffix to choose the highlighting language. The include tag instead inserts external Markdown into a comment. Both can select named regions, several comma-separated regions, or line numbers. In TypeScript and JavaScript files, named regions use region and end-region comments. Paths use forward slashes. TypeDoc warns that line-number references are likely to break when a file changes, so a named region is usually a more durable way to identify an excerpt.

An excerpt has a second risk: it may omit the import or setup that makes the complete source file runnable. A region can render exactly the intended two lines and still fail when copied into a fresh environment. Decide whether the published example should include its own setup or whether a test must supply documented context.

TypeDoc can also bring in project documents through a document tag, the projectDocuments option, or children listed in a document’s YAML front matter. Documents can have title, group, category and children front matter. The readme option selects the readme shown on the index page; setting it to none disables it. Entry points and the entry-point strategy determine the API material TypeDoc processes; resolve is the default strategy. When project documents are used, alwaysCreateEntryPointModule defaults to true.

Build a small reference

First install the tools used in this illustrative project. The versions resolved in the verification were TypeDoc 0.28.20 and TypeScript 6.0.3.

npm install --save-dev typedoc typescript

The package manifest exposes the built file. Node supports referencing a package by its own name from within that package when its exports are configured, so the examples can use the same import shape a reader would use.

{
  "name": "acme-version",
  "version": "1.0.0",
  "type": "module",
  "exports": "./dist/index.js",
  "scripts": {
    "build": "tsc",
    "docs": "typedoc"
  },
  "devDependencies": {
    "typedoc": "^0.28.20",
    "typescript": "^6.0.3"
  }
}

This TypeScript configuration emits declarations as well as JavaScript. The explicit rootDir is significant for this verified setup: TypeScript 6.0.3 refused the build without it.

{
  "compilerOptions": {
    "target": "ES2022",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "declaration": true,
    "rootDir": "src",
    "outDir": "dist",
    "strict": true
  },
  "include": ["src"]
}

The illustrative TypeDoc configuration adds Markdown files in docs/ as project documents and makes warnings fatal. That setting is valuable for unresolved links and other warnings, but it does not turn examples into executable tests.

{
  "entryPoints": ["src/index.ts"],
  "projectDocuments": ["docs/*.md"],
  "out": "site",
  "treatWarningsAsErrors": true
}

The source file demonstrates three different example locations: a fenced example, a bare example, and an included region. The code and package name are illustrative.

/**
 * Parse a version string such as "2.4.1" into its three numbers.
 *
 * @example
 * ```ts
 * import { parseVersion } from "acme-version";
 * console.log(parseVersion("2.4.1"));
 * ```
 */
export function parseVersion(text: string): [number, number, number] {
  const parts = text.trim().split(".").map(Number);
  if (parts.length !== 3 || parts.some((n) => !Number.isInteger(n) || n < 0)) {
    throw new Error(`not a version: ${text}`);
  }
  return [parts[0], parts[1], parts[2]];
}

/**
 * Compare two version strings. Returns -1, 0 or 1.
 *
 * @example
 * import { compareVersions } from "acme-version";
 * compareVersions("2.4.1", "2.10.0"); // -1
 */
export function compareVersions(a: string, b: string): number {
  const x = parseVersion(a);
  const y = parseVersion(b);
  for (let i = 0; i < 3; i++) {
    if (x[i] !== y[i]) return x[i] < y[i] ? -1 : 1;
  }
  return 0;
}

/**
 * Build the URL of a host. See {@link parseVersion} for version strings.
 *
 * {@includeCode ../examples/connect.ts#connect}
 */
export function connect(host: string, port = 443): string {
  return `https://${host}:${port}`;
}

The included file is runnable as a whole, but the selected region starts after the import. The rendered excerpt therefore needs context if it is copied into a standalone test.

import { connect } from "acme-version";

//#region connect
const url = connect("localhost", 8443);
console.log(url);
//#endregion connect

The project document below contains both TypeScript and JavaScript. Its tuple annotation is deliberately useful for demonstrating the engine’s TypeScript limit: the compiler can understand it, while the engine’s simple annotation stripping cannot.

---
title: Getting started
---

# Getting started

Parse a version and keep the result typed:

```ts
import { parseVersion } from "acme-version";

const v: [number, number, number] = parseVersion("2.4.1");
console.log(v[1]);
```

Sort a list of versions:

```js
import { compareVersions } from "acme-version";

const sorted = ["2.10.0", "2.4.1", "1.0.0"].sort(compareVersions);
console.log(sorted.join(" "));
```

The root README is another reader-facing page and is included on the index in this setup.

# acme-version

Parse and compare version strings.

```ts
import { compareVersions } from "acme-version";

console.log(compareVersions("1.0.0", "1.0.0"));
```

Build the package before building the reference. In the verification, both commands succeeded. The reference showed the two comment examples and the two selected region lines; the import above the region was absent.

npx tsc
npx typedoc

A successful build does not mean every example has been type-checked. TypeDoc’s validation has a different job. Its defaults enable checks including unresolved link tags and invalid paths; notDocumented is off by default. treatWarningsAsErrors makes warnings fatal, while treatValidationWarningsAsErrors applies to validation warnings specifically. Keep those checks enabled as appropriate, but add example checks independently.

Check an include failure

This change is broken on purpose: it asks for a region that is not present.

- * {@includeCode ../examples/connect.ts#connect}
+ * {@includeCode ../examples/connect.ts#connect-url}

TypeDoc reported the missing region as an error and exited with status 4. It did so with treatWarningsAsErrors both enabled and disabled. This is a useful build guard, but it verifies that the region exists, not that its contents run.

[error] @includeCode tag in index.connect specified "../examples/connect.ts#connect-url" to include from file "examples/connect.ts" the region labeled "connect-url", but the region was not found in the file.
[error] Found 1 errors and 0 warnings

Restore the correct region before continuing. When an include builds successfully, inspect what readers actually receive: a valid region can still omit imports or reference a name that has changed.

Scan the Markdown pages

The following command plans a scan; execution requires the CLI’s execution option. In the verified run after the package build, the default plain-project scope covered two pages and three blocks: the README TypeScript block and the getting-started JavaScript block passed, while the tuple-typed block was skipped as unsupported syntax. None of the three source-comment examples was read.

docsalive scan .

The distinction between planning and execution is important when interpreting a report. A planned block has been found and classified for a possible check; it has not necessarily run. The CLI reference describes execution, setup and report options at /docs/cli/.

TypeDoc item What TypeDoc does What the engine does in 0.6.3
Fenced example in a source comment Renders the example Does not read the comment
Bare example in a source comment Treats the whole tag as a code block Does not read the comment
Included code region Expands and renders the selected region; fails if the region is missing Does not read the source comment or resolve the include
Project document in docs/ Adds it to the reference when configured Scans its Markdown under the default scope
Root README Can show it on the index Scans it alongside docs/
TypeScript fence Renders it Strips simple annotations and runs with Node; unsupported syntax is not judged
JavaScript fence Renders it Runs it with Node
Link validation Warns for unresolved link tags; warnings can be fatal Does not replace TypeDoc’s validation

Extract examples for the compiler and scan

The following illustrative script reads TypeDoc’s JSON output. In the verified output, the bare example had already become a TypeScript fence, and the included region had already been expanded into one. The script writes comment examples to a Markdown page and writes TypeScript examples from comments, project documents and the readme to separate files for the compiler.

It adds an import listing exported names when an example has no import from the package. That makes the selected region testable in this particular project, but it is an assumption to review: a generated import can supply context missing from the published excerpt.

"""Copy the code examples TypeDoc documents into files that can be scanned and type-checked.

Run `npx typedoc --json api.json` first. TypeDoc's JSON holds each @example
as a fenced code part (bare @example text is already wrapped as ts) and each
includeCode region already expanded.

Writes scan-docs/api/examples.md (examples from doc comments, for a docs scan)
and scan-docs/typecheck/*.ts (every ts example: comments, project documents
and the readme, for tsc --noEmit).
"""
import json
import re
import shutil
import sys
from pathlib import Path

api = json.loads(Path(sys.argv[1]).read_text())
out = Path(sys.argv[2])
package = json.loads(Path("package.json").read_text())["name"]
FENCE = re.compile(r"^```(\w*)\n(.*?)\n```$", re.S)


def walk(refl):
    for child in refl.get("children", []):
        yield child
        yield from walk(child)


# Names a reader can import (kind 2 is a module and 4 a namespace).
exported = [r["name"] for r in walk(api) if r["kind"] not in (2, 4)]
prelude = "import { " + ", ".join(exported) + ' } from "' + package + '";\n'


def fences(parts):
    for part in parts:
        if part["kind"] == "code":
            m = FENCE.match(part["text"].strip())
            if m:
                yield (m.group(1) or "ts"), m.group(2)


def comment_parts(refl):
    parts = []
    for c in [refl.get("comment")] + [s.get("comment") for s in refl.get("signatures", [])]:
        if c:
            parts += c.get("summary", [])
            for tag in c.get("blockTags", []):
                if tag["tag"] == "@example":
                    parts += tag["content"]
    return parts


def with_import(code):
    # An includeCode region often leaves out the import line.
    return code if f'from "{package}"' in code else prelude + code


page = ["# API examples", ""]
typecheck = []
for refl in walk(api):
    for lang, code in fences(comment_parts(refl)):
        if lang in ("ts", "js"):
            code = with_import(code)
        page += [f"## {refl['name']}", "", f"```{lang}", code, "```", ""]
        if lang == "ts":
            typecheck.append((refl["name"], code))
for doc in api.get("documents", []):
    typecheck += [(doc["name"], c) for lang, c in fences(doc["content"]) if lang == "ts"]
typecheck += [("readme", c) for lang, c in fences(api.get("readme", [])) if lang == "ts"]

shutil.rmtree(out, ignore_errors=True)
(out / "api").mkdir(parents=True)
(out / "api" / "examples.md").write_text("\n".join(page))
(out / "typecheck").mkdir()
for n, (name, code) in enumerate(typecheck, 1):
    slug = re.sub(r"\W+", "-", name).strip("-").lower()
    # export {} makes each file a module, so names do not clash between files.
    (out / "typecheck" / f"{n:02d}-{slug}.ts").write_text(code + "\nexport {};\n")
print(f"wrote {out / 'api' / 'examples.md'} and {len(typecheck)} files in {out / 'typecheck'}")

Use a separate compiler configuration for the generated examples. In this verification, TypeScript 6.0.3 refused a command that supplied file names while a project configuration existed, so the separate project file also makes the intended input explicit.

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "noEmit": true,
    "rootDir": "."
  },
  "include": ["scan-docs/typecheck"]
}

Build the package first so its declaration files exist, then generate TypeDoc JSON, regenerate the copy and type-check it. The scan command shown here plans the generated page; use execution when you want the examples run. In the verified execution, the generated scope contained the README and generated API page: four blocks were run and all four passed.

npx typedoc --json api.json
python3 tools/typedoc_scan_copy.py api.json scan-docs
npx tsc -p tsconfig.examples.json
docsalive scan . --docs-dir scan-docs

The script reported the generated page and five TypeScript files:

wrote scan-docs/api/examples.md and 5 files in scan-docs/typecheck

There are several boundaries to preserve in CI. The script needs a successful TypeDoc JSON run first. It understands ts and js fences for its import handling; other languages are copied to the page but are not type-checked. The added import lists every exported name and assumes the package can import itself by name. It cannot find examples TypeDoc did not document, including private or excluded items.

The generated Markdown page contains comment examples only. With --docs-dir scan-docs, the ordinary docs/ folder is not read, so retain the default scan for project documents. The compiler check does not execute the generated files. The scan executes TypeScript only after simple annotation stripping, so richer syntax can be skipped as not judged. Regenerate scan-docs in CI rather than editing it by hand.

Test a renamed export

This change is broken on purpose: it renames an export while leaving its examples and the README unchanged.

-export function compareVersions(a: string, b: string): number {
+export function compare(a: string, b: string): number {

The package build and TypeDoc build still succeeded. The getting-started JavaScript fence failed as invalid-syntax because Node reported the missing named export as a syntax error. The stale TypeScript examples in the README and generated page were skipped as unsupported syntax, not judged as documentation bugs. The compiler supplied the missing signal and exited with status 2:

scan-docs/typecheck/01-compare.ts(1,10): error TS2724: '"acme-version"' has no exported member named 'compareVersions'. Did you mean 'parseVersion'?
scan-docs/typecheck/05-readme.ts(1,10): error TS2724: '"acme-version"' has no exported member named 'compareVersions'. Did you mean 'parseVersion'?

This is why the recommended layers are complementary: TypeDoc validates the reference and its links; the compiler checks extracted TypeScript against declarations; the scan runs supported Markdown examples and helps triage what happened. A passing layer should not be interpreted as coverage from the other two.

Triage and coverage

Finding Likely cause What to do
TypeDoc reports a missing region The region name or path changed Restore the intended region or update the include, then inspect the rendered excerpt
Link warning becomes fatal A link target cannot be resolved or another warning was emitted Correct the target or investigate the warning before relaxing validation
Compiler reports a missing export An example still imports an old API name Compare the example with the intended public API and update it or restore compatibility
TypeScript block is not judged Syntax could not be stripped, or Node reported a syntax error including a missing named export Run the compiler check and inspect the original example
JavaScript block reports invalid-syntax after a rename Node reported a missing named export as a syntax error Check the import against the built package
Generated region fails for an undefined name The region omitted context Make the reader-facing excerpt self-contained or document and test its prerequisite

Read every skip with its reason, not just the totals. A block skipped as unsupported syntax was not judged at all, so it is a coverage gap, not a pass. In this project the compiler check narrows that gap: a block the scan cannot strip is still type-checked in full by the compiler, although the compiler does not run it. Bash install lines in a README are a separate case: they need the network, and when a scan runs with the network off they are skipped rather than run. Keep a short note in the pull request when a skip is expected, so a reviewer can tell a known gap from a new one.

Use this checklist in a review or CI task:

[ ] Build the package and its declarations.
[ ] Build TypeDoc with the desired validation warnings made fatal.
[ ] Check that included regions contain the context readers need.
[ ] Generate TypeDoc JSON and regenerate scan-docs.
[ ] Type-check the extracted TypeScript examples.
[ ] Run the default docs and README scan.
[ ] Run the generated comment-example scan.
[ ] Review skipped and unsupported blocks as coverage gaps.
[ ] Check changed exports against examples before release.

DocsAlive fits the execution and triage layer. It can run supported blocks in page order and report findings with their context, but it does not inspect TypeDoc comments directly or replace a full TypeScript compiler. See findings, API reference testing, and pre-commit docs testing for adjacent checks.

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
TypeDoc example tag Fenced and bare example text
TypeDoc include tags External content, regions and line references
TypeDoc external documents Project documents and front matter
TypeDoc input options Entry points, project documents and readme
TypeDoc validation options Validation and fatal warnings
Node packages Package exports and self-reference

FAQ

Does TypeDoc run its examples?

No. It renders examples and validates aspects of the reference, but it does not compile or execute example code. Add a compiler check and an execution layer for that evidence.

What does DocsAlive read in this TypeDoc project?

In engine 0.6.3 it does not detect TypeDoc or read doc comments. With a top-level docs folder it scans that folder plus the root README. It strips simple TypeScript annotations before running with Node; unsupported syntax is skipped as not judged.

Will a renamed export be caught in a TypeScript fence?

The verified missing export surfaced as a Node syntax error and was skipped as unsupported syntax, not judged. The same missing export in a JavaScript fence was reported as invalid-syntax. Type-check extracted TypeScript examples with the compiler.

Why did an included region fail as a standalone example?

The selected lines may omit an import or other setup outside the region. Review the rendered excerpt and either include the necessary context or document the prerequisite. A generated test import can hide that reader-facing gap.

Does a successful TypeDoc build verify included code?

TypeDoc fails when a named includeCode region is missing, but an existing region can still contain stale or nonworking code. A successful build does not compile or run its contents.

Should the generated scan page be edited by hand?

No. Regenerate it from the current TypeDoc JSON in CI. Keep the ordinary scan too, because the generated scope does not include the original docs folder.

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