Code Monkey home page Code Monkey logo

grunt-markdownlint's Introduction

grunt-markdownlint

NPM Version CI Coverage Status Known Vulnerabilities Inline docs License Total Downloads

A grunt task for markdown style checker and lint tool.

Overview

The markdownlint grunt plugin enables to run rule based linting on your project markdown files.

See markdownlint for more information.

For linting rules, please see Rules document.

Usage

In order to use the markdownlint plugin, please use following example:

//to use via grunt, first load the task
require('load-grunt-tasks')(grunt); // npm install --save-dev load-grunt-tasks
//or load it manually
grunt.loadNpmTasks('grunt-markdownlint');

grunt.initConfig({
  markdownlint: {
    example1: {
      options: {
        config: { //configure the linting rules
          'default': true,
          'line-length': false,
          'blanks-around-headers': false,
          'no-duplicate-header': false,
          'no-inline-html': false
        }
      },
      src: [
        'README.md',
        '.github/*.md'
      ]
    },
    example2: {
      options: {
        config: grunt.file.readJSON(rulesFile) //read linting rules from file
      },
      src: [
        'README.md',
        '.github/*.md'
      ]
    }
  }
});

grunt.registerTask('default', ['markdownlint:example1']);

The different options are defined in the markdownlint api documentation.

Installation

In order to use this library, just run the following npm install command:

npm install --save-dev grunt-markdownlint

API Documentation

See full docs at: API Docs

Contributing

See contributing guide

Release History

Date Version Description
2022-12-28 v3.1.6 Upgrade markdownlint version
2022-08-06 v3.1.5 Upgrade markdownlint version
2022-01-04 v3.1.4 Upgrade markdownlint version
2021-08-24 v3.1.3 Upgrade markdownlint version
2021-02-08 v3.1.2 Upgrade markdownlint version
2020-11-26 v3.1.1 Upgrade markdownlint version
2020-09-22 v3.1.0 Upgrade markdownlint version
2020-05-11 v3.0.0 Migrate to github actions and upgrade minimal node version
2020-04-13 v2.10.0 Upgrade markdownlint version
2018-06-07 v2.0.0 Upgrade markdownlint and minimal node version
2018-05-29 v1.1.6 Upgrade markdownlint version
2016-11-04 v1.0.11 Support new markdownlint 0.3.0 options
2016-07-01 v0.1.0 Updated task config to use options
2016-06-14 v0.0.5 Initial release

License

Developed by Sagie Gur-Ari and licensed under the Apache 2 open source license.

grunt-markdownlint's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar sagiegurari avatar xhmikosr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

grunt-markdownlint's Issues

Provide alternative means (or document) use with `.markdownlint.json`

Problem Description

Grunt task ignores .markdownlint.json and only processes rules placed within its options.config.
A "markdownlint-cli" user with an existing configuration file (or someone wishing to store tool configuration externally) is SOL. Propose adding options.configFile to simplify external configuration; it would read the file's contents and store within options.config.

Proposed Gruntfile.coffee modification (partial)
  grunt.initConfig
    readme: 'README.md'
    markdownlint:
      options:
        configFile: '.markdownlint.json'
      default:
        src: [
          '<%= readme %>'
        ]

Alternatively (or meanwhile), document use of external file configuration.

Gruntfile.coffee using existing codebase without modification (partial)
  grunt.initConfig
    readme: 'README.md'
    markdownlint:
      options:
        config: require './.markdownlint.json'
      default:
        src: [
          '<%= readme %>'
        ]

Accept markdownlint config file

Problem Description

Doesn't accept markdownlint config file.

Code Example

markdownlint: {
    all: {
        options: {
            config: './markdownlint.json'
        },
        src: [
            'src/**/*.md'
        ]
    }
},

I believe this would make things much simpler.

bug(registering): “No tasks were registered or unregistered”

1. Summary

Possible grunt-markdownlint bug.

On the stage “Registering Gruntfile tasks” after

Loading "grunt-markdownlint.js" tasks…OK

+ markdownlint

Loading "linter.js" tasks…OK

I get in console:

>> No tasks were registered or unregistered.

I’m not getting it for any of my 50 Grunt plugins.

2. MCVE

