grunt-markdownlint

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

Grunt plugin for markdownlint, a rule-based Markdown linter. Version 3.1.6 wraps markdownlint 0.26+. Integrates linting into Grunt build pipelines, supporting config files (JSON) or inline rules. Alternatives: direct markdownlint CLI or other Grunt linters. Active maintenance, monthly releases.

error Warning: Task "markdownlint" not found.
cause grunt.loadNpmTasks('grunt-markdownlint') not called or plugin not installed.
fix
Run npm install --save-dev grunt-markdownlint and add grunt.loadNpmTasks('grunt-markdownlint') to Gruntfile.
error Fatal error: Cannot find module 'markdownlint'
cause markdownlint is a peer dependency not installed automatically.
fix
Run npm install --save-dev markdownlint.
breaking Minimum Node.js version required: v13+ (since v3.0.0). Older versions cause runtime errors.
fix Upgrade Node.js to v13 or later.
gotcha Config file must be parsed with grunt.file.readJSON, not a string path.
fix Use grunt.file.readJSON('path/to/config.json').
deprecated The 'rules' property in options is deprecated; use 'config' instead.
fix Replace 'rules' with 'config' in task options.
gotcha Glob patterns in src must not include directories without markdown files; task succeeds silently if no files matched.
fix Verify glob patterns with grunt.file.expand.
npm install grunt-markdownlint
yarn add grunt-markdownlint
pnpm add grunt-markdownlint

Registers markdownlint task with inline config, runs on all markdown files excluding node_modules.

// Gruntfile.js
module.exports = function(grunt) {
  grunt.loadNpmTasks('grunt-markdownlint');
  grunt.initConfig({
    markdownlint: {
      all: {
        options: {
          config: {
            'default': true,
            'line-length': false,
            'no-inline-html': false
          }
        },
        src: ['README.md', '**/*.md', '!node_modules']
      }
    }
  });
  grunt.registerTask('lint', ['markdownlint']);
};