colinwalker
colinwalker
Sometimes I feel quite clever only for it to be demonstrated how I might have been overthinking things. Smokey recently produced a function to automatically convert @-mentions to clickable links for micro.blog users. His regex pattern is simple and works. He takes a different... colinwalker.blog
|
Embed
Progress spinner
colinwalker
colinwalker

@PhoneBoy Indeed, it’s just surprising how doing the same thing at different points requires something totally different.

|
Embed
Progress spinner
colinwalker
colinwalker

@PhoneBoy I’ll put both variants up on GitHub later when I get home.

|
Embed
Progress spinner
smokey
smokey

@colinwalker Your regex is certainly more comprehensive than mine ;-) There are several edge-cases mine doesn't handle (most notably adjacent to HTML markup). I think it's neat how you can have your hashtags only linked on your site (where they make sense). But mostly I like how we're all sharing helpful code snippets and learning from each other here 👍

|
Embed
Progress spinner
In reply to
colinwalker
colinwalker

@smokey I tried yours against a test post I have in draft and it worked perfectly. The difference between save and display requirements is crazy.

|
Embed
Progress spinner
smokey
smokey

@colinwalker Wow, crazy indeed!

|
Embed
Progress spinner