remark-lint-match-punctuation

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

A remark-lint rule that warns when paired punctuation marks (e.g., parentheses, quotation marks, brackets) are not properly matched. Version 0.2.1 is the latest release, with no frequent updates. It focuses on non-ASCII pairs like Chinese quotation marks and angle quotes. Unlike general remark-lint rules, this plugin specifically targets punctuation mismatches that are not covered by standard linting.

error Error: Cannot find module 'remark-lint-match-punctuation'
cause Package not installed.
fix
Run npm install remark-lint-match-punctuation
error TypeError: Cannot read properties of undefined (reading 'match-punctuation')
cause Plugin not registered correctly in remark configuration.
fix
Ensure the config has "remark-lint-match-punctuation": true and that remark-lint is also used.
error Invalid option for plugin remark-lint-match-punctuation: expected array of 2-character strings
cause Options passed in wrong format.
fix
Pass options as an array of strings where each string is exactly two characters (left and right pair).
gotcha The plugin only checks explicitly listed punctuation pairs. Custom characters may not be caught unless passed as options.
fix Pass custom pairs as an array of two-character strings to the plugin.
breaking No breaking changes documented; handle with care.
fix Review changelog for any future updates.
gotcha The plugin does not ignore punctuation inside code blocks or inline code by default.
fix Use a custom markdown node walker to skip these cases, or combine with other remark plugins.
npm install remark-lint-match-punctuation
yarn add remark-lint-match-punctuation
pnpm add remark-lint-match-punctuation

Demonstrates using the plugin with remark programmatically to lint a markdown file for punctuation pair mismatches.

import { remark } from 'remark';
import remarkLint from 'remark-lint';
import remarkLintMatchPunctuation from 'remark-lint-match-punctuation';
import { readSync } from 'to-vfile';
import { reporter } from 'vfile-reporter';

const file = readSync('./readme.md');
remark()
  .use(remarkLint)
  .use(remarkLintMatchPunctuation)
  .process(file, (err, result) => {
    console.error(reporter(err || result));
  });