Skip to content

Commit ad642d1

Browse files
committed
deal with unused variables
1 parent f6d9757 commit ad642d1

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/utils.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,14 @@ export function convertMarkdownToTelegram(markdown: string): string {
7474

7575
// 1. Fenced code blocks (```...```)
7676
// Matches an optional language (letters only) and then any content until the closing ```
77-
converted = converted.replace(/```(\w+)?\n([\s\S]*?)```/g, (match, lang, code) => {
77+
converted = converted.replace(/```(\w+)?\n([\s\S]*?)```/g, (_match, lang, code) => {
7878
const escapedCode = escapeCode(code);
7979
const formatted = '```' + (lang || '') + '\n' + escapedCode + '```';
8080
return storeReplacement(formatted);
8181
});
8282

8383
// 2. Inline code (`...`)
84-
converted = converted.replace(/`([^`]+)`/g, (match, code) => {
84+
converted = converted.replace(/`([^`]+)`/g, (_match, code) => {
8585
const escapedCode = escapeCode(code);
8686
const formatted = '`' + escapedCode + '`';
8787
return storeReplacement(formatted);
@@ -90,7 +90,7 @@ export function convertMarkdownToTelegram(markdown: string): string {
9090
// 3. Links: [link text](url)
9191
converted = converted.replace(
9292
/$begin:math:display$([^$end:math:display$]+)]$begin:math:text$([^)]+)$end:math:text$/g,
93-
(match, text, url) => {
93+
(_match, text, url) => {
9494
// For link text we escape as plain text.
9595
const formattedText = escapePlainText(text);
9696
const escapedURL = escapeUrl(url);
@@ -101,15 +101,15 @@ export function convertMarkdownToTelegram(markdown: string): string {
101101

102102
// 4. Bold text: standard markdown bold **text**
103103
// Telegram bold is delimited by single asterisks: *text*
104-
converted = converted.replace(/\*\*([^*]+)\*\*/g, (match, content) => {
104+
converted = converted.replace(/\*\*([^*]+)\*\*/g, (_match, content) => {
105105
const formattedContent = escapePlainText(content);
106106
const formatted = `*${formattedContent}*`;
107107
return storeReplacement(formatted);
108108
});
109109

110110
// 5. Strikethrough: standard markdown uses ~~text~~,
111111
// while Telegram uses ~text~
112-
converted = converted.replace(/~~([^~]+)~~/g, (match, content) => {
112+
converted = converted.replace(/~~([^~]+)~~/g, (_match, content) => {
113113
const formattedContent = escapePlainText(content);
114114
const formatted = `~${formattedContent}~`;
115115
return storeReplacement(formatted);
@@ -120,13 +120,13 @@ export function convertMarkdownToTelegram(markdown: string): string {
120120
// In Telegram MarkdownV2 italic must be delimited by underscores.
121121
// Process asterisk-based italic first.
122122
// (Using negative lookbehind/lookahead to avoid matching bold **)
123-
converted = converted.replace(/(?<!\*)\*([^*\n]+)\*(?!\*)/g, (match, content) => {
123+
converted = converted.replace(/(?<!\*)\*([^*\n]+)\*(?!\*)/g, (_match, content) => {
124124
const formattedContent = escapePlainText(content);
125125
const formatted = `_${formattedContent}_`;
126126
return storeReplacement(formatted);
127127
});
128128
// Then underscore-based italic.
129-
converted = converted.replace(/_([^_\n]+)_/g, (match, content) => {
129+
converted = converted.replace(/_([^_\n]+)_/g, (_match, content) => {
130130
const formattedContent = escapePlainText(content);
131131
const formatted = `_${formattedContent}_`;
132132
return storeReplacement(formatted);
@@ -135,7 +135,7 @@ export function convertMarkdownToTelegram(markdown: string): string {
135135
// 7. Headers: Convert markdown headers (lines starting with '#' characters)
136136
// to bold text. This avoids unescaped '#' characters (which crash Telegram)
137137
// by removing them and wrapping the rest of the line in bold markers.
138-
converted = converted.replace(/^(#{1,6})\s*(.*)$/gm, (match, hashes, headerContent: string) => {
138+
converted = converted.replace(/^(#{1,6})\s*(.*)$/gm, (_match, _hashes, headerContent: string) => {
139139
// Remove any trailing whitespace and escape the header text.
140140
const formatted = `*${escapePlainText(headerContent.trim())}*`;
141141
return storeReplacement(formatted);

0 commit comments

Comments
 (0)