Repository: lycheeverse/lychee

Issue #1462: Mastodon link is interpreted as email address
Created: 2024-07-03T20:00:23Z
When running Lychee on degrowth.net/organisations/instituto-resiliencia/index.html, it reports, that the email address cannot be reached:

Errors in public/organisations/instituto-resiliencia/index.html
[ERR] instituto_resiliencia@15-15-15.social | Failed: Unreachable mail address: instituto_resiliencia@15-15-15.social: Invalid: Email doesn't exist or is syntactically incorrect
degrowth/idn-website#23

This is a special case, since the string that is recognised is only used as the label for a hyperlink to https://15-15-15.social/@instituto_resiliencia. The link clearly does not point at a mailto: URI.
This is because of a design choice made in how Mastodon addresses are displayed. The @ is shown directly before of the string that is recognised as an email address, but not part of the link anchor.

<p>Mastodon: @<a href=[https://15-15-15.social/@instituto_resiliencia](view-source:https://15-15-15.social/@instituto_resiliencia) target=_blank>instituto_resiliencia@15-15-15.social</a><br>Twitter: @<a href=[https://twitter.com/ins_resiliencia](view-source:https://twitter.com/ins_resiliencia) target=_blank>ins_resiliencia</a></p>

The HTML in action:

Mastodon: @instituto_resiliencia@15-15-15.socialTwitter: @ins_resiliencia

It appears check-if-email-exists, of which an outdated fork exists at github.com/lycheeverse/check-if-email-exists, which has fallen back considerably behind github.com/reacherhq/check-if-email-exists, does not recognise that the link points some place else. Eventually by grepping the whole file for a regular expression matching an email pattern, not considering the semantics of the HTML.
What would be the best way to proceed from here?

Duplicate issue #1399: a.textContent is checked even if the text is shortened for the link
Created: 2024-04-04T20:47:42Z
Is there a way to skip the check of textContent for the a tag?
<a href="https://example.com/foo/1231241243124124124">https://example.com/foo/...</a>
Originally posted by @MichaIng in #259 (comment)

While checking our forum for outdated links, I recognised that also shortened URL text within anchor tags is checked. phpBB shortens long URLs. so that such an element is produced:
<a href="https://example.com/loong/looong/url/that/is/shorteneed/index.html" class="postlink">https://example.com/loong/looong/url/th ... index.html</a>

lychee now checks the URL itself but as well the text, where it identifies https://example.com/loong/looong/url/th as URL, which of course fails.
So once a basic functionality exists to exclude URLs/text based on HTML tags, the text content of tags/elements which have an explicit src/href/... attribute could be excluded by default, as AFAIK such shortening is quite common.

Closing comment (2025-05-02T15:33:33Z): Did some investigation. This is indeed related to #1462 and according to my testing the bug reported in this issue was fixed with the relating PR #1528.
#1579 however is still not fixed, probably because the PR only affected HTML but not Markdown. This also means that "verbatim" currently has a different meaning for Markdown and HTML. I will try to fix #1579 and I will also try to make sure that the meaning of "verbatim" is consistent and better documented.