Skip to content

[docs] Document the :ref: label requirement and default_role in the style guide - #65869

Merged
dstrodtman merged 1 commit into
masterfrom
doc-1541-ref-anchor-mechanics
Sep 2, 2026
Merged

dstrodtman merged 1 commit into
masterfrom
doc-1541-ref-anchor-mechanics

Conversation

@dstrodtman

Copy link
Copy Markdown
Contributor

Summary

Documents two facts about Ray's Sphinx configuration in the documentation style guide. Neither was written down anywhere contributors or agents would find them, and both were rediscovered from conf.py during recent Ray Data style passes (#65374, #65525).

  • Ray doesn't enable autosectionlabel, so a heading's text isn't a {ref} target on its own and every linked section needs an explicit label. Added to the cross-references section, which already showed the (my-label)= pattern but never said why it's required.
  • Ray sets default_role = "code", so a bare single-backtick in reStructuredText renders as inline code, not italics or a broken role. Added as a note in the bold-and-italics section. This one nearly produced ~50 false "single backticks are a rendering bug" findings in a prior review pass.

Why this isn't a duplicate

Searched open PRs with gh pr list --search for writing-style, autosectionlabel, default_role, and anchor. No open PR documents these.

Test plan

Prose-only change under doc/. A change to only .md files under doc/ runs no library test steps; the Read the Docs render gate validates the build. Both claims were verified directly against doc/source/conf.py (autosectionlabel absent from extensions; default_role = "code").

AI assistance

Drafted with AI assistance (Claude Code). Facts verified against doc/source/conf.py. The submitter reviews every changed line before requesting review.

…tyle guide

Two facts about Ray's Sphinx config weren't written down where
contributors or agents would find them:

- autosectionlabel isn't enabled, so a heading's text isn't a {ref}
  target on its own; every linked section needs an explicit label.
- default_role is code, so a bare single-backtick in reStructuredText
  renders as inline code, not italics or a broken role.

Both were rediscovered from conf.py during recent Ray Data style passes.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman
dstrodtman requested review from a team as code owners September 2, 2026 16:28

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Ray writing style guide documentation. It adds a note clarifying how to italicize terms in reStructuredText and MyST Markdown using asterisks, explaining that single backticks render as inline code. Additionally, it explains that the Sphinx autosectionlabel extension is not enabled, meaning explicit labels are required for linking to sections to ensure stability when headings are reworded. There are no review comments to address.

@dstrodtman dstrodtman added the go add ONLY when ready to merge, run all tests label Sep 2, 2026
## The section to link
```

Ray docs don't enable Sphinx's `autosectionlabel` extension, so a heading's text isn't a `{ref}` target on its own. Every section you link to needs an explicit label. The tradeoff favors stability: rewording a heading can't break an existing `{ref}`, because the label is a separate line that the edit leaves untouched.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Ray docs don't enable Sphinx's `autosectionlabel` extension, so a heading's text isn't a `{ref}` target on its own. Every section you link to needs an explicit label. The tradeoff favors stability: rewording a heading can't break an existing `{ref}`, because the label is a separate line that the edit leaves untouched.
Ray docs don't enable Sphinx's `autosectionlabel` extension, so a heading's text isn't a `{ref}` target on its own. Every section you link to needs an explicit label. The tradeoff favors stability: rewording a heading can't break an existing `{ref}`, because the label is a separate line that the edit leaves untouched.

Is 'Ray docs' a plural thing or singular (i.e., Ray doc set) in this case? IOW, is don't better than doesn't?

@dstrodtman
dstrodtman merged commit 2c7d7a4 into master Sep 2, 2026
6 checks passed
@dstrodtman
dstrodtman deleted the doc-1541-ref-anchor-mechanics branch September 2, 2026 17:58
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…tyle guide (ray-project#65869)

## Summary

Documents two facts about Ray's Sphinx configuration in the
documentation style guide. Neither was written down anywhere
contributors or agents would find them, and both were rediscovered from
`conf.py` during recent Ray Data style passes (ray-project#65374, ray-project#65525).

- Ray doesn't enable `autosectionlabel`, so a heading's text isn't a
`{ref}` target on its own and every linked section needs an explicit
label. Added to the cross-references section, which already showed the
`(my-label)=` pattern but never said why it's required.
- Ray sets `default_role = "code"`, so a bare single-backtick in
reStructuredText renders as inline code, not italics or a broken role.
Added as a note in the bold-and-italics section. This one nearly
produced ~50 false "single backticks are a rendering bug" findings in a
prior review pass.

## Why this isn't a duplicate

Searched open PRs with `gh pr list --search` for `writing-style`,
`autosectionlabel`, `default_role`, and `anchor`. No open PR documents
these.

## Test plan

Prose-only change under `doc/`. A change to only `.md` files under
`doc/` runs no library test steps; the Read the Docs render gate
validates the build. Both claims were verified directly against
`doc/source/conf.py` (`autosectionlabel` absent from `extensions`;
`default_role = "code"`).

## AI assistance

Drafted with AI assistance (Claude Code). Facts verified against
`doc/source/conf.py`. The submitter reviews every changed line before
requesting review.

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants