Registry / testing / lint-md

lint-md

JSON →
library0.2.0jsnpmunverified

lint-md is a core library for linting Chinese markdown files using AST-based rules. Version 0.2.0 is currently the latest and only version on npm. It provides lint, fix, and getDescription APIs, supporting over 17 rules covering spacing around Chinese/English, number formatting, empty content checks, and more. Rules can be configured with severity levels (ignore/warning/error) and options. Differentiator: focuses specifically on Chinese writing conventions, unlike generic markdown linting tools.

npm install lint-md
INSTALL
IMPORT
SIG · LINT-MD
L
lint-md
testingjavascriptv0.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

lint
import { lint } from 'lint-md'
import lint from 'lint-md'
Named export, not default.
fix
import { fix } from 'lint-md'
const { fix } = require('lint-md')
ESM only, CommonJS require may work but not officially supported.
getDescription
import { getDescription } from 'lint-md'
import getDescription from 'lint-md'
Named export.
version
import { version } from 'lint-md'
Exports version string.

Demonstrates lint, fix, and getDescription APIs with a simple markdown example.

import { lint, fix, getDescription } from 'lint-md'; const markdown = '# Hello 中文'; const rules = { 'space-round-alphabet': 2 }; const errors = lint(markdown, rules); console.log('Errors:', errors); // Fix the markdown const fixed = fix(markdown); console.log('Fixed:', fixed); // Get description for a rule const desc = getDescription('space-round-alphabet', 'zh_CN'); console.log('Description:', desc);
lint-md --version
Debug
Known issues
gotchaAll rules default to error level; must explicitly set rules object to ignore.
fix
Pass a rules object with rule names mapped to 0, 1, or 2.
affects: >=0.2.0
gotchaRule options for no-long-code are only accepted when severity is an array, not a number.
fix
Use [2, { length: 100, exclude: [] }] instead of { 2: {...} }.
affects: >=0.2.0
gotchagetDescription second parameter is a language string (e.g., 'zh_CN'), not a locale object.
fix
Pass string 'en_US' or 'zh_CN'.
affects: >=0.2.0
gotchaLint and fix work on raw markdown strings, not file paths.
fix
Read file content first with fs.readFileSync().
affects: >=0.2.0
Errors
Common errors & fixes
Cannot find module 'lint-md'
Package not installed or import path incorrect.
fix
Run 'npm install lint-md' and ensure import is from 'lint-md' (no subpath).
TypeError: lint is not a function
Using default import instead of named import.
fix
Use 'import { lint } from "lint-md"' instead of 'import lint from "lint-md"'.
Uncaught TypeError: fix is not a function
Using destructured require incorrectly in ESM context.
fix
Use 'import { fix } from "lint-md"' if using ESM.
Upgrade
Version history
0.2.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
lint-md — npm install lint-md · libregistry