Closed philippkuehn closed 4 years ago
Ah right, makes sense!
the code is currently made specifically for GH, e.g., also to support teams: @foo/bar
.
What do you think, would it make more sense to a) support only twitter, or b) support both?
You made it for GitHub so I would prefer b :)
Another solution would be to give an option to pass a custom regex.
btw I also miss a package for supporting hashtags which would be very similar to this one. But this is out of scope here.
Yah, this project was specifically made for https://github.com/github/opensource.guide, and I’m using it on all our readmes, so typically stuff that renders on GH or like that, so indeed, no twitter handles!
Re b), vaguely worded, but I meant to question whether people would use @foo
and @bar
together, where the former would refer to a GH user, and the latter to a twitter user, which doesn’t make too much sense to me.
I think passing in a new regex makes sense. And a boolean option for whether to support teams?
Wonder if we should make “presets”: pass in 'github'
to get the current regex and teams, pass twitter
to get their regex and no teams.
So then, accept a style
option, defaulting to 'github'
, which could be 'github'
, 'twitter'
, or an object: {name: /\w+/, teams: false}
? Maybe teams
could have a better name.
Do you know what the syntax for twitter handles is?
I'm building a markdown writing app with spell checks etc. So I don't know which kind of mention will may be used. I would love to support just some kind of "generic" mention.
So when adding a style option with 'github'
, 'twitter'
and a regex I have to go with the regex. Maybe we can also allow style: ['github', 'twitter']
but that will make it more complex? Since teams is a GitHub feature I don't think it's useful as an option – it should be part of the GitHub regex.
syntax for twitter handles:
A username can only contain alphanumeric characters (letters A-Z, numbers 0-9) with the exception of underscores, as noted above. Check to make sure your desired username doesn't contain any symbols, dashes, or spaces.
Your username cannot be longer than 15 characters.
So /^[a-z0-9_]{1,15}$/i
can work for twitter!
Since teams is a GitHub feature I don't think it's useful as an option – it should be part of the GitHub regex.
Teams unfortunately can’t be matched with a regex, as /
is not part of a word, hence an extra option:
So, in your writing app, what should happen if someone were to use a GH-style mention of @remarkjs/maintainers
?
Ah okay, makes sense.
So, in your writing app, what should happen if someone were to use a GH-style mention of
@remarkjs/maintainers
?
I want to prevent that retext-spell
finds anything within a mention. So @_philippkuehn
or @remarkjs/maintainers
should’t throw a spell error.
Teams wasn’t needed! Released in 2.1.0. See docs for more info.
great! thank you! 🙌
Since Twitter also allows underscores in the username, it would be nice if this is would also be supported by this package.
@_philippkuehn
(my twitter handle) is not recognized.