Package Exports
- remark-lint-no-empty-image-alt-text
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (remark-lint-no-empty-image-alt-text) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
remark-lint-no-empty-image-alt-text
This remark-lint rule is created to check if all images have alt text or not. This will help to get standard accessibility for images.
<!-- Invalid -->

<!-- Valid -->

Using the rule
With remark
Let’s say example.js
looks as follows:
var report = require('vfile-reporter')
var remark = require('remark')
var remarkLint = require('remark-lint');
var imageAltText = require('remark-lint-no-empty-image-alt-text')
var file = remark()
.use(remarkLint)
.use(imageAltText)
.processSync('')
console.log(report(file))
Now, running node example.js
yields:
1:1-1:25 warning Missing alt text for image! no-empty-image-alt-text remark-lint
⚠ 1 warning
Via .remarkrc
npm install -g remark-cli
npm install remark-lint remark-lint-no-empty-image-alt-text
Then, set up your .remarkrc
:
{
"plugins": [
"lint",
"lint-no-empty-image-alt-text"
]
}
Now you can use the following command to run the lint:
remark xxx.md
Via CLI
npm install -g remark-cli
npm install remark-lint remark-lint-no-empty-image-alt-text
remark -u lint -u lint-no-empty-image-alt-text xxx.md