Prerequisites
- VS Code 1.85.0 or newer
- A documentation directory with a valid
docs.jsonfile - The Mintlify CLI, for the in-editor preview only
Install the extension
Install from the command line:- Open the Extensions view.
- Search for
@id:mintlify.mintlify-snippets. - Click Install.
.mdx file or a workspace containing a docs.json file.
Autocomplete
Type< to view every built-in component. Autocomplete suggests components’ properties and values inside tags.
The extension suggests components that you import from reusable snippets alongside built-in ones.
Diagnostics
The extension reports problems in the Problems panel and underlines them in your file as you write:- Unknown components.
- Unknown or duplicate properties.
- Invalid values for enumerated properties.
- Missing required properties.
- Unclosed or mismatched tags.
- Unresolved snippet imports.
mintlify.diagnostics.enabled to false.
Hover documentation
Hover over a component or property to see what it does and a link to its page in the Mintlify documentation. Hovering over a snippet component previews the contents of the snippet file.Go to definition
Hold CMD (macOS) or CTRL (Windows) and click to navigate to the definition of:- Snippet components.
- Import paths.
hrefandsrcattributes that point to local pages.
docs.json, so absolute imports like /snippets/example.mdx resolve correctly. The detected project appears in the status bar. To check which root the extension is using, run Mintlify: Show detected docs root from the command palette.
Configuration validation
The extension validatesdocs.json against the Mintlify schema.
Preview in your editor
Open an.mdx file and select the preview icon in the editor title bar, or right-click the file and select Preview Mintlify. A preview panel opens beside your editor and renders the page.
In-editor previews require the Mintlify CLI. The URL of the running server appears in the status bar. Select it to stop the server, or run Mintlify: Stop preview server.
To see the output of the underlying mint dev process, open the Mintlify Preview output channel.
Wrap content in components
The extension includes snippets that wrap selected text in a component, rather than inserting an empty component for you to fill in. To use them, select the content you want to wrap, then run Snippets: Surround With from the command palette and choose a component. Snippets are available forAccordionGroup, CardGroup, CodeGroup, Expandable, Frame, RequestExample, ResponseExample, and fenced code blocks.
Settings
mintlify.preview.command is a user setting, so a workspace cannot override it. This prevents a cloned repository from running an arbitrary command on your machine when you open a preview.
Commands
Run these from the command palette:Conflicting extensions
Other MDX extensions provide their own syntax highlighting and language features for.mdx files, which conflict with this extension. Disable other MDX extensions to avoid duplicate suggestions and inconsistent highlighting.
For code formatting, use Prettier alongside this extension or run mint format.
Troubleshooting
Components are reported as unknown
Components are reported as unknown
The extension resolves components relative to your docs root. Run Mintlify: Show detected docs root to confirm it found the correct
docs.json file. If the root is wrong or missing, open the folder containing your docs.json file as your workspace.If the root is correct, run Mintlify: Restart language server.Autocomplete and highlighting behave inconsistently
Autocomplete and highlighting behave inconsistently
Another MDX extension is likely also active. Open the Extensions view, search for
mdx, and disable any other MDX extensions in this workspace.The preview fails to start
The preview fails to start
Open the Mintlify Preview output channel to see the error from
mint dev.could not run "mint dev --no-open": The CLI is not installed. Install it withnpm i -g mint.Trust the workspace first: Trust the workspace through Manage Workspace Trust.no docs.json found above this file: Open the folder containing yourdocs.jsonfile as your workspace.Invalid docs.json: Runmint validateto find the configuration error.
Snippet imports are reported as unresolved
Snippet imports are reported as unresolved
Absolute import paths resolve from your docs root, not from your file. Confirm the path matches the location of the snippet file relative to your
docs.json file, and that the detected root is correct.