[backend/libmfm] When converting from HTML, shorten http & -s links with identical text and link components

This commit is contained in:
Laura Hausmann 2024-09-23 01:57:33 +02:00
parent 7cee8513de
commit c3c85419e4
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -34,6 +34,9 @@ internal class HtmlParser(IEnumerable<Note.MentionedUser> mentions)
: $"<plain>{el.TextContent}</plain>";
}
if (el.TextContent == href && (href.StartsWith("http://") || href.StartsWith("https://")))
return href;
return $"[{el.TextContent}]({href})";
}