@010101 are u actually working on hashtag extension? just to know if i can work on other things
and i also want to peek at your code to see how u implement this
@010101 are u actually working on hashtag extension? just to know if i can work on other things
and i also want to peek at your code to see how u implement this
I think it will be something great, I appreciate your work THANK you waiting for this !? !
Justoverclock You may work on this if you'd like. I think you already have a better idea of how to do it. The regular expression that seems to work well is within the JS here:
But, if you don't get to it I'll give it a shot one of these days.
010101 yes i'm trying to find a way to inspect all posts safely, and then we can use this instead:
https://regex101.com/r/9lIA2s/1
if u know how to access to post, we can do it
i do not want to use innerHTML
This regex won't convert other languages. That's also an issue I ran into in the past. You'll notice my codepen above will convert any language. This was another tricky part.
010101 true, i was looking at your pen, and is definitely better.
but have u an idea to access to post safely?
Justoverclock I thought your glossary extension inspects the posts and I noticed you use regex in it. Something like that won't work?
That's what I was going to start with. Fork that extension and start picking it apart.
010101 ok i still wait for your result
Justoverclock Looks like I won't be able to do it that way. Your keywords extension doesn't work with all languages and it doesn't work if you add formatting to words. I tried adjusting the regular expression but wasn't successful.
These are all things I ran into with my original hashtags extension. I would spend hours just researching the regular expression. I would get it working. Then someone would say it conflicted with another extension. I would fix that conflict, then someone said innerHTML is bad.
I don't really want to spend all weekend on this which is probably what I would end up doing. And so, I'm not worrying about a hashtag extension right now. You're welcome to give it a shot, but remember it should:
I bet one of the core devs could do this somewhat quickly. I'm not sure why a group like fof never put out a proper hashtagging extension.
Another approach I've thought about but haven't tried would be to use the core mentions extension. It already is able to real-time detect "@"... I bet someone could change it to detect "#" instead (plus a ton of other changes would be needed but, it's a start).
bring back reflar/level ranks
You also may want to wait because I read there may be a taxonomy extension coming. Maybe not the same as hashtagging, but similar.
Ok i will try something 010101 what u have tried so far, just to know code that doesn’t work
Justoverclock I tried playing around with the regex(s). I was trying to first keep everything as-is, but make it detect "#". Currently only letters are detected.
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
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:
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).
Justoverclock Also, how are you with PHP? Maybe doing this the PHP way would be better.
https://www.quora.com/How-do-I-create-a-hashtag-system-with-PHP
https://stackoverflow.com/questions/22202443/php-converting-plain-text-to-hashtag-link
I don’t love the RegEx in these examples because they won’t work with all languages. But, it’s another start to doing this a different way.