elk-zone / elk

A nimble Mastodon web client
https://elk.zone
MIT License
5.53k stars 565 forks source link

Handle backticks in front of URLs #1090

Open ayoayco opened 1 year ago

ayoayco commented 1 year ago

Clear and concise description of the problem

Mastodon accepts backticks on URLs if it is in front of a slash /

This is problematic when the user wants to post a single-line markdown with a URL at the end

Yeah, this is a URL `https://ayco.io/`

... because then Mastodon will create a link node and, if the URL is long, will truncate it

Screenshot 2023-01-13 at 6 07 54 PM

It should be fine if there is no slash / as in the screenshot

Suggested solution

If we want to give the user a single-line markdown with a URL at the end, we might need to check the link node and display the value of the href property.

However there may be a scenario when the typed url is not the same as the href, because when Mastodon formats a URL as a link, it queries this link first and puts the final URL it resolves to into the href prop

I'll try to look for an example (I saw one before 🤣)

Alternative

An alternative will be to report this to Mastodon, if they will consider ignoring backticks in front of slashes in a URL 😔

Additional context

Related discord conversation: https://discord.com/channels/1044887051155292200/1045308117119946784/1063492629007962132

stackblitz[bot] commented 1 year ago

Solve in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.