Skip to content

[doc] Convert the four remaining wrapped card grids to native MyST - #65472

Merged
dstrodtman merged 12 commits into
masterfrom
doc-1521-native-grid-cleanup
Aug 14, 2026
Merged

dstrodtman merged 12 commits into
masterfrom
doc-1521-native-grid-cleanup

Conversation

@dstrodtman

Copy link
Copy Markdown
Contributor

Why are these changes needed?

Stacked on #65470. Four pages are already Markdown but keep their sphinx-design card grids as RST inside an {eval-rst} block:

File Cards
cluster/kubernetes/index.md 6
serve/index.md 5
cluster/vms/index.md 4
ray-overview/index.md 3

That pattern predates native MyST card support and, until #65470, was the only card-grid precedent in the tree. Now that the seven highest-traffic front doors use native fences, these four are the remainder. Converting them leaves one pattern instead of two, so batches 4 through 8 have an unambiguous model to copy.

What changed

Each {eval-rst} grid becomes native colon fences, widest on the outside:

::::{grid} 1 2 2 2
:gutter: 1
:class-container: container pb-3

:::{grid-item-card}
:class-img-top: pt-2 w-75 d-block mx-auto fixed-height-img

**Getting Started**
^^^
Body text.

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

Button text

:::
::::


Format-only. Grid and card options, the `^^^` and `+++` separators, and every `button-ref` target are preserved verbatim.

**The one non-mechanical part:** a native card's content parses as Markdown, not RST, so the `:doc:` and `:ref:` roles in the card bodies had to become `{doc}` and `{ref}` in the same pass. Left as RST they wouldn't warn — they'd render as literal text through a green build. `ray-overview/index.md` has six `:doc:` roles in one card and `serve/index.md` has ten `:ref:` roles across five, so this is the bulk of the non-whitespace diff.

The separate `{eval-rst}` block in `cluster/kubernetes/index.md` holding an `.. image::` and a source-document comment is left alone. It isn't a grid, and folding it in would widen this PR past its stated scope.

## Verification

- Fence balance checked at every colon width on all four files; backtick fences even; no residual `:doc:`/`:ref:`/``` `` ``` RST outside fences.
- Read the Docs preview under `fail_on_warning: true`.
- `render_diff.py` against `/en/master` for all four pages. **Please hold the merge until I've posted those results in a comment** — the render diff is the only check that catches a card whose nested content silently degraded.

## Not a duplicate

`gh pr list --repo ray-project/ray --state open` shows no other PR touching these four files.

## Related issue number

Follows #65470. The mapping and the `nested_parse` caveat behind this change are documented in #65471.

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 CI or `BUILD.bazel` wiring changes.
  - [x] Release tests: not applicable.
  - [x] This PR is not tested (please justify below): the decisive checks for a format conversion are the RtD preview under `fail_on_warning: true` and the rendered diff against `/en/master`, both listed above.

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]>
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]>
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]>
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]>
Second batch of the RST-to-MyST conversion of doc/source. These are the
seven library front-door pages, 1,889 lines and 18% of all .rst page views
over the last 90 days:

  tune/index, ray-core/walkthrough, data/data, train/train,
  ray-overview/installation, ray-overview/ray-libraries,
  cluster/getting-started

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

The sphinx-design card grids convert to native MyST fences rather than
staying RST inside an {eval-rst} block. sphinx-design supports MyST
first-class, the ^^^ and +++ separators are split out of the raw content
before any parsing, and the grid directives are ordinary docutils
directives that MyST dispatches the same way it already dispatches
{tab-set} in a dozen .md pages.

doc/source/ray-overview/getting-started.md linked to ../tune/index.rst,
which would dangle after the rename. It becomes a {doc} reference.

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

@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 several documentation files across the Kubernetes, VMs, Ray Overview, and Serve sections by migrating Sphinx-style eval-rst grid, card, and button directives to native MyST Markdown syntax. It also updates legacy role syntax like :doc: and :ref: to the MyST {doc} and {ref} formats. No review comments were provided, so there is no additional feedback.

The RtD build was green and silent on all three.

The nightly-wheel table's links broke. The RST simple table's cells used
named hyperlink references whose targets were defined in the same
{eval-rst} block, and those resolved as internal anchors rather than the
S3 URLs, so all eight Linux wheel links pointed at #linux-python-3-10-x86-64
and friends instead of downloading anything. The table becomes a
{list-table} with the URLs inlined, matching the MacOS and Windows tabs
that were already list-tables. Inlining the URLs into the simple table
wasn't an option: cell text longer than the column ruler breaks it.

"<no tag>" in the platform-tag table rendered as an empty HTML element.
CommonMark parsed it as a tag; RST rendered it as literal text. Escaped.

