Skip to content

docs: fix RST double-backtick notation breaking API cross-reference links#658

Merged
planetf1 merged 1 commit intogenerative-computing:mainfrom
planetf1:docs/fix-rst-backtick-crossrefs
Mar 17, 2026
Merged

docs: fix RST double-backtick notation breaking API cross-reference links#658
planetf1 merged 1 commit intogenerative-computing:mainfrom
planetf1:docs/fix-rst-backtick-crossrefs

Conversation

@planetf1
Copy link
Contributor

@planetf1 planetf1 commented Mar 16, 2026

docs: fix RST double-backtick notation breaking API cross-reference links

Type of PR

  • Bug Fix
  • New Feature
  • Documentation
  • Other

Description

API doc pages were displaying cross-references as raw markdown text rather than clickable links. For example, on mellea.backends.backend, the class description rendered as:

FormatterBackend extends the abstract [`Backend`](../core/backend#class-backend)…

— the link syntax appeared as inline code rather than a hyperlink.

Root cause: 91 source files use RST-style ``Symbol`` double-backtick notation (Sphinx convention). The add_cross_references build step matched the inner backtick boundary and generated a link wrapped in an extra code span:

``Backend``  →  `[`Backend`](url)`   ← renders as code, not a link

Fix: A new normalize_rst_backticks() pass in decorate_api_mdx.py converts ``x`` → `x` in MDX prose before add_cross_references runs. A new validate_rst_docstrings() check in validate.py detects remaining occurrences and reports them as a build warning (does not fail the build).

The 992 occurrences across 91 source files are tracked for cleanup in #657.

CI validation output after this fix:

✅ Source links:      PASS
✅ Coverage:          PASS
✅ MDX syntax:        PASS
✅ Internal links:    PASS
✅ Anchor collisions: PASS
⚠️ RST docstrings:   WARN — 992 occurrences across 91 files (cleanup: #657)

Overall: ✅ PASS

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code was added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

…inks

RST-style ``Symbol`` in docstrings caused add_cross_references to
generate malformed link syntax: `[`Symbol`](url)` renders as inline
code rather than a clickable link in Mintlify.

- Add normalize_rst_backticks() pass in decorate_api_mdx.py (runs before
  add_cross_references) to convert ``x`` to `x` in MDX prose
- Add validate_rst_docstrings() in validate.py to scan source files and
  report occurrences as a warning (does not fail the build)

91 source files / 992 occurrences detected; fix is applied at build time.
Source cleanup tracked separately.
@planetf1 planetf1 requested a review from a team as a code owner March 16, 2026 17:24
@mergify
Copy link

mergify bot commented Mar 16, 2026

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert|release)(?:\(.+\))?:

@planetf1 planetf1 assigned nrfulton and planetf1 and unassigned nrfulton Mar 16, 2026
@planetf1 planetf1 enabled auto-merge March 16, 2026 17:31
@psschwei
Copy link
Member

need to decide if we want to merge this one or #659

@jakelorocco
Copy link
Contributor

@planetf1, is there a ruff linting rule we can activate to prevent future misuses? If so, I think we should #659 and then just enable the rule / add a quality check instead of doing the change at doc compile time.

@planetf1
Copy link
Contributor Author

planetf1 commented Mar 16, 2026

I'm looking at the other PR which is indeed appropriate to fix.

There's 2 issues currently - short term/proper fix - this was to avoid risk/approval and get broken doc fixed quickly since we published it a few hours ago.

I would recommend we merge this issue in any case - it's not inconsistent in any way, and also adds a validation check for bad links. This is currently a soft check so after merge will report the RST issues.

Then if we merge #659 we'll see that validation drop by 0

We already have an issue open to move soft fail to hard fail in #f616 (this should include seeing if any parts can be replaced/augmented by ruff checks)

The benefit #659 brings is it's another step completed quickly :-)

So I see a progression here.. we get better step by step :-)

@planetf1
Copy link
Contributor Author

Minor: generate_report() docstring not updated for the new rst_docstring_errors parameter. Otherwise looks clean.

@planetf1
Copy link
Contributor Author

re: above -- docstring fixed

@planetf1 planetf1 added this pull request to the merge queue Mar 17, 2026
Merged via the queue into generative-computing:main with commit 98c0e22 Mar 17, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: RST double-backtick notation breaks API cross-reference links

4 participants