remark-lint-spaces-around-number

raw JSON →
0.1.2 verified Fri May 01 auth: no javascript

A remark-lint plugin (v0.1.2) enforcing spacing between numbers and Chinese characters per the Chinese Document Style Guide. It warns when a number (including percentages) is directly adjacent to Chinese text without a space. Designed for use with remark-lint, it integrates into remark CLI, config files, or API. Differs from general lint rules by targeting CJK typographic conventions; actively maintained with irregular release cadence.

error TypeError: remarkLintSpacesAroundNumber is not a function
cause Named import of default-exported package
fix
Use import remarkLintSpacesAroundNumber from 'remark-lint-spaces-around-number'
error Error: Cannot find module 'remark-lint'
cause remark-lint not installed as a dependency
fix
Run npm install remark-lint
error Warning: unknown rule "spaces-around-number"
cause Plugin not registered in remark config or .use() chain before remark-lint
fix
Add remark-lint-spaces-around-number as a plugin after remark-lint
gotcha Plugin only works with remark-lint and unified ecosystem
fix Ensure remark-lint is installed and used as a plugin before this one.
gotcha Default export; named import will yield undefined
fix Use default import: import pkg from 'remark-lint-spaces-around-number'
breaking Incompatible with remark 13+ if using older plugin API
fix Upgrade to v0.1.0 or later which uses unified-lint-rule
deprecated Console usage via require('remark-lint-spaces-around-number') may stop working in future ESM-only releases
fix Use import syntax
npm install remark-lint-spaces-around-number
yarn add remark-lint-spaces-around-number
pnpm add remark-lint-spaces-around-number

Shows usage with remark API: process markdown and catch missing space between number and Chinese.

import remark from 'remark';
import remarkLint from 'remark-lint';
import remarkLintSpacesAroundNumber from 'remark-lint-spaces-around-number';
import report from 'vfile-reporter';

remark()
  .use(remarkLint)
  .use(remarkLintSpacesAroundNumber)
  .process('理财产品的收益是 4.0%左右。', (err, file) => {
    console.error(report(err || file));
  });
// Output: 1:10-1:13 warning Should have space after "4.0%"