You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @akhilacubrio, I have issues both for (#175) and against (#245) this behaviour. I'm going to err on leaving it as is (no mentions with .) to match allowed GitHub and Twitter mentions.
As a workaround, you can add mentions with dots yourself with a custom plugin (using the existing mention plugin as a reference):
import{createTokenClass,registerPlugin}from'linkifyjs';constMentionToken=createTokenClass('mention',{isLink: true,toHref(){return'/'+this.toString().slice(1);}});registerPlugin('mention',({ scanner, parser })=>{const{DOT,HYPHEN,SLASH,UNDERSCORE,AT}=scanner.tokens;const{ domain }=scanner.tokens.groups;// @constAt=parser.start.tt(AT);// @// Begin with hyphen (not mention unless contains other characters)constAtHyphen=At.tt(HYPHEN);AtHyphen.tt(HYPHEN,AtHyphen);// Valid mention (not made up entirely of symbols)constMention=At.tt(UNDERSCORE,MentionToken);At.ta(domain,Mention);AtHyphen.tt(UNDERSCORE,Mention);AtHyphen.ta(domain,Mention);// More valid mentionsMention.ta(domain,Mention);Mention.tt(HYPHEN,Mention);Mention.tt(UNDERSCORE,Mention);// Mention with a dividerconstMentionDivider=Mention.tt(SLASH);// Once we get a word token, mentions can start up againMentionDivider.ta(domain,Mention);MentionDivider.tt(UNDERSCORE,Mention);MentionDivider.tt(HYPHEN,Mention);// ADDED: . transitionsconstMentionDot=Mention.tt(DOT);MentionDot.ta(domain,Mention);MentionDot.tt(HYPHEN,Mention);MentionDot.tt(UNDERSCORE,Mention);})
E.g. @dani.winks @ellie.unicorn.klein
The text was updated successfully, but these errors were encountered: