Skip to content

[docs] Convert the nine highest-traffic landing pages from RST to MyST - #65467

Merged
dstrodtman merged 7 commits into
masterfrom
doc-1520-rst-myst-landing-stubs
Aug 14, 2026
Merged

dstrodtman merged 7 commits into
masterfrom
doc-1520-rst-myst-landing-stubs

Conversation

@dstrodtman

@dstrodtman dstrodtman commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Why are these changes needed?

MyST Markdown is the standard for Ray doc pages, and a lint check already rejects newly-added .rst. This is the first batch of the conversion of the existing hand-written prose under doc/source/.

The batch is the nine highest-traffic, lowest-risk pages in the tree: short prose intros plus a toctree, no tabs, no doctests, no includes. 679 lines total, and 23% of all .rst page views over the last 90 days. Starting here validates the conversion end to end on the pages where any regression is immediately obvious, at close to zero conversion risk.

File Lines
index.rst 27
ray-overview/examples.rst 10
ray-overview/use-cases.rst 187
data/api/api.rst 22
train/api/api.rst 256
ray-core/key-concepts.rst 50
cluster/key-concepts.rst 90
ray-core/api/index.rst 15
ray-overview/examples/index.rst 22

The conversion is format-only. Every label name, toctree entry, directive, and prose line is preserved, so the rendered HTML should be unchanged and the preview-versus-/en/master diff should be empty. No URLs change: Sphinx maps foo.rst and foo.md to the same foo.html.

Conversions worth a second look

  • index.rst has no heading, so its browser title comes entirely from .. title:: Welcome to Ray!. There's no MyST frontmatter equivalent, so it stays as RST in an {eval-rst} block. The file-level :html_theme.sidebar_secondary.remove: field becomes frontmatter, matching 404.md.
  • train/api/api.rst keeps its 19 autosummary directives and its .. currentmodule:: as column-0 RST inside {eval-rst} blocks — the pattern serve/api/index.md already uses. The two labels that sit directly above an autosummary stay inside the block so their targets still register.
  • ray-core/key-concepts.rst has a two-item list that docutils folds into the preceding paragraph, because no blank line separates them. The rendered page shows it as one <p>. The conversion first escaped the leading 1. and 2. to preserve that, but soft-wrapping the paragraph put the whole thing on one line and made the problem plain, so the last commit restores the intent: a real two-item <ol> with a complete lead-in sentence. This is the one deliberate rendering change in the PR.
  • use-cases.rst keeps the .. raw:: html body of its two query-param-ref blocks as RST. That directive parses its own content with a docutils parser at doctree-resolved time, independent of the host file's format, so the content has to stay RST either way.

The CI change in the second commit

Converting data/api/api.rst and ray-core/api/index.rst surfaced a real gap in ci/ray_ci/doc/autodoc.py, which is why this PR isn't docs-only.

The API-discrepancy check builds each team's documented-API set by walking its landing page's toctree. The walker only recognized the RST directive form (.. toctree:: followed by indented entries). A MyST toctree is a directive fence with entries at column 0, so the walker's "first unindented line ends the block" heuristic stops on the very first entry. The data and core teams would have walked no children at all, collapsing their documented set to the landing page itself and flagging every child page's autosummary entries as undocumented public APIs.

serve/api/index.md was already Markdown, but it declares its whole surface inline with no page-level toctree, so this path had never been exercised.

The second commit teaches the walker the fence form alongside the RST form, points the data, core, and train head_doc_file entries at the converted pages, and adds a regression test. The toctree entries themselves are unchanged, so the walk reaches exactly the same set of child files as before.

The .buildkite rules fixtures and the two notebook links that named a converted file by path are refreshed in the same commit. The rules themselves match on directory prefix and on both extensions, so what each path emits is unchanged.

The soft-wrap pass in the third commit

The converted pages inherit the hard-wrapped line breaks of their RST sources. Four of them still carried wrapped prose, so a commit here runs the ray-soft-wrap pass from #65469 over them, joining each paragraph and list item onto one source line: cluster/key-concepts.md (7 joins), ray-overview/use-cases.md (6), ray-core/key-concepts.md (1), and train/api/api.md (1). Whitespace-only, and verify.py confirms it on all four.

Two notes for anyone re-running that gate:

  • verify.py --ref <base> reports content=FAIL render=FAIL on ray-core/key-concepts.md. That's the ordered-list fix in the following commit, not the soft-wrap. verify.py is a whitespace-only gate, and that commit changes words and rendering on purpose, so it's outside what the gate can attest. idempotent=ok on the same file confirms the soft-wrap layer underneath is stable. Every other file reports content=ok render=ok idempotent=ok.
  • The two raw-HTML SVG icons in use-cases.md keep their wrapped form. They sit indented inside a query-param-ref body, outside CommonMark's 3-space window for opening an HTML block, so the engine read them as prose and collapsed each onto one 3,000-character line while all three checks still reported ok. [doc] Conversion tooling: render diff, card-grid mapping, and a soft-wrap skill #65469 teaches the engine that boundary. Across all 232 Markdown files on master at 8788cfb87d, that engine change is a no-op on every axis, so it's safe to land in either order.

Not a duplicate

gh pr list --repo ray-project/ray --state open --search "MyST" and a search for the converted paths return no other open PR touching these files or this conversion. #65469 is the companion skill change and is deliberately separate, so a rule change isn't buried in a content PR.

AI assistance was used to prepare this change.

Related issue number

Part of the ongoing RST-to-MyST conversion of doc/source/. Subsequent batches follow the same traffic-weighted ordering.

Checks

  • I've signed off every commit (git commit -s).
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for the change.
  • Testing strategy
    • Unit tests: ci/ray_ci/doc/test_autodoc.py gains coverage for the MyST fence form; the walk over the three converted API landing pages was verified to reach the same child set as before.
    • Release tests: not applicable.
    • This PR is not tested (please justify below): the decisive check for the conversion itself is the Read the Docs preview build under fail_on_warning: true, plus a rendered diff against /en/master. Please hold the merge until both are confirmed clean.

Convert the nine highest-traffic landing pages under doc/source/ from RST to MyST
Markdown. Format-only: every label name, toctree entry, directive, and prose line
is preserved, so the rendered HTML is unchanged.

The pages are short prose intros plus a toctree, the lowest-risk shape in the
tree, and together they carry 23% of all .rst page views over the last 90 days.

Notable conversions:

- index.rst has no heading, so its browser title comes from the .. title::
  directive. That has no MyST frontmatter equivalent, so it stays as RST in an
  {eval-rst} block. The file-level :html_theme.sidebar_secondary.remove: field
  becomes frontmatter, matching 404.md.
- train/api/api.rst keeps its 19 autosummary directives and its .. currentmodule::
  as column-0 RST inside {eval-rst} blocks, the pattern serve/api/index.md
  already uses. The two labels that sit directly above an autosummary stay inside
  the block so their targets still register.
- ray-core/key-concepts.rst has a two-item list that docutils folds into the
  preceding paragraph because no blank line separates them. CommonMark would
  turn it into a real <ol>, so the leading 1. and 2. are escaped to keep the
  current single-paragraph rendering.
- use-cases.rst keeps the .. raw:: html body of its two query-param-ref blocks
  as RST. That directive parses its own content with a docutils parser at
  doctree-resolved time, independent of the host file's format.

Signed-off-by: Douglas Strodtman <[email protected]>
The API-discrepancy check builds each team's documented-API set by walking its
landing page's toctree. The walker only recognized the RST directive form, so
converting an API landing page to Markdown would leave it walking no children at
all: the team's documented set would collapse to whatever the landing page
itself declares, and every child page's autosummary entries would read as
undocumented public APIs.

