markdown-it / linkify-it

Links recognition library with full unicode support
http://markdown-it.github.io/linkify-it/
MIT License
655 stars 63 forks source link

Match link prefix without a whitespace in front? #70

Closed b1acKr0se closed 5 years ago

b1acKr0se commented 6 years ago

First of all, thank you for this awesome library. I'm using it in combination with https://github.com/obipawan/react-native-hyperlink .

I'm having an use case which involves linkify hashtags inside a string. The setup is done by using the add method:

this.linkifyIt.add('#', {
        validate: function (text, pos, self) {
        //doing the validation
     })

Now it works well if there is a space in front of the hashtag, like This is a #hashtag. But in the case there is none, like hashtag#hashtag, the validation function is not even called. Also I need it with special case like this ####hashtag1####hashtag2 to result in #hashtag1 and #hashtag2 being detected, but I have no luck.

What should I do for these cases? Thank you for taking your time to read through this :D

puzrin commented 6 years ago

https://github.com/markdown-it/linkify-it/blob/master/index.js#L257

I guess, that's not possible in current implementation. And that can cause false positives for link ancors.

b1acKr0se commented 5 years ago

@puzrin That's unfortunate, guess I'll have to find another way. Thanks for your response 😄

Liqiankun commented 5 years ago

@b1acKr0se Did you solve this issue?