mdast-lint-url-trailing-slash
v0.1.1
Published
Checks that the host part of a URL has no extra trailing slash
Downloads
3
Readme
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
.