{"id":17351153,"url":"https://github.com/aschaeffer/mdbook-preprocessor-graphql-playground","last_synced_at":"2025-06-20T03:04:11.917Z","repository":{"id":59145170,"uuid":"534631339","full_name":"aschaeffer/mdbook-preprocessor-graphql-playground","owner":"aschaeffer","description":"A preprocessor for mdbook to add GraphQL playgrounds.","archived":false,"fork":false,"pushed_at":"2025-05-16T16:26:09.000Z","size":2061,"stargazers_count":3,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-19T00:43:45.321Z","etag":null,"topics":["documentation-generator","graphql","mdbook","mdbook-plugins","mdbook-preprocessor"],"latest_commit_sha":null,"homepage":"https://aschaeffer.github.io/mdbook-preprocessor-graphql-playground/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aschaeffer.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-09-09T12:21:51.000Z","updated_at":"2025-04-10T14:44:12.000Z","dependencies_parsed_at":"2024-10-26T13:56:57.162Z","dependency_job_id":"34c89cf2-7704-4e75-956a-9a31bcd77594","html_url":"https://github.com/aschaeffer/mdbook-preprocessor-graphql-playground","commit_stats":{"total_commits":92,"total_committers":2,"mean_commits":46.0,"dds":0.06521739130434778,"last_synced_commit":"8a3a8e0da387f9eb757d291b782d30cc7d9bdc6b"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/aschaeffer/mdbook-preprocessor-graphql-playground","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aschaeffer%2Fmdbook-preprocessor-graphql-playground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aschaeffer%2Fmdbook-preprocessor-graphql-playground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aschaeffer%2Fmdbook-preprocessor-graphql-playground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aschaeffer%2Fmdbook-preprocessor-graphql-playground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aschaeffer","download_url":"https://codeload.github.com/aschaeffer/mdbook-preprocessor-graphql-playground/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aschaeffer%2Fmdbook-preprocessor-graphql-playground/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260868844,"owners_count":23074959,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["documentation-generator","graphql","mdbook","mdbook-plugins","mdbook-preprocessor"],"created_at":"2024-10-15T17:09:05.392Z","updated_at":"2025-06-20T03:04:06.891Z","avatar_url":"https://github.com/aschaeffer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GraphQL Playground for your mdbook\n\nA preprocessor for [mdbook](https://github.com/rust-lang/mdBook) to add a [GraphQL playground](https://github.com/graphql/graphql-playground).\n\n---\n\n[\u003cimg src=\"https://img.shields.io/badge/Docs-mdBook-brightgreen\"\u003e](https://aschaeffer.github.io/mdbook-preprocessor-graphql-playground/)\n[![Crate](https://img.shields.io/crates/v/mdbook-preprocessor-graphql-playground.svg)](https://crates.io/crates/mdbook-preprocessor-graphql-playground)\n[\u003cimg src=\"https://img.shields.io/badge/Language-Rust-brightgreen\"\u003e](https://www.rust-lang.org/)\n[\u003cimg src=\"https://img.shields.io/github/actions/workflow/status/aschaeffer/mdbook-preprocessor-graphql-playground/rust.yml\"\u003e](https://github.com/aschaeffer/mdbook-preprocessor-graphql-playground/actions?query=workflow%3ARust)\n[\u003cimg src=\"https://img.shields.io/github/last-commit/aschaeffer/mdbook-preprocessor-graphql-playground\"\u003e]()\n[\u003cimg src=\"https://img.shields.io/github/languages/code-size/aschaeffer/mdbook-preprocessor-graphql-playground\"\u003e]()\n[![downloads](https://img.shields.io/crates/d/mdbook-preprocessor-graphql-playground.svg)](https://crates.io/crates/mdbook-preprocessor-graphql-playground)\n\n---\n\n[![preview](book/src/images/screenshot.png)](book/src/images/screenshot.png)\n\n## Demo\n\nhttps://aschaeffer.github.io/mdbook-preprocessor-graphql-playground/\n\n## Usage\n\n1. Install `mdbook-preprocessor-graphql-playground`\n    ```shell\n    cargo install mdbook-preprocessor-graphql-playground\n    ```\n2. Add to `book.toml`:\n    ```toml\n    [preprocessor.graphql-playground]\n    command = \"mdbook-graphql-playground\"\n    renderer = [\"html\"]\n    \n    [output]\n    \n    [output.html]\n    additional-js = [\"graphql-playground-react-middleware.js\", \"graphql-playground.js\"]\n    additional-css = [\"graphql-playground.css\"]\n    ```\n3. Copy assets into the book root directory:\n    ```shell\n    cp assets/graphql-playground.css \u003cbook_dir\u003e\n    cp assets/graphql-playground.js \u003cbook_dir\u003e\n    cp assets/graphql-playground-react-middleware.js \u003cbook_dir\u003e\n    cp assets/images/* \u003cbook_dir\u003e/src/images/\n    ```\n4. Create a [query file](#query-files)\n    ```shell\n    mkdir -p \u003cbook_dir\u003e/queries/swapi\n    nano \u003cbook_dir\u003e/queries/swapi/all-planets.query.graphql\n    ```\n5. Create a [config file](#config-files)\n    ```shell\n    mkdir \u003cbook_dir\u003e/configs\n    nano \u003cbook_dir\u003e/configs/swapi.json\n    ```\n6. Embed the GraphQL Playground in your markdown files\n    ```\n    {{ graphql_playground(config=\"/configs/swapi.json\") }}\n    ```\n\n### Query files\n\n* You can have multiple queries\n\n```graphql\nquery AllPlanetsQuery {\n  allPlanets {\n    planets {\n      name\n      diameter\n    }\n  }\n}\n```\n\n### Config files\n\n* You can have multiple config files\n* You can have multiple tabs, each refers to a query\n\n```json\n{\n  \"title\": \"The Star Wars API\",\n  \"description\": \"Explore the star wars API using mdbook-preprocessor-graphql-playground\",\n  \"endpoint\": \"https://swapi-graphql.netlify.app/.netlify/functions/index\",\n  \"tabs\": [\n    {\n      \"name\": \"All Planets\",\n      \"url\": \"/queries/swapi/all-planets.query.graphql\"\n    }\n  ]\n}\n```\n\n### Use a config in the book\n\n1. Embed with the `graphql_playground` function\n2. Specify the location of the config file with the `config` parameter\n\n```\n{{ graphql_playground(config=\"/configs/swapi.json\") }}\n```\n\n### Example\n\nA full example can be found [in this repository](https://github.com/aschaeffer/mdbook-preprocessor-graphql-playground/tree/main/book)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faschaeffer%2Fmdbook-preprocessor-graphql-playground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faschaeffer%2Fmdbook-preprocessor-graphql-playground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faschaeffer%2Fmdbook-preprocessor-graphql-playground/lists"}