Prettier Plugin Markdown No CJK Space
raw JSON → 1.5.1 verified Sat Apr 25 auth: no javascript
A Prettier plugin (v1.5.1, active) that prevents Prettier from inserting spaces between Chinese/Japanese characters and Latin letters/numbers in Markdown documents. Requires Prettier 2.x. Not needed with Prettier 3.x. Provides custom parsers 'markdown-nocjsp' and 'mdx-nocjsp'. Key differentiator: solves the specific issue of unwanted spacing for CJK text, with a quickFix option to revert past damage.
Common errors
error Cannot find module 'prettier-plugin-md-nocjsp' ↓
cause Plugin not installed or not in node_modules
fix
Run npm install --save-dev prettier-plugin-md-nocjsp
error Unsupported parser "markdown-nocjsp" specified. This typically indicates a misconfigured plugin. ↓
cause Prettier cannot load the plugin; it may be missing or not installed
fix
Install the plugin and ensure it is listed in plugins or auto-discovered
error Error: Unknown option: quickFix ↓
cause Using quickFix via CLI instead of config file
fix
Set quickFix: true in .prettierrc overrides, not as a CLI argument
error Error: prettier-plugin-md-nocjsp is only compatible with Prettier 2.x ↓
cause Trying to use with Prettier 3.x
fix
Downgrade to Prettier 2.x or uninstall this plugin (feature built into 3.x)
Warnings
breaking This plugin will NOT work with Prettier 3.x. Use the built-in behavior instead. ↓
fix Uninstall this plugin when upgrading to Prettier 3.x; it is no longer needed.
deprecated The functionality has been merged into Prettier 3.x. This plugin is deprecated for future use. ↓
fix Switch to Prettier 3.x and remove this plugin from dependencies.
gotcha quickFix option only works in configuration file, not via CLI flags. ↓
fix Add quickFix: true to .prettierrc overrides section for a one-time format.
gotcha The plugin only affects Markdown parsing; other Prettier rules (e.g., wrapping) still apply. ↓
fix Use the plugin only for CJK spacing; configure other Prettier options separately.
gotcha The plugin must be listed as a plugin in Prettier config or discovered automatically; it is not imported as a module. ↓
fix Ensure the package is installed and Prettier can find it (e.g., install in project root or use --plugins).
Install
npm install prettier-plugin-md-nocjsp yarn add prettier-plugin-md-nocjsp pnpm add prettier-plugin-md-nocjsp Imports
- plugin wrong
import prettierPluginMdNocjsp from 'prettier-plugin-md-nocjsp'; // not a JS module, it's a plugincorrectAdd 'prettier-plugin-md-nocjsp' to package.json or .prettierrc plugins; no JavaScript import needed - parser wrong
parser: 'nocjsp' // incorrect namecorrectSet parser: 'markdown-nocjsp' in .prettierrc overrides - option wrong
quickFix: false // default is false, but setting true only for one-time fixcorrectSet quickFix: true in .prettierrc overrides to remove existing extra spaces
Quickstart
// Install dependencies
npm install --save-dev prettier prettier-plugin-md-nocjsp
// Create .prettierrc with:
{
"overrides": [
{
"files": ["*.md", "README"],
"options": {
"parser": "markdown-nocjsp"
}
},
{
"files": "*.mdx",
"options": {
"parser": "mdx-nocjsp"
}
}
]
}
// Format your Markdown files
npx prettier --write *.md