Xyphyn / photon

An opinionated web client for Lemmy to help users discover the fediverse.
https://phtn.app
GNU Affero General Public License v3.0
389 stars 43 forks source link

Feature request: Markdown - Open community links in own instance #386

Closed sevonj closed 4 months ago

sevonj commented 4 months ago

Is your feature request related to a problem? Please describe. This is issue #188 again. I guess some kind of misunderstanding or brain fart occurred as it was supposed to be fixed, but then nothing happened. I can't reopen it, so here's a new one.

Lemmy is littered with community links formatted like this:

[!technology@lemmy.world](https://lemmy.world/c/technology)

Clicking such link leaves photon and opens the url.

The bad markdown isn't just user error; lemmy-ui turns !community@instance into links automatically. I see this a lot in posts, comments, and sidebars.

Describe the solution you'd like Recognize these links and open them in photon.

Describe alternatives you've considered Leaving as is.

Additional context

sevonj commented 4 months ago

Seems that b84492439343433ca7217ecd9fbb3c3d03679e1d got most of them.

There's still some cases the regex doesn't catch:

[!science_memes@mander.xyz](https://mander.xyz/c/science_memes) fails, because of the underscore.

Edit: Looks like underscore is the only missing character.

https://github.com/LemmyNet/lemmy/blob/7321a6300560262ffb87ebbf2b73720b579a81fc/crates/utils/src/utils/validation.rs#L91

sevonj commented 4 months ago

After b75675212fc904c1b1fed798ac69843fe1512073 every link that I could find works.