Update MD054/link-image-style to handle autolinked email addresses when disallowed (fixes #1391).

This commit is contained in:
David Anson 2024-10-27 22:02:25 -07:00
parent 3b07268aeb
commit a7a50eaa39
16 changed files with 858 additions and 4 deletions

View file

@ -51,9 +51,9 @@ module.exports = {
let isError = false;
if (type === "autolink") {
// link kind is an autolink
destination = getDescendantsByType(link, [ "autolinkProtocol" ])[0].text;
destination = getDescendantsByType(link, [ [ "autolinkEmail", "autolinkProtocol" ] ])[0]?.text;
label = destination;
isError = !autolink;
isError = !autolink && Boolean(destination);
} else {
// link type is "image" or "link"
label = getDescendantsByType(link, [ "label", "labelText" ])[0].text;