# Rimfe for Sphinx and reStructuredText docs

Source: https://rimfe.com/docs-frameworks/sphinx
Updated: October 30, 2026

Sphinx projects write docs in reStructuredText, and Rimfe parses it, accepting Sphinx directives and roles. Setup recognises a conf.py beside an index.rst and suggests that folder with the rst extension. Name rst in your own globs, or a default-style md glob will miss every page.

## Where the docs live

`.rst` files beside `conf.py`, usually in `docs/` or `doc/`. Output goes to `_build/`. Many projects mix in Markdown through MyST.

## What Rimfe watches

- Detected by a `conf.py` with an `index.rst` in the same folder.
- Suggested scope: that folder, with `.rst` as the fallback extension when no page is in the tree yet.
- The default scope also covers `.rst`; a custom glob must name every extension you use.

## Sample .rimfe.json

Commit this to your default branch, then set Documentation scope to `.rimfe.json at the PR base` on the repository's Advanced settings tab. Rimfe reads it from each pull request's base commit.

```json
{
  "$schema": "https://rimfe.com/schema/rimfe.json",
  "docsGlobs": [
    "README.rst",
    "docs/**/*.{rst,md}"
  ],
  "docsIgnorePaths": [
    "docs/_build/**",
    "docs/locale/**"
  ],
  "ignorePaths": [
    "tests/**"
  ],
  "codeMappings": [
    {
      "source": "src/acme/client.py",
      "target": "docs/usage.rst"
    }
  ]
}
```

## Worked example: the code change

A pull request changes `src/acme/client.py`. Nothing in the pull request touches the docs.

```diff
- def fetch(url, retries=3):
+ def fetch(url, *, attempts=3):
```

## Worked example: the page it makes wrong

`docs/usage.rst` still states the old behavior. Rimfe quotes both sides as evidence and suggests this patch.

```diff
- .. py:function:: fetch(url, retries=3)
+ .. py:function:: fetch(url, *, attempts=3)
```

## Limits

- `include` directives are never followed, so text pulled in from another file is checked in its own file.
- Pages produced by autodoc come from docstrings at build time; review the docstring, not the generated page.
- Translations in `locale/` are `.po` files and are not reviewed.
- Sphinx-specific roles are accepted, not resolved.

## Related

- [Python: what Rimfe reads](https://rimfe.com/stacks/python)
- [What is API drift](https://rimfe.com/learn/api-drift)
- [Templates](https://rimfe.com/templates)
- [Documentation scope](https://docs.rimfe.com/configuration/docs-scope)
