{"id":20056,"library":"gatsby-remark-prettier","title":"gatsby-remark-prettier","description":"A Gatsby remark plugin that formats code blocks in Markdown files using Prettier. Version 1.0.0 is stable but relies on older Gatsby (^1.9.273) and Prettier (^1.13.7) peer dependencies. It integrates with gatsby-transformer-remark and can be configured to use a local .prettierrc file or override options. Unlike manual formatting, it automates code block styling within Gatsby's build pipeline. No longer actively developed.","status":"active","version":"1.0.0","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","gatsby","gatsby-plugin","prettier","remark"],"install":[{"cmd":"npm install gatsby-remark-prettier","lang":"bash","label":"npm"},{"cmd":"yarn add gatsby-remark-prettier","lang":"bash","label":"yarn"},{"cmd":"pnpm add gatsby-remark-prettier","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required as the parent transformer to process Markdown files.","package":"gatsby-transformer-remark","optional":false},{"reason":"Peer dependency used to format code blocks.","package":"prettier","optional":false}],"imports":[{"note":"Must be used as a plugin in gatsby-config.js under gatsby-transformer-remark's plugins array, not as a top-level plugin.","wrong":"plugins: ['gatsby-remark-prettier']","symbol":"gatsby-remark-prettier","correct":"{\n  resolve: `gatsby-remark-prettier`,\n  options: {}\n}"},{"note":"Boolean, not string. Defaults to true.","wrong":"options: { usePrettierrc: 'true' }","symbol":"options.usePrettierrc","correct":"options: { usePrettierrc: true }"},{"note":"Accepts Prettier options object. Overrides .prettierrc if usePrettierrc is true.","wrong":"options: { prettierOptions: { singleQuote: true } } (valid but depends on preference)","symbol":"options.prettierOptions","correct":"options: { prettierOptions: { semi: false } }"}],"quickstart":{"code":"// gatsby-config.js\nmodule.exports = {\n  plugins: [\n    {\n      resolve: `gatsby-transformer-remark`,\n      options: {\n        plugins: [\n          {\n            resolve: `gatsby-remark-prettier`,\n            options: {\n              usePrettierrc: true,\n              prettierOptions: {\n                semi: false,\n                singleQuote: true\n              }\n            }\n          },\n          `gatsby-remark-prismjs`\n        ]\n      }\n    }\n  ]\n}","lang":"javascript","description":"Configures gatsby-remark-prettier to format code blocks, using .prettierrc and overriding some options, with a highlight plugin after it."},"warnings":[{"fix":"Check peer dependency versions; if using newer Gatsby, look for alternatives or fork.","message":"Requires gatsby@^1.9.273 and prettier@^1.13.7. Not compatible with Gatsby v2+ or prettier v2+.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Place prettier plugin before highlight plugins in the plugins array.","message":"Order matters: gatsby-remark-prettier should be placed before any syntax highlighting plugins like gatsby-remark-prismjs to avoid conflicts.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Set `usePrettierrc: false` and specify all options in `prettierOptions` if issues arise.","message":"The `usePrettierrc` option resolves config relative to process.cwd(), which may not be the project root in some Gatsby setups.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"npm install gatsby-remark-prettier","cause":"Plugin not installed or missing in node_modules.","error":"Error: Cannot find module 'gatsby-remark-prettier'"},{"fix":"Move it to the plugins array inside gatsby-transformer-remark options.","cause":"Plugin added to top-level plugins array instead of under gatsby-transformer-remark.","error":"Warning: unknown plugin \"gatsby-remark-prettier\""},{"fix":"npm install prettier@^1.13.7","cause":"prettier peer dependency not installed.","error":"ReferenceError: prettier is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}