Vale's Data scope now covers this file. doc/source/data/data.rst was
exempt from the link-text spell check because .vale.ini's [*.rst]
TokenIgnores skips backtick-wrapped tokens, and an RST link is entirely
backtick-wrapped. A Markdown link's text isn't, so "Instacart" started
failing Vale.Spelling. Added to the Data vocabulary, next to the
Predibase and Spotify entries that were presumably added the same way.

Signed-off-by: Douglas Strodtman <[email protected]>
@ray-gardener ray-gardener Bot added docs An issue or change related to documentation core Issues that should be addressed in Ray Core labels Aug 14, 2026
MyST slugifies the apostrophe differently from docutils, moving the
section anchor from #what-s-next to #whats-next. The heading carries no
explicit label, so it gets a compat target with the old slug.

ray-core/walkthrough.md has the same apostrophe heading but already
carries (core-walkthrough)=, which is the anchor callers should use, so
it gets nothing rather than a second target.

Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman
dstrodtman force-pushed the doc-1521-native-grid-cleanup branch from 5000d61 to 1518459 Compare August 14, 2026 09:21
The RST simple table this replaced emitted no <colgroup>, so ":widths:
49 51" was the last remaining render diff on the page. ":widths: auto"
suppresses it.

Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman
dstrodtman force-pushed the doc-1521-native-grid-cleanup branch from 1518459 to 3f823d0 Compare August 14, 2026 09:41
@dstrodtman

Copy link
Copy Markdown
Contributor Author

Render diff: 4/4 identical

fail_on_warning build green, and render_diff.py against /en/master is clean on every page:

IDENTICAL  cluster/kubernetes/index.html
IDENTICAL  cluster/vms/index.html
IDENTICAL  ray-overview/index.html
IDENTICAL  serve/index.html
4/4 pages render identically

Worth noting for the wider conversion: this is the controlled comparison for native MyST card grids. These four pages changed only their grid markup, from {eval-rst}-wrapped RST to native fences, and the rendered HTML is byte-identical after the script's two known-inert filters. Whatever else native grids might cost, rendering fidelity isn't it.

Whitespace-only. Each paragraph and list item becomes one line, leaving
wrapping to the editor and renderer. Kept as its own commit so the
conversion commit before it stays line-aligned with the .rst it replaces
and a reviewer can confirm the words are unchanged.

Code fences, fenced directives, list-table bodies, pipe tables, front
matter, and sphinx-design ^^^ and +++ card separators are untouched.
Verified on three axes per file: non-whitespace bytes byte-identical,
CommonMark+GFM render identical, and the transform idempotent.

Signed-off-by: Douglas Strodtman <[email protected]>
These four pages are already Markdown but keep their sphinx-design card
grids as RST inside an {eval-rst} block, which predates native MyST card
support. With the seven front doors converted natively, this leaves the
tree with one pattern instead of two.

  cluster/kubernetes/index.md, cluster/vms/index.md,
  ray-overview/index.md, serve/index.md

Format-only. Grid and card options, the ^^^ and +++ separators, and every
button target are preserved. Because a native card's content parses as
Markdown rather than RST, the :doc: and :ref: roles in the card bodies
become {doc} and {ref} in the same pass.

The separate {eval-rst} block in cluster/kubernetes/index.md holding an
.. image:: and a source-document comment is left alone; it isn't a grid.

Signed-off-by: Douglas Strodtman <[email protected]>
@dstrodtman
dstrodtman force-pushed the doc-1521-native-grid-cleanup branch from 3f823d0 to 106cd61 Compare August 14, 2026 10:11
@dstrodtman dstrodtman added the go add ONLY when ready to merge, run all tests label Aug 14, 2026
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]>
Base automatically changed from doc-1521-rst-myst-card-grids to master August 14, 2026 19:25
@dstrodtman
dstrodtman requested review from a team as code owners August 14, 2026 19:25
@dstrodtman
dstrodtman requested a review from a team as a code owner August 14, 2026 19:25
…rid-cleanup

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

# Conflicts:
#	doc/source/cluster/key-concepts.md
#	doc/source/ray-core/key-concepts.md
#	doc/source/ray-overview/use-cases.md
#	doc/source/train/api/api.md
@dstrodtman dstrodtman added the docs-go RtD-only checks for docs-only changes. Doesn't run full library doc-test suites. label Aug 14, 2026
@dstrodtman
dstrodtman merged commit 05b51b2 into master Aug 14, 2026
6 checks passed
@dstrodtman
dstrodtman deleted the doc-1521-native-grid-cleanup branch August 14, 2026 19:46
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
…ay-project#65472)

## Why are these changes needed?

Stacked on ray-project#65470. Four pages are already Markdown but keep their
sphinx-design card grids as RST inside an `{eval-rst}` block:

| File | Cards |
| --- | --- |
| `cluster/kubernetes/index.md` | 6 |
| `serve/index.md` | 5 |
| `cluster/vms/index.md` | 4 |
| `ray-overview/index.md` | 3 |

