Skip to content

Commit b3ca29b

Browse files
committed
fix(src/index.ts): escape square brackets in display name
1 parent b3d94e6 commit b3ca29b

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,11 +456,12 @@ export const plugin: Plugin = async (ctx) => {
456456
? formatProjectName(_projectName)
457457
: projectName;
458458

459+
const escapedName = displayName.replace(/\[/g, "\\[").replace(/\]/g, "\\]");
459460
if (totalMins !== null) {
460461
const totalFormatted = formatMinutes(totalMins);
461-
return `Today's coding time for ${displayName}:\n\`\`\`\n ${projectFormatted} (Total across all projects: ${totalFormatted})\n\`\`\``;
462+
return `Today's coding time for ${escapedName}: ${projectFormatted} (Total across all projects: ${totalFormatted})`;
462463
}
463-
return `Today's coding time for ${displayName}:\n\`\`\`\n ${projectFormatted}\n\`\`\``;
464+
return `Today's coding time for ${escapedName}: ${projectFormatted}`;
464465
}
465466

466467
// Default: total coding time (original behavior)

0 commit comments

Comments
 (0)