doc8 is an opinionated style checker for reStructuredText (RST) based documentation, including Sphinx-compatible projects. It helps enforce style guidelines for `.rst` and plain text files. The library is currently at version 2.0.0, with a release cadence that addresses Python compatibility, bugfixes, and minor enhancements.
pip install doc8Verified import paths — ran on the pinned version, not inferred.
Run doc8 against a directory containing your reStructuredText documentation to check for style violations.
Upgrade your Python environment to 3.10 or newer. For older Python versions, use doc8 < 2.0.0, e.g., `pip install 'doc8<2.0.0'`.
Ensure your project's Python version meets the minimum requirements for the doc8 version you intend to use.
Migrate your configuration to `pyproject.toml` for future compatibility. Example configuration structures can be found in the official documentation.
Explicitly set the file encoding using the `--file-encoding` option if your documentation files are not UTF-8.
Install `doc8` using pip: `pip install doc8`. If using an IDE like VS Code, ensure the correct Python interpreter (where `doc8` is installed) is selected, or specify the executable path in the IDE's settings.
Either refactor the line to be shorter than the maximum length, or configure `doc8` to allow a longer line length using the `--max-line-length` option (e.g., `doc8 --max-line-length 120`) or by setting `max-line-length` in a configuration file (e.g., `doc8.ini`, `pyproject.toml`).
Configure your text editor or version control system to use LF line endings for reStructuredText files. Alternatively, ignore this specific error using the `--ignore D004` command-line option or by adding `ignore=D004` to your `doc8` configuration file.
Ensure `toml` parsing libraries are available (e.g., `pip install toml`). Double-check the configuration file path and syntax, ensuring the `[tool.doc8]` section is correctly defined. If using an older Python version or encountering persistence issues, consider using an older configuration format like `doc8.ini` or passing arguments directly via the command line.