Recognize the fence form (```{toctree} or :::{toctree}, entries at the fence's
own indentation, closed by a line of the same fence character) alongside the RST
form, and point the data, core, and train head_doc_file entries at the converted
pages. Serve's landing page was already Markdown but declares its whole surface
inline, so this path had never been exercised.

Also refresh the .buildkite rules fixtures and the two notebook links that name
a converted file by path. The rules themselves match on directory prefix and on
both extensions, so what each path emits is unchanged.

Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman
dstrodtman requested review from a team as code owners August 13, 2026 19:32

@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 migrates several Sphinx documentation landing pages from RST to MyST Markdown format and updates the associated Buildkite test rules, documentation links, and CI scripts to support this transition. Specifically, it introduces support for parsing MyST toctree fences in ci/ray_ci/doc/autodoc.py and adds corresponding unit tests. Feedback on the changes suggests extending the new MyST toctree parser to support both .rst and .md child page extensions, as well as handling the Title <path> format, to ensure future-proof compatibility as more child pages are converted.

Comment thread ci/ray_ci/doc/autodoc.py Resolved
Found by diffing the Read the Docs preview against /en/master page by page.

- index.md: .. title:: does not set the document title from inside an
  {eval-rst} block, so the site root's browser title silently degraded from
  'Welcome to Ray!' to '<no title>'. fail_on_warning says nothing about this.
  An H1 sets env.titles to the same string, and _templates/index.html overrides
  the body block, so the heading never renders.
- use-cases.md: an RST .. image:: with no :alt: takes its alt text from the URI
  and emits a bare <img>. Markdown ![]() emitted alt="" wrapped in a <p>. Use
  the {image} directive instead.
- cluster/key-concepts.md: default_role = "code" means a single-backtick RST
  literal renders as <code class="code docutils literal notranslate">. A
  Markdown single-backtick drops the 'code' class. Use the {code} role.

Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman

Copy link
Copy Markdown
Contributor Author

Render verification is complete. I diffed the RtD preview against /en/master page by page, extracting <article> and normalizing the host, release string, and search-highlight params.

That check found three regressions a green fail_on_warning build had said nothing about, all fixed in the last commit:

  • index.html lost its browser title. .. title:: does not set the document title from inside an {eval-rst} block, so the site root went from Welcome to Ray! to <no title>. An H1 sets env.titles to the same string and _templates/index.html overrides the body block, so nothing renders differently.
  • use-cases.html: an RST .. image:: with no :alt: takes its alt text from the URI and emits a bare <img>; Markdown ![]() emitted alt="" inside a <p>. Now uses the {image} directive.
  • cluster/key-concepts.html: default_role = "code" makes a single-backtick RST literal render as <code class="code docutils literal notranslate">; a Markdown single-backtick drops the code class. Now uses the {code} role.

After the fixes, all nine pages are identical to /en/master except for two explained classes:

  1. class="tex2jax_ignore mathjax_ignore" on the root <section> — myst-parser adds this to every MyST document. Present on every already-Markdown page in the tree.
  2. ray-overview/examples.html differs by ~110 lines because custom_directives.py:1096 picks the gallery icons with random.randint / random.choice at build time. That page differs between any two builds of the same commit.

Happy to drop the {code} role back to a plain backtick if reviewers prefer: the code class carries no styling in either Ray's CSS or the pydata theme, and every other converted page in the tree uses plain backticks. It's a byte-level difference with no visual one.

The {code} role produced a byte-identical render, but the 'code' class it
preserves carries no styling in Ray's CSS or in pydata-sphinx-theme, and every
other converted page in the tree uses a plain backtick. Match the corpus.

Signed-off-by: Douglas Strodtman <[email protected]>
dstrodtman added a commit that referenced this pull request Aug 13, 2026
…rrors

Review feedback on the initial version.

- Strip the benign classes from the BeautifulSoup tree instead of the
  serialized HTML. The regex matched one exact class string, so a change in
  class order or an added class would have silently stopped the filter and
  resurrected the noise it exists to suppress.
- Normalize the release string in the <title> as well as the body. Sphinx
  builds titles as '... - Ray {release}' from html_title, so a version bump
  landing between the preview and master would have reported a title
  difference on every page.
- Catch urllib.error.URLError and report the page as ERROR rather than
  crashing. A typo'd path or an unpublished preview must read as 'not
  verified', never as 'verified clean'. Strip leading slashes from page
  arguments while here.
- Cap the exit status. An uncapped count of differing pages wraps to 0 on a
  run of exactly 256.

Verified against #65467's preview: all nine converted pages still report
IDENTICAL, and a bad page path now exits 1 with a clean message.

Signed-off-by: Douglas Strodtman <[email protected]>
Review feedback: the MyST branch matched only entries ending in .rst, so a
child page would drop out of the walk the moment it converted to Markdown,
taking its autosummary entries out of the team's documented-API set.

Widen it past the suggested .rst/.md pair. The dominant MyST idiom is an
extensionless docname, which Sphinx resolves to whichever source file exists,
and titled entries ('Title <docname>') are common on landing pages. Matching
only explicit extensions would have looked like a fix while still missing the
form these pages actually use.

_toctree_entry_path now handles all three, and applies to the RST toctree
branch too: a landing page still in RST can toctree into an already-converted
child, which is the normal mid-campaign state. Root-relative entries
('/path/to/page') return None, since resolving them needs the Sphinx source
root; no API landing page uses that form.

Verified the walk output is unchanged for all six teams (data, serve, core,
train, tune, rllib) against the pre-change baseline.

Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman

Copy link
Copy Markdown
Contributor Author

Good catch on the direction — taken, and widened, in fef0917.

Two amendments to the diagnosis, both of which change the fix.

The suggested patch closes the smaller half of the gap. It adds .md and the Title <path> form, but a MyST toctree entry is most often a bare extensionless docname — Sphinx strips a known suffix and resolves it to whichever source file exists, and the conversion skill prescribes exactly that form. Two of this PR's own converted pages already use it (index.md writes Overview <ray-overview/index>). Matching only explicit extensions would have read as a fix while still missing the form the pages actually use, which is the worse outcome: a walk that looks fixed and isn't.

_toctree_entry_path now handles all three forms — explicit .rst/.md, extensionless resolved against disk, and Title <docname> — and returns None for option lines and for root-relative entries (/path/to/page), which can't be resolved without the Sphinx source root. No API landing page uses that form.

It applies to the RST branch too, not just the MyST one. The same limitation was already in the RST toctree parser. It's latent today because every remaining API landing page writes explicit .rst entries — I checked tune/api/api.rst, rllib/package_ref/index.rst, and ray-core/api/index.rst — but the normal mid-campaign state is a landing page still in RST toctree-ing into an already-converted child, and that would have hit the same wall.

One correction on severity: the failure would have been loud, not silent. A dropped child takes its autosummary entries out of api_in_docs, so its symbols fail the "every public API must be documented" check. Confusing to debug, but not silent corruption. Still worth fixing ahead of the batch that would trigger it.

Verified the walk output is unchanged for all six teams — data 18, serve 1, core 10, train 1, tune 16, rllib 21 files — against the pre-change baseline, and ci/ray_ci/doc/test_autodoc.py covers each entry form in both toctree syntaxes. python3 -m pytest ci/ray_ci/doc/test_autodoc.py → 4 passed.

@dstrodtman dstrodtman added go add ONLY when ready to merge, run all tests docs-go RtD-only checks for docs-only changes. Doesn't run full library doc-test suites. and removed docs-go RtD-only checks for docs-only changes. Doesn't run full library doc-test suites. labels Aug 13, 2026
@ray-gardener ray-gardener Bot added docs An issue or change related to documentation core Issues that should be addressed in Ray Core devprod labels Aug 14, 2026
Apply the ray-soft-wrap pass to the four converted pages that still carried
hard-wrapped prose, so each paragraph and list item is one source line.

Whitespace-only: the transform only collapses newlines inside a paragraph.
softwrap.py's content invariant and verify.py's render-equality check pass on
all four files.

The two raw-HTML SVG blocks in use-cases.md are restored to their wrapped form
by hand. They sit indented inside a query-param-ref directive body, which the
engine's HTML rule (0-3 leading spaces, per CommonMark) doesn't recognize, so
it joined them. Joining raw HTML isn't the pass's business, so those blocks
stay as they were and use-cases.md reports idempotent=FAIL until the engine
learns the boundary.

Signed-off-by: Douglas Strodtman <[email protected]>
The RST had two numbered lines with no blank line before them, so docutils read
them as part of the preceding paragraph and rendered them as running prose. The
conversion escaped the numbers to preserve that rendering faithfully, and
soft-wrapping the paragraph then put the whole thing on one line, which is where
it became obvious.

Restore the intent: a two-item ordered list, with a complete lead-in sentence.
This is the one place in these pages where the rendering changes on purpose.

Signed-off-by: Douglas Strodtman <[email protected]>
dstrodtman added a commit that referenced this pull request Aug 14, 2026
…wrap skill (#65469)

## Why are these changes needed?

This is the single skill PR for the RST-to-MyST conversion campaign.
Everything the conversion taught us about the tooling lands here, so the
content batches stay pure content. It started as the render-diff fix and
grew as batches 0 and 1 exercised it; #65471 was folded in rather than
stacked.

## 1. A green build is not evidence of a faithful conversion

The `rst-to-myst` skill treated a green `fail_on_warning` build as
near-sufficient. It isn't. #65467 produced three regressions that built
clean and emitted no warning anywhere: `doc/source/index.rst`'s `..
title::` didn't set the document title from inside `{eval-rst}`, so the
site root rendered as `<no title>`; an `.. image::` with no `:alt:`
became `![](URL)`, changing a bare `<img>` into an `alt=""` wrapped in a
`<p>`; and single-backtick RST under `default_role = "code"` dropped a
`code` class.

**`render_diff.py`** fetches the RtD PR preview and `/en/master` for
each page, extracts `<article>`, normalizes the host, release string,
and search-highlight params, and diffs.

```bash
python3 doc/.claude/skills/rst-to-myst/render_diff.py \
    https://anyscale-ray--65467.com.readthedocs.build/en/65467/ \
    index.html cluster/key-concepts.html ray-overview/use-cases.html
```

It filters the two differences every MyST page shows against an RST
page, both verified inert: `class="tex2jax_ignore mathjax_ignore"`,
which myst-parser stamps on the root `<section>`, and the missing `code`
class above (no rule for it in `pydata-sphinx-theme.css`, `theme.css`,
or `doc/source/_static/css/`). `--keep-benign` shows them. It also
labels `ray-overview/examples.html`, which differs between *any* two
builds because `custom_directives.py` picks its gallery icons with
`random.randint`.

SKILL.md promotes the render diff from a one-line afterthought to a
required step, corrects the `.. image::` row, adds rows for `..
figure::` and `.. title::`, adds Hard rule 5 covering the three
page-identity constructs, and rewrites the `default_role` note.

The guidance is deliberately "read the diffs," not "expect zero."
Byte-identical isn't always the right bar, so the question is whether
every diff is explainable.

**It has since paid for itself twice.** On #65470 it caught three more
silent regressions: all eight Linux nightly-wheel links resolving as
dead internal anchors instead of S3 URLs, `<no tag>` parsing as an HTML
element, and a Vale spelling failure from link text that RST's
`TokenIgnores` had exempted.

## 2. sphinx-design card grids

Batch 1 (#65470) converted seven pages built on `grid` /
`grid-item-card`, which the skill had no mapping for at all — cards are
the dominant construct in the batches still to come.

Adds mapping rows for `grid`, `grid-item-card`, `grid-item`,
`button-ref`, `button-link`, and `div`, plus a construct note covering
the two non-obvious parts:

- `^^^` and `+++` need no translation. sphinx-design matches them with
`REGEX_HEADER`/`REGEX_FOOTER` in `cards.py` and splits them out of the
raw content lines before anything parses them.
- `GridDirective`, `GridItemCardDirective`, `div`, and Ray's
`callout`/`annotations` all call `self.state.nested_parse`, which under
MyST parses content as **Markdown**. RST left inside a native card
doesn't warn — it renders as literal text. Everything nested converts in
the same pass, and the render diff is the only check that catches a
miss.

That also fixes a dangling reference: step 4 already cited "the
`nested_parse` degradation below" and there was no such note.

Two facts recorded from the pinned source rather than assumed:
`sphinx_design==0.7.0` supports MyST first-class (its own docs are MyST,
it ships `snippets/myst/`, and its directives register via
`app.add_directive`); and the `<1>`-to-① substitution in
`doc/source/_ext/callouts.py` works under MyST, in both of the
independent places it happens — `_replace_numbers()` for annotation text
and `CalloutIncludePostTransform` for `literal_block` code.

That second note is written the way it is to head off a
plausible-looking wrong fix. `_replace_numbers()` discards the return
value of its `.replace()` calls, which reads like a classic
immutable-string no-op. It isn't: `self.content` is a docutils
`StringList`, whose `replace()` mutates in place and returns `None`, and
`/en/master/tune/index.html` renders the circled numerals today. The
real defect is only a misleading signature — the `content: str` hint and
the "returns the formatted string" docstring describe behavior the
function doesn't have, so passing it an actual `str` would silently
no-op. Worth fixing, but not here.

## 3. Apostrophe headings move their anchor

docutils slugifies `What's Ray Core?` to `what-s-ray-core`; MyST
produces `whats-ray-core`. Green build, no warning, dead inbound links.
About 17 headings across 15 of the files still to convert.

Hard rule 7: if the heading already carries an explicit label, that
label is the anchor callers should use and nothing is added. Only a bare
heading gets a compat target with the old docutils slug. Never two
targets on one heading.

## 4. A soft-wrap skill

Converted pages come out hard-wrapped because the RST source is, but
Ray's `.md` prose is soft-wrapped. `ray-soft-wrap` is the deterministic
reflow: `softwrap.py` collapses each paragraph and list item to one
line, and `verify.py` gates a pass on three axes — non-whitespace bytes
byte-identical, CommonMark+GFM render identical, transform idempotent.

`rst-to-myst` now says to keep the source line-wrapping in the
conversion commit, so that diff stays line-aligned and a reviewer can
confirm the words didn't change, and to reflow in a separate
whitespace-only commit.

**`softwrap.py` gains a `--selftest`**, following `sphinx-fix`'s
pattern, with regression cases for the boundaries `verify.py`'s oracle
can't see:

```
$ python3 doc/.claude/skills/ray-soft-wrap/scripts/softwrap.py --selftest
ok    plain prose joins
ok    sphinx-design card separators stay on their own line
ok    RST simple table inside eval-rst is untouched
ok    hard break suppresses the join
ok    pipe table rows keep their lines
```

The card-separator case exists because the engine used to fold a card's
title, its `^^^`, and its body into one line — silently dropping the
header — while all three `verify.py` checks reported `ok`, since the
non-whitespace bytes were intact and CommonMark has no concept of a
card. Nothing had exercised it before: Ray had no native
`{grid-item-card}` until this campaign started emitting them.

**Provenance:** this skill was developed in an Anyscale repo while
building out the conversion campaign, and is moved here so it sits
beside the docs it operates on and beside `rst-to-myst`, which now calls
it. In-repo means contributors get it for free and it stays in sync with
the content that exercises it.

## Not a duplicate

`gh pr list --repo ray-project/ray --state open --search "rst-to-myst"`
returns no other open PR touching `doc/.claude/`. #65471 was folded into
this PR and closed.

## Related issue number

Tooling for the RST-to-MyST conversion of `doc/source/`. Content
batches: #65467, #65470, #65472.

AI assistance was used to prepare this change.

## Checks

- [x] I've signed off every commit (`git commit -s`).
- [x] I've run `scripts/format.sh` to lint the changes in this PR.
- [x] I've included any doc changes needed for the change.
- [x] Testing strategy
- `softwrap.py --selftest` passes, and fails as intended when the
card-separator guard is removed.
- `render_diff.py` run against #65467, #65470, and #65472. On #65472 all
four pages render identically; on #65470 four of seven do, with the
three differences explained in [that PR's
comment](#65470 (comment)).
- The sphinx-design claims were read off `sphinx_design==0.7.0`'s source
(`cards.py`, `grids.py`, `extension.py`).
  - Release tests: not applicable.
- This PR touches `doc/.claude/` only, which
`.buildkite/always.rules.txt` and `test.rules.txt` both exclude from the
build and which defines no Bazel targets, so it pulls no CI suite.

---------

Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman
dstrodtman enabled auto-merge (squash) August 14, 2026 17:51

@ronny-anyscale ronny-anyscale 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.

bam

@dstrodtman
dstrodtman merged commit 445bf3d into master Aug 14, 2026
7 checks passed
@dstrodtman
dstrodtman deleted the doc-1520-rst-myst-landing-stubs branch August 14, 2026 18:01
dstrodtman added a commit that referenced this pull request Aug 14, 2026
…ST (#65470)

## Why are these changes needed?

MyST Markdown is the standard for Ray doc pages, and a lint check
already rejects newly-added `.rst`. This is the second batch of the
conversion of the existing hand-written prose under `doc/source/`,
following #65467.

The batch is the seven library front-door pages. They share one pattern:
a `grid` of `grid-item-card`s, some `tab-set`s, `literalinclude` pulls,
and a `toctree`. 1,889 lines, and 18% of all `.rst` page views over the
last 90 days.

| File | Lines | Constructs |
| --- | --- | --- |
| `tune/index.rst` | 299 | 3 tabs, 6 cards, 3 literalinclude,
`callout`/`annotations` |
| `ray-core/walkthrough.rst` | 132 | 3 cards, 4 literalinclude |
| `data/data.rst` | 187 | 5 cards, 1 testcode |
| `train/train.rst` | 233 | 10 cards, nested `div`, `raw:: html :file:`
|
| `ray-overview/installation.rst` | 548 | 2 tab-sets, 3 tables, 20 named
link targets |
| `ray-overview/ray-libraries.rst` | 378 | 17 cards |
| `cluster/getting-started.rst` | 112 | 4 cards |

The conversion is format-only. Every label name, `toctree` entry,
directive, and prose line is preserved, so the rendered HTML should be
unchanged. No URLs change: Sphinx maps `foo.rst` and `foo.md` to the
same `foo.html`.

Unlike #65467, this batch needs no CI or `BUILD.bazel` changes. None of
the seven files is named in `doc/BUILD.bazel`, in a `.buildkite` rules
fixture, or in `ci/ray_ci/doc`. `data/data.rst`'s one real
`testcode`/`testoutput` pair stays covered by the `data` doctest rule's
`source/**/*.md` glob.

## Card grids convert to native MyST

Every card grid already in a `.md` page (`cluster/vms/index.md`,
`cluster/kubernetes/index.md`, `ray-overview/index.md`,
`serve/index.md`) is wrapped in `{eval-rst}` and left as RST. This batch
uses native MyST fences instead:

```markdown
::::{grid} 1 2 2 2
:gutter: 1

:::{grid-item-card}
**Title**
^^^
Body text.

+++
```{button-ref} some-label
:color: primary

Button text
```
:::
::::
```

sphinx-design supports MyST first-class — its own docs are MyST and it
ships a `snippets/myst/` tree. The `^^^` and `+++` separators are
matched by `REGEX_HEADER`/`REGEX_FOOTER` and split out of the raw
content lines before anything parses them, so they're format-agnostic.
`GridDirective` and `GridItemCardDirective` are ordinary docutils
directives registered through `app.add_directive`, which MyST dispatches
exactly the way it already dispatches `{tab-set}` in a dozen `.md` pages
today.

The one thing to know: these directives call `self.state.nested_parse`,
so under MyST their content parses as **Markdown**. Any RST left inside
a native card renders as literal text instead of erroring. That's why
the nested `button-ref`/`button-link`/`image`/`figure` directives all
convert too, and it's the specific thing the render diff below was run
to confirm.

A follow-up PR converts the four existing `{eval-rst}`-wrapped grids so
the tree ends up with one pattern rather than two.

## Conversions worth a second look

- **`installation.rst`'s nightly-wheel table becomes a `{list-table}`.**
It's a `====`-delimited RST simple table whose cells are named-target
references. Keeping it as RST inside `{eval-rst}` was the first attempt
and it silently broke all eight Linux wheel links, which resolved as
internal anchors instead of the S3 URLs; see the verification comment.
Inlining the URLs into the simple table isn't possible either, because
cell text longer than the column ruler breaks it. So it becomes a
`{list-table}` with `:widths: auto`, matching the MacOS and Windows tabs
that were already list-tables. The page render-diffs identical.
- **`tune/index.rst` had two link forms that don't survive
transcription.** `` `Ray Serve`_ `` pointed at `../serve/index.html`, a
relative `.html` URL that renders in RST but is a cross-reference target
under MyST; it becomes `` {doc}`Ray Serve </serve/index>` ``.
Separately, `` `terminating bad runs early <tune-scheduler-hyperband>`_
`` is an RST *external* link to a bare label name, so today it renders
as `<a href="tune-scheduler-hyperband">` — a dead relative URL. Sibling
lines in the same paragraph use `:ref:` for the same targets, so it
becomes `{ref}`. **That is a deliberate rendering change and the one
place the diff below is not empty.** Happy to keep the dead link if
you'd rather this PR stay strictly format-only.
- **`tune/index.rst` is the only file in the tree using the `callout`
and `annotations` directives** (`doc/source/_ext/callouts.py`). Both
`nested_parse`, so their content is now Markdown; the `<1>`/`<2>`
annotation markers are literal text under both parsers.
- **`train/train.rst`'s logo block** nests `div` inside `div` around a
`raw:: html` with a `:file:` option. It converts to nested colon fences
with a `{raw}` fence inside.
- **`ray-overview/getting-started.md` linked to `../tune/index.rst`**,
which would dangle after the rename. It becomes a `{doc}` reference.

## Verification

- Static checks pass on all seven files: frontmatter parses, backtick
and colon fences balance at every width, all 14 labels preserved, no
residual RST outside fences, no `.rst`/`.html#` link forms,
`testcode`/`testoutput` counts match the originals.
- Read the Docs preview green under `fail_on_warning: true`, and
`buildkite/microcheck` green.
- `render_diff.py` against `/en/master`: 4 of 7 pages identical, 3
differing intentionally. **Full results, including three regressions the
diff caught that the green build did not, are in [this
comment](#65470 (comment)

## Not a duplicate

`gh pr list --repo ray-project/ray --state open` shows no other PR
touching these seven files or this conversion, other than #65468, which
changes six lines inside `installation.rst`'s extras table. Whichever
lands first, the other rebases.

## Related issue number

Part of the ongoing RST-to-MyST conversion of `doc/source/`, following
#65467. Subsequent batches follow the same traffic-weighted ordering.

AI assistance was used to prepare this change.

## Checks

- [x] I've signed off every commit (`git commit -s`).
- [x] I've run `scripts/format.sh` to lint the changes in this PR.
- [x] I've included any doc changes needed for the change.
- [x] Testing strategy
- [x] Unit tests: not applicable; no `BUILD.bazel` or CI wiring changes
in this batch.
  - [x] Release tests: not applicable.
- [x] This PR is not tested (please justify below): the decisive checks
for a conversion are the RtD preview build under `fail_on_warning: true`
and the rendered diff against `/en/master`, both listed above.

---------

Signed-off-by: Douglas Strodtman <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…wrap skill (ray-project#65469)

## Why are these changes needed?

This is the single skill PR for the RST-to-MyST conversion campaign.
Everything the conversion taught us about the tooling lands here, so the
content batches stay pure content. It started as the render-diff fix and
grew as batches 0 and 1 exercised it; ray-project#65471 was folded in rather than
stacked.

## 1. A green build is not evidence of a faithful conversion

The `rst-to-myst` skill treated a green `fail_on_warning` build as
near-sufficient. It isn't. ray-project#65467 produced three regressions that built
clean and emitted no warning anywhere: `doc/source/index.rst`'s `..
title::` didn't set the document title from inside `{eval-rst}`, so the
site root rendered as `<no title>`; an `.. image::` with no `:alt:`
became `![](URL)`, changing a bare `<img>` into an `alt=""` wrapped in a
`<p>`; and single-backtick RST under `default_role = "code"` dropped a
`code` class.

**`render_diff.py`** fetches the RtD PR preview and `/en/master` for
each page, extracts `<article>`, normalizes the host, release string,
and search-highlight params, and diffs.

```bash
python3 doc/.claude/skills/rst-to-myst/render_diff.py \
    https://anyscale-ray--65467.com.readthedocs.build/en/65467/ \
    index.html cluster/key-concepts.html ray-overview/use-cases.html
```

It filters the two differences every MyST page shows against an RST
page, both verified inert: `class="tex2jax_ignore mathjax_ignore"`,
which myst-parser stamps on the root `<section>`, and the missing `code`
class above (no rule for it in `pydata-sphinx-theme.css`, `theme.css`,
or `doc/source/_static/css/`). `--keep-benign` shows them. It also
labels `ray-overview/examples.html`, which differs between *any* two
builds because `custom_directives.py` picks its gallery icons with
`random.randint`.

SKILL.md promotes the render diff from a one-line afterthought to a
required step, corrects the `.. image::` row, adds rows for `..
figure::` and `.. title::`, adds Hard rule 5 covering the three
page-identity constructs, and rewrites the `default_role` note.

The guidance is deliberately "read the diffs," not "expect zero."
Byte-identical isn't always the right bar, so the question is whether
every diff is explainable.

**It has since paid for itself twice.** On ray-project#65470 it caught three more
silent regressions: all eight Linux nightly-wheel links resolving as
dead internal anchors instead of S3 URLs, `<no tag>` parsing as an HTML
element, and a Vale spelling failure from link text that RST's
`TokenIgnores` had exempted.

## 2. sphinx-design card grids

Batch 1 (ray-project#65470) converted seven pages built on `grid` /
`grid-item-card`, which the skill had no mapping for at all — cards are
the dominant construct in the batches still to come.

Adds mapping rows for `grid`, `grid-item-card`, `grid-item`,
`button-ref`, `button-link`, and `div`, plus a construct note covering
the two non-obvious parts:

- `^^^` and `+++` need no translation. sphinx-design matches them with
`REGEX_HEADER`/`REGEX_FOOTER` in `cards.py` and splits them out of the
raw content lines before anything parses them.
- `GridDirective`, `GridItemCardDirective`, `div`, and Ray's
`callout`/`annotations` all call `self.state.nested_parse`, which under
MyST parses content as **Markdown**. RST left inside a native card
doesn't warn — it renders as literal text. Everything nested converts in
the same pass, and the render diff is the only check that catches a
miss.

That also fixes a dangling reference: step 4 already cited "the
`nested_parse` degradation below" and there was no such note.

Two facts recorded from the pinned source rather than assumed:
`sphinx_design==0.7.0` supports MyST first-class (its own docs are MyST,
it ships `snippets/myst/`, and its directives register via
`app.add_directive`); and the `<1>`-to-① substitution in
`doc/source/_ext/callouts.py` works under MyST, in both of the
independent places it happens — `_replace_numbers()` for annotation text
and `CalloutIncludePostTransform` for `literal_block` code.

That second note is written the way it is to head off a
plausible-looking wrong fix. `_replace_numbers()` discards the return
value of its `.replace()` calls, which reads like a classic
immutable-string no-op. It isn't: `self.content` is a docutils
`StringList`, whose `replace()` mutates in place and returns `None`, and
`/en/master/tune/index.html` renders the circled numerals today. The
real defect is only a misleading signature — the `content: str` hint and
the "returns the formatted string" docstring describe behavior the
function doesn't have, so passing it an actual `str` would silently
no-op. Worth fixing, but not here.

## 3. Apostrophe headings move their anchor

docutils slugifies `What's Ray Core?` to `what-s-ray-core`; MyST
produces `whats-ray-core`. Green build, no warning, dead inbound links.
About 17 headings across 15 of the files still to convert.

Hard rule 7: if the heading already carries an explicit label, that
label is the anchor callers should use and nothing is added. Only a bare
heading gets a compat target with the old docutils slug. Never two
targets on one heading.

## 4. A soft-wrap skill

Converted pages come out hard-wrapped because the RST source is, but
Ray's `.md` prose is soft-wrapped. `ray-soft-wrap` is the deterministic
reflow: `softwrap.py` collapses each paragraph and list item to one
line, and `verify.py` gates a pass on three axes — non-whitespace bytes
byte-identical, CommonMark+GFM render identical, transform idempotent.

`rst-to-myst` now says to keep the source line-wrapping in the
conversion commit, so that diff stays line-aligned and a reviewer can
confirm the words didn't change, and to reflow in a separate
whitespace-only commit.

**`softwrap.py` gains a `--selftest`**, following `sphinx-fix`'s
pattern, with regression cases for the boundaries `verify.py`'s oracle
can't see:

```
$ python3 doc/.claude/skills/ray-soft-wrap/scripts/softwrap.py --selftest
ok    plain prose joins
ok    sphinx-design card separators stay on their own line
ok    RST simple table inside eval-rst is untouched
ok    hard break suppresses the join
ok    pipe table rows keep their lines
```

The card-separator case exists because the engine used to fold a card's
title, its `^^^`, and its body into one line — silently dropping the
header — while all three `verify.py` checks reported `ok`, since the
non-whitespace bytes were intact and CommonMark has no concept of a
card. Nothing had exercised it before: Ray had no native
`{grid-item-card}` until this campaign started emitting them.

**Provenance:** this skill was developed in an Anyscale repo while
building out the conversion campaign, and is moved here so it sits
beside the docs it operates on and beside `rst-to-myst`, which now calls
it. In-repo means contributors get it for free and it stays in sync with
the content that exercises it.

## Not a duplicate

`gh pr list --repo ray-project/ray --state open --search "rst-to-myst"`
returns no other open PR touching `doc/.claude/`. ray-project#65471 was folded into
this PR and closed.

## Related issue number

Tooling for the RST-to-MyST conversion of `doc/source/`. Content
batches: ray-project#65467, ray-project#65470, ray-project#65472.

AI assistance was used to prepare this change.

## Checks

- [x] I've signed off every commit (`git commit -s`).
- [x] I've run `scripts/format.sh` to lint the changes in this PR.
- [x] I've included any doc changes needed for the change.
- [x] Testing strategy
- `softwrap.py --selftest` passes, and fails as intended when the
card-separator guard is removed.
- `render_diff.py` run against ray-project#65467, ray-project#65470, and ray-project#65472. On ray-project#65472 all
four pages render identically; on ray-project#65470 four of seven do, with the
three differences explained in [that PR's
comment](ray-project#65470 (comment)).
- The sphinx-design claims were read off `sphinx_design==0.7.0`'s source
(`cards.py`, `grids.py`, `extension.py`).
  - Release tests: not applicable.
- This PR touches `doc/.claude/` only, which
`.buildkite/always.rules.txt` and `test.rules.txt` both exclude from the
build and which defines no Bazel targets, so it pulls no CI suite.

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Signed-off-by: 400Ping <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
ray-project#65467)

## Why are these changes needed?

MyST Markdown is the standard for Ray doc pages, and a lint check
already rejects newly-added `.rst`. This is the first batch of the
conversion of the existing hand-written prose under `doc/source/`.

The batch is the nine highest-traffic, lowest-risk pages in the tree:
short prose intros plus a `toctree`, no tabs, no doctests, no includes.
679 lines total, and 23% of all `.rst` page views over the last 90 days.
Starting here validates the conversion end to end on the pages where any
regression is immediately obvious, at close to zero conversion risk.

| File | Lines |
| --- | --- |
| `index.rst` | 27 |
| `ray-overview/examples.rst` | 10 |
| `ray-overview/use-cases.rst` | 187 |
| `data/api/api.rst` | 22 |
| `train/api/api.rst` | 256 |
| `ray-core/key-concepts.rst` | 50 |
| `cluster/key-concepts.rst` | 90 |
| `ray-core/api/index.rst` | 15 |
| `ray-overview/examples/index.rst` | 22 |

The conversion is format-only. Every label name, `toctree` entry,
directive, and prose line is preserved, so the rendered HTML should be
unchanged and the preview-versus-`/en/master` diff should be empty. No
URLs change: Sphinx maps `foo.rst` and `foo.md` to the same `foo.html`.

### Conversions worth a second look

- **`index.rst` has no heading**, so its browser title comes entirely
from `.. title:: Welcome to Ray!`. There's no MyST frontmatter
equivalent, so it stays as RST in an `{eval-rst}` block. The file-level
`:html_theme.sidebar_secondary.remove:` field becomes frontmatter,
matching `404.md`.
- **`train/api/api.rst` keeps its 19 `autosummary` directives and its
`.. currentmodule::` as column-0 RST inside `{eval-rst}` blocks** — the
pattern `serve/api/index.md` already uses. The two labels that sit
directly above an `autosummary` stay inside the block so their targets
still register.
- **`ray-core/key-concepts.rst` has a two-item list that docutils folds
into the preceding paragraph**, because no blank line separates them.
[The rendered
page](https://docs.ray.io/en/master/ray-core/key-concepts.html#environment-dependencies)
shows it as one `<p>`. The conversion first escaped the leading `1.` and
`2.` to preserve that, but soft-wrapping the paragraph put the whole
thing on one line and made the problem plain, so the last commit
restores the intent: a real two-item `<ol>` with a complete lead-in
sentence. This is the one deliberate rendering change in the PR.
- **`use-cases.rst` keeps the `.. raw:: html` body of its two
`query-param-ref` blocks as RST.** That directive parses its own content
with a `docutils` parser at `doctree-resolved` time, independent of the
host file's format, so the content has to stay RST either way.

## The CI change in the second commit

Converting `data/api/api.rst` and `ray-core/api/index.rst` surfaced a
real gap in `ci/ray_ci/doc/autodoc.py`, which is why this PR isn't
docs-only.

The API-discrepancy check builds each team's documented-API set by
walking its landing page's `toctree`. The walker only recognized the RST
directive form (`.. toctree::` followed by indented entries). A MyST
`toctree` is a directive fence with entries at column 0, so the walker's
"first unindented line ends the block" heuristic stops on the very first
entry. The `data` and `core` teams would have walked no children at all,
collapsing their documented set to the landing page itself and flagging
every child page's `autosummary` entries as undocumented public APIs.

`serve/api/index.md` was already Markdown, but it declares its whole
surface inline with no page-level `toctree`, so this path had never been
exercised.

The second commit teaches the walker the fence form alongside the RST
form, points the `data`, `core`, and `train` `head_doc_file` entries at
the converted pages, and adds a regression test. The `toctree` entries
themselves are unchanged, so the walk reaches exactly the same set of
child files as before.

The `.buildkite` rules fixtures and the two notebook links that named a
converted file by path are refreshed in the same commit. The rules
themselves match on directory prefix and on both extensions, so what
each path emits is unchanged.

## The soft-wrap pass in the third commit

The converted pages inherit the hard-wrapped line breaks of their RST
sources. Four of them still carried wrapped prose, so a commit here runs
the `ray-soft-wrap` pass from ray-project#65469 over them, joining each paragraph
and list item onto one source line: `cluster/key-concepts.md` (7 joins),
`ray-overview/use-cases.md` (6), `ray-core/key-concepts.md` (1), and
`train/api/api.md` (1). Whitespace-only, and `verify.py` confirms it on
all four.

Two notes for anyone re-running that gate:

- **`verify.py --ref <base>` reports `content=FAIL render=FAIL` on
`ray-core/key-concepts.md`.** That's the ordered-list fix in the
following commit, not the soft-wrap. `verify.py` is a whitespace-only
gate, and that commit changes words and rendering on purpose, so it's
outside what the gate can attest. `idempotent=ok` on the same file
confirms the soft-wrap layer underneath is stable. Every other file
reports `content=ok render=ok idempotent=ok`.
- **The two raw-HTML SVG icons in `use-cases.md` keep their wrapped
form.** They sit indented inside a `query-param-ref` body, outside
CommonMark's 3-space window for opening an HTML block, so the engine
read them as prose and collapsed each onto one 3,000-character line
while all three checks still reported ok. ray-project#65469 teaches the engine that
boundary. Across all 232 Markdown files on `master` at `8788cfb87d`,
that engine change is a no-op on every axis, so it's safe to land in
either order.

## Not a duplicate

`gh pr list --repo ray-project/ray --state open --search "MyST"` and a
search for the converted paths return no other open PR touching these
files or this conversion. ray-project#65469 is the companion skill change and is
deliberately separate, so a rule change isn't buried in a content PR.

AI assistance was used to prepare this change.

## Related issue number

Part of the ongoing RST-to-MyST conversion of `doc/source/`. Subsequent
batches follow the same traffic-weighted ordering.

## Checks

- [x] I've signed off every commit (`git commit -s`).
- [x] I've run `scripts/format.sh` to lint the changes in this PR.
- [x] I've included any doc changes needed for the change.
- [x] Testing strategy
- [x] Unit tests: `ci/ray_ci/doc/test_autodoc.py` gains coverage for the
MyST fence form; the walk over the three converted API landing pages was
verified to reach the same child set as before.
  - [x] Release tests: not applicable.
- [x] This PR is not tested (please justify below): the decisive check
for the conversion itself is the Read the Docs preview build under
`fail_on_warning: true`, plus a rendered diff against `/en/master`.
Please hold the merge until both are confirmed clean.

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Signed-off-by: 400Ping <[email protected]>
400Ping pushed a commit to 400Ping/ray that referenced this pull request Aug 18, 2026
…ST (ray-project#65470)

## Why are these changes needed?

MyST Markdown is the standard for Ray doc pages, and a lint check
already rejects newly-added `.rst`. This is the second batch of the
conversion of the existing hand-written prose under `doc/source/`,
following ray-project#65467.

The batch is the seven library front-door pages. They share one pattern:
a `grid` of `grid-item-card`s, some `tab-set`s, `literalinclude` pulls,
and a `toctree`. 1,889 lines, and 18% of all `.rst` page views over the
last 90 days.

| File | Lines | Constructs |
| --- | --- | --- |
| `tune/index.rst` | 299 | 3 tabs, 6 cards, 3 literalinclude,
`callout`/`annotations` |
| `ray-core/walkthrough.rst` | 132 | 3 cards, 4 literalinclude |
| `data/data.rst` | 187 | 5 cards, 1 testcode |
| `train/train.rst` | 233 | 10 cards, nested `div`, `raw:: html :file:`
|
| `ray-overview/installation.rst` | 548 | 2 tab-sets, 3 tables, 20 named
link targets |
| `ray-overview/ray-libraries.rst` | 378 | 17 cards |
| `cluster/getting-started.rst` | 112 | 4 cards |

The conversion is format-only. Every label name, `toctree` entry,
directive, and prose line is preserved, so the rendered HTML should be
unchanged. No URLs change: Sphinx maps `foo.rst` and `foo.md` to the
same `foo.html`.

Unlike ray-project#65467, this batch needs no CI or `BUILD.bazel` changes. None of
the seven files is named in `doc/BUILD.bazel`, in a `.buildkite` rules
fixture, or in `ci/ray_ci/doc`. `data/data.rst`'s one real
`testcode`/`testoutput` pair stays covered by the `data` doctest rule's
`source/**/*.md` glob.

## Card grids convert to native MyST

Every card grid already in a `.md` page (`cluster/vms/index.md`,
`cluster/kubernetes/index.md`, `ray-overview/index.md`,
`serve/index.md`) is wrapped in `{eval-rst}` and left as RST. This batch
uses native MyST fences instead:

```markdown
::::{grid} 1 2 2 2
:gutter: 1

:::{grid-item-card}
**Title**
^^^
Body text.

+++
```{button-ref} some-label
:color: primary

Button text
```
:::
::::
```

sphinx-design supports MyST first-class — its own docs are MyST and it
ships a `snippets/myst/` tree. The `^^^` and `+++` separators are
matched by `REGEX_HEADER`/`REGEX_FOOTER` and split out of the raw
content lines before anything parses them, so they're format-agnostic.
`GridDirective` and `GridItemCardDirective` are ordinary docutils
directives registered through `app.add_directive`, which MyST dispatches
exactly the way it already dispatches `{tab-set}` in a dozen `.md` pages
today.

The one thing to know: these directives call `self.state.nested_parse`,
so under MyST their content parses as **Markdown**. Any RST left inside
a native card renders as literal text instead of erroring. That's why
the nested `button-ref`/`button-link`/`image`/`figure` directives all
convert too, and it's the specific thing the render diff below was run
to confirm.

A follow-up PR converts the four existing `{eval-rst}`-wrapped grids so
the tree ends up with one pattern rather than two.

## Conversions worth a second look

- **`installation.rst`'s nightly-wheel table becomes a `{list-table}`.**
It's a `====`-delimited RST simple table whose cells are named-target
references. Keeping it as RST inside `{eval-rst}` was the first attempt
and it silently broke all eight Linux wheel links, which resolved as
internal anchors instead of the S3 URLs; see the verification comment.
Inlining the URLs into the simple table isn't possible either, because
cell text longer than the column ruler breaks it. So it becomes a
`{list-table}` with `:widths: auto`, matching the MacOS and Windows tabs
that were already list-tables. The page render-diffs identical.
- **`tune/index.rst` had two link forms that don't survive
transcription.** `` `Ray Serve`_ `` pointed at `../serve/index.html`, a
relative `.html` URL that renders in RST but is a cross-reference target
under MyST; it becomes `` {doc}`Ray Serve </serve/index>` ``.
Separately, `` `terminating bad runs early <tune-scheduler-hyperband>`_
`` is an RST *external* link to a bare label name, so today it renders
as `<a href="tune-scheduler-hyperband">` — a dead relative URL. Sibling
lines in the same paragraph use `:ref:` for the same targets, so it
becomes `{ref}`. **That is a deliberate rendering change and the one
place the diff below is not empty.** Happy to keep the dead link if
you'd rather this PR stay strictly format-only.
- **`tune/index.rst` is the only file in the tree using the `callout`
and `annotations` directives** (`doc/source/_ext/callouts.py`). Both
`nested_parse`, so their content is now Markdown; the `<1>`/`<2>`
annotation markers are literal text under both parsers.
- **`train/train.rst`'s logo block** nests `div` inside `div` around a
`raw:: html` with a `:file:` option. It converts to nested colon fences
with a `{raw}` fence inside.
- **`ray-overview/getting-started.md` linked to `../tune/index.rst`**,
which would dangle after the rename. It becomes a `{doc}` reference.

## Verification

- Static checks pass on all seven files: frontmatter parses, backtick
and colon fences balance at every width, all 14 labels preserved, no
residual RST outside fences, no `.rst`/`.html#` link forms,
`testcode`/`testoutput` counts match the originals.
- Read the Docs preview green under `fail_on_warning: true`, and
`buildkite/microcheck` green.
- `render_diff.py` against `/en/master`: 4 of 7 pages identical, 3
differing intentionally. **Full results, including three regressions the
diff caught that the green build did not, are in [this
comment](ray-project#65470 (comment)

## Not a duplicate

`gh pr list --repo ray-project/ray --state open` shows no other PR
touching these seven files or this conversion, other than ray-project#65468, which
changes six lines inside `installation.rst`'s extras table. Whichever
lands first, the other rebases.

## Related issue number

Part of the ongoing RST-to-MyST conversion of `doc/source/`, following
ray-project#65467. Subsequent batches follow the same traffic-weighted ordering.

AI assistance was used to prepare this change.

## Checks

- [x] I've signed off every commit (`git commit -s`).
- [x] I've run `scripts/format.sh` to lint the changes in this PR.
- [x] I've included any doc changes needed for the change.
- [x] Testing strategy
- [x] Unit tests: not applicable; no `BUILD.bazel` or CI wiring changes
in this batch.
  - [x] Release tests: not applicable.
- [x] This PR is not tested (please justify below): the decisive checks
for a conversion are the RtD preview build under `fail_on_warning: true`
and the rendered diff against `/en/master`, both listed above.

---------

Signed-off-by: Douglas Strodtman <[email protected]>
Signed-off-by: 400Ping <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…wrap skill (ray-project#65469)

## Why are these changes needed?

This is the single skill PR for the RST-to-MyST conversion campaign.
Everything the conversion taught us about the tooling lands here, so the
content batches stay pure content. It started as the render-diff fix and
grew as batches 0 and 1 exercised it; ray-project#65471 was folded in rather than
stacked.

## 1. A green build is not evidence of a faithful conversion

The `rst-to-myst` skill treated a green `fail_on_warning` build as
near-sufficient. It isn't. ray-project#65467 produced three regressions that built
clean and emitted no warning anywhere: `doc/source/index.rst`'s `..
title::` didn't set the document title from inside `{eval-rst}`, so the
site root rendered as `<no title>`; an `.. image::` with no `:alt:`
became `![](URL)`, changing a bare `<img>` into an `alt=""` wrapped in a
`<p>`; and single-backtick RST under `default_role = "code"` dropped a
`code` class.

**`render_diff.py`** fetches the RtD PR preview and `/en/master` for
each page, extracts `<article>`, normalizes the host, release string,
and search-highlight params, and diffs.

```bash
python3 doc/.claude/skills/rst-to-myst/render_diff.py \
    https://anyscale-ray--65467.com.readthedocs.build/en/65467/ \
    index.html cluster/key-concepts.html ray-overview/use-cases.html
```

It filters the two differences every MyST page shows against an RST
page, both verified inert: `class="tex2jax_ignore mathjax_ignore"`,
which myst-parser stamps on the root `<section>`, and the missing `code`
class above (no rule for it in `pydata-sphinx-theme.css`, `theme.css`,
or `doc/source/_static/css/`). `--keep-benign` shows them. It also
labels `ray-overview/examples.html`, which differs between *any* two
builds because `custom_directives.py` picks its gallery icons with
`random.randint`.

SKILL.md promotes the render diff from a one-line afterthought to a
required step, corrects the `.. image::` row, adds rows for `..
figure::` and `.. title::`, adds Hard rule 5 covering the three
page-identity constructs, and rewrites the `default_role` note.

The guidance is deliberately "read the diffs," not "expect zero."
Byte-identical isn't always the right bar, so the question is whether
every diff is explainable.

**It has since paid for itself twice.** On ray-project#65470 it caught three more
silent regressions: all eight Linux nightly-wheel links resolving as
dead internal anchors instead of S3 URLs, `<no tag>` parsing as an HTML
element, and a Vale spelling failure from link text that RST's
`TokenIgnores` had exempted.

## 2. sphinx-design card grids

Batch 1 (ray-project#65470) converted seven pages built on `grid` /
`grid-item-card`, which the skill had no mapping for at all — cards are
the dominant construct in the batches still to come.

Adds mapping rows for `grid`, `grid-item-card`, `grid-item`,
`button-ref`, `button-link`, and `div`, plus a construct note covering
the two non-obvious parts:

- `^^^` and `+++` need no translation. sphinx-design matches them with
`REGEX_HEADER`/`REGEX_FOOTER` in `cards.py` and splits them out of the
raw content lines before anything parses them.
- `GridDirective`, `GridItemCardDirective`, `div`, and Ray's
`callout`/`annotations` all call `self.state.nested_parse`, which under
MyST parses content as **Markdown**. RST left inside a native card
doesn't warn — it renders as literal text. Everything nested converts in
the same pass, and the render diff is the only check that catches a
miss.

That also fixes a dangling reference: step 4 already cited "the
`nested_parse` degradation below" and there was no such note.

Two facts recorded from the pinned source rather than assumed:
`sphinx_design==0.7.0` supports MyST first-class (its own docs are MyST,
it ships `snippets/myst/`, and its directives register via
`app.add_directive`); and the `<1>`-to-① substitution in
`doc/source/_ext/callouts.py` works under MyST, in both of the
independent places it happens — `_replace_numbers()` for annotation text
and `CalloutIncludePostTransform` for `literal_block` code.

That second note is written the way it is to head off a
plausible-looking wrong fix. `_replace_numbers()` discards the return
value of its `.replace()` calls, which reads like a classic
immutable-string no-op. It isn't: `self.content` is a docutils
`StringList`, whose `replace()` mutates in place and returns `None`, and
`/en/master/tune/index.html` renders the circled numerals today. The
real defect is only a misleading signature — the `content: str` hint and
the "returns the formatted string" docstring describe behavior the
function doesn't have, so passing it an actual `str` would silently
no-op. Worth fixing, but not here.

## 3. Apostrophe headings move their anchor

docutils slugifies `What's Ray Core?` to `what-s-ray-core`; MyST
produces `whats-ray-core`. Green build, no warning, dead inbound links.
About 17 headings across 15 of the files still to convert.

Hard rule 7: if the heading already carries an explicit label, that
label is the anchor callers should use and nothing is added. Only a bare
heading gets a compat target with the old docutils slug. Never two
targets on one heading.

## 4. A soft-wrap skill

Converted pages come out hard-wrapped because the RST source is, but
Ray's `.md` prose is soft-wrapped. `ray-soft-wrap` is the deterministic
reflow: `softwrap.py` collapses each paragraph and list item to one
line, and `verify.py` gates a pass on three axes — non-whitespace bytes
byte-identical, CommonMark+GFM render identical, transform idempotent.

`rst-to-myst` now says to keep the source line-wrapping in the
conversion commit, so that diff stays line-aligned and a reviewer can
confirm the words didn't change, and to reflow in a separate
whitespace-only commit.

**`softwrap.py` gains a `--selftest`**, following `sphinx-fix`'s
pattern, with regression cases for the boundaries `verify.py`'s oracle
can't see:

```
$ python3 doc/.claude/skills/ray-soft-wrap/scripts/softwrap.py --selftest
ok    plain prose joins
ok    sphinx-design card separators stay on their own line
ok    RST simple table inside eval-rst is untouched
ok    hard break suppresses the join
ok    pipe table rows keep their lines
```

The card-separator case exists because the engine used to fold a card's
title, its `^^^`, and its body into one line — silently dropping the
header — while all three `verify.py` checks reported `ok`, since the
non-whitespace bytes were intact and CommonMark has no concept of a
card. Nothing had exercised it before: Ray had no native
`{grid-item-card}` until this campaign started emitting them.

**Provenance:** this skill was developed in an Anyscale repo while
building out the conversion campaign, and is moved here so it sits
beside the docs it operates on and beside `rst-to-myst`, which now calls
it. In-repo means contributors get it for free and it stays in sync with
the content that exercises it.

## Not a duplicate

`gh pr list --repo ray-project/ray --state open --search "rst-to-myst"`
returns no other open PR touching `doc/.claude/`. ray-project#65471 was folded into
this PR and closed.

## Related issue number

Tooling for the RST-to-MyST conversion of `doc/source/`. Content
batches: ray-project#65467, ray-project#65470, ray-project#65472.

AI assistance was used to prepare this change.

## Checks

- [x] I've signed off every commit (`git commit -s`).
- [x] I've run `scripts/format.sh` to lint the changes in this PR.
- [x] I've included any doc changes needed for the change.
- [x] Testing strategy
- `softwrap.py --selftest` passes, and fails as intended when the
card-separator guard is removed.
- `render_diff.py` run against ray-project#65467, ray-project#65470, and ray-project#65472. On ray-project#65472 all
four pages render identically; on ray-project#65470 four of seven do, with the
three differences explained in [that PR's
comment](ray-project#65470 (comment)).
- The sphinx-design claims were read off `sphinx_design==0.7.0`'s source
(`cards.py`, `grids.py`, `extension.py`).
  - Release tests: not applicable.
- This PR touches `doc/.claude/` only, which
`.buildkite/always.rules.txt` and `test.rules.txt` both exclude from the
build and which defines no Bazel targets, so it pulls no CI suite.

---------

Signed-off-by: Douglas Strodtman <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
ray-project#65467)

## Why are these changes needed?

MyST Markdown is the standard for Ray doc pages, and a lint check
already rejects newly-added `.rst`. This is the first batch of the
conversion of the existing hand-written prose under `doc/source/`.

The batch is the nine highest-traffic, lowest-risk pages in the tree:
short prose intros plus a `toctree`, no tabs, no doctests, no includes.
679 lines total, and 23% of all `.rst` page views over the last 90 days.
Starting here validates the conversion end to end on the pages where any
regression is immediately obvious, at close to zero conversion risk.

| File | Lines |
| --- | --- |
| `index.rst` | 27 |
| `ray-overview/examples.rst` | 10 |
| `ray-overview/use-cases.rst` | 187 |
| `data/api/api.rst` | 22 |
| `train/api/api.rst` | 256 |
| `ray-core/key-concepts.rst` | 50 |
| `cluster/key-concepts.rst` | 90 |
| `ray-core/api/index.rst` | 15 |
| `ray-overview/examples/index.rst` | 22 |

The conversion is format-only. Every label name, `toctree` entry,
directive, and prose line is preserved, so the rendered HTML should be
unchanged and the preview-versus-`/en/master` diff should be empty. No
URLs change: Sphinx maps `foo.rst` and `foo.md` to the same `foo.html`.

### Conversions worth a second look

- **`index.rst` has no heading**, so its browser title comes entirely
from `.. title:: Welcome to Ray!`. There's no MyST frontmatter
equivalent, so it stays as RST in an `{eval-rst}` block. The file-level
`:html_theme.sidebar_secondary.remove:` field becomes frontmatter,
matching `404.md`.
- **`train/api/api.rst` keeps its 19 `autosummary` directives and its
`.. currentmodule::` as column-0 RST inside `{eval-rst}` blocks** — the
pattern `serve/api/index.md` already uses. The two labels that sit
directly above an `autosummary` stay inside the block so their targets
still register.
- **`ray-core/key-concepts.rst` has a two-item list that docutils folds
into the preceding paragraph**, because no blank line separates them.
[The rendered
page](https://docs.ray.io/en/master/ray-core/key-concepts.html#environment-dependencies)
shows it as one `<p>`. The conversion first escaped the leading `1.` and
`2.` to preserve that, but soft-wrapping the paragraph put the whole
thing on one line and made the problem plain, so the last commit
restores the intent: a real two-item `<ol>` with a complete lead-in
sentence. This is the one deliberate rendering change in the PR.
- **`use-cases.rst` keeps the `.. raw:: html` body of its two
`query-param-ref` blocks as RST.** That directive parses its own content
with a `docutils` parser at `doctree-resolved` time, independent of the
host file's format, so the content has to stay RST either way.

## The CI change in the second commit

Converting `data/api/api.rst` and `ray-core/api/index.rst` surfaced a
real gap in `ci/ray_ci/doc/autodoc.py`, which is why this PR isn't
docs-only.

The API-discrepancy check builds each team's documented-API set by
walking its landing page's `toctree`. The walker only recognized the RST
directive form (`.. toctree::` followed by indented entries). A MyST
`toctree` is a directive fence with entries at column 0, so the walker's
"first unindented line ends the block" heuristic stops on the very first
entry. The `data` and `core` teams would have walked no children at all,
collapsing their documented set to the landing page itself and flagging
every child page's `autosummary` entries as undocumented public APIs.

`serve/api/index.md` was already Markdown, but it declares its whole
surface inline with no page-level `toctree`, so this path had never been
exercised.

The second commit teaches the walker the fence form alongside the RST
form, points the `data`, `core`, and `train` `head_doc_file` entries at
the converted pages, and adds a regression test. The `toctree` entries
themselves are unchanged, so the walk reaches exactly the same set of
child files as before.

The `.buildkite` rules fixtures and the two notebook links that named a
converted file by path are refreshed in the same commit. The rules
themselves match on directory prefix and on both extensions, so what
each path emits is unchanged.

## The soft-wrap pass in the third commit

The converted pages inherit the hard-wrapped line breaks of their RST
sources. Four of them still carried wrapped prose, so a commit here runs
the `ray-soft-wrap` pass from ray-project#65469 over them, joining each paragraph
and list item onto one source line: `cluster/key-concepts.md` (7 joins),
`ray-overview/use-cases.md` (6), `ray-core/key-concepts.md` (1), and
`train/api/api.md` (1). Whitespace-only, and `verify.py` confirms it on
all four.

Two notes for anyone re-running that gate:

- **`verify.py --ref <base>` reports `content=FAIL render=FAIL` on
`ray-core/key-concepts.md`.** That's the ordered-list fix in the
following commit, not the soft-wrap. `verify.py` is a whitespace-only
gate, and that commit changes words and rendering on purpose, so it's
outside what the gate can attest. `idempotent=ok` on the same file
confirms the soft-wrap layer underneath is stable. Every other file
reports `content=ok render=ok idempotent=ok`.
- **The two raw-HTML SVG icons in `use-cases.md` keep their wrapped
form.** They sit indented inside a `query-param-ref` body, outside
CommonMark's 3-space window for opening an HTML block, so the engine
read them as prose and collapsed each onto one 3,000-character line
while all three checks still reported ok. ray-project#65469 teaches the engine that
boundary. Across all 232 Markdown files on `master` at `8788cfb87d`,
that engine change is a no-op on every axis, so it's safe to land in
either order.

## Not a duplicate

`gh pr list --repo ray-project/ray --state open --search "MyST"` and a
search for the converted paths return no other open PR touching these
files or this conversion. ray-project#65469 is the companion skill change and is
deliberately separate, so a rule change isn't buried in a content PR.

AI assistance was used to prepare this change.

## Related issue number

Part of the ongoing RST-to-MyST conversion of `doc/source/`. Subsequent
batches follow the same traffic-weighted ordering.

## Checks

- [x] I've signed off every commit (`git commit -s`).
- [x] I've run `scripts/format.sh` to lint the changes in this PR.
- [x] I've included any doc changes needed for the change.
- [x] Testing strategy
- [x] Unit tests: `ci/ray_ci/doc/test_autodoc.py` gains coverage for the
MyST fence form; the walk over the three converted API landing pages was
verified to reach the same child set as before.
  - [x] Release tests: not applicable.
- [x] This PR is not tested (please justify below): the decisive check
for the conversion itself is the Read the Docs preview build under
`fail_on_warning: true`, plus a rendered diff against `/en/master`.
Please hold the merge until both are confirmed clean.

---------

Signed-off-by: Douglas Strodtman <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…ST (ray-project#65470)

## Why are these changes needed?

MyST Markdown is the standard for Ray doc pages, and a lint check
already rejects newly-added `.rst`. This is the second batch of the
conversion of the existing hand-written prose under `doc/source/`,
following ray-project#65467.

The batch is the seven library front-door pages. They share one pattern:
a `grid` of `grid-item-card`s, some `tab-set`s, `literalinclude` pulls,
and a `toctree`. 1,889 lines, and 18% of all `.rst` page views over the
last 90 days.

| File | Lines | Constructs |
| --- | --- | --- |
| `tune/index.rst` | 299 | 3 tabs, 6 cards, 3 literalinclude,
`callout`/`annotations` |
| `ray-core/walkthrough.rst` | 132 | 3 cards, 4 literalinclude |
| `data/data.rst` | 187 | 5 cards, 1 testcode |
| `train/train.rst` | 233 | 10 cards, nested `div`, `raw:: html :file:`
|
| `ray-overview/installation.rst` | 548 | 2 tab-sets, 3 tables, 20 named
link targets |
| `ray-overview/ray-libraries.rst` | 378 | 17 cards |
| `cluster/getting-started.rst` | 112 | 4 cards |

The conversion is format-only. Every label name, `toctree` entry,
directive, and prose line is preserved, so the rendered HTML should be
unchanged. No URLs change: Sphinx maps `foo.rst` and `foo.md` to the
same `foo.html`.

Unlike ray-project#65467, this batch needs no CI or `BUILD.bazel` changes. None of
the seven files is named in `doc/BUILD.bazel`, in a `.buildkite` rules
fixture, or in `ci/ray_ci/doc`. `data/data.rst`'s one real
`testcode`/`testoutput` pair stays covered by the `data` doctest rule's
`source/**/*.md` glob.

## Card grids convert to native MyST

Every card grid already in a `.md` page (`cluster/vms/index.md`,
`cluster/kubernetes/index.md`, `ray-overview/index.md`,
`serve/index.md`) is wrapped in `{eval-rst}` and left as RST. This batch
uses native MyST fences instead:

```markdown
::::{grid} 1 2 2 2
:gutter: 1

:::{grid-item-card}
**Title**
^^^
Body text.

+++
```{button-ref} some-label
:color: primary

Button text
```
:::
::::
```

sphinx-design supports MyST first-class — its own docs are MyST and it
ships a `snippets/myst/` tree. The `^^^` and `+++` separators are
matched by `REGEX_HEADER`/`REGEX_FOOTER` and split out of the raw
content lines before anything parses them, so they're format-agnostic.
`GridDirective` and `GridItemCardDirective` are ordinary docutils
directives registered through `app.add_directive`, which MyST dispatches
exactly the way it already dispatches `{tab-set}` in a dozen `.md` pages
today.

The one thing to know: these directives call `self.state.nested_parse`,
so under MyST their content parses as **Markdown**. Any RST left inside
a native card renders as literal text instead of erroring. That's why
the nested `button-ref`/`button-link`/`image`/`figure` directives all
convert too, and it's the specific thing the render diff below was run
to confirm.

A follow-up PR converts the four existing `{eval-rst}`-wrapped grids so
the tree ends up with one pattern rather than two.

## Conversions worth a second look

- **`installation.rst`'s nightly-wheel table becomes a `{list-table}`.**
It's a `====`-delimited RST simple table whose cells are named-target
references. Keeping it as RST inside `{eval-rst}` was the first attempt
and it silently broke all eight Linux wheel links, which resolved as
internal anchors instead of the S3 URLs; see the verification comment.
Inlining the URLs into the simple table isn't possible either, because
cell text longer than the column ruler breaks it. So it becomes a
`{list-table}` with `:widths: auto`, matching the MacOS and Windows tabs
that were already list-tables. The page render-diffs identical.
- **`tune/index.rst` had two link forms that don't survive
transcription.** `` `Ray Serve`_ `` pointed at `../serve/index.html`, a
relative `.html` URL that renders in RST but is a cross-reference target
under MyST; it becomes `` {doc}`Ray Serve </serve/index>` ``.
Separately, `` `terminating bad runs early <tune-scheduler-hyperband>`_
`` is an RST *external* link to a bare label name, so today it renders
as `<a href="tune-scheduler-hyperband">` — a dead relative URL. Sibling
lines in the same paragraph use `:ref:` for the same targets, so it
becomes `{ref}`. **That is a deliberate rendering change and the one
place the diff below is not empty.** Happy to keep the dead link if
you'd rather this PR stay strictly format-only.
- **`tune/index.rst` is the only file in the tree using the `callout`
and `annotations` directives** (`doc/source/_ext/callouts.py`). Both
`nested_parse`, so their content is now Markdown; the `<1>`/`<2>`
annotation markers are literal text under both parsers.
- **`train/train.rst`'s logo block** nests `div` inside `div` around a
`raw:: html` with a `:file:` option. It converts to nested colon fences
with a `{raw}` fence inside.
- **`ray-overview/getting-started.md` linked to `../tune/index.rst`**,
which would dangle after the rename. It becomes a `{doc}` reference.

## Verification

- Static checks pass on all seven files: frontmatter parses, backtick
and colon fences balance at every width, all 14 labels preserved, no
residual RST outside fences, no `.rst`/`.html#` link forms,
`testcode`/`testoutput` counts match the originals.
- Read the Docs preview green under `fail_on_warning: true`, and
`buildkite/microcheck` green.
- `render_diff.py` against `/en/master`: 4 of 7 pages identical, 3
differing intentionally. **Full results, including three regressions the
diff caught that the green build did not, are in [this
comment](ray-project#65470 (comment)

## Not a duplicate

`gh pr list --repo ray-project/ray --state open` shows no other PR
touching these seven files or this conversion, other than ray-project#65468, which
changes six lines inside `installation.rst`'s extras table. Whichever
lands first, the other rebases.

## Related issue number

Part of the ongoing RST-to-MyST conversion of `doc/source/`, following
ray-project#65467. Subsequent batches follow the same traffic-weighted ordering.

AI assistance was used to prepare this change.

## Checks

- [x] I've signed off every commit (`git commit -s`).
- [x] I've run `scripts/format.sh` to lint the changes in this PR.
- [x] I've included any doc changes needed for the change.
- [x] Testing strategy
- [x] Unit tests: not applicable; no `BUILD.bazel` or CI wiring changes
in this batch.
  - [x] Release tests: not applicable.
- [x] This PR is not tested (please justify below): the decisive checks
for a conversion are the RtD preview build under `fail_on_warning: true`
and the rendered diff against `/en/master`, both listed above.

---------

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

Labels

core Issues that should be addressed in Ray Core devprod docs An issue or change related to documentation go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants