mdast-lint-url-trailing-slash

0.1.1 • Public • Published

mdast-lint-trailing-slash

This mdast-lint rule was created for free-programming-books-lint to enforce free-programming-books formatting guidelines.

This rule checks that the host part of a URL has no extra trailing slash. It only applies to links.

<!-- Invalid -->
 
[example.com](http://example.com/)
 
<!-- Valid -->
 
[example.com](http://example.com)

Using the rule

Via .mdastrc

npm install -g mdast
npm install -g mdast-lint
npm install mdast-lint-trailing-slash # local install! 

Then, set up your .mdastrc:

{
  "plugins": {
    "mdast-lint": {
      "external": ["mdast-lint-trailing-slash"]
    }
  }
}

Now you can use the following command to run the lint:

mdast --no-stdout xxx.md

Via CLI

npm install -g mdast
npm install -g mdast-lint
npm install -g mdast-lint-trailing-slash # global install! 
mdast --no-stdout -u mdast-lint="external:[\"mdast-lint-trailing-slash\"]" xxx.md

Note that the lint=<lint_options> option only works with mdast >= 1.1.1.

This README.md is based on this one by @chcokr (MIT).

Readme

Keywords

none

Package Sidebar

Install

npm i mdast-lint-url-trailing-slash

Weekly Downloads

1

Version

0.1.1

License

MIT

Last publish

Collaborators

  • vhf