@graphql-markdown/core
v1.23.0
Published
GraphQL-Markdown core package for generating Markdown documentation from a GraphQL schema.
Maintainers
Readme
@graphql-markdown/core
Core engine for generating Markdown documentation from a GraphQL schema. It orchestrates schema loading, diffing, rendering, and the event lifecycle used by @graphql-markdown/cli and @graphql-markdown/docusaurus. Most users should install one of those packages instead of depending on core directly.
Installation
npm install @graphql-markdown/coreUsage
import { buildConfig, generateDocFromSchema } from "@graphql-markdown/core";
const config = await buildConfig({
schema: "./schema.graphql",
rootPath: "./docs",
baseURL: "api",
});
await generateDocFromSchema(config);Event system
core exposes a cancellable event emitter so that formatters, printers, and custom scripts can hook into schema loading, diff checks, and rendering:
import { getEvents, SchemaEvents } from "@graphql-markdown/core";
getEvents().on(SchemaEvents.SCHEMA_LOAD, (event) => {
console.log("Schema loaded", event);
});See the event handlers documentation for the full list of lifecycle events and their payloads.
Documentation
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.
