mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-09-21 21:30:47 +02:00
Add MD045/no-alt-text (fixes #75).
This commit is contained in:
parent
ac180ff9b9
commit
4fa837a031
8 changed files with 94 additions and 5 deletions
18
lib/rules.js
18
lib/rules.js
|
@ -1219,5 +1219,23 @@ module.exports = [
|
|||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "MD045",
|
||||
"desc": "Images should have ALT Text attribute",
|
||||
"tags": [ "accessibility", "images" ],
|
||||
"aliases": [ "no-alt-text" ],
|
||||
"regexp": null,
|
||||
"func": function MD045(params, errors) {
|
||||
forEachInlineChild(params, "image", function forToken(token) {
|
||||
if (token.content === "") {
|
||||
token.attrs.forEach(function forAttr(attr) {
|
||||
if (attr[0] === "alt" && attr[1] === "") {
|
||||
errors.add(token.lineNumber);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue