Repository navigation
[doc] Conversion tooling: render diff, card-grid mapping, and a soft-wrap skill - #65469
Conversation
The skill treated a green fail_on_warning build as near-sufficient evidence that
a conversion was faithful. It isn't. Converting the first batch of landing pages
produced three regressions that built clean and warned about nothing:
- doc/source/index.rst carries its browser title in a .. title:: directive. That
directive does not set the document title from inside an {eval-rst} block, so
the site root rendered as "<no title>".
- An RST .. image:: with no :alt: takes its alt text from the URI and emits a
bare <img>. The skill mapped it to , which emits alt="" wrapped in a
<p>.
- default_role = "code" makes a single-backtick RST literal render as
<code class="code docutils literal notranslate">. The skill called the
Markdown single-backtick "byte-faithful"; it drops the code class.
Add render_diff.py, which fetches the RtD preview and /en/master for each page,
extracts <article>, normalizes the host, release string, and search-highlight
params, and diffs. It filters the two differences every MyST page shows against
an RST page, both verified inert: the tex2jax_ignore/mathjax_ignore classes
myst-parser stamps on every document, and the missing code class above, which
carries no styling in Ray's CSS or in pydata-sphinx-theme.
Promote that from an afterthought to a required verification step, and say
plainly what it is for: steps 1-3 are all source-side or resolution-side, so
step 4 is the only one that can catch this class at all.
Also correct the mapping table for .. image::, add rows for .. figure:: and
.. title::, and add Hard rule 5 covering all three page-identity constructs.
AI assistance was used to prepare this change.
Signed-off-by: Douglas Strodtman <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request updates the RST-to-MyST conversion documentation and introduces a new utility script, render_diff.py, to compare Read the Docs PR previews against the master branch to detect rendering regressions. The reviewer feedback is highly constructive, suggesting improvements to make the script more robust. Key recommendations include handling network errors gracefully using urllib.error, manipulating the BeautifulSoup parse tree directly instead of using fragile regexes to strip benign classes, and fixing a potential exit code wrapping issue when there are multiple of 256 differing pages.
| BENIGN = [ | ||
| (re.compile(r'\s*class="tex2jax_ignore mathjax_ignore"'), ""), | ||
| (re.compile(r'class="code (docutils literal notranslate)"'), r'class="\1"'), | ||
| ] |
| def compare(page: str, preview_base: str, keep_benign: bool, context: int) -> bool: | ||
| """Print one page's diff. Returns True when the page differs.""" | ||
| master_title, master_lines = normalize(fetch(MASTER + page), MASTER, keep_benign) | ||
| preview_title, preview_lines = normalize( | ||
| fetch(preview_base + page), preview_base, keep_benign | ||
| ) |
There was a problem hiding this comment.
To make the script more robust and user-friendly:
- Strip any leading slashes from
pageto prevent double slashes when appending to the base URLs. - Catch
urllib.error.URLErrorto handle network or HTTP errors (such as 404 for new pages or temporary network issues) gracefully with a clean error message instead of crashing with a traceback.
def compare(page: str, preview_base: str, keep_benign: bool, context: int) -> bool:
"""Print one page's diff. Returns True when the page differs."""
page = page.lstrip("/")
try:
master_html = fetch(MASTER + page)
except urllib.error.URLError as e:
print(f"ERROR {page} (failed to fetch from master: {e})")
return True
try:
preview_html = fetch(preview_base + page)
except urllib.error.URLError as e:
print(f"ERROR {page} (failed to fetch from preview: {e})")
return True
master_title, master_lines = normalize(master_html, MASTER, keep_benign)
preview_title, preview_lines = normalize(preview_html, preview_base, keep_benign)…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]>
|
Thanks — took all six. Pushed in 6570e72. Bugbot, title version normalization. Correct, and the one I'd have been most annoyed to hit later. Gemini, strip classes from the parse tree rather than the serialized HTML. Agreed, and for a sharper reason than tidiness: the regex matched one exact class string, so a change in class order or one added class would have silently stopped matching and resurrected the diff it exists to remove — and it would have read as a regression in the page, not a bug in the filter. Now done on the tree via Gemini, catch Gemini, exit code masking. Taken, capped at 125 rather than collapsed to 1, so the count stays usable for a normal-sized batch while a 256-page run can't wrap to success. Re-verified against #65467's preview after the refactor: all nine converted pages still report |
Batch 1 converted the seven card-grid library front doors, and the skill
had no mapping for `grid`, `grid-item-card`, `button-ref`, `button-link`,
or `div`. It also had no entry for RST named hyperlink targets, which
`installation.rst` uses twenty times.
Adds mapping rows for all of the above, plus two construct notes:
- Card grids convert to native MyST colon fences, widest on the outside.
`^^^` and `+++` need no translation because sphinx-design splits them
out of the raw content lines before parsing. The trap is `nested_parse`:
grid, div, and Ray's own callout/annotations directives all parse their
content as Markdown under MyST, so RST left inside a card renders as
literal text through a green build. Step 4's dangling reference to "the
`nested_parse` degradation below" now points at a real note.
- Named hyperlink targets inline as Markdown links, except where an
`{eval-rst}` table's cells reference them, in which case the definitions
stay RST inside that same block.
Also records two verified facts: sphinx-design 0.7.0's MyST support, and
that `_replace_numbers()` in `doc/source/_ext/callouts.py` discards its
own result, so annotation text keeps literal `<1>` markers either way.
Signed-off-by: Douglas Strodtman <[email protected]>
docutils and MyST slugify an apostrophe differently, so converting a heading like "What's Ray Core?" moves its anchor from #what-s-ray-core to #whats-ray-core. Green build, no warning, dead inbound links. Adds Hard rule 7: if the heading already carries an explicit label, that label is the anchor and you add nothing; only a bare heading gets a compat target with the old docutils slug. Never two targets on one heading. Signed-off-by: Douglas Strodtman <[email protected]>
The RST-to-MyST conversion produces hard-wrapped .md because the source RST is hard-wrapped, but Ray prose in .md is soft-wrapped. This adds the deterministic reflow tooling next to the skill that needs it. ray-soft-wrap collapses each paragraph and list item to one line and leaves code, directives, tables, math, front matter, and sphinx-design card separators untouched. verify.py gates a pass on three axes: non-whitespace bytes byte-identical, CommonMark+GFM render identical, and the transform idempotent. softwrap.py grows a --selftest with regression cases for the boundaries verify.py cannot see, following the same pattern as sphinx-fix. The card-separator case is there because the engine used to fold a card's bold title, its ^^^ separator, and its body into one line, silently dropping the card header while all three verify.py checks still reported ok -- the render oracle is CommonMark, which has no concept of a sphinx-design card. rst-to-myst now says to keep the source line-wrapping in the conversion commit, so that diff stays line-aligned and reviewable against the .rst, and to reflow in a separate whitespace-only commit. Signed-off-by: Douglas Strodtman <[email protected]>
The note claimed _replace_numbers() discards its own result and that annotation text therefore keeps literal <1> markers. Both are wrong. self.content is a docutils StringList, not a str, and StringList.replace mutates in place and returns None -- so discarding the return value is harmless and the substitution has already happened. /en/master/tune/ index.html renders six each of the circled numerals, not <1>. What is real is a misleading signature over a working function: the content: str hint and the "returns the formatted string" docstring both describe behavior it does not have, and passing it an actual str would silently no-op. Rewritten to say that, and to warn against "fixing" the discarded return value. Signed-off-by: Douglas Strodtman <[email protected]>
The HTML rule matched CommonMark's 3-space window for opening an HTML block,
so raw HTML carrying a directive body's indentation fell through to the prose
path and got joined. Ray has such a block: use-cases.md nests an SVG icon in a
`.. raw:: html` block inside a `{query-param-ref}` body, whose content Sphinx
re-parses with docutils, where the indented block is raw HTML rather than an
indented code block. The engine collapsed the icon onto one 3,000-character
line while all three of verify.py's checks reported ok, since the render oracle
treats an HTML block as opaque passthrough and normalizes whitespace inside it.
Match raw HTML at any indentation, and run a multi-line HTML comment verbatim
to its `-->` so a comment's interior stays as the author wrote it. Two
regression cases cover both, since verify.py's oracle can't see either.
Across all 241 Markdown files in doc/source, the new engine differs from the
old one on exactly one file, use-cases.md, and only by leaving eight raw-HTML
lines wrapped. The content invariant holds everywhere.
Signed-off-by: Douglas Strodtman <[email protected]>
|
Read through this carefully, and I think there's a third member of the exact class you're hunting here — one that's still live.
|
| check | why it can't see it |
|---|---|
content invariant, softwrap.py:370 |
re.sub(r"\s+", "", ...) on both sides |
render oracle, verify.py:50 |
re.sub(r"\s+", " ", html) — <pre> isn't exempt |
| idempotency | the joined form is a stable fixed point |
render_diff.py:118 |
same whitespace collapse on the serialized <article> |
I checked the last one directly rather than assuming — feeding normalize() two <article> fragments that differ only in newlines inside a <pre> returns identical line lists and an IDENTICAL verdict. So for the reflow commit that step 3 now tells you to make, step 4 isn't a backstop for this.
verify.py on the reflowed file:
content=ok render=ok idempotent=ok example.md
RESULT: all 1 file(s) passed.
Scope in the tree today. Running the engine over all 260 .md files under doc/source changes 20, and exactly one has its code-block content altered: _collections/ray-overview/examples/multi_agent_a2a/README.md, whose 22-line directory-tree diagram flattens onto a single line. That one is sphinx_collections output (gitignored at doc/.gitignore:32), so it regenerates — but it's the shape that matters, because synced example READMEs are full of tree diagrams and indented console output. The two tracked files with indented blocks (serve/tutorials/video-analysis/README.md, tune/tutorials/tune_get_data_in_and_out.md) survive only by luck: their indented lines are blank-line-separated, so every run is a single line and gets emitted verbatim.
A guard consistent with the engine's existing shape: after a blank line, a line indented ≥4 spaces opens a verbatim run until the next non-blank line indented <4. That leaves a 4-space-indented list-item continuation paragraph wrapped, which is the "Known under-reflow (safe)" direction the skill already prefers. Worth a --selftest case, since by construction nothing else can catch a regression in it.
verify.py reports "passed" when it hasn't verified
verify.py:129 folds None into passing, so both of these exit 0 under RESULT: all N file(s) passed (verify.py:147):
- No reference — a new or untracked file. Prints
content=-- render=-- idempotent=ok, then "all 1 file(s) passed". Two of the three checks silently didn't run. markdown-it-pynot installed — render check skipped, still "passed".
This is the standard the PR sets for render_diff.py and argues for well in the description — "a typo'd path or an unpublished preview has to read as 'not verified', never as 'verified clean'" — just not applied here. The two findings also compose: _collections/ is gitignored, so the one file that actually corrupts today is also one verify.py structurally cannot compare.
Suggested: treat a missing reference or an unavailable oracle as NOT VERIFIED with a non-zero exit, matching render_diff.py's ERROR path.
Nit: render_diff.py:128 misses read timeouts
except urllib.error.URLError covers HTTPError and connection failures, but a read timeout comes out of response.read() as a bare TimeoutError — confirmed against a stalling local socket:
raised: builtins.TimeoutError
is URLError? -> False
is OSError? -> True
So a slow preview tracebacks instead of printing the ERROR … not verified line it's supposed to. except OSError covers both, since URLError subclasses it.
Nit: the skill's PR step drops Ray's PR-body requirements
ray-soft-wrap/SKILL.md's last step hands an agent a gh pr create --repo ray-project/ray recipe. It cites the root AGENTS.md for the commit conventions and DCO, but the body requirements aren't carried over — why the change isn't a duplicate, the test commands and their results, and the AI-assistance disclosure. Worth inlining, given the skill is checked into the repo that mandates them.
Things I checked that are clean: ruff 0.8.4 (with --select I) and black against Ray's pyproject.toml pass on all three scripts — doc/.claude/skills/ isn't in the pre-commit exclude, only sphinx-fix/tests/ is — and --selftest is 7/7. The "pulls no CI suite" claim checks out too: init on build 71900 logged selected tags: always for all six files.
AI assistance was used for this analysis.
The skill documented its own fork-and-PR flow, which the sibling skills in this directory don't do and which AGENTS.md asks contributors not to duplicate. It also contradicted itself: the branch step based work on `origin/master` while the push step called `origin` the contributor's fork, so following both steps in a fork-based clone silently branched off a stale fork master instead of Ray's. Drop the push-and-open-PR step and point at AGENTS.md and CONTRIBUTING.rst, which already cover remotes, DCO, and the PR process. Make the branch step derive the remote that tracks ray-project/ray rather than assuming a name, and name the stale-base mistake it prevents. Leaves the soft-wrap mechanics, the scripts, and the verification gate untouched. Signed-off-by: Douglas Strodtman <[email protected]>
…ed files Three review findings, all the same shape: a check that reports green on work it never actually inspected. `softwrap.py` had no boundary for CommonMark's four-space indented code block, so the dispatch fell it through to the prose path and joined it. The output is still a valid code block holding every non-whitespace byte -- it just contains a command that no longer runs, `pip install ray` and `ray start --head` on one line. Nothing in the toolkit catches it: the content invariant and both render oracles collapse whitespace without exempting `<pre>`, and the joined form is a stable fixed point, so idempotency holds. The rst-to-myst render diff normalizes the serialized `<article>` the same way, so it isn't a backstop here either. That matters most for synced example READMEs, which are full of directory-tree diagrams and pasted console output. A line indented four or more spaces (or a tab) now opens a verbatim run when it follows a blank line or starts the document, closing at the next non-blank line indented less than four -- the same conditions CommonMark uses, since an indented line can't interrupt a paragraph. Anything else at that indentation, a nested list or a list-item continuation paragraph, is left wrapped rather than joined, which is the under-reflow direction. Two selftest cases cover it, because by construction no other check can. `verify.py` folded a `None` check into passing, so a file with no reference (new or untracked) and a run without markdown-it-py both printed `RESULT: all N file(s) passed` and exited 0 -- one and two of the three checks respectively having never run. Those now report `NOT VERIFIED` with the reason and exit non-zero, matching what `render_diff.py` already does for a failed fetch. The markdown-it-py warning becomes an error for the same reason. `render_diff.py` caught `urllib.error.URLError`, which misses a read timeout: that comes out of `response.read()` as a bare `TimeoutError`, an `OSError` but not a `URLError`, so a stalled preview raised a traceback instead of printing the `ERROR ... not verified` line. Widened to `OSError`, which covers both. Verified: `--selftest` 9/9; reflowing all 232 tracked `.md` files under `doc/source` reports `all 232 file(s) verified` and changes the same 8 files as before the guard; the tree-diagram and `pip install` cases flatten before the change and survive after; a stalling local socket now prints `ERROR ... timed out` and counts the page as differing; an untracked file and a blocked `markdown_it` import each report `NOT VERIFIED` and exit 1. `ruff check --select I` and `black --check` pass on all three scripts. AI assistance was used for this change. Signed-off-by: Douglas Strodtman <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e2f4e97. Configure here.
… open
The guard added in the previous commit required a preceding blank line, which
reads CommonMark's "an indented code block cannot interrupt a paragraph" as
"always needs a blank line." It doesn't. Indented code opens immediately after
any closed block, and confirmed against markdown-it-py, all of these render as
`<pre>` with no blank line between them:
## Install
pip install ray
ray start --head
```python
x = 1
```
pip install ray
Both were still being joined into a single unrunnable command, and every check
still reported green, which is the whole failure mode the guard exists to close.
The condition is now an empty `run`, which is precisely "no paragraph is open
right now" -- `run` accumulates only paragraph and list-item lines and is
flushed at every boundary the engine already models. That's strictly broader
than the blank-line test (a blank line flushes, so it implies an empty `run`)
and it's the actual CommonMark rule rather than a proxy for it. A line indented
four spaces mid-paragraph still joins, since there the run is non-empty.
Two selftest cases, one per shape above.
Verified: `--selftest` 11/11; a differential against markdown-it-py over six
shapes (ATX heading, setext heading, thematic break, closing fence, block quote,
mid-paragraph) now agrees with CommonMark on all six, where the blank-line
version missed four; reflowing all 232 tracked `.md` files under `doc/source`
still reports `all 232 file(s) verified` and still changes the same 8 files, so
the wider guard costs no reflow on the tracked tree.
AI assistance was used for this change.
Signed-off-by: Douglas Strodtman <[email protected]>
#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 #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. #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 - [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]>
…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 ``, 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]>
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]>
…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 ``, 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]>
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]>

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-mystskill treated a greenfail_on_warningbuild 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, changing a bare<img>into analt=""wrapped in a<p>; and single-backtick RST underdefault_role = "code"dropped acodeclass.render_diff.pyfetches the RtD PR preview and/en/masterfor each page, extracts<article>, normalizes the host, release string, and search-highlight params, and diffs.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.htmlIt 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 missingcodeclass above (no rule for it inpydata-sphinx-theme.css,theme.css, ordoc/source/_static/css/).--keep-benignshows them. It also labelsray-overview/examples.html, which differs between any two builds becausecustom_directives.pypicks its gallery icons withrandom.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 thedefault_rolenote.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'sTokenIgnoreshad 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, anddiv, plus a construct note covering the two non-obvious parts:^^^and+++need no translation. sphinx-design matches them withREGEX_HEADER/REGEX_FOOTERincards.pyand splits them out of the raw content lines before anything parses them.GridDirective,GridItemCardDirective,div, and Ray'scallout/annotationsall callself.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_parsedegradation below" and there was no such note.Two facts recorded from the pinned source rather than assumed:
sphinx_design==0.7.0supports MyST first-class (its own docs are MyST, it shipssnippets/myst/, and its directives register viaapp.add_directive); and the<1>-to-① substitution indoc/source/_ext/callouts.pyworks under MyST, in both of the independent places it happens —_replace_numbers()for annotation text andCalloutIncludePostTransformforliteral_blockcode.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.contentis a docutilsStringList, whosereplace()mutates in place and returnsNone, and/en/master/tune/index.htmlrenders the circled numerals today. The real defect is only a misleading signature — thecontent: strhint and the "returns the formatted string" docstring describe behavior the function doesn't have, so passing it an actualstrwould silently no-op. Worth fixing, but not here.3. Apostrophe headings move their anchor
docutils slugifies
What's Ray Core?towhat-s-ray-core; MyST produceswhats-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
.mdprose is soft-wrapped.ray-soft-wrapis the deterministic reflow:softwrap.pycollapses each paragraph and list item to one line, andverify.pygates a pass on three axes — non-whitespace bytes byte-identical, CommonMark+GFM render identical, transform idempotent.rst-to-mystnow 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.pygains a--selftest, followingsphinx-fix's pattern, with regression cases for the boundariesverify.py's oracle can't see: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 threeverify.pychecks reportedok, 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 touchingdoc/.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
git commit -s).scripts/format.shto lint the changes in this PR.softwrap.py --selftestpasses, and fails as intended when the card-separator guard is removed.render_diff.pyrun against [docs] Convert the nine highest-traffic landing pages from RST to MyST #65467, [docs] Convert the seven card-grid library front doors from RST to MyST #65470, and [doc] Convert the four remaining wrapped card grids to native MyST #65472. On [doc] Convert the four remaining wrapped card grids to native MyST #65472 all four pages render identically; on [docs] Convert the seven card-grid library front doors from RST to MyST #65470 four of seven do, with the three differences explained in that PR's comment.sphinx_design==0.7.0's source (cards.py,grids.py,extension.py).doc/.claude/only, which.buildkite/always.rules.txtandtest.rules.txtboth exclude from the build and which defines no Bazel targets, so it pulls no CI suite.