• Dev
  • bring back hashtag to life?

010101 actually i have a working solution, but now i need help to adjust the pattern...

actually i'm about to become mad 😆

with regex we are able to exclude url with a negative lookaheads in the pattern that exclude http, https, www [url] and bbcode....but i cannot find the right pattern

if you or someone else have an idea...feel free to save me from the die 😆

    010101 I'm not sure why a group like fof never put out a proper hashtagging extension

    Because fof isn't really about feature or extension development. It's about extension survival and that's already a massive burden to the few people committing time to this groups purpose.

      luceos True. But, I said a group like fof. I was just commenting on the fact that talented developers are creating all kinds of cool new extensions all the time but I’m surprised no one has done certain ones such as hashtagging or og link preview cards. Both must be very difficult to make or the developers just aren’t interested. Either way is fine. I know it’s really time consuming. It takes me like two days just to figure out something basic. 😰

      Justoverclock I don’t know if it’ll work. It probably depends on how you did the RegEx. But, I did this in the original extension. Everything in the codepen regular expression (see above) before the “#” does nothing but attempts to ensure html, BBcode, markdown, and similar things are ignored.

      .replace(/((?!([\S]))[\S\s])#(\p{L}+)/gu,' <a href="'+siteURL+'?q=$3" class="hashlink" title="Find more posts tagged with $3">#$3</a>');

      See the part with ?! and the three \s... that’s to make sure if a hashtag is preceded by markdown or html it is ignored. Which means you couldn’t do formatted hashtags. But, this way it’s less likely to conflict with something (maybe). 😒

        well, i think i will abandon this extension, since i can't find help on few things:

        • exclude html tag (i have a solution that works partially)
        • remove '#' from the output link.

        so, feel free to ping me if someone find a solution 🙂

        https://github.com/justoverclockl/flarum-ext-hashtag/blob/main/js/src/forum/ReplaceHashTag.js

        i've lost my battle today 😆

        010101 if u want to spend some time on it i can send u an invite as collaborator (two brain is better than one 😆 )

          Justoverclock I don’t know when I’ll have time. I’m trying to take a bit of a break because once I start trying to code a Flarum extension, I have this problem where I won’t stop until I figure it out, or I fall asleep. ☺️ My family gets a little tired of me spending too much time on my laptop. 🤓🤪

          Did you try my RegEx exactly as-is or with slight modifications?

          Because my old hashtags extension with that RegEx was working fairly well. I got it to the point where it had very little conflicts with other things. But, it didn’t work for some reason with the rich text extension. But, I don’t think that had to do with the RegEx, it was more the way it was coded (innerHTML).

          010101 i have php basic knowledge, but my code actually works fine, need only some tweak to ignore url (i can't find the right way to do that)

            edit: found a solution for link output...now remain just one thing.....

            the regex....and we have hashtag extension again....
            010101 the regex that u have found not work at all

            but i've invented a new kind of link 😆

            the first part work as a complete link(with anchor), the second part could be searched through flarum 😄

            smell like a Nobel 👓

            edit2: i think i've found a solution...need a debug from you guys, i will release this as a beta