docs: make API reference cross-links version-aware - #5092
Open
harshasiddartha wants to merge 1 commit into
Open
Conversation
crd-ref-docs derives Markdown anchors from the type name alone. Eleven types are defined in both ray.io/v1 and ray.io/v1alpha1 (RayClusterSpec, WorkerGroupSpec, RayJob, ...), so both sections emit the same anchor. Markdown renderers de-duplicate the heading ids (`rayclusterspec`, `rayclusterspec_1`) but not the links, so all 23 cross-links in the ray.io/v1alpha1 section resolved to the ray.io/v1 definition of the type. The failure was silent: no broken link, no warning at generation time, and the two definitions differ substantially (RayClusterSpec has 14 fields in v1 and 7 in v1alpha1). Point `make api-docs` at a local copy of the crd-ref-docs Markdown templates that emits an explicit, version-qualified anchor next to each type heading (`#rayclusterspec-v1alpha1`) and resolves every cross-reference against it. Heading text is unchanged, so the auto-generated heading ids the published site already exposes still exist and existing deep links such as `#rayclusterspec` keep working. Closes ray-project#5091 Signed-off-by: harshasiddartha <siddartha2367@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why are these changes needed?
crd-ref-docsderives Markdown anchors from the type name alone, so the eleven types that exist in bothray.io/v1andray.io/v1alpha1(RayClusterSpec,WorkerGroupSpec,RayJob, ...) emit the same anchor twice. Markdown renderers de-duplicate the heading ids (rayclusterspec,rayclusterspec_1) but not the links, so all 23 cross-links in theray.io/v1alpha1section ofdocs/reference/api.mdresolved to theray.io/v1definition. The failure is silent — no broken link, no warning at generation time — and the definitions differ substantially (RayClusterSpechas 14 fields in v1 and 7 in v1alpha1), so a reader following a v1alpha1 link lands on a table advertising fields that do not exist in v1alpha1.This is issue direction (1): version-qualified slugs, fixed in the generation step rather than by post-processing the output.
make api-docsnow renders through a local copy of the upstreamcrd-ref-docsMarkdown templates (ray-operator/hack/api-docs-templates/). The only change from upstream is that each type heading carries an explicit, version-qualified anchor and every cross-reference resolves against it:Heading text is byte-for-byte unchanged, so the auto-generated ids the published site already exposes (
#rayclusterspec,#rayclusterspec_1) still exist and existing external deep links keep working.Before / after
Heading (
RayClusterSpec,ray.io/v1alpha1section):Cross-link from
AutoscalerOptionsin theray.io/v1alpha1section:Field reference in the v1alpha1
RayClusterSpectable:All 23 previously-wrong links in the v1alpha1 section, after regeneration:
Related issue number
Closes #5091
Labels
doc-updates-requiredlabel.breaking-changelabel.Checks
Manual test instructions
Also verified:
./hack/verify-api-docs.sh->./hack/../../docs/reference up to date.(regeneration is idempotent, so the consistency check passes)go build ./...inray-operator/-> cleanmarkdownlint-cli@0.44.0 --disable=MD033ondocs/reference/api.md: no new violations;MD024/no-duplicate-headingdrops from 12 to 1MD033(inline HTML) is already disabled in.pre-commit-config.yaml, so the<a>anchors don't trip the linter. Thenameattribute is emitted alongsideidso the anchors also resolve when the file is viewed on GitHub.ray-operator/DEVELOPMENT.mdnotes that the templates are a fork of the upstream ones and should be re-synced when thecrd-ref-docsversion is bumped.