Registry / testing / graphql-markdown

graphql-markdown

JSON →
library7.3.0jsnpmunverified

Generates Markdown documentation from a GraphQL schema, supporting introspection URLs, GraphQL files, JSON introspection results, and JS modules exporting GraphQLSchema. Version 7.3.0 requires Node >=14 and peer dependency graphql ^14.0.2 || ^15.0.0 || ^16.0.0. Offers CLI with options like --title, --no-toc, --toc-fields, --prologue, --epilogue, --heading-level, and --update-file for embedding in existing Markdown. Steady release cadence; lighter-weight alternative to graphql-docs.

npm install graphql-markdown
INSTALL
IMPORT
SIG · GRAPHQL-MARKDOWN
G
graphql-markdown
testingjavascriptv7.3.0
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.

default
import graphqlMarkdown from 'graphql-markdown'
const graphqlMarkdown = require('graphql-markdown'); // Use ESM import for proper default export
Package uses ESM; default export is the main function.
graphqlMarkdown
import graphqlMarkdown from 'graphql-markdown'
ESM default import; no named exports.
require
const graphqlMarkdown = require('graphql-markdown').default
const graphqlMarkdown = require('graphql-markdown') // Returns ESM module, requires .default
CommonJS require must use .default to access the default export.

Generate Markdown documentation from a GraphQL schema defined in code, showing async usage and default export.

import graphqlMarkdown from 'graphql-markdown'; import { buildSchema } from 'graphql'; const schema = buildSchema(` type Query { "A friendly greeting" hello: String "Multiply two numbers" multiply(a: Int!, b: Int!): Int } `); const markdown = await graphqlMarkdown({ schema }); console.log(markdown);
Debug
Known issues
breakingv7 changed default export to async function; previously it was synchronous.
fix
Await the result of the imported function: const markdown = await graphqlMarkdown({ schema });
affects: >=7.0.0
breakingv7 removed support for CommonJS default require without .default.
fix
Use const graphqlMarkdown = require('graphql-markdown').default; or switch to ESM import.
affects: >=7.0.0
deprecatedPassing schema as first argument (non-object) is deprecated since v7.
fix
Wrap schema in an object: graphqlMarkdown({ schema })
affects: >=7.0.0 <8.0.0
gotchaWhen using --update-file, the file must contain <!-- START graphql-markdown --> and <!-- END graphql-markdown --> markers.
fix
Add the markers to your Markdown file before running the command.
affects: >=0.0.0
gotchaCLI may fail if schema URL does not respond with valid GraphQL introspection result.
fix
Verify the endpoint works with a tool like GraphiQL.
affects: >=0.0.0
Errors
Common errors & fixes
graphqlMarkdown is not a function
Using require() without .default in CommonJS for v7+.
fix
Change to const graphqlMarkdown = require('graphql-markdown').default;
Cannot find module 'graphql-markdown'
Package not installed or not in node_modules.
fix
Run npm install graphql-markdown --save-dev
Received a non-object argument as schema
Passing schema as a bare argument instead of object in v7+.
fix
Call graphqlMarkdown({ schema })
graphql-markdown: error: Could not retrieve schema from <url>
Introspection endpoint unreachable or not returning JSON.
fix
Check URL, network connectivity, and CORS settings.
Upgrade
Version history
7.3.0latest on npm
Audit
Dependencies
graphqlrequiredPeer dependency required to work with GraphQL schema objects and introspection queries.
Agent activity
6 hits · last 30 days
node
6
Resources
graphql-markdown — npm install graphql-markdown · libregistry