Skip to content

Commit 0120c4c

Browse files
update regex
1 parent ea19417 commit 0120c4c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

docs/.vitepress/theme/components/Contributors.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ const nonExistent = ref<string[]>([])
3737
const parsedContributors = computed(() => {
3838
if (!body.value || !author.value) return []
3939
40-
const list = [...body.value.matchAll(/(?:^|\s|[^\w@])@([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,38}[a-zA-Z0-9])?)(?!\.[a-z]{2,})\b/g)]
40+
const list = [...body.value.matchAll(/@\[?([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,38}[a-zA-Z0-9])?)\]?/g)]
41+
.filter(match => {
42+
const start = match.index ?? 0
43+
const before = body.value[start - 1] || ''
44+
return !/[a-zA-Z0-9._%+-]/.test(before)
45+
})
4146
.map(match => match[1].trim())
4247
const uncredited = author.value.includes('[bot]')
4348
? notMentioned.value

0 commit comments

Comments
 (0)