Profile
Back to NewsBack
GitHub Trending 2 min
Reader Mode
graphql-markdown/graphql-markdown: Customizable MDX documentation for GraphQL schemas

graphql-markdown/graphql-markdown: Customizable MDX documentation for GraphQL schemas

7 hours ago

GraphQL-Markdown</a>

Flexible documentation for GraphQL schemas

npm downloads</a> NPM Last Update</a> GitHub License</a> Buy us a tree</a> Commitizen friendly</a>

GraphQL-Markdown

Generate Markdown and MDX documentation from GraphQL schemas for Docusaurus and other supported documentation ecosystems.

Installation

GraphQL-Markdown supports two main setup paths:

  • use the official Docusaurus integration for Docusaurus sites
  • use the CLI with formatter presets for other supported ecosystems such as Hugo, MkDocs, DocFX, and mdBook
Choose your preferred package based on your documentation stack:
# For Docusaurus sites
npm install @graphql-markdown/docusaurus graphql

For formatter-based setups

npm install @graphql-markdown/cli @graphql-markdown/formatters graphql

Usage

Docusaurus Plugin

Add to your docusaurus.config.js:

module.exports = {
  plugins: ["@graphql-markdown/docusaurus"],
};

Run the generation command:

npx docusaurus graphql-to-doc

CLI Usage

Use the CLI directly for custom workflows, or pair it with @graphql-markdown/formatters to adapt the generated output for supported frameworks.

npx gqlmd graphql-to-doc --schema ./schema.graphql --root ./docs

For formatter-based setups:

schema: ./schema.graphql
extensions:
  graphql-markdown:
    rootPath: ./docs
    baseURL: api
    formatter: "@graphql-markdown/formatters/hugo"

API Usage

For programmatic usage, you can use the CLI package:

import { runGraphQLMarkdown } from '@graphql-markdown/cli';

const config = { schema: './schema.graphql', rootPath: './docs', };

await runGraphQLMarkdown(config);

See API documentation and our Framework Integration page for the full list of supported formatter presets.

Configuration

See documentation configuration page.

Troubleshooting

See documentation troubleshooting page.

Showcase

Used in production by 30+ teams including Saleor, Sui, Mozilla, IOTA, Swan, Sablier, and Browserless.

View the full showcase · Add your site

License

GraphQL-Markdown packages are 100% free and open-source, under the MIT license.

This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

Contributions

Contributions, issues and feature requests are very welcome. If you are using this package and fixed a bug for yourself, please consider submitting a PR!

Contributors

Chat with me