Skip to main content

docs-output-filter

Filter documentation build output to show only what matters: warnings and errors.

Works with MkDocs and Sphinx (including sphinx-autobuild, Jupyter Book, myst-nb). Includes an MCP server for AI code assistant integration (Claude Code, etc.).

Before & After

❌ Raw build output (43 lines) ✅ Filtered output (15 lines)
INFO    -  Building documentation...
INFO    -  Cleaning site directory
INFO    -  Log level set to INFO
INFO    -  Building documentation to directory: /project/site
INFO    -  MERMAID2  - Initialization arguments: {}
INFO    -  Generating index pages...
INFO    -  Reading page 'index.md'
INFO    -  Reading page 'guide/getting-started.md'
INFO    -  Reading page 'guide/configuration.md'
INFO    -  Reading page 'api/reference.md'
INFO    -  Copying static files from theme: material
INFO    -  Copying 'assets/stylesheets/extra.css'
INFO    -  Copying 'assets/javascripts/extra.js'
[git-revision-date-localized-plugin] has no git logs
INFO    -  Executing code blocks with markdown_exec...
WARNING -  markdown_exec: Execution of python
code block exited with errors

Code block is:

  import numpy as np
  data = np.random.rand(10, 10)
  raise ValueError("INTENTIONAL TEST ERROR")

Output is:

  Traceback (most recent call last):
    File "<code block: session test; n1>", line 3
      raise ValueError("INTENTIONAL TEST ERROR")
  ValueError: INTENTIONAL TEST ERROR

WARNING -  [git-revision] Unable to read git logs
INFO    -  Rendering 'index.md'
INFO    -  Rendering 'guide/getting-started.md'
INFO    -  Rendering 'guide/configuration.md'
INFO    -  Rendering 'api/reference.md'
INFO    -  Building search index...
INFO    -  Writing 'sitemap.xml'
INFO    -  Writing 'search/search_index.json'
INFO    -  Documentation built in 12.34 seconds
⚠ WARNING [markdown_exec] ValueError: INTENTIONAL TEST ERROR
   📍 session 'test' → line 3

╭──────────────── Code Block ─────────────────╮
│  1 import numpy as np                       │
│  2 data = np.random.rand(10, 10)            │
│  3 raise ValueError("INTENTIONAL TEST E...")│
╰─────────────────────────────────────────────╯
╭─────────── Error Output ────────────╮
│ ValueError: INTENTIONAL TEST ERROR  │
╰───────── use -v for full traceback ─╯

⚠ WARNING [git-revision] Unable to read git logs

Summary: 2 warning(s)

🌐 Server: http://127.0.0.1:8000/
📁 Output: /project/site
Built in 12.34s

Installation

# Run directly (no install needed)
uvx docs-output-filter -- mkdocs build

# Or install permanently
uv tool install docs-output-filter

# Or with pip
pip install docs-output-filter

Usage

# Wrapper mode (recommended) — just prefix your build command
docs-output-filter -- mkdocs build
docs-output-filter -- mkdocs serve --livereload
docs-output-filter -- sphinx-autobuild docs _build/html

# Pipe mode — traditional Unix pipe
mkdocs build 2>&1 | docs-output-filter
sphinx-build docs _build 2>&1 | docs-output-filter

# Process a remote build log (e.g., ReadTheDocs)
docs-output-filter --url https://app.readthedocs.org/projects/myproject/builds/12345/

Tip: Wrapper mode (--) is the easiest way to use docs-output-filter. It runs the command for you, automatically captures both stdout and stderr, and fixes buffering issues with sphinx-autobuild. No 2>&1 needed.

Note: If using pipe mode, 2>&1 is important — Sphinx writes warnings to stderr. Without it, warnings bypass the filter.

Note: Use --livereload with mkdocs serve due to a Click 8.3.x bug.

Features

Feature Description
Multi-tool support MkDocs and Sphinx with auto-detection
Filtered output Shows WARNING and ERROR messages, hides routine INFO
Code blocks Syntax-highlighted code for markdown_exec and myst-nb errors
Location info File, line number, session name, warning codes
Streaming mode Real-time output for mkdocs serve / sphinx-autobuild with rebuild detection
Interactive mode Toggle between raw/filtered with keyboard (-i)
Remote logs Fetch and parse build logs from ReadTheDocs and other CI
MCP server API for AI code assistants like Claude Code

Options

Flag Description
-- COMMAND Run command as subprocess (recommended, no 2>&1 needed)
-v, --verbose Show full tracebacks and code blocks
-e, --errors-only Hide warnings, show only errors
--no-color Disable colored output
--raw Pass through unfiltered build output
-i, --interactive Toggle raw/filtered with keyboard
--url URL Fetch and process a remote build log
--tool mkdocs|sphinx|auto Force build tool detection (default: auto)
--share-state Write state for MCP server integration

MCP Server (for AI Assistants)

Enable AI code assistants to access build issues:

# Terminal 1: Run build tool with state sharing
docs-output-filter --share-state -- mkdocs serve --livereload

# Terminal 2: Add MCP server to Claude Code (if installed)
claude mcp add --scope user --transport stdio docs-output-filter -- docs-output-filter --mcp --watch
# Or with uvx (no install needed)
claude mcp add --scope user --transport stdio docs-output-filter -- uvx docs-output-filter --mcp --watch

Documentation

Full documentation: https://ianhuntisaak.com/docs-output-filter/

Development

git clone https://github.com/ianhi/docs-output-filter
cd docs-output-filter
uv sync
uv run pre-commit install
uv run pytest

License

MIT

Metadata

Release files for docs-output-filter 0.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for docs-output-filter 0.3.4
File Size Uploaded
docs_output_filter-0.3.4.tar.gz 35.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for docs-output-filter 0.3.4
File Interpreter ABI Platform
docs_output_filter-0.3.4-py3-none-any.whl Python 3 none any Details

Total release size: 78.6 kB

Release files / docs_output_filter-0.3.4.tar.gz

Download URL docs_output_filter-0.3.4.tar.gz
Size 35.0 kB
Tags Source
SHA-256 checksum
How to use checksums
ae1a4eae1f3c4225fec39f63be2737804246f2f9390bdfaf84bc4a11c8cd113e
BLAKE2b-256 checksum
How to use checksums
ac21c8e14179f66bff592b5241fa42583982ef5ae13d653852ce1c6b6a2ad6da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 5, 2026.

Transparency log

Release files / docs_output_filter-0.3.4-py3-none-any.whl

Download URL docs_output_filter-0.3.4-py3-none-any.whl
Size 43.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
271d80b782f97980003e1042a8ccda7027aa94857fd4fb7d68f237cf13bffaa4
BLAKE2b-256 checksum
How to use checksums
05ba6090ddc954a093729c2233d4e100012e390a100e93a957e0abf1c8fbb8d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.4 This release

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page