.mdx files in a visual editor and runs a live preview inside your editor, so you can write and see rendered output without switching to a browser.
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, closing tags after </, and enumerated prop values like <Badge color="…">.
The extension suggests components that you import from reusable snippets alongside built-in ones. className, id, and style are offered on every component and HTML element, and typing inside className="…" suggests Tailwind utility classes, including variants like md: and hover:.
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, including plain HTML elements like
<div>. - 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.
Folding
Use the gutter chevrons to collapse regions of a page:- Component and HTML tag regions, like
<Accordion>…</Accordion>. - Heading sections.
- Frontmatter.
- Code blocks.
- JSX comments.
Configuration validation
The extension validatesdocs.json against the Mintlify schema.
Visual mode
Open any.mdx file in visual mode to edit the page in a rich editor like the one in the Mintlify dashboard, with headings, lists, tables, links, callouts, cards, steps, tabs, accordions, code blocks, and images all editable in place.
To switch between visual mode and the text editor:
- Press Cmd+Shift+V (macOS) or Ctrl+Shift+V (Windows).
- Or use the editor picker at the right end of the breadcrumbs row.
.mdx files open with by default.
Markdown shortcuts work as you type (# for a heading, - for a list item, **bold**, `code`), and the toolbar and / menu insert components. Visual mode writes edits back as MDX through the same converter as mint format, and preserves unfamiliar components as written.
Snippet forms
In visual mode, a component imported from a snippet appears as a form with one input per prop instead of an opaque tag. Visual mode infers fields from the props in the component’s function signature and their default values, so a default oftrue becomes a checkbox, 2 becomes a number box, icon or logo becomes an image path with a thumbnail, and href or url becomes a link.
To control the inputs, document the component with a JSDoc @param comment right before the export. In .jsx and .tsx files use a /** … */ block. In .mdx snippets, use an MDX comment ({/* … */}) so it doesn’t render:
Brackets (
[name]) mark a prop optional. A documented prop without brackets shows a required marker. [name=value] supplies a default when the component’s signature doesn’t already have one. The first line of the comment is the description shown in the form header and the Insert menu.
children is never a field. Visual mode leaves the tag’s body as written and summarizes it under the form. Switch to the text editor to edit it.
Imported snippets also appear in the + Insert menu and the / menu.
Docs sidebar
The Mintlify view in the activity bar mirrors yourdocs.json navigation tree. Top-level products and tabs stay at the root, with their navigation nested in expandable rows. The sidebar uses icons from docs.json and page frontmatter, and page labels come from sidebarTitle or title. Selecting a page opens it in visual mode.
Use the + action to add groups, tabs, dropdowns, anchors, languages, products, and versions. Drag rows to reorder them, or drop a page on a group to move it to the top of that group. The tree moves immediately, then Mintlify saves the change to docs.json.
The tree follows the active page and reloads when docs.json or a page changes.
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.
The preview toolbar has back, forward, and reload buttons, an address box, and a Follow editor toggle. Type a path like /quickstart in the address box and press Enter to navigate to that page. With Follow editor on, the preview switches pages as you change files in your editor.
Press Cmd+F (macOS) or Ctrl+F (Windows) inside the preview to open a find bar for the rendered page. Enter and Shift+Enter step through matches. Esc closes the find bar.
The in-editor preview renders in an iframe, so browser dev tools can’t reach it. Select the Open in browser button in the preview toolbar, or run Mintlify: Open preview in browser, to open the page in your browser instead.
In-editor previews require the Mintlify CLI. The preview server runs on port 3939 by default so it doesn’t collide with apps on port 3000. Change the port with the mintlify.preview.port setting.
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.