Feature Flags
Overview
export default defineNuxtConfig({
extends: ['@movk/nuxt-docs'],
movkNuxtDocs: {
componentDocs: false,
mcp: true,
ogImage: true,
mermaid: false,
a11y: false
},
aiChat: {
enabled: undefined
}
})
| Flag | Default | Enables | Extra install |
|---|---|---|---|
movkNuxtDocs.componentDocs | false | ComponentProps, ComponentSlots, ComponentEmits, ComponentCode, ComponentExample and Prettier formatting | Yes |
movkNuxtDocs.mcp | true | Built-in MCP Server (@nuxtjs/mcp-toolkit) | No |
movkNuxtDocs.ogImage | true | OG images generated per page at build time (nuxt-og-image) | No |
movkNuxtDocs.mermaid | false | Mermaid diagrams in Markdown | Yes |
movkNuxtDocs.a11y | false | @nuxt/a11y accessibility checks during development | Yes |
aiChat.enabled | true when AI_API_KEY exists at build time | AI chat assistant, floating input and "Explain with AI" | Yes |
Dependencies of features that are on by default (MCP, OG images) ship with the layer. Features that are off by default declare their dependencies as optional peer dependencies, which your project installs when enabling them.
movkNuxtDocs.mcp: false while aiChat is enabled fails the build.Installing dependencies
When an enabled feature is missing dependencies, the build stops and lists the missing packages with an install command, for example:
[@movk/nuxt-docs] 已启用的功能缺少依赖:
- mermaid: mermaid, dompurify
请安装后重试:pnpm add mermaid dompurify
Component docs
pnpm add nuxt-component-meta vue-component-meta prettier
npm install nuxt-component-meta vue-component-meta prettier
yarn add nuxt-component-meta vue-component-meta prettier
bun add nuxt-component-meta vue-component-meta prettier
Once enabled, only components listed in componentMeta.include get metadata, see nuxt.config Options.
Mermaid
pnpm add mermaid dompurify
npm install mermaid dompurify
yarn add mermaid dompurify
bun add mermaid dompurify
Accessibility checks
pnpm add @nuxt/a11y
npm install @nuxt/a11y
yarn add @nuxt/a11y
bun add @nuxt/a11y
AI Chat
pnpm add ai @ai-sdk/openai @ai-sdk/vue @comark/vue @shikijs/engine-javascript @shikijs/langs @shikijs/themes
npm install ai @ai-sdk/openai @ai-sdk/vue @comark/vue @shikijs/engine-javascript @shikijs/langs @shikijs/themes
yarn add ai @ai-sdk/openai @ai-sdk/vue @comark/vue @shikijs/engine-javascript @shikijs/langs @shikijs/themes
bun add ai @ai-sdk/openai @ai-sdk/vue @comark/vue @shikijs/engine-javascript @shikijs/langs @shikijs/themes
Then set AI_API_KEY (and optionally AI_BASE_URL) in both the build and runtime environments. See AI Chat for models and other options.
When a feature is off
Disabled features are excluded from bundling and type checking, and callers never need to check the flag:
| Feature | When off |
|---|---|
| Component docs | The component docs MDC components are not registered; raw markdown and the MCP component tools receive empty metadata and examples |
| MCP | The /mcp endpoint is not registered and /.well-known/mcp/server-card.json is not generated |
| OG images | defineOgImage calls become no-ops; og:title, og:description and other meta tags remain |
| Mermaid | Code blocks tagged mermaid render as plain code blocks |
| a11y | @nuxt/a11y is not loaded |
| AI Chat | AiChat, AiChatPanel and related components are replaced with disabled versions, useAIChat() returns a disabled implementation, and the header hides the AI entry |
When aiChat.enabled is not set, it follows whether AI_API_KEY exists at build time. If you set aiChat.enabled: true without the variable at build time, the build warns you to make sure the runtime environment provides it.
export default defineNuxtConfig({
movkNuxtDocs: {
mcp: false,
ogImage: false
},
aiChat: {
enabled: false
}
})
Navigation & Categories
Header links, the mobile menu and sidebar groups are declared in app.config, while the docs directory structure drives the section bar and the sidebar order. This page covers where each navigation comes from, localized labels and link prefixes, sidebar grouping rules, the sidebar filter and ⌘K search.
Customization
Create a Vue file with the same name as a built-in component in your component directory to replace the header, sidebars, footer and other UI regions. This page lists the components v3 promises to keep stable, where each is mounted, and a minimal override for every one of them.