From Mintlify
Move a Mintlify site to Vuesho.
@vuesho/mintlify runs a Mintlify project on Vuesho. It applies the navigation, colors, redirects and analytics from your docs.json to the site, and its CLI converts .mdx pages to Markdown with Vue syntax.
Setup
Create a Site
Create a site as in Getting Started, then install the package:
npm i @vuesho/mintlify @lucide/vueMove the Project Files
Keep docs.json, the files its $ref keys point to, and snippets/ at the root. Move the pages into content/, and the assets that pages link with root paths, like /images/a.png, into public/:
Page paths in navigation resolve inside content/, without a leading docs/ or content/docs/.
Convert the Pages
The command rewrites the .mdx files in content/ and snippets/ as .md files with Vue syntax:
npx vuesho-mintlify convert---
title: Quickstart
---
import Install from "/snippets/install.mdx";
export const version = "24";
{/* Shown on every page */}
<Note>Requires Node.js {version} or later.</Note>
<Install />A snippet becomes an include, and its attributes become props of the snippet. It reports the file and line of each part it can't convert, like JSX inside an expression or a .jsx component.
Fix the Remaining Syntax
Change three patterns by hand:
- Replace
<CodeGroup>with code tabs. - Move a
<Card>'siconinto its#iconslot. - Write frontmatter icons as Lucide names, like
BookOpenforbook-open.
---
title: Introduction
icon: book-open
---
<Card title="Quickstart" icon="rocket" href="/quickstart">
Get going in five minutes.
</Card>
<CodeGroup>
```bash npm
npm i acme
```
```bash pnpm
pnpm add acme
```
</CodeGroup>Type Checking
For type checking, map /snippets/* in tsconfig.json:
{
"compilerOptions": {
"paths": { "/snippets/*": ["./snippets/*"] }
},
"include": ["*.ts", "src", "content", "snippets"]
}Map the Components
Define Mintlify's components in a module, and register them with a plugin's components. Each key maps to the named export of that module. Write the components this example leaves out, like Frame or ParamField, yourself.
import { defineComponent, type FunctionalComponent, h } from "vue";
import {
Accordions,
Callout,
Cards,
Step as VueshoStep,
Tab as VueshoTab,
Tabs as VueshoTabs,
} from "vuesho/components";
type CalloutType = "info" | "idea" | "warn" | "error" | "success";
const callout =
(type: CalloutType): FunctionalComponent =>
(_, { slots }) =>
h(Callout, { type }, slots);
export const Note = callout("info");
export const Info = callout("info");
export const Tip = callout("idea");
export const Warning = callout("warn");
export const Danger = callout("error");
export const Check = callout("success");
export const AccordionGroup = Accordions;
export const CardGroup = defineComponent({
props: { cols: Number },
setup(props, { slots }) {
return () => {
const columns = props.cols && `repeat(${props.cols}, minmax(0, 1fr))`;
return h(Cards, { style: { gridTemplateColumns: columns } }, slots);
};
},
});
export const Columns = CardGroup;
// Mintlify names each tab via the `title` prop on `Tab`.
export const Tabs = defineComponent((_, { slots }) => () => {
const tabs = slots.default?.() ?? [];
const items = tabs.flatMap((tab) => tab.props?.title ?? []);
return h(VueshoTabs, { items }, () => tabs);
});
export const Tab = defineComponent({
props: { title: { type: String, required: true } },
setup(props, { slots }) {
return () => h(VueshoTab, { value: props.title }, slots);
},
});
export const Step = defineComponent({
props: { title: String },
setup(props, { slots }) {
const title = () => props.title && h("h3", props.title);
return () => h(VueshoStep, null, () => [title(), slots.default?.()]);
},
});Tabs, Tab and Step replace the built-in components, so every page uses Mintlify's props for them.
Add the Plugin
Add mintlify.plugin(), and a plugin whose components maps each name to src/mintlify.ts:
import { createMintlify } from "@vuesho/mintlify";
// ...
const mintlify = createMintlify();
const m = "/src/mintlify.ts";
export default createSite(docs.toSource()).plugins(
recommendedPreset(),
lucideIconsPlugin(),
ogImagePlugin(),
mintlify.plugin(),
{
name: "site:mintlify",
components: {
Note: m,
Info: m,
Tip: m,
Warning: m,
Danger: m,
Check: m,
AccordionGroup: m,
CardGroup: m,
Columns: m,
Tabs: m,
Tab: m,
Step: m,
},
},
);Vuesho reads docs.json when the site builds, and your own config overrides it.
Customization
Turning Off Features
To configure a part of docs.json in Vuesho instead, turn it off in features:
mintlify.plugin({ features: { search: false } });Prop
Type
Prop
Type
Prop
Type
Not Found Page
errors.404 redirects to / by default. With redirect: false, the site renders a not found page from the title and description of errors.404, or its own not found page when both are missing. To replace that page, set the mintlify.404 view in src/theme.ts:
import { defineTheme } from "vuesho/theme";
import defaultTheme from "vuesho/theme/default";
export default defineTheme({
extends: defaultTheme,
views: { "mintlify.404": () => import("./NotFound.vue") },
});Languages
createMintlify() builds the i18n config from navigation.languages. Pass localeMap to rename language codes:
const mintlify = createMintlify({ localeMap: { cn: "zh" } });
export default createSite(docs.toSource(), { i18n: mintlify.i18n })
.plugins(
recommendedPreset(),
// ...
mintlify.plugin(),
)
.config({ site: { languages: mintlify.languages } }); Without navigation.languages, i18n and languages are undefined. Each language uses the navigation, navbar, banner and footer that docs.json sets for it, or the top-level ones.
API Pages
createMintlifyOpenAPI() and createMintlifyAsyncAPI() read api.openapi and api.asyncapi from docs.json, for OpenAPI and AsyncAPI:
import { createMintlifyOpenAPI } from "@vuesho/mintlify/openapi";
import { openapiPlugin } from "@vuesho/openapi";
// ...
const { openapi, proxy } = createMintlifyOpenAPI();
export default createSite({
docs: docs.toSource(),
api: openapi.staticSource({ baseDir: "api" }),
}).plugins(
recommendedPreset(),
// ...
mintlify.plugin(),
openapiPlugin({ proxy }),
);Both helpers give the built server their docs.json and its $ref files, so the site needs no extra serverFiles for them. They work without createMintlify().plugin() and with another path.
Both take the same options as createOpenAPI() and createAsyncAPI(), and fail when neither docs.json nor input lists an API document. For a static build, turn off the playground proxy with api.playground.proxy: false.
Supported docs.json Keys
The plugin applies these keys, and ignores the others:
| Key | Result |
|---|---|
name | The navbar title, when there's no logo |
description | The page description, unless site.description is set |
colors.primary, colors.light | The accent color in light and dark mode |
logo, favicon | One image, or one per color mode, and logo.href |
navigation | The sidebar, see Navigation Keys |
navbar | Navbar links and a button |
appearance | The default color mode, and no color mode switch with strict |
background.color, background.image | The page background in each color mode |
fonts | Google Fonts, weights 400 to 700 by default, or local .woff and .woff2 files with source |
banner | A Markdown banner, with dismissible, type and color |
footer | Social links with icons, and columns of links |
redirects | Permanent and temporary redirects, by path or pattern |
errors.404 | A redirect home, or a not found page with a title and description |
seo.metatags, seo.indexing | Meta tags on every page, and noindex on unlisted pages with navigable |
search.prompt | The search placeholder |
metadata.timestamp | The last modified date, with true |
integrations | Analytics scripts |
api.openapi, api.asyncapi | API reference pages, with the helpers above |
integrations adds the scripts for Amplitude, Clarity, Fathom, Google Analytics 4, Google Tag Manager, Heap, Hotjar, Intercom, Koala, LogRocket, Mixpanel, Pirsch, Plausible, PostHog and Segment. Add others with head tags.
Redirects on Static Hosts
A redirect of an exact path, or of a whole folder with *, works on a static build: Vercel, Netlify and Cloudflare apply it, and for another static host the build writes a page for each exact path. Other patterns, like :slug, and a redirect that overlaps another need a server.
Navigation Keys
navigation key | Sidebar |
|---|---|
pages | Pages, in order |
groups | Folders, open with expanded: true and linked with root |
tabs, anchors, dropdowns, products, menu | Top-level folders, or external links with href |
versions | A root folder for each version |
languages | A sidebar for each language, see Languages |
global | Tabs, anchors, dropdowns and products added before those of each version and language |
Groups and versions take a tag, shown as a badge in the sidebar. Groups, tabs, anchors, dropdowns, products and menus take an icon, and every item except a page takes hidden.
Icons
Icons render with Lucide. Common Font Awesome and Tabler names map to Lucide icons, and Vuesho warns about an unknown name.