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
.mdastrc
Via npm install -g mdastnpm install -g mdast-lintnpm 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 mdastnpm install -g mdast-lintnpm 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
.