Skip to content

Commit 4e7440e

Browse files
vnaren23claude
andauthored
chore: guard against Sphinx/RST markup returning to docstrings (#1913)
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 467f609 commit 4e7440e

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

‎.pre-commit-config.yaml‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,20 @@ repos:
55
- id: ruff
66
args: [ --fix ]
77
- id: ruff-format
8+
9+
# The docs site renders docstrings through mkdocstrings with the Google
10+
# parser, which treats them as Markdown, so Sphinx/RST markup leaks through
11+
# verbatim onto the published API pages. Scoped to src/ because test
12+
# docstrings are never rendered.
13+
- repo: local
14+
hooks:
15+
- id: no-rst-roles
16+
name: No Sphinx/RST roles or directives in docstrings (docs render as Markdown)
17+
language: pygrep
18+
entry: ':(class|meth|func|mod|attr|data|exc|obj|ref):`|^\s*\.\. [a-z-]+::'
19+
files: ^packages/[^/]+/src/.*\.py$
20+
- id: no-rst-literal-blocks
21+
name: No RST literal-block markers in docstrings (use a fenced code block)
22+
language: pygrep
23+
entry: '::$'
24+
files: ^packages/[^/]+/src/.*\.py$

0 commit comments

Comments
 (0)