feat: add anchor validation to internal link checker#748
Merged
Conversation
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
Contributor
There was a problem hiding this comment.
Pull request overview
Extend the docs link-checking tool to validate internal link fragments (#anchors) by extracting valid anchors from MDX/Markdown content, and fix newly-detected broken anchors across EN/JA/ZH docs.
Changes:
- Add per-file anchor extraction + validation to
tools/check-links.py(headings, custom IDs,<a id="">, and Mintlify Tab/Accordion titles). - Skip anchor validation for
/api-reference/...links where anchors are not derived from page MDX. - Update multiple documentation pages to use the correct (translated/updated) anchor slugs.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/check-links.py | Adds anchor extraction, caching, and validation for internal links with fragments. |
| en/use-dify/knowledge/test-retrieval.mdx | Fixes internal anchor to match updated heading slug in the indexing/retrieval settings page. |
| en/self-host/troubleshooting/weaviate-v4-migration.mdx | Fixes a percent-encoded anchor to the canonical slug form. |
| en/develop-plugin/features-and-specs/plugin-types/tool.mdx | Updates card links to correct anchors (variables, custom-output-variables). |
| en/develop-plugin/dev-guides-and-walkthroughs/datasource-plugin.mdx | Updates links to tool-plugin sections with current heading slugs. |
| ja/use-dify/nodes/user-input.mdx | Updates same-page anchor to match Japanese heading slug. |
| ja/use-dify/knowledge/test-retrieval.mdx | Fixes anchor/link text to match current Japanese section heading. |
| ja/self-host/troubleshooting/weaviate-v4-migration.mdx | Updates troubleshooting anchor to Japanese heading slug. |
| ja/develop-plugin/features-and-specs/plugin-types/tool.mdx | Updates card links to match Japanese section anchors. |
| ja/develop-plugin/features-and-specs/plugin-types/model-schema.mdx | Updates card links to match Japanese section anchors. |
| ja/develop-plugin/dev-guides-and-walkthroughs/datasource-plugin.mdx | Updates links to tool-plugin sections with current Japanese heading slugs. |
| zh/use-dify/nodes/user-input.mdx | Updates same-page anchor to match Chinese heading slug. |
| zh/self-host/troubleshooting/weaviate-v4-migration.mdx | Updates troubleshooting anchor to Chinese heading slug. |
| zh/develop-plugin/features-and-specs/plugin-types/tool.mdx | Updates card links to match Chinese section anchors. |
| zh/develop-plugin/features-and-specs/plugin-types/model-schema.mdx | Updates card links to match Chinese section anchors. |
| zh/develop-plugin/dev-guides-and-walkthroughs/datasource-plugin.mdx | Updates links to tool-plugin sections with current Chinese heading slugs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
Extend
tools/check-links.pyto validate the#anchorportion of internal links, not just the file portion. Previously the checker stripped anchors before resolving, so a link like/foo/bar#stalewould pass as long as/foo/barexisted.The checker now extracts anchors from:
{#id}and<a id="...">syntax<Tab title="...">and<Accordion title="...">, which generate per-tab anchors from the title attributeSame-page
#anchorlinks are validated against the source file. API reference paths (/api-reference/...) are skipped because their anchors come from OpenAPI specs rather than MDX content; supporting those would require resolving and parsing the spec referenced indocs.json.Anchors fixed as a side effect
The new check surfaced 29 broken anchors across en/zh/ja, fixed in the second commit. They fall into three groups:
#variable→#variables, URL-encoded colon in a Weaviate migration anchor).#model-provider→#モデルプロバイダー/#模型提供商).datasource-plugin.mdxpointing to a "Hello World Guide" structure that no longer matches the currenttool-plugin.mdx. Both link text and anchors updated.