Document where to declare imports for nested snippets#6440
Open
aicortez wants to merge 2 commits into
Open
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
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
The reusable snippets page says snippets "can import other snippets" but never says where the import must be declared. Declaring a nested snippet's import in the top-level page instead of the parent snippet silently renders empty content, because each file resolves its own imports — page-level imports don't apply inside imported snippets. Whether it happens to work is import order-dependent, so the same pattern can work on one page and fail on another.
This adds a "Nested snippets" section stating the rule (declare the import in the snippet file that uses the nested snippet), explaining why, and showing a parent/child snippet example. Also links to it from the "Create snippets" section, the only other place nesting is mentioned.
🤖 Generated with Claude Code
Note
Low Risk
Documentation-only changes to
create/reusable-snippets.mdxwith no runtime, auth, or data impact.Overview
Documents a common nested snippets pitfall: nested imports must live in the parent snippet file, not on the page that imports the parent, because each MDX file resolves its own imports and page-level imports do not apply inside imported snippet content (which can silently render empty).
Adds a Nested snippets subsection with that rule, a short explanation, and parent/child MDX examples, plus a link from Create snippets where nesting is first mentioned.
Reformats several how-to sections (Import text, variables, snippets with variables, React components) from numbered lists into
<Steps>/<Step>blocks for consistency with the new nested-snippet walkthrough.Reviewed by Cursor Bugbot for commit 44f1f93. Bugbot is set up for automated code reviews on this repo. Configure here.