Skip to content

Commit 6be4575

Browse files
committed
fix: keep notification header title and event line on separate rows
Rich Markdown collapses single newlines, so repo and Release/PR/push summary rendered on one visual line. Use a blank line between header rows.
1 parent fd63eb0 commit 6be4575

3 files changed

Lines changed: 14 additions & 8 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ GitHub Releases.
88

99
## Unreleased
1010

11-
Use this section for changes that are merged but not released yet.
11+
### Fixed
12+
13+
- **Notification headers keep a line break under the repo name.** Rich Markdown
14+
collapses a single `\n`, so the event line (`Release · …`, commit summary,
15+
PR action) sat on the same visual row as `📦 repo`. Headers now use a blank
16+
line between the title row and the event row.
1217

1318
## v1.1.0-alpha.1 - 2026-07-16
1419

‎internal/notify/format.go‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func GitHubEvent(event Event) string {
7777
}
7878

7979
func TestMessage(repoFullName string) string {
80-
return "<b>" + esc(repoFullName) + "</b>\nTest notification. Branchy can deliver notifications to this chat."
80+
return "<b>" + esc(repoFullName) + "</b>\n\nTest notification. Branchy can deliver notifications to this chat."
8181
}
8282

8383
func eventTitle(eventType string) string {
@@ -111,7 +111,8 @@ func commitEvent(event Event) string {
111111
if event.Branch != "" {
112112
summary += fmt.Sprintf(" · <code>%s</code>", esc(event.Branch))
113113
}
114-
header := fmt.Sprintf("%s <b>%s</b>\n%s", iconCommits, esc(event.RepoFullName), summary)
114+
// Double newline: Rich Markdown collapses single \n into one visual line.
115+
header := fmt.Sprintf("%s <b>%s</b>\n\n%s", iconCommits, esc(event.RepoFullName), summary)
115116

116117
var list []string
117118
used := 0
@@ -142,7 +143,7 @@ func commitEvent(event Event) string {
142143

143144
func pullRequestEvent(event Event) string {
144145
action := humanizePRAction(event)
145-
header := fmt.Sprintf("%s <b>%s</b>\nPull request %s", iconPR, esc(event.RepoFullName), esc(action))
146+
header := fmt.Sprintf("%s <b>%s</b>\n\nPull request %s", iconPR, esc(event.RepoFullName), esc(action))
146147

147148
var meta []string
148149
if title := truncateText(event.Title, maxTitleRunes); title != "" {
@@ -220,7 +221,7 @@ func releaseEvent(event Event) string {
220221
versionLine += " · " + esc(version)
221222
}
222223
}
223-
header := fmt.Sprintf("%s <b>%s</b>\n%s", iconRelease, esc(event.RepoFullName), versionLine)
224+
header := fmt.Sprintf("%s <b>%s</b>\n\n%s", iconRelease, esc(event.RepoFullName), versionLine)
224225

225226
var meta string
226227
if event.Actor != "" {

‎internal/notify/format_test.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func TestGitHubEventFormatsSingleCommit(t *testing.T) {
5151
CommitCount: 1,
5252
})
5353
for _, want := range []string{
54-
iconCommits + " <b>FreshLabDev/branchy</b>",
54+
iconCommits + " <b>FreshLabDev/branchy</b>\n\n1 new commit · <code>main</code>",
5555
"1 new commit · <code>main</code>",
5656
"Pushed by <b>amtiYo</b>",
5757
`<a href="https://github.com/FreshLabDev/branchy/compare/a...b">Compare changes</a>`,
@@ -211,7 +211,7 @@ func TestGitHubEventFormatsPullRequest(t *testing.T) {
211211
Body: "This PR **improves** things.\n\nSee `notify` for details.",
212212
})
213213
for _, want := range []string{
214-
iconPR + " <b>FreshLabDev/branchy</b>",
214+
iconPR + " <b>FreshLabDev/branchy</b>\n\nPull request opened",
215215
"Pull request opened",
216216
"into <code>main</code> · by <b>amtiYo</b>",
217217
`<a href="https://github.com/FreshLabDev/branchy/pull/7">#7 Fix &lt;format&gt; &amp; &#34;escape&#34;</a>`,
@@ -267,7 +267,7 @@ func TestGitHubEventFormatsRelease(t *testing.T) {
267267
"<ins>Underlined bit</ins>",
268268
})
269269
for _, want := range []string{
270-
iconRelease + " <b>FreshLabDev/branchy</b>",
270+
iconRelease + " <b>FreshLabDev/branchy</b>\n\n<b>Pre-release</b>",
271271
`<b>Pre-release</b> · <a href="https://github.com/FreshLabDev/branchy/releases/tag/v0.1.0-alpha.1">v0.1.0-alpha.1 &lt;format&gt; &amp; &#34;escape&#34;</a>`,
272272
"> ## Added",
273273
"> - **Commit notifications** with [compare links](https://github.com/FreshLabDev/branchy/compare/a...b)",

0 commit comments

Comments
 (0)