Registry / devops / gatsby-remark-prettier

gatsby-remark-prettier

JSON →
library1.0.0jsnpmunverified

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.

npm install gatsby-remark-prettier
INSTALL
IMPORT
SIG · GATSBY-REMARK-PRET
G
gatsby-remark-prettier
devopsjavascriptv1.0.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

gatsby-remark-prettier
✓ { resolve: `gatsby-remark-prettier`, options: {} }
✗ plugins: ['gatsby-remark-prettier']
Must be used as a plugin in gatsby-config.js under gatsby-transformer-remark's plugins array, not as a top-level plugin.
options.usePrettierrc
✓ options: { usePrettierrc: true }
✗ options: { usePrettierrc: 'true' }
Boolean, not string. Defaults to true.
options.prettierOptions
✓ options: { prettierOptions: { semi: false } }
✗ options: { prettierOptions: { singleQuote: true } } (valid but depends on preference)
Accepts Prettier options object. Overrides .prettierrc if usePrettierrc is true.

Configures gatsby-remark-prettier to format code blocks, using .prettierrc and overriding some options, with a highlight plugin after it.

// gatsby-config.js module.exports = { plugins: [ { resolve: `gatsby-transformer-remark`, options: { plugins: [ { resolve: `gatsby-remark-prettier`, options: { usePrettierrc: true, prettierOptions: { semi: false, singleQuote: true } } }, `gatsby-remark-prismjs` ] } } ] }
Debug
Known issues
breakingRequires gatsby@^1.9.273 and prettier@^1.13.7. Not compatible with Gatsby v2+ or prettier v2+.
fix
Check peer dependency versions; if using newer Gatsby, look for alternatives or fork.
affects: >=1.0.0
gotchaOrder matters: gatsby-remark-prettier should be placed before any syntax highlighting plugins like gatsby-remark-prismjs to avoid conflicts.
fix
Place prettier plugin before highlight plugins in the plugins array.
affects: >=1.0.0
gotchaThe `usePrettierrc` option resolves config relative to process.cwd(), which may not be the project root in some Gatsby setups.
fix
Set `usePrettierrc: false` and specify all options in `prettierOptions` if issues arise.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'gatsby-remark-prettier'
Plugin not installed or missing in node_modules.
fix
npm install gatsby-remark-prettier
Warning: unknown plugin "gatsby-remark-prettier"
Plugin added to top-level plugins array instead of under gatsby-transformer-remark.
fix
Move it to the plugins array inside gatsby-transformer-remark options.
ReferenceError: prettier is not defined
prettier peer dependency not installed.
fix
npm install prettier@^1.13.7
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
gatsby-transformer-remarkrequiredRequired as the parent transformer to process Markdown files.
prettierrequiredPeer dependency used to format code blocks.
Agent activity
4 hits · last 30 days
node
4
Resources
gatsby-remark-prettier — npm install gatsby-remark-prettier · libregistry