Skip to content

Markdownlint

markdownlint-cli is a command line interface for the markdownlint Node.js style checker and lint tool for Markdown/CommonMark files.

I've evaluated these other projects (1, 2, but their configuration is less user friendly and are less maintained.

You can use this cookiecutter template to create a python project with markdownlint already configured.

Installation

npm install -g markdownlint-cli

Configuration

To configure your project, add a .markdownlint.json in your project root directory, or in any parent. I've opened an issue to see if they are going to support pyproject.toml to save the configuration. Check the styles examples.

Go to the rules document if you ever need to check more information on a specific rule.

You can use it both with:

  • The Vim through the ALE plugin.

  • Pre-commit:

    File: .pre-commit-config.yaml

    - repo: https://github.com/igorshubovych/markdownlint-cli
      rev: v0.23.2
      hooks:
        - id: markdownlint
    

Troubleshooting

Until the #2926 PR is merged you need to change the let l:pattern=.* file to make the linting work to:

File: ~/.vim/bundle/ale/autoload/ale/handlers

let l:pattern=': \?\(\d*\):\? \(MD\d\{3}\)\(\/\)\([A-Za-z0-9-\/]\+\)\(.*\)$'

References