feat(transform): transform GitHub and Telegram links

This commit is contained in:
taskylizard 2024-08-05 19:19:30 +00:00
parent a21b3e9e92
commit dc08d06032
No known key found for this signature in database
GPG key ID: 1820131ED1A24120
12 changed files with 39 additions and 13 deletions

View file

@ -368,5 +368,20 @@ function transformLinks(text: string): string {
/\[Discord\]\(([^\)]*?)\)/gm,
'<a target="_blank" href="$1"><div alt="Discord" class="i-carbon:logo-discord" /></a>'
)
// Transform GitHub links to icons
.replace(
/\[GitHub\]\(([^\)]*?)\)/gm,
'<a target="_blank" href="$1"><div alt="GitHub" class="i-carbon:logo-github mb-1" /></a>'
)
// Fallback for GitHub
.replace(
/\[Github\]\(([^\)]*?)\)/gm,
'<a target="_blank" href="$1"><div alt="GitHub" class="i-carbon:logo-github mb-1" /></a>'
)
// Transform Telegram links to icons
.replace(
/\[Telegram\]\(([^\)]*?)\)/gm,
'<a target="_blank" href="$1"><div alt="Telegram" class="i-mdi:telegram" /></a>'
)
return _text
}