@@ -3,8 +3,8 @@ import { regex } from '../regex.js'
33import { template } from '../template.js'
44import { url } from '../url.js'
55
6- export const usernameCompact : GitHubLinkifyTransformer = ( text : string , repo : string ) => {
7- const replacer = ( value , item ) => value . replace ( item [ 0 ] , template ( 'username ' , item [ 1 ] ) )
6+ export const mentionCompact : GitHubLinkifyTransformer = ( text : string , repo : string ) => {
7+ const replacer = ( value , item ) => value . replace ( item [ 0 ] , template ( 'mention ' , item [ 1 ] ) )
88
99 text = regex ( text , / < \s * a .+ @ ( [ a - z A - Z ] [ \w \d \- _ ] * ) .+ < \/ \s * a \s * > / g, replacer )
1010 text = regex ( text , / \[ [ \s ` @ ] * [ \w \d \- ] + [ \s ` ] * ] \( h t t p s : \/ \/ g i t h u b \. c o m \/ ( [ \w \d \- ] + ) \/ ? \) / g, replacer )
@@ -13,10 +13,10 @@ export const usernameCompact: GitHubLinkifyTransformer = (text: string, repo: st
1313 return text
1414}
1515
16- export const usernameExpand : GitHubLinkifyTransformer = ( text : string , repo : string ) => {
16+ export const mentionExpand : GitHubLinkifyTransformer = ( text : string , repo : string ) => {
1717 const replacer = ( value , item ) => value . replace ( item [ 0 ] , url ( repo , `@${ item [ 1 ] } ` , item [ 1 ] ) )
1818
19- text = regex ( text , / : : u s e r n a m e : : ( [ \w \d \- _ ] + ) : : / g, replacer )
19+ text = regex ( text , / : : m e n t i o n : : ( [ \w \d \- _ ] + ) : : / g, replacer )
2020
2121 return text
2222}
0 commit comments