That pattern predates native MyST card support and, until ray-project#65470, was
the only card-grid precedent in the tree. Now that the seven
highest-traffic front doors use native fences, these four are the
remainder. Converting them leaves one pattern instead of two, so batches
4 through 8 have an unambiguous model to copy.

## What changed

Each `{eval-rst}` grid becomes native colon fences, widest on the
outside:

```markdown
::::{grid} 1 2 2 2
:gutter: 1
:class-container: container pb-3

:::{grid-item-card}
:class-img-top: pt-2 w-75 d-block mx-auto fixed-height-img

**Getting Started**
^^^
Body text.

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

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

Format-only. Grid and card options, the `^^^` and `+++` separators, and
every `button-ref` target are preserved verbatim.

**The one non-mechanical part:** a native card's content parses as
Markdown, not RST, so the `:doc:` and `:ref:` roles in the card bodies
had to become `{doc}` and `{ref}` in the same pass. Left as RST they
wouldn't warn — they'd render as literal text through a green build.
`ray-overview/index.md` has six `:doc:` roles in one card and
`serve/index.md` has ten `:ref:` roles across five, so this is the bulk
of the non-whitespace diff.

The separate `{eval-rst}` block in `cluster/kubernetes/index.md` holding
an `.. image::` and a source-document comment is left alone. It isn't a
grid, and folding it in would widen this PR past its stated scope.

## Verification

- Fence balance checked at every colon width on all four files; backtick
fences even; no residual `:doc:`/`:ref:`/``` `` ``` RST outside fences.
- Read the Docs preview under `fail_on_warning: true`.
- `render_diff.py` against `/en/master` for all four pages. **Please
hold the merge until I've posted those results in a comment** — the
render diff is the only check that catches a card whose nested content
silently degraded.

## Not a duplicate

`gh pr list --repo ray-project/ray --state open` shows no other PR
touching these four files.

## Related issue number

Follows ray-project#65470. The mapping and the `nested_parse` caveat behind this
change are documented in ray-project#65471.

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 CI or `BUILD.bazel` wiring changes.
  - [x] Release tests: not applicable.
- [x] This PR is not tested (please justify below): the decisive checks
for a format conversion are the RtD preview 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
…ay-project#65472)

## Why are these changes needed?

Stacked on ray-project#65470. Four pages are already Markdown but keep their
sphinx-design card grids as RST inside an `{eval-rst}` block:

| File | Cards |
| --- | --- |
| `cluster/kubernetes/index.md` | 6 |
| `serve/index.md` | 5 |
| `cluster/vms/index.md` | 4 |
| `ray-overview/index.md` | 3 |

That pattern predates native MyST card support and, until ray-project#65470, was
the only card-grid precedent in the tree. Now that the seven
highest-traffic front doors use native fences, these four are the
remainder. Converting them leaves one pattern instead of two, so batches
4 through 8 have an unambiguous model to copy.

## What changed

Each `{eval-rst}` grid becomes native colon fences, widest on the
outside:

```markdown
::::{grid} 1 2 2 2
:gutter: 1
:class-container: container pb-3

:::{grid-item-card}
:class-img-top: pt-2 w-75 d-block mx-auto fixed-height-img

**Getting Started**
^^^
Body text.

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

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

Format-only. Grid and card options, the `^^^` and `+++` separators, and
every `button-ref` target are preserved verbatim.

**The one non-mechanical part:** a native card's content parses as
Markdown, not RST, so the `:doc:` and `:ref:` roles in the card bodies
had to become `{doc}` and `{ref}` in the same pass. Left as RST they
wouldn't warn — they'd render as literal text through a green build.
`ray-overview/index.md` has six `:doc:` roles in one card and
`serve/index.md` has ten `:ref:` roles across five, so this is the bulk
of the non-whitespace diff.

The separate `{eval-rst}` block in `cluster/kubernetes/index.md` holding
an `.. image::` and a source-document comment is left alone. It isn't a
grid, and folding it in would widen this PR past its stated scope.

## Verification

- Fence balance checked at every colon width on all four files; backtick
fences even; no residual `:doc:`/`:ref:`/``` `` ``` RST outside fences.
- Read the Docs preview under `fail_on_warning: true`.
- `render_diff.py` against `/en/master` for all four pages. **Please
hold the merge until I've posted those results in a comment** — the
render diff is the only check that catches a card whose nested content
silently degraded.

## Not a duplicate

`gh pr list --repo ray-project/ray --state open` shows no other PR
touching these four files.

## Related issue number

Follows ray-project#65470. The mapping and the `nested_parse` caveat behind this
change are documented in ray-project#65471.

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 CI or `BUILD.bazel` wiring changes.
  - [x] Release tests: not applicable.
- [x] This PR is not tested (please justify below): the decisive checks
for a format conversion are the RtD preview 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 docs An issue or change related to documentation docs-go RtD-only checks for docs-only changes. Doesn't run full library doc-test suites. 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