Add MD042 no-empty-links "No empty links" (fixes #24).

This commit is contained in:
David Anson 2016-06-27 22:19:02 -07:00
parent efe9c9e73c
commit 2612a96ae8
7 changed files with 95 additions and 17 deletions

View file

@ -891,5 +891,21 @@ module.exports = [
errors.push(1);
}
}
},
{
"name": "MD042",
"desc": "No empty links",
"tags": [ "links" ],
"aliases": [ "no-empty-links" ],
"func": function MD034(params, errors) {
forEachInlineChild(params, "link_open", function forToken(token) {
token.attrs.forEach(function forAttr(attr) {
if (attr[0] === "href" && (!attr[1] || (attr[1] === "#"))) {
errors.push(token.lineNumber);
}
});
});
}
}
];