All Projects → exogen → Graphql Markdown

exogen / Graphql Markdown

Licence: mit
The easiest way to document your GraphQL schema.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Graphql Markdown

Docnado
Rapid documentation tool that will blow you away...
Stars: ✭ 67 (-41.23%)
Mutual labels:  docs, markdown
Catalog
Create living style guides using Markdown or React
Stars: ✭ 1,527 (+1239.47%)
Mutual labels:  docs, markdown
Foliant
Comprehensive markdown-based documentation toolkit
Stars: ✭ 74 (-35.09%)
Mutual labels:  docs, markdown
Parse Comments
Parse JavaScript code comments. Works with block and line comments, and should work with CSS, LESS, SASS, or any language with the same comment formats.
Stars: ✭ 53 (-53.51%)
Mutual labels:  docs, markdown
Goreadme
Generate readme file from Go doc. Now available with Github actions!
Stars: ✭ 113 (-0.88%)
Mutual labels:  docs, markdown
Docsify Tabs
A docsify.js plugin for rendering tabbed content from markdown
Stars: ✭ 65 (-42.98%)
Mutual labels:  docs, markdown
Graphdoc
Static page generator for documenting GraphQL Schema
Stars: ✭ 1,218 (+968.42%)
Mutual labels:  graphql, documentation-generator
Pdoc
API Documentation for Python Projects
Stars: ✭ 853 (+648.25%)
Mutual labels:  docs, documentation-generator
Live Doc
💫 Convert markdown to live React demos
Stars: ✭ 97 (-14.91%)
Mutual labels:  docs, markdown
Gatsby Documentation Starter
Automatically generate docs for React components using MDX, react-docgen, and GatsbyJS
Stars: ✭ 91 (-20.18%)
Mutual labels:  docs, documentation-generator
Vuesence Book
Minimalistic Vue.js based documentation system component
Stars: ✭ 48 (-57.89%)
Mutual labels:  docs, markdown
Prettier
Prettier is an opinionated code formatter.
Stars: ✭ 41,411 (+36225.44%)
Mutual labels:  graphql, markdown
App
Fast and searchable Ruby docs
Stars: ✭ 47 (-58.77%)
Mutual labels:  docs, documentation-generator
Funbook Old
I have a dream, to be a novelist someday.
Stars: ✭ 65 (-42.98%)
Mutual labels:  docs, markdown
Bsdoc
📚 Documentation Generator for BuckleScript
Stars: ✭ 43 (-62.28%)
Mutual labels:  docs, documentation-generator
Jsdoc To Markdown
Generate markdown documentation from jsdoc-annotated javascript
Stars: ✭ 1,199 (+951.75%)
Mutual labels:  documentation-generator, markdown
Pdoc
🐍 ➡️ 📜 Auto-generate API documentation for Python projects
Stars: ✭ 604 (+429.82%)
Mutual labels:  docs, documentation-generator
Gatsby Gitbook Starter
Generate GitBook style modern docs/tutorial websites using Gatsby + MDX
Stars: ✭ 700 (+514.04%)
Mutual labels:  documentation-generator, markdown
Write With Me
Real-time Collaborative Markdown Editor
Stars: ✭ 81 (-28.95%)
Mutual labels:  graphql, markdown
Log4brains
✍️ Log and publish your architecture decisions (ADR)
Stars: ✭ 98 (-14.04%)
Mutual labels:  documentation-generator, markdown

graphql-markdown

The easiest way to document your GraphQL schema.

npm version


This package will generate Markdown that beautifully renders your GraphQL schema in an easily explorable document.

$ yarn add graphql-markdown --dev
$ npm install graphql-markdown --save-dev

See an example generated from the GraphBrainz schema.

Usage

Command Line API

Installing the package adds a graphql-markdown script. Point it at a schema and the output will be written to stdout. You must install graphql alongside this package according to the compatible versions specified in peerDependencies.

The schema may be retrieved from a GraphQL endpoint:

