doccmd

2026.3.26.2 · active · verified Thu Apr 16

doccmd is a command-line tool (CLI) designed to run external commands, such as linters and formatters, against code blocks embedded within reStructuredText and Markdown documentation files. It helps ensure the code examples in documentation remain correct and up-to-date. The library follows a rapid release cadence, with frequent updates, often on a daily basis.

Common errors

Warnings

Install

Quickstart

This quickstart demonstrates how to use `doccmd` from the command line to execute code blocks in a Markdown file. `doccmd` will find the code blocks, create temporary files, run them, and report any errors. By default, it runs all supported languages. You can specify a language with `--language`.

# Create a sample markdown file
cat << EOF > example.md
# My Project

This is an example document.

```python
import os
print("Hello from Python!")
```

```shell
echo "Hello from Shell!"
```
EOF

# Run doccmd to execute Python and shell code blocks
doccmd example.md

view raw JSON →