Registry / devops / graphql-markdown-vitepress

graphql-markdown-vitepress

JSON →
library0.0.17jsnpmunverified

VitePress plugin for generating GraphQL schema documentation from SDL files, JSON introspection, or remote URLs. Version 0.0.17 (pre-1.0.0, rapid iteration). Converts GraphQL schemas into Markdown with automatic VitePress sidebar generation, support for nested categories, and scoped CSS. Offers three schema input modes and a lazy-loading runtime for collapsible type documentation. Requires Vite >=5.0.0, VitePress >=1.0.0, and Vue >=3.3.0.

npm install graphql-markdown-vitepress
INSTALL
IMPORT
SIG · GRAPHQL-MARKDOWN-V
G
graphql-markdown-vitepress
devopsjavascriptv0.0.17
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

generateDocs
import { generateDocs } from 'graphql-markdown-vitepress'
import generateDocs from 'graphql-markdown-vitepress'
Named export, not default. Available since v0.0.1.
createSidebar
import { createSidebar } from 'graphql-markdown-vitepress'
const createSidebar = require('graphql-markdown-vitepress').createSidebar
ESM-only package; require() not supported. Also available in CommonJS via bundler.
graphqlDocsPlugin
import { graphqlDocsPlugin } from 'graphql-markdown-vitepress'
Vite plugin, used in VitePress config under vite.plugins.
graphqlThemeSetup
import { graphqlThemeSetup } from 'graphql-markdown-vitepress/theme'
import { graphqlThemeSetup } from 'graphql-markdown-vitepress'
Theme export lives in a subpath '/theme'. v0.0.1+.

Generates GraphQL docs from schema.json, creates a VitePress sidebar, and registers the theme plugin.

// .vitepress/config.ts import { defineConfig } from "vitepress"; import { generateDocs, createSidebar, graphqlDocsPlugin, } from "graphql-markdown-vitepress"; import { resolve } from "node:path"; export default async () => { const schemaPath = resolve(__dirname, "../schema.json"); const rootPath = resolve(__dirname, ".."); const graphqlDir = resolve(rootPath, "graphql"); await generateDocs({ schema: schemaPath, rootPath, baseURL: "graphql", linkRoot: "/", }); const sidebar = await createSidebar(graphqlDir, "graphql"); return defineConfig({ title: "GraphQL API Docs", themeConfig: { sidebar: { "/graphql/": sidebar }, }, vite: { plugins: [ graphqlDocsPlugin({ schema: schemaPath, rootPath, baseURL: "graphql", linkRoot: "/", }), ], }, }); }; // .vitepress/theme/index.ts import DefaultTheme from "vitepress/theme"; import { graphqlThemeSetup } from "graphql-markdown-vitepress/theme"; import "graphql-markdown-vitepress/style.css"; export default { extends: DefaultTheme, setup() { graphqlThemeSetup({ linkPrefix: "/graphql/" }); }, };
Debug
Known issues
deprecatedSome internal APIs may change before v1.0.0.
fix
Pin to exact minor version or update frequently.
affects: <0.1.0
gotchaESM-only: require() will fail. Use import syntax.
fix
Use 'import' instead of 'require'.
affects: >=0.0.0
gotchaTheme import path is '/theme', not main package.
fix
Import from 'graphql-markdown-vitepress/theme'.
affects: >=0.0.0
gotchagraphqlDocsPlugin must be run before returning config; it modifies Vite's transform pipeline.
fix
Call graphqlDocsPlugin() inside the async config function, not outside.
affects: >=0.0.0
gotchanode >=18 required; older versions may fail.
fix
Update Node.js to v18 or later.
affects: >=0.0.0
Errors
Common errors & fixes
ERR_REQUIRE_ESM: require() of ES Module
Using require() on an ESM-only package.
fix
Switch to import syntax or use dynamic import().
Cannot find module 'graphql-markdown-vitepress/theme'
Import path missing '/theme' subpath.
fix
Import from 'graphql-markdown-vitepress/theme' instead of 'graphql-markdown-vitepress'.
Property 'graphqlDocsPlugin' does not exist on type
Using TypeScript but import path is incorrect.
fix
Use 'import { graphqlDocsPlugin } from "graphql-markdown-vitepress"'.
Upgrade
Version history
0.0.17latest on npm
Audit
Dependencies
vitepressrequiredpeer dependency for VitePress integration
viterequiredpeer dependency for build tooling
vuerequiredpeer dependency for Vue runtime
Agent activity
6 hits · last 30 days
node
6
Resources
graphql-markdown-vitepress — npm install graphql-markdown-vitepress · libregistry