Skip to content

Commit 6bf2431

Browse files
committed
feat: fix issues with the font
1 parent 3d51ffd commit 6bf2431

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

src/commands/fork.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ export default async function (msg: Message) {
1414

1515
const text = `
1616
\`Canis for WhatsApp\`
17-
mrepol742/project-canis
17+
https://github.com/mrepol742/project-canis
1818
1919
\`Canis for Telegram\`
20-
mrepol742/project-canis-ts
20+
https://github.com/mrepol742/project-canis-ts
2121
2222
This bot is not affiliated, endorsed, partner, or connected to Meta.
2323
Use it at your own RISK.

src/components/utils/font.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,25 +64,24 @@ const mathSansMap: Record<string, string> = {
6464
};
6565

6666
export default function (text: string) {
67-
// Regex to match URLs
6867
const urlRegex = /(https?:\/\/[^\s]+|www\.[^\s]+)/g;
6968
let result = "";
7069
let lastIndex = 0;
7170

72-
// Find all URLs and skip conversion for them
73-
text.replace(urlRegex, (url, index) => {
74-
// Convert text before URL
71+
for (const match of text.matchAll(urlRegex)) {
72+
const url = match[0];
73+
const index = match.index!;
74+
7575
for (let i = lastIndex; i < index; i++) {
7676
const char = text[i];
7777
result += mathSansMap[char] || char;
7878
}
79-
// Add URL as is
79+
8080
result += url;
81+
8182
lastIndex = index + url.length;
82-
return url;
83-
});
83+
}
8484

85-
// Convert remaining text after last URL
8685
for (let i = lastIndex; i < text.length; i++) {
8786
const char = text[i];
8887
result += mathSansMap[char] || char;

0 commit comments

Comments
 (0)