{"id":47904,"library":"graphql-markdown","title":"graphql-markdown","description":"Generates Markdown documentation from a GraphQL schema, supporting introspection URLs, GraphQL files, JSON introspection results, and JS modules exporting GraphQLSchema. Version 7.3.0 requires Node >=14 and peer dependency graphql ^14.0.2 || ^15.0.0 || ^16.0.0. Offers CLI with options like --title, --no-toc, --toc-fields, --prologue, --epilogue, --heading-level, and --update-file for embedding in existing Markdown. Steady release cadence; lighter-weight alternative to graphql-docs.","status":"active","version":"7.3.0","language":"javascript","source_language":"en","source_url":"git@github.com:exogen/graphql-markdown","tags":["javascript"],"install":[{"cmd":"npm install graphql-markdown","lang":"bash","label":"npm"},{"cmd":"yarn add graphql-markdown","lang":"bash","label":"yarn"},{"cmd":"pnpm add graphql-markdown","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required to work with GraphQL schema objects and introspection queries.","package":"graphql","optional":false}],"imports":[{"note":"Package uses ESM; default export is the main function.","wrong":"const graphqlMarkdown = require('graphql-markdown'); // Use ESM import for proper default export","symbol":"default","correct":"import graphqlMarkdown from 'graphql-markdown'"},{"note":"ESM default import; no named exports.","wrong":"","symbol":"graphqlMarkdown","correct":"import graphqlMarkdown from 'graphql-markdown'"},{"note":"CommonJS require must use .default to access the default export.","wrong":"const graphqlMarkdown = require('graphql-markdown') // Returns ESM module, requires .default","symbol":"require","correct":"const graphqlMarkdown = require('graphql-markdown').default"}],"quickstart":{"code":"import graphqlMarkdown from 'graphql-markdown';\nimport { buildSchema } from 'graphql';\n\nconst schema = buildSchema(`\n  type Query {\n    \"A friendly greeting\"\n    hello: String\n    \"Multiply two numbers\"\n    multiply(a: Int!, b: Int!): Int\n  }\n`);\n\nconst markdown = await graphqlMarkdown({ schema });\nconsole.log(markdown);","lang":"typescript","description":"Generate Markdown documentation from a GraphQL schema defined in code, showing async usage and default export."},"warnings":[{"fix":"Await the result of the imported function: const markdown = await graphqlMarkdown({ schema });","message":"v7 changed default export to async function; previously it was synchronous.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Use const graphqlMarkdown = require('graphql-markdown').default; or switch to ESM import.","message":"v7 removed support for CommonJS default require without .default.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Wrap schema in an object: graphqlMarkdown({ schema })","message":"Passing schema as first argument (non-object) is deprecated since v7.","severity":"deprecated","affected_versions":">=7.0.0 <8.0.0"},{"fix":"Add the markers to your Markdown file before running the command.","message":"When using --update-file, the file must contain <!-- START graphql-markdown --> and <!-- END graphql-markdown --> markers.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Verify the endpoint works with a tool like GraphiQL.","message":"CLI may fail if schema URL does not respond with valid GraphQL introspection result.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'14':28 '14.0.2':33 '15.0.0':34 '16.0.0':35 '7.3.0':25 'altern':68 'cadenc':64 'cli':37 'depend':31 'doc':72 'document':6 'embed':58 'epilogu':49 'exist':60 'export':22 'field':47 'file':15,56 'generat':4 'graphql':2,9,14,32,71 'graphql-doc':70 'graphql-markdown':1 'graphqlschema':23 'head':51 'heading-level':50 'introspect':12,17 'javascript':73 'js':20 'json':16 'level':52 'lighter':66 'lighter-weight':65 'like':40 'markdown':3,5,61 'modul':21 'no-toc':42 'node':27 'offer':36 'option':39 'peer':30 'prologu':48 'releas':63 'requir':26 'result':18 'schema':10 'steadi':62 'support':11 'titl':41 'toc':44,46 'toc-field':45 'updat':55 'update-fil':54 'url':13 'version':24 'weight':67","created_at":"2026-06-07T16:53:55.712533+00:00","updated_at":"2026-06-07T16:53:55.712533+00:00","problems":[{"fix":"Change to const graphqlMarkdown = require('graphql-markdown').default;","cause":"Using require() without .default in CommonJS for v7+.","error":"graphqlMarkdown is not a function"},{"fix":"Run npm install graphql-markdown --save-dev","cause":"Package not installed or not in node_modules.","error":"Cannot find module 'graphql-markdown'"},{"fix":"Call graphqlMarkdown({ schema })","cause":"Passing schema as a bare argument instead of object in v7+.","error":"Received a non-object argument as schema"},{"fix":"Check URL, network connectivity, and CORS settings.","cause":"Introspection endpoint unreachable or not returning JSON.","error":"graphql-markdown: error: Could not retrieve schema from <url>"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"git@github.com:exogen/graphql-markdown","github":"git@github.com:exogen/graphql-markdown","docs":null,"changelog":null,"pypi":null,"npm":"graphql-markdown","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}