Skip to Content
Vuesho

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/vue

Move 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/:

index.mdx
quickstart.mdx
logo.svg
install.mdx
docs.json
vuesho.config.ts

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>'s icon into its #icon slot.
  • Write frontmatter icons as Lucide names, like BookOpen for book-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:

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.

src/mintlify.ts
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:

vuesho.config.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:

vuesho.config.ts
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:

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:

vuesho.config.ts
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:

vuesho.config.ts
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:

KeyResult
nameThe navbar title, when there's no logo
descriptionThe page description, unless site.description is set
colors.primary, colors.lightThe accent color in light and dark mode
logo, faviconOne image, or one per color mode, and logo.href
navigationThe sidebar, see Navigation Keys
navbarNavbar links and a button
appearanceThe default color mode, and no color mode switch with strict
background.color, background.imageThe page background in each color mode
fontsGoogle Fonts, weights 400 to 700 by default, or local .woff and .woff2 files with source
bannerA Markdown banner, with dismissible, type and color
footerSocial links with icons, and columns of links
redirectsPermanent and temporary redirects, by path or pattern
errors.404A redirect home, or a not found page with a title and description
seo.metatags, seo.indexingMeta tags on every page, and noindex on unlisted pages with navigable
search.promptThe search placeholder
metadata.timestampThe last modified date, with true
integrationsAnalytics scripts
api.openapi, api.asyncapiAPI reference pages, with the helpers above

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 keySidebar
pagesPages, in order
groupsFolders, open with expanded: true and linked with root
tabs, anchors, dropdowns, products, menuTop-level folders, or external links with href
versionsA root folder for each version
languagesA sidebar for each language, see Languages
globalTabs, 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.