This configuration on GitHub, Travis CI build for it.

  1. Gruntfile.coffee:

    module.exports = (grunt) ->
    
    	grunt.loadNpmTasks('grunt-markdownlint')
    	# [INFO] Or any another working Grunt plugins instead of “grunt-contrib-stylus”,
    	# “grunt-purgecss” and “merge-source-maps”
    	grunt.loadNpmTasks('grunt-contrib-stylus')
    	grunt.loadNpmTasks('grunt-purgecss')
    	grunt.loadNpmTasks('merge-source-maps')
    
    	grunt.initConfig
    
    		markdownlint:
    			# [INFO] Or any another valid Markdown file
    			src: ["KiraGoddess.md"]
    
  2. package.json:

    {
    	"devDependencies": {
    		"coffeescript": "^2.7.0",
    		"grunt": "^1.5.3",
    		"grunt-contrib-stylus": "^1.2.0",
    		"grunt-markdownlint": "^3.1.5",
    		"grunt-purgecss": "^5.0.0",
    		"merge-source-maps": "^0.6.1"
    	}
    }
    
  3. KiraGoddess.md:

    # Kira
    
    Goddess!
    
  4. The part of the .travis.yml:

    install:
    - npm install -g grunt-cli
    - npm install
    
    script:
    - grunt markdownlint --verbose --stack
    

3. Behavior

Travis CI link:

	Reading "Gruntfile.coffee" Gruntfile…OK

	Registering Gruntfile tasks.

	Registering "grunt-markdownlint" local Npm module tasks.

	Reading /home/travis/build/Kristinita/SashaGruntDebugging/node_modules/grunt-markdownlint/package.json…OK

	Parsing /home/travis/build/Kristinita/SashaGruntDebugging/node_modules/grunt-markdownlint/package.json…OK

	Loading "grunt-markdownlint.js" tasks…OK

	+ markdownlint

	Loading "linter.js" tasks…OK

+	>> No tasks were registered or unregistered.

	Registering "grunt-contrib-stylus" local Npm module tasks.

	Reading /home/travis/build/Kristinita/SashaGruntDebugging/node_modules/grunt-contrib-stylus/package.json…OK

	Parsing /home/travis/build/Kristinita/SashaGruntDebugging/node_modules/grunt-contrib-stylus/package.json…OK

	Loading "stylus.js" tasks…OK

	+ stylus

	Registering "grunt-purgecss" local Npm module tasks.

	Reading /home/travis/build/Kristinita/SashaGruntDebugging/node_modules/grunt-purgecss/package.json…OK

	Parsing /home/travis/build/Kristinita/SashaGruntDebugging/node_modules/grunt-purgecss/package.json…OK

	Loading "purgecss.js" tasks…OK

	+ purgecss

	Registering "merge-source-maps" local Npm module tasks.

	Reading /home/travis/build/Kristinita/SashaGruntDebugging/node_modules/merge-source-maps/package.json…OK

	Parsing /home/travis/build/Kristinita/SashaGruntDebugging/node_modules/merge-source-maps/package.json…OK

	Loading "merge.js" tasks…OK

	+ merge-source-maps

	Initializing config…OK

As you can see in this console output, Grunt generate unexpected message solely after grunt-markdownlint linter.js loading. After registering and loading other Grunt plugins, Grunt doesn’t generate this message.

4. Environment

  1. Operating system:

    1. Local — Microsoft Windows [Version 10.0.19041.1415]
    2. Travis CI — Ubuntu 22.04 LTS Jammy Jellyfish
  2. Node.js v18.9.0

  3. grunt-cli v1.3.2, grunt v1.5.3

  4. grunt-markdownlint 3.1.5

Thanks.

Add "engines" specification to "package.json"

Problem Description

This package does not indicate which versions of Node are supported.
For example, your update of "markdownlint" caused the supported version
of Node to change in a patch release. This requires others to have to track
through your commits as well as those of your dependencies to figure out
WTH happened. While I see no reason for this package to have specified a
newer version of "markdownlint" (since its API did not change), this change
would have been caught by TravisCI if "engines" had been specified.

This fix should officially update the package version to 2.0.0, as should
have occurred for 1.1.5.

Fix to specify Node-6 LTS

...
"engines": {
    "node": ">= 6.14.12",
    "npm": ">= 3.10.10"
  }
}

English

CONTRIBUTING.md:

  1. First place to go is the repository issues section[,] and I'll try to help as much as possible.
  2. This repository is integrated with travis.ci for [continuous] integration.
  3. Any fix/enhancement must come with a set of tests to ensure [it's] working well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.