18 lines
664 B
TypeScript
18 lines
664 B
TypeScript
/**
|
|
* Defines what counts as an @mention, so that the server notifies the same
|
|
* users the chat highlights.
|
|
*
|
|
* @module
|
|
*/
|
|
|
|
/**
|
|
* Matches an @username, with the name as its first group. The `@` must not
|
|
* follow a word character, so an email address mentions no one. Nor may it
|
|
* follow `[` or `(`, which leaves out a Markdown link's text or URL starting
|
|
* with `@`, and also a plain `(@name)`.
|
|
* `notifyMentions` notifies the users it matches, and the chat's
|
|
* `mentionsUser` highlights and chimes by it. `Markdown` links mentions with a
|
|
* looser pattern of its own, on text already parsed.
|
|
*/
|
|
export const MENTION_RE: RegExp = /(?<![[(\w])@(\w+)/g;
|