All Projects → 2fd → Graphdoc

2fd / Graphdoc

Licence: mit
Static page generator for documenting GraphQL Schema

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Graphdoc

Drf Autodocs
Ultimately automated DRF documentation rendering(UNMAINTAINED)
Stars: ✭ 82 (-93.27%)
Mutual labels:  documentation, documentation-tool, documentation-generator
Pdoc
API Documentation for Python Projects
Stars: ✭ 853 (-29.97%)
Mutual labels:  documentation, documentation-tool, documentation-generator
Pdoc
🐍 ➡️ 📜 Auto-generate API documentation for Python projects
Stars: ✭ 604 (-50.41%)
Mutual labels:  documentation, documentation-tool, documentation-generator
Sourcedocs
Generate Markdown documentation from source code
Stars: ✭ 286 (-76.52%)
Mutual labels:  documentation, documentation-tool, documentation-generator
Spectaql
Autogenerate static GraphQL API documentation
Stars: ✭ 198 (-83.74%)
Mutual labels:  graphql, documentation, documentation-generator
Naturaldocs
Natural Docs source code documentation system
Stars: ✭ 106 (-91.3%)
Mutual labels:  documentation, documentation-tool, documentation-generator
Jsdoc To Markdown
Generate markdown documentation from jsdoc-annotated javascript
Stars: ✭ 1,199 (-1.56%)
Mutual labels:  documentation, documentation-tool, documentation-generator
Documentalist
📝 A sort-of-static site generator optimized for living documentation of software projects
Stars: ✭ 130 (-89.33%)
Mutual labels:  documentation, documentation-tool, documentation-generator
Literate.jl
Simple package for literate programming in Julia
Stars: ✭ 272 (-77.67%)
Mutual labels:  documentation, documentation-tool, documentation-generator
App
Fast and searchable Ruby docs
Stars: ✭ 47 (-96.14%)
Mutual labels:  documentation, documentation-tool, documentation-generator
Devdocs
API Documentation Browser
Stars: ✭ 27,208 (+2133.83%)
Mutual labels:  documentation, documentation-tool
Wowchemy Hugo Modules
🔥 Hugo website builder, Hugo themes & Hugo CMS. No code, build with widgets! 创建在线课程,学术简历或初创网站。
Stars: ✭ 6,093 (+400.25%)
Mutual labels:  documentation-generator, documentation-tool
Documentation
📖 documentation for modern JavaScript
Stars: ✭ 5,443 (+346.88%)
Mutual labels:  documentation, documentation-tool
Standardese
A (work-in-progress) nextgen Doxygen for C++
Stars: ✭ 713 (-41.46%)
Mutual labels:  documentation, documentation-tool
Awesome Magento2
Curated list of awesome Magento 2 Extensions, Resources and other Highlights
Stars: ✭ 817 (-32.92%)
Mutual labels:  documentation, documentation-tool
Hawkmoth
Hawkmoth - Sphinx Autodoc for C
Stars: ✭ 31 (-97.45%)
Mutual labels:  documentation, documentation-generator
Daux.io
Daux.io is an documentation generator that uses a simple folder structure and Markdown files to create custom documentation on the fly. It helps you create great looking documentation in a developer friendly way.
Stars: ✭ 603 (-50.49%)
Mutual labels:  documentation-tool, documentation-generator
Markdown Guide
The comprehensive Markdown reference guide.
Stars: ✭ 835 (-31.44%)
Mutual labels:  documentation, documentation-tool
Bsdoc
📚 Documentation Generator for BuckleScript
Stars: ✭ 43 (-96.47%)
Mutual labels:  documentation, documentation-generator
Awesome Readme
A guide to writing an Awesome README. Read the full article in Towards Data Science.
Stars: ✭ 65 (-94.66%)
Mutual labels:  documentation, documentation-tool

Static page generator for documenting GraphQL Schema

build coverage npm tag

Demos

Install

  npm install -g @2fd/graphdoc

Use

Generate documentation from live endpoint

  > graphdoc -e http://localhost:8080/graphql -o ./doc/schema

Generate documentation from IDL file

  > graphdoc -s ./schema.graphql -o ./doc/schema

Generate documentation from for the "modularized schema" of graphql-tools

  > graphdoc -s ./schema.js -o ./doc/schema

./schema.graphql must be able to be interpreted with graphql-js/utilities#buildSchema

Generate documentation from json file

  > graphdoc -s ./schema.json -o ./doc/schema

./schema.json contains the result of GraphQL introspection query

Puts the options in your package.json

  // package.json

  {
    "name": "project",
    "graphdoc": {
      "endpoint": "http://localhost:8080/graphql",
      "output": "./doc/schema",
    }
  }

And execute

  > graphdoc

Help

  > graphdoc -h
  
    Static page generator for documenting GraphQL Schema v2.4.0

    Usage: node bin/graphdoc.js [OPTIONS] 

    
    [OPTIONS]:
    -c, --config                   Configuration file [./package.json].
    -e, --endpoint                 Graphql http endpoint ["https://domain.com/graphql"].
    -x, --header                   HTTP header for request (use with --endpoint). ["Authorization: Token cb8795e7"].
    -q, --query                    HTTP querystring for request (use with --endpoint) ["token=cb8795e7"].
    -s, --schema, --schema-file    Graphql Schema file ["./schema.json"].
    -p, --plugin                   Use plugins [default=graphdoc/plugins/default].
    -t, --template                 Use template [default=graphdoc/template/slds].
    -o, --output                   Output directory.
    -d, --data                     Inject custom data.
    -b, --base-url                 Base url for templates.
    -f, --force                    Delete outputDirectory if exists.
    -v, --verbose                  Output more information.
    -V, --version                  Show graphdoc version.
    -h, --help                     Print this help


Plugin

In graphdoc a plugin is simply an object that controls the content that is displayed on every page of your document.

This object should only implement the PluginInterface.

Make a Plugin

To create your own plugin you should only create it as a plain object or a constructor and export it as default

If you export your plugin as a constructor, when going to be initialized, will receive three parameters

  • schema: The full the result of GraphQL introspection query
  • projectPackage: The content of package.json of current project (or the content of file defined with --config flag).
  • graphdocPackage: The content of package.json of graphdoc.

For performance reasons all plugins receive the reference to the same object and therefore should not modify them directly as it could affect the behavior of other plugins (unless of course that is your intention)

Examples

  // es2015 export constructor

  export default class MyPlugin {

    constructor(schema, projectPackage, graphdocPackage) {}

    getAssets() {
      /* ... */
    }
  }
  // es2015 export plain object

  export default cost myPlugin = {
    getAssets() {
      /* ... */
    },
  }
  // export constructor

  function MyPlugin(schema, projectPackage, graphdocPackage) {
    /* ... */
  }

  MyPlugin.prototype.getAssets = function() {
    /* ... */
  };

  exports.default = MyPlugin;
  // export plain object

  exports.default = {
    getAssets: function() {
      /* ... */
    }
  };

Use plugin

You can use the plugins in 2 ways.

Use plugins with command line

  > graphdoc -p graphdoc/plugins/default \
  -p some-dependencies/plugin \
  -p ./lib/plugin/my-own-plugin \
  -s ./schema.json -o ./doc/schema

Use plugins with package.json

  // package.json

  {
    "name": "project",
    "graphdoc": {
      "endpoint": "http://localhost:8080/graphql",
      "output": "./doc/schema",
      "plugins": [
        "graphdoc/plugins/default",
        "some-dependencie/plugin",
        "./lib/plugin/my-own-plugin"
      ]
    }
  }

Build-in plugin

TODO

Template

TODO

Contributors

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].