Skip to content

Fix plain-text email formatting - #151

Open
ivankuznetsov wants to merge 2 commits into
basecamp:mainfrom
ivankuznetsov:fix/plain-text-message-formatting
Open

Fix plain-text email formatting#151
ivankuznetsov wants to merge 2 commits into
basecamp:mainfrom
ivankuznetsov:fix/plain-text-message-formatting

Conversation

@ivankuznetsov

@ivankuznetsov ivankuznetsov commented Jul 30, 2026

Copy link
Copy Markdown

Summary

Plain-text messages sent through hey compose and hey reply currently appear as one collapsed paragraph in HEY, even when their input contains blank lines. This change converts ordinary text into escaped HEY-compatible HTML so paragraph and line-break formatting survives rendering, while --raw-html keeps an explicit path for callers that already provide Action Text markup.

The behavior was reproduced with a self-email in HEY’s mobile UI, then validated end to end with a patched binary: ordinary plain-text input rendered as separate paragraphs and preserved line breaks.

Validation

  • make check
  • Live self-email through the patched CLI
  • Unit coverage for paragraphs, CRLF normalization, HTML escaping, raw HTML, and surrounding whitespace

Summary by cubic

Fixes collapsed paragraphs in plain-text emails by converting input to HEY-compatible HTML so line breaks and blank lines render in hey compose and hey reply. Adds --raw-html for preformatted HTML and rejects empty or whitespace-only bodies.

  • Bug Fixes

    • Convert plain text to escaped HTML with paragraph and line-break markup; normalize CRLF and trim.
    • Revalidate after formatting and reject empty/whitespace-only content, including with --raw-html.
  • New Features

    • Add --raw-html to hey compose and hey reply to bypass formatting when sending HEY-compatible HTML.

Written for commit 59a1bfa. Summary will update on new commits.

Review in cubic

Copilot AI review requested due to automatic review settings July 30, 2026 17:46
@github-actions github-actions Bot added the bug Something isn't working label Jul 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes HEY’s collapsed formatting for plain-text bodies sent via hey compose and hey reply by converting plain text into escaped, HEY-compatible HTML (paragraphs + line breaks), while adding a --raw-html escape hatch for callers who already supply Action Text/HTML.

Changes:

  • Add formatMessageContent helper to normalize newlines, trim, escape HTML, and wrap paragraphs/line breaks for HEY rendering.
  • Wire formatting into both compose and reply, and add a --raw-html flag to bypass formatting.
  • Add unit tests for the formatter and update the CLI surface snapshot to include the new flags.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
internal/cmd/message_format.go Introduces plain-text → HEY-compatible HTML formatting helper.
internal/cmd/message_format_test.go Adds unit coverage for paragraph splitting, newline normalization, escaping, raw HTML passthrough, and trimming.
internal/cmd/compose.go Adds --raw-html flag and applies message formatting before send.
internal/cmd/reply.go Adds --raw-html flag and applies message formatting before sending replies.
.surface Updates surface baseline to include the new flags.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/cmd/message_format.go
Comment thread internal/cmd/compose.go
Comment thread internal/cmd/reply.go
- Reject whitespace-only raw HTML content\n- Revalidate formatted compose and reply messages before sending
Copilot AI review requested due to automatic review settings July 30, 2026 18:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants