graphql-markdown
Advanced tools
Comparing version 5.1.0 to 5.2.0
{ | ||
"name": "graphql-markdown", | ||
"version": "5.1.0", | ||
"version": "5.2.0", | ||
"description": "Generate documentation for your GraphQL schema in Markdown", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -80,2 +80,3 @@ <div align="center"> | ||
--no-title Do not print a default title | ||
--no-toc Do not print table of contents | ||
--prologue <string> Include custom Markdown after the title | ||
@@ -89,2 +90,4 @@ --epilogue <string> Include custom Markdown after everything else | ||
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 | ||
@@ -98,3 +101,3 @@ ``` | ||
#### loadSchemaJSON(schemaPath: string) | ||
#### loadSchemaJSON(schemaPath: string, options: object) | ||
@@ -116,2 +119,4 @@ Given a string pointing to a GraphQL schema (URL, module, or file path), get the | ||
* **`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 | ||
@@ -118,0 +123,0 @@ the output, defaults to 1. Use this if you are using `updateSchema` to embed |
@@ -34,2 +34,3 @@ #!/usr/bin/env node | ||
--no-title Do not print a default title | ||
--no-toc Do not print table of contents | ||
--prologue <string> Include custom Markdown after the title | ||
@@ -81,2 +82,3 @@ --epilogue <string> Include custom Markdown after everything else | ||
epilogue: args.epilogue, | ||
skipTableOfContents: args['toc'] === false, | ||
headingLevel: args['heading-level'] | ||
@@ -83,0 +85,0 @@ } |
@@ -103,2 +103,3 @@ 'use strict' | ||
const skipTitle = options.skipTitle || false | ||
const skipTableOfContents = options.skipTableOfContents || false | ||
const prologue = options.prologue || '' | ||
@@ -157,41 +158,43 @@ const epilogue = options.epilogue || '' | ||
printer('<details>') | ||
printer(' <summary><strong>Table of Contents</strong></summary>\n') | ||
if (query) { | ||
printer(' * [Query](#query)') | ||
if (!skipTableOfContents) { | ||
printer('<details>') | ||
printer(' <summary><strong>Table of Contents</strong></summary>\n') | ||
if (query) { | ||
printer(' * [Query](#query)') | ||
} | ||
if (mutation) { | ||
printer(' * [Mutation](#mutation)') | ||
} | ||
if (objects.length) { | ||
printer(' * [Objects](#objects)') | ||
objects.forEach(type => { | ||
printer(` * [${type.name}](#${type.name.toLowerCase()})`) | ||
}) | ||
} | ||
if (inputs.length) { | ||
printer(' * [Inputs](#inputs)') | ||
inputs.forEach(type => { | ||
printer(` * [${type.name}](#${type.name.toLowerCase()})`) | ||
}) | ||
} | ||
if (enums.length) { | ||
printer(' * [Enums](#enums)') | ||
enums.forEach(type => { | ||
printer(` * [${type.name}](#${type.name.toLowerCase()})`) | ||
}) | ||
} | ||
if (scalars.length) { | ||
printer(' * [Scalars](#scalars)') | ||
scalars.forEach(type => { | ||
printer(` * [${type.name}](#${type.name.toLowerCase()})`) | ||
}) | ||
} | ||
if (interfaces.length) { | ||
printer(' * [Interfaces](#interfaces)') | ||
interfaces.forEach(type => { | ||
printer(` * [${type.name}](#${type.name.toLowerCase()})`) | ||
}) | ||
} | ||
printer('\n</details>') | ||
} | ||
if (mutation) { | ||
printer(' * [Mutation](#mutation)') | ||
} | ||
if (objects.length) { | ||
printer(' * [Objects](#objects)') | ||
objects.forEach(type => { | ||
printer(` * [${type.name}](#${type.name.toLowerCase()})`) | ||
}) | ||
} | ||
if (inputs.length) { | ||
printer(' * [Inputs](#inputs)') | ||
inputs.forEach(type => { | ||
printer(` * [${type.name}](#${type.name.toLowerCase()})`) | ||
}) | ||
} | ||
if (enums.length) { | ||
printer(' * [Enums](#enums)') | ||
enums.forEach(type => { | ||
printer(` * [${type.name}](#${type.name.toLowerCase()})`) | ||
}) | ||
} | ||
if (scalars.length) { | ||
printer(' * [Scalars](#scalars)') | ||
scalars.forEach(type => { | ||
printer(` * [${type.name}](#${type.name.toLowerCase()})`) | ||
}) | ||
} | ||
if (interfaces.length) { | ||
printer(' * [Interfaces](#interfaces)') | ||
interfaces.forEach(type => { | ||
printer(` * [${type.name}](#${type.name.toLowerCase()})`) | ||
}) | ||
} | ||
printer('\n</details>') | ||
@@ -198,0 +201,0 @@ if (query) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
248109
652
160