[PR #32293] fix: preserve plain‑text line breaks in Human Input email templates #33656

Closed
opened 2026-02-21 20:53:40 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/32293

State: closed
Merged: No


Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

Fixes #32292

Fixes newline rendering in Human Input email templates by converting plain-text \n into <br> when the body does not already contain HTML. Adds unit tests to cover newline conversion and HTML-preservation behavior.

Fixes #TBD

Screenshots

Before

image

After

image

This change won't affect rendering of proper html formats, as shown below:

image image

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran make lint and make type-check (backend) and cd web && npx lint-staged (frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/32293 **State:** closed **Merged:** No --- > [!IMPORTANT] > > 1. Make sure you have read our contribution guidelines > 1. Ensure there is an associated issue and you have been assigned to it > 1. Use the correct syntax to link this PR: `Fixes #<issue number>`. ## Summary Fixes #32292 Fixes newline rendering in Human Input email templates by converting plain-text `\n` into `<br>` when the body does not already contain HTML. Adds unit tests to cover newline conversion and HTML-preservation behavior. Fixes #TBD ## Screenshots ### Before <img width="1702" height="568" alt="image" src="https://github.com/user-attachments/assets/46b8bec6-7a04-4b88-b2dd-839a9927186b" /> ### After <img width="868" height="426" alt="image" src="https://github.com/user-attachments/assets/05baea02-333a-49d2-b875-5c849013a609" /> ### This change won't affect rendering of proper html formats, as shown below: <img width="1206" height="458" alt="image" src="https://github.com/user-attachments/assets/7d25c4a4-3919-4b46-8c00-fd7936fc74db" /> <img width="798" height="366" alt="image" src="https://github.com/user-attachments/assets/8c82fcdf-00f0-48ce-bf7c-50a7e7097542" /> ## Checklist - [ ] This change requires a documentation update, included: Dify Document - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [ ] I've updated the documentation accordingly. - [ ] I ran `make lint` and `make type-check` (backend) and `cd web && npx lint-staged` (frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:53:40 -05:00
yindo closed this issue 2026-02-21 20:53:40 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#33656