Fix plain-text email formatting - #151
Open
ivankuznetsov wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
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
formatMessageContenthelper to normalize newlines, trim, escape HTML, and wrap paragraphs/line breaks for HEY rendering. - Wire formatting into both
composeandreply, and add a--raw-htmlflag 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.
- Reject whitespace-only raw HTML content\n- Revalidate formatted compose and reply messages before sending
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Plain-text messages sent through
hey composeandhey replycurrently 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-htmlkeeps 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 checkSummary 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 composeandhey reply. Adds--raw-htmlfor preformatted HTML and rejects empty or whitespace-only bodies.Bug Fixes
--raw-html.New Features
--raw-htmltohey composeandhey replyto bypass formatting when sending HEY-compatible HTML.Written for commit 59a1bfa. Summary will update on new commits.