diff --git a/.readthedocs.yaml b/.readthedocs.yaml index d70923f86..31cb64970 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -26,4 +26,23 @@ build: - uv venv "${READTHEDOCS_VIRTUALENV_PATH}" install: - UV_PROJECT_ENVIRONMENT="${READTHEDOCS_VIRTUALENV_PATH}" uv sync --frozen --group docs + post_build: + - | + python - <<'PY' + from pathlib import Path + import os + output = Path(os.environ["READTHEDOCS_OUTPUT"]) / "html" / "api" + candidates = [output / "v3_0.html", output / "v3_0" / "index.html"] + targets = [path for path in candidates if path.exists()] + if not targets: + raise RuntimeError( + f"RTD build failed: No Sphinx API documentation found. Expected one of: {candidates}" + ) + + for path in targets: + path.write_text( + path.read_text(encoding="utf-8").replace("(id)", "id"), + encoding="utf-8", + ) + PY