$ graphql-markdown http://your-server.com/graphql > schema.md

…or a module exporting an instance of GraphQLSchema:

$ graphql-markdown ./path/to/schema.js > schema.md

…or a file containing GraphQL syntax:

$ graphql-markdown ./path/to/schema.graphql > schema.md

…or a file containing the JSON output of an introspection query:

$ graphql-markdown ./path/to/schema.json > schema.md

If --update-file is given, the generated Markdown will be output to the given file between the <!-- START graphql-markdown --> and <!-- END graphql-markdown --> comment markers instead of printed to STDOUT. If the file does not exist, it will be created (and will include the comment markers for future updates). Use this if you’d like to embed the rendered Markdown as just one part of a larger document (see also the --heading-level option).

Options

$ graphql-markdown --help

Usage: graphql-markdown [options] <schema>

Output a Markdown document with rendered descriptions and links between types.
The schema may be specified as:

  - a URL to the GraphQL endpoint (the introspection query will be run)
  - a GraphQL document containing the schema (.graphql or .gql)
  - a JSON document containing the schema (as returned by the introspection query)
  - an importable module with the schema as its default export (either an instance
    of GraphQLSchema or a JSON object)

Options:

  --title <string>       Change the top heading title (default: 'Schema Types')
  --no-title             Do not print a default title
  --no-toc               Do not print table of contents
  --prologue <string>    Include custom Markdown after the title
  --epilogue <string>    Include custom Markdown after everything else
  --heading-level <num>  Heading level to begin at, useful if you are embedding the
                         output in a document with other sections (default: 1)
  --update-file <file>   Markdown document to update (between comment markers) or
                         create (if the file does not exist)
  --require <module>     If importing the schema from a module, require the specified
                         module first (useful for e.g. babel-register)
  --header <name=value>  Additional header(s) to use in GraphQL request
                         e.g. --header "Authorization=Bearer ey..."
  --version              Print version and exit

Node API

The following functions are exported from the graphql-markdown module for programmatic use.

loadSchemaJSON(schemaPath: string, options: object)

Given a string pointing to a GraphQL schema (URL, module, or file path), get the result of the introspection query, suitable for use as input to renderSchema.

renderSchema(schema: object, options: object)

Given a schema JSON object (the output of the introspection query, an object with a __schema property), render the schema to the console or the provided printer function.

Options
  • title: The title of the document, defaults to “Schema Types”.
  • prologue: Markdown content to include after the title.
  • epilogue: Markdown content to include after everything else.
  • printer: A function to handle each line of output, defaults to console.log.
  • skipTableOfContents: When set, rendering of "Table of contents" section is skipped.
  • headingLevel: The initial level at which to render Markdown headings in the output, defaults to 1. Use this if you are using updateSchema to embed the output in a larger document with other sections.
  • unknownTypeURL: A string or function to determine the URL for linking to types that aren’t found in the schema being rendered. This may be the case if you’re rendering the result of diffSchema(), for example. String values will have #${type.name.toLowerCase()} appended, and function values will be called with the type object for full control.

updateSchema(path: string, schema: object, options: object)

Given a path to a Markdown document, inject the output of renderSchema (with the given schema and options) into the document between the comment markers <!-- START graphql-markdown --> and <!-- END graphql-markdown -->. Returns a Promise.

If the file does not exist, it will be created. If the document is empty, the necessary comment markers will automatically be inserted, but if there is existing content and no comment markers, the Promise will be rejected with an error.

diffSchema(oldSchema: object, newSchema: object, options: object)

Given two schema JSON objects (the results of the introspection query on two schemas), return a new schema JSON object containing only the added or updated types and fields. You can use this to document a schema update, or to document the effects of a schema extension (e.g. extend type definitions).

Options
  • processTypeDiff: A function to add or modify fields on each type that will be output.

Output

Output is optimized for display on GitHub, using GitHub Flavored Markdown. Due to the complexity of the tables in the generated document, much of the table output is raw HTML (as allowed by Markdown).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].