Skip to content

fix(templates): emit .mdx so Mintlify nav resolves auto-gen pages#22

Closed
WomB0ComB0 wants to merge 1 commit intomainfrom
feat/templates-emit-mdx
Closed

fix(templates): emit .mdx so Mintlify nav resolves auto-gen pages#22
WomB0ComB0 wants to merge 1 commit intomainfrom
feat/templates-emit-mdx

Conversation

@WomB0ComB0
Copy link
Copy Markdown
Member

@WomB0ComB0 WomB0ComB0 commented May 9, 2026

Summary

Each language template (api-docs.typescript.yml, api-docs.dotnet.yml, api-docs.python.yml) now ends with a .md -> .mdx rename + relative-link rewrite step, run after the pages-index builder.

Without this, the next regen force-pushes .md content into the docs repo and mint dev warns:

warning - "sdks/<lang>/api/README" is referenced in the docs.json navigation but the file does not exist.

Mintlify's nav resolver matches only .mdx for page ids in docs.json. In-content links accept either extension, but nav does not.

Why this insertion point

The rename runs after _pages.json is built so the index paths (which are already extensionless) are stable. Earlier post-processing steps (breadcrumb strip, bare-filename ./ prefix, MDX curly-brace escape) all target .md and run unchanged. The link-rewrite uses a paren-aware Python regex that skips external URLs (http://, https://, mailto:) and absolute paths (/).

Pairs with

Test plan

  • Merge.
  • Sync to consumer repos via three follow-up PRs.
  • Trigger api-docs on each, confirm the resulting docs PR's tree is .mdx.
  • mint dev no longer warns about missing nav-registered files.

Summary by CodeRabbit

  • Chores
    • Updated API documentation generation workflows for .NET, Python, and TypeScript to improve Mintlify platform compatibility. Documentation generation now includes automated file formatting adjustments and systematic link reference updates across all generated files, ensuring API documentation properly integrates with the documentation platform's navigation and indexing systems.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 9, 2026

Warning

Rate limit exceeded

@WomB0ComB0 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 55 minutes and 28 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: de6d3a70-58fe-4119-bf5a-12ebc86304d7

📥 Commits

Reviewing files that changed from the base of the PR and between 84cbf4e and 0a3b79a.

📒 Files selected for processing (3)
  • automation/source-repo-templates/api-docs.dotnet.yml
  • automation/source-repo-templates/api-docs.python.yml
  • automation/source-repo-templates/api-docs.typescript.yml
📝 Walkthrough

Walkthrough

Three API documentation workflows for .NET, Python, and TypeScript are updated to rename generated Markdown files from .md to .mdx to satisfy Mintlify navigation requirements, and to rewrite relative in-document links to use extensionless targets while preserving external URLs and fragment links.

Changes

MDX Extension and Link Rewriting for Mintlify Navigation

Layer / File(s) Summary
Comment Clarifications
automation/source-repo-templates/api-docs.dotnet.yml, automation/source-repo-templates/api-docs.python.yml, automation/source-repo-templates/api-docs.typescript.yml
"Build pages index" step comments are updated to clarify that the extensionless path list is built before the .md.mdx rename.
File Rename and Link Rewriting
automation/source-repo-templates/api-docs.dotnet.yml, automation/source-repo-templates/api-docs.python.yml, automation/source-repo-templates/api-docs.typescript.yml
New workflow steps rename all *.md files to *.mdx and run a Python regex to strip .md extensions from relative in-document markdown link targets, while preserving external URLs, mailto links, and absolute paths.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • resq-software/docs#15: Modifies the api-docs.dotnet.yml workflow's Mintlify post-processing and index ordering in a related manner.

Suggested labels

area:meta

Poem

🐰 Three workflows bloom in spring,
Renaming Markdown files to bring
Mintlify navigation cheer—
Extensionless links, clean and clear!
.mdx magic, links take flight,
Your docs are formatted just right! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(templates): emit .mdx so Mintlify nav resolves auto-gen pages' directly and accurately summarizes the main change: converting generated documentation from .md to .mdx format to resolve Mintlify navigation issues.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/templates-emit-mdx

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

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 introduces a step to rename generated Markdown files from .md to .mdx and update internal links across the .NET, Python, and TypeScript documentation workflows to satisfy Mintlify's navigation requirements. Feedback recommends standardizing the explanatory comments across all templates for consistency. Furthermore, there is a concern that the regex-based link replacement script does not account for code blocks or inline code spans, which could lead to unintended modifications of documentation examples.

Comment on lines +236 to +240
# Mintlify's docs.json nav resolver only matches .mdx.
# Leaving the tree as .md makes `mint dev` warn that
# nav-registered files do not exist. Rename every .md and
# rewrite the matching `(path.md)` / `(path.md#anchor)`
# link targets in place.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For clarity and consistency with the TypeScript template, consider adding the note that Mintlify accepts both extensions for in-content links, but requires .mdx for the navigation resolver. This helps explain why the link rewrite is beneficial but perhaps not as critical as the file rename.

        # Mintlify accepts both .md and .mdx for in-content links,
        # but its docs.json navigation resolver only matches .mdx.
        # Leaving the tree as .md makes mint dev warn that
        # nav-registered files do not exist. Rename every .md and
        # rewrite the matching (path.md) / (path.md#anchor)
        # link targets in place.

Comment on lines +247 to +255
python3 - <<'PY'
import pathlib, re
LINK = re.compile(r'(\]\()((?!https?://|mailto:|#|/)[^)\s]*?)(\.md)((?:#[^)]*)?)(\))')
for p in pathlib.Path(".").rglob("*.mdx"):
text = p.read_text(encoding="utf-8")
new = LINK.sub(r'\1\2.mdx\4\5', text)
if new != text:
p.write_text(new, encoding="utf-8")
PY
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The Python script for link rewriting does not respect Markdown code blocks or inline code spans. Per the general rules, post-processing should avoid modifying content inside code regions to prevent breaking examples. Consider using a more robust parsing approach (e.g., splitting by code fences) if literal link syntax is expected in the documentation prose.

References
  1. When processing Markdown/MDX files to escape curly braces for JSX compatibility, ensure the logic ignores content within inline code spans (backticks) to prevent breaking code snippets.

Comment on lines +312 to +316
# Mintlify's docs.json nav resolver only matches .mdx.
# Leaving the tree as .md makes `mint dev` warn that
# nav-registered files do not exist. Rename every .md and
# rewrite the matching `(path.md)` / `(path.md#anchor)`
# link targets in place.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For clarity and consistency with the TypeScript template, consider adding the note that Mintlify accepts both extensions for in-content links, but requires .mdx for the navigation resolver.

        # Mintlify accepts both .md and .mdx for in-content links,
        # but its docs.json navigation resolver only matches .mdx.
        # Leaving the tree as .md makes mint dev warn that
        # nav-registered files do not exist. Rename every .md and
        # rewrite the matching (path.md) / (path.md#anchor)
        # link targets in place.

Comment on lines +323 to +331
python3 - <<'PY'
import pathlib, re
LINK = re.compile(r'(\]\()((?!https?://|mailto:|#|/)[^)\s]*?)(\.md)((?:#[^)]*)?)(\))')
for p in pathlib.Path(".").rglob("*.mdx"):
text = p.read_text(encoding="utf-8")
new = LINK.sub(r'\1\2.mdx\4\5', text)
if new != text:
p.write_text(new, encoding="utf-8")
PY
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The Python script for link rewriting does not respect Markdown code blocks or inline code spans. Per the general rules, post-processing should avoid modifying content inside code regions to prevent breaking examples. Consider using a more robust parsing approach if literal link syntax is expected in the documentation prose.

References
  1. When processing Markdown/MDX files to escape curly braces for JSX compatibility, ensure the logic ignores content within inline code spans (backticks) to prevent breaking code snippets.

Comment on lines +233 to +241
python3 - <<'PY'
import pathlib, re
LINK = re.compile(r'(\]\()((?!https?://|mailto:|#|/)[^)\s]*?)(\.md)((?:#[^)]*)?)(\))')
for p in pathlib.Path(".").rglob("*.mdx"):
text = p.read_text(encoding="utf-8")
new = LINK.sub(r'\1\2.mdx\4\5', text)
if new != text:
p.write_text(new, encoding="utf-8")
PY
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The Python script for link rewriting does not respect Markdown code blocks or inline code spans. Per the general rules, post-processing should avoid modifying content inside code regions to prevent breaking examples. Consider using a more robust parsing approach if literal link syntax is expected in the documentation prose.

References
  1. When processing Markdown/MDX files to escape curly braces for JSX compatibility, ensure the logic ignores content within inline code spans (backticks) to prevent breaking code snippets.

Previous approach (commits 229acac, 84cbf4e on origin) renamed
every .md in the auto-generated tree to .mdx and rewrote
in-content link targets. The wholesale rename tripped Mintlify's
broken-links validation with 3832 broken-link errors because
Mintlify rejects explicit `.mdx` extensions in in-content links
(treats them as static-asset references rather than page
references). The previous attempt to fix the link form (strip
.md from targets, leave them extensionless) didn't help either:
Mintlify's broken-links also requires nav registration for any
non-.md link.

Scope the rename to ONLY the three files Mintlify's nav
resolver actually looks for:

- TypeScript: add a tiny `mv README.md README.mdx` step at the
  end (typedoc-plugin-markdown emits the README itself, so we
  rename the result rather than redirecting the generator).
- .NET: change the `Write top-level index` step's redirect
  target from `README.md` to `README.mdx`.
- Python: same as .NET.

Submodule pages stay .md. Mintlify treats their `(path.md)`
in-content links as page references and resolves them on disk
regardless of extension, so they continue to render correctly.

Pairs with #21 (one-shot rename of the same
three READMEs in the existing tree).
@WomB0ComB0
Copy link
Copy Markdown
Member Author

Closing — analysis on docs#21 showed the .mdx-rename was the wrong fix. Mintlify's .mdx parent files have stricter link resolution that breaks the auto-generated cross-references (3832 broken-links errors), whereas .md parents resolve filesystem-style and pass cleanly. The 'is referenced in nav but does not exist' warning from mint dev is cosmetic; Mintlify still renders the page. Templates stay emitting .md, no change needed.

@WomB0ComB0 WomB0ComB0 closed this May 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:content MDX/MD documentation content

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants