diff --git a/x.js b/x.js index 302981e..f238337 100644 --- a/x.js +++ b/x.js @@ -246,7 +246,7 @@ function formatCommitMessage(payload) { let filesList = ''; if (allAdded.size > 0) { - filesList += `\nāž• *Added (${allAdded.size}):*\n`; + filesList += `\nāž• *Added \\(${allAdded.size}\\):*\n`; Array.from(allAdded).slice(0, 10).forEach(file => { filesList += ` • \`${escapeInlineCode(file)}\`\n`; }); @@ -256,7 +256,7 @@ function formatCommitMessage(payload) { } if (allModified.size > 0) { - filesList += `\nšŸ“ *Modified (${allModified.size}):*\n`; + filesList += `\nšŸ“ *Modified \\(${allModified.size}\\):*\n`; Array.from(allModified).slice(0, 10).forEach(file => { filesList += ` • \`${escapeInlineCode(file)}\`\n`; }); @@ -266,7 +266,7 @@ function formatCommitMessage(payload) { } if (allRemoved.size > 0) { - filesList += `\nāŒ *Removed (${allRemoved.size}):*\n`; + filesList += `\nāŒ *Removed \\(${allRemoved.size}\\):*\n`; Array.from(allRemoved).slice(0, 10).forEach(file => { filesList += ` • \`${escapeInlineCode(file)}\`\n`; }); @@ -284,13 +284,15 @@ function formatCommitMessage(payload) { // Escape heading line content and link text/url appropriately const repoEsc = escapeMdV2(repo); - const heading = `šŸš€ *${repoEsc}* - ${totalCommits} ${commitWord} pushed`; + // Use en dash and keep the rest escaped via escapeMdV2 for safety + const heading = `šŸš€ *${repoEsc}* – ${totalCommits} ${commitWord} pushed`; let compare = ''; if (payload.compare_url) { + // Safer to avoid Markdown link syntax; print escaped text and URL const linkText = escapeMdV2('Compare Changes'); const linkUrl = escapeMdV2(payload.compare_url); - compare = `[${linkText}](${linkUrl})`; + compare = `${linkText}: ${linkUrl}`; } // Try to append a German executive summary of the most recent commit. @@ -308,10 +310,11 @@ function formatCommitMessage(payload) { // already logged inside summarizer; keep silent here } + // Ensure each section starts on its own line; compare may be plain URL text. return `${heading} - ${commitsText} - ${filesList} - ${compare}${summaryBlock}`; +${commitsText} +${filesList} +${compare ? `\n${compare}` : ''}${summaryBlock}`; })(); }