mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-18 23:10:12 +01:00
Adding a new rule, no-alt-text as per Issue #75
This commit is contained in:
parent
4345423be1
commit
7e3e671eeb
9 changed files with 75 additions and 5 deletions
18
lib/rules.js
18
lib/rules.js
|
|
@ -1202,5 +1202,23 @@ module.exports = [
|
|||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "MD045",
|
||||
"desc": "Images should have ALT Text attribute",
|
||||
"tags": [ "images", "accessibility" ],
|
||||
"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