fix(gmail): stop wrapping draft/send HTML body in per-paragraph <p> tags#5479
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview Comments in Reviewed by Cursor Bugbot for commit e3a2a5e. Configure here. |
white-space: pre-wrap has inconsistent email-client support (including Gmail for non-Google accounts per caniemail.com); <br> is the client-agnostic standard for plain-text-to-HTML line breaks.
Greptile SummaryFixes Gmail's "Remove formatting" prompt by replacing the per-paragraph
Confidence Score: 5/5Safe to merge — the change is confined to a single utility function and its tests, with no side effects on surrounding logic. The rewrite of plainTextToHtml is minimal and mechanically correct: escapeHtml runs before the newline replacement, so HTML injection from user content is not affected. The new br approach is a well-understood, universally supported HTML email primitive. All related tests pass and cover the key contract. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["plainTextToHtml(body)"] --> B["Normalize line endings"]
B --> C["Escape HTML special chars"]
C --> D["Replace newlines with br tags"]
D --> E["Wrap in bare HTML document"]
E --> F["Return HTML string"]
style A fill:#4A90D9,color:#fff
style E fill:#27AE60,color:#fff
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A["plainTextToHtml(body)"] --> B["Normalize line endings"]
B --> C["Escape HTML special chars"]
C --> D["Replace newlines with br tags"]
D --> E["Wrap in bare HTML document"]
E --> F["Return HTML string"]
style A fill:#4A90D9,color:#fff
style E fill:#27AE60,color:#fff
Reviews (2): Last reviewed commit: "fix(gmail): use <br> instead of CSS whit..." | Re-trigger Greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit e3a2a5e. Configure here.
Summary
plainTextToHtmlwas wrapping each paragraph in<p>tags, which carries default paragraph margins that Gmail flags as "formatting" (requiring the "Remove formatting" button to strip)white-space: pre-wrapblock, which preserves line breaks/blank lines without introducing any margin/stylingType of Change
Testing
Updated unit tests in
apps/sim/tools/gmail/utils.test.ts; full suite passes (5716/5716)Checklist