@@ -196,28 +196,43 @@ def calculate_score(
196196
197197The PyRIT docs build uses ** MyST** (Markdown-flavoured), not reStructuredText.
198198Do ** not** use reST cross-reference roles in docstrings or module comments —
199- they render as raw text under MyST and are inconsistent with the rest of the
200- codebase, which uses plain double-backtick code spans for symbol names.
199+ they render as raw text under MyST. A pre-commit hook
200+ (` check_no_rest_roles ` ) blocks new ones from landing.
201+
202+ Use plain double-backticks for symbol references. The API page generator
203+ (` build_scripts/gen_api_md.py ` ) automatically rewrites known PyRIT symbol
204+ names into MyST cross-reference links at build time, so you get clickable
205+ navigation in the rendered docs without any extra markup.
201206
202207``` python
203- # WRONG — reST roles render as literal `:class:\`SeedPrompt\`` under MyST
208+ # WRONG — reST roles render as literal `:class:\`SeedPrompt\`` under MyST,
209+ # and the pre-commit guard will reject them
204210""" Returns a :class:`SeedPrompt` instance."""
205211""" Delegate to :func:`download_files_async` (deprecated alias)."""
206212""" See :meth:`PromptTarget.apply_capabilities` for details."""
207213
208- # CORRECT — plain double-backtick code span (matches existing convention)
214+ # CORRECT — plain double-backticks; gen_api_md.py auto-links these
209215""" Returns a ``SeedPrompt`` instance."""
210216""" Delegate to ``download_files_async`` (deprecated alias)."""
211217""" See ``PromptTarget.apply_capabilities`` for details."""
212218```
213219
214- Roles to avoid include ` :class: ` , ` :func: ` , ` :meth: ` , ` :mod: ` , ` :attr: ` ,
215- ` :data: ` , ` :exc: ` , ` :obj: ` , ` :ref: ` , and any ` :py:*: ` variants
216- (e.g. ` :py:class: ` , ` :py:func: ` ).
220+ The auto-linker resolves:
221+
222+ - bare class/function names (`` `` SeedPrompt`` `` )
223+ - ` Class.method ` references (`` `` PromptTarget.apply_capabilities`` `` )
224+ - fully-qualified paths (`` `` pyrit.models.SeedPrompt`` `` )
225+ - bare method names when the docstring is on the owning class
226+ (`` `` send_prompt_async`` `` inside ` PromptTarget ` )
227+
228+ Ambiguous short names (e.g. two unrelated classes both called ` Scorer ` )
229+ are left as plain code-spans; spell out the FQN when you need a stable
230+ cross-reference. Unknown names also stay as plain code-spans, so
231+ docstrings remain safe to write without consulting the symbol index.
217232
218- If you genuinely need a Sphinx cross-reference (rare in PyRIT — most
219- docstrings just name the symbol in backticks), use the MyST role syntax
220- `` {class}`Name` `` instead. The default, though, is plain double- backticks.
233+ If you need an explicit MyST link in markdown documentation, use the
234+ standard syntax `` [`Name`](#api-pyrit_module-Name) `` — but inside
235+ Python docstrings this should be rare; plain backticks are the default .
221236
222237### Class-Level Constants
223238- Define constants as class attributes, not module-level
0 commit comments