# docusaurus-plugin-content-graphql

> Docusaurus plugin generating Markdown documentation from a GraphQL schema.

Latest version **0.4.0** (published 2021-02-25) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install docusaurus-plugin-content-graphql
pnpm add docusaurus-plugin-content-graphql
yarn add docusaurus-plugin-content-graphql
bun add docusaurus-plugin-content-graphql
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.4.0 |
| Published | 2021-02-25 |
| First published | 2021-02-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 27.5 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 26 |
| Author | Gabin Aureche |
| Maintainers | gabinzhouzi |
| Keywords | docusaurus, plugin, markdown, generated, graphql, documentation |

## Links

- npm: https://www.npmjs.com/package/docusaurus-plugin-content-graphql
- Repository: https://github.com/Zhouzi/docusaurus-plugin-content-graphql
- Homepage: https://github.com/zhouzi/docusaurus-plugin-content-graphql/
- Issues: https://github.com/zhouzi/docusaurus-plugin-content-graphql/issues/
- npm.io page: https://npm.io/package/docusaurus-plugin-content-graphql

## Dependencies (10)

- [joi](https://npm.io/package/joi.md) ^17.4.0
- [marked](https://npm.io/package/marked.md) ^2.0.0
- [graphql](https://npm.io/package/graphql.md) ^15.5.0
- [fs-extra](https://npm.io/package/fs-extra.md) ^9.1.0
- [url-join](https://npm.io/package/url-join.md) ^4.0.1
- [@types/marked](https://npm.io/package/@types/marked.md) ^1.2.2
- [@graphql-tools/load](https://npm.io/package/@graphql-tools/load.md) ^6.2.7
- [@graphql-tools/url-loader](https://npm.io/package/@graphql-tools/url-loader.md) ^6.8.1
- [@graphql-tools/json-file-loader](https://npm.io/package/@graphql-tools/json-file-loader.md) ^6.2.6
- [@graphql-tools/graphql-file-loader](https://npm.io/package/@graphql-tools/graphql-file-loader.md) ^6.2.7

## Alternatives

- [apollo-link-http-common](https://npm.io/package/apollo-link-http-common.md) — 879.0K weekly downloads
- [react-relay](https://npm.io/package/react-relay.md) — 336.8K weekly downloads
- [relay-test-utils](https://npm.io/package/relay-test-utils.md) — 181.6K weekly downloads
- [@vendure/core](https://npm.io/package/@vendure/core.md) — 14.8K weekly downloads
- [@pnpm/deps.graph-sequencer](https://npm.io/package/@pnpm/deps.graph-sequencer.md) — 13.4K weekly downloads

## Recent versions

- 0.4.0 (latest) — 2021-02-25
- 0.3.0 — 2021-02-25
- 0.2.0 — 2021-02-25
- 0.1.0 — 2021-02-25

## README

# docusaurus-plugin-content-graphql

Docusaurus plugin generating Markdown documentation from a GraphQL schema.

## Usage

1. In an existing Docusaurus project, install the plugin:

```
yarn add docusaurus-plugin-content-graphql
```

2. Add the plugin to your `docusaurus.config.js` file:

```js
module.exports = {
  // preceded by your existing configuration
  // ...
  plugins: [
    [
      "docusaurus-plugin-content-graphql",
      {
        // can be a path, a glob or an URL
        schema: "schema.graphql",
      },
    ],
  ],
};
```

3. Start the application:

```
yarn start
```

4. The plugin will generate Markdown files in the `docs/api` folder. So you can now add these files to your `sidebars.js`:

```js
modules.exports = {
  docs: {
    API: [
      "api/queries",
      "api/mutations",
      "api/objects",
      "api/interfaces",
      "api/enums",
      "api/unions",
      "api/inputObjects",
      "api/scalars",
    ],
  },
};
```

## Options

### `schema`

Can be a path, a glob or an URL used to load your GraphQL schema.

### `routeBasePath`

By default this is set to `/docs/api/` which means that the Markdown files will be generated in `docs/api`.
You can change the name of the generated folder and path to `api-reference` by setting this to: `/docs/api-reference/`.

This option is also useful if you used the docs plugin's `routeBasePath`. For example, if you opted for docs only:

```js
module.exports = {
  // preceded by your existing configuration
  // ...
  presets: [
    [
      "@docusaurus/preset-classic",
      {
        docs: {
          sidebarPath: require.resolve("./sidebars.js"),
          editUrl:
            "https://github.com/facebook/docusaurus/edit/master/website/",
          routeBasePath: "/",
        },
      },
    ],
  ],
  plugins: [
    [
      "docusaurus-plugin-content-graphql",
      {
        schema: "schema.graphql",
        routeBasePath: "/api/",
      },
    ],
  ],
};
```

With this configuration, the files are still generated in `docs/api` but the reference links will point to `/api/` instead of `/docs/api/`.

---
_Source: https://npm.io/package/docusaurus-plugin-content-graphql · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
