2018-01-21 21:44:25 -08:00
|
|
|
// @ts-check
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
2019-04-13 11:18:57 -07:00
|
|
|
const { addError, forEachInlineChild } = require("../helpers");
|
2018-01-21 21:44:25 -08:00
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
"names": [ "MD045", "no-alt-text" ],
|
|
|
|
|
"description": "Images should have alternate text (alt text)",
|
|
|
|
|
"tags": [ "accessibility", "images" ],
|
|
|
|
|
"function": function MD045(params, onError) {
|
2019-04-13 11:18:57 -07:00
|
|
|
forEachInlineChild(params, "image", function forToken(token) {
|
2018-01-21 21:44:25 -08:00
|
|
|
if (token.content === "") {
|
2019-04-13 11:18:57 -07:00
|
|
|
addError(onError, token.lineNumber);
|
2018-01-21 21:44:25 -08:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
};
|