Conversation
the HTML code might have line breaks. Fixes: OX-12298
First of all, we drop all line breaks from the original HTML code. These are ignored by any browser on display, so we want to imitate the same behavior. Later, each line will be additionally trimmed, as leading/training spaces in a row would not be displayed by a browser as well. Finally, we cannot just trust if the builder is empty, as code starting with line breaks will trick the check. Fixes: OX-12298
as HTML like `<b>Hello </b> world` is rendered with a single space between Hello and world Fixes: OX-12298
fhaScireum
reviewed
Jan 16, 2026
Fixes: OX-12298
Fixes: OX-12298
jakobvogel
approved these changes
Jan 16, 2026
Member
jakobvogel
left a comment
There was a problem hiding this comment.
Thank you, @idlira!
I would still prefer to do that all via jsoup, particularly the conversion of <p> seems to be strange judging from the tests that require trimming. Also, I would still prefer parameterized tests. But I agree: For now, this is fine.
sabieber
approved these changes
Jan 19, 2026
mkeckmkeck
approved these changes
Jan 19, 2026
Fixes: OX-12298
Extra spaces are dropped later when reduceWhitespace is used Fixes: OX-12298
sabieber
approved these changes
Jan 19, 2026
jakobvogel
reviewed
Jan 19, 2026
| assertEquals( | ||
| "\nLine 1 Line 2 Line 3", | ||
| Strings.cleanup( | ||
| "<p>Line 1\nLine 2\nLine 3</p>", |
Member
There was a problem hiding this comment.
I know, it seems to be legacy behaviour, and we don't need to change this now: But for future extensions, we should consider whether <p>…</p> should really cause a leading newline character in the plain text version. IMHO, this should only be there if there is other content before the <p>
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.
Description
Note in advance:
we should evaluate using jsoup or some lib to perform these kind of operations. But since that required an analysis (impact and feasibility), I just try to improve the current code. There is no real recognition of things like inline vs block elements.
The HTML code might contain line-breaks. These are not considered for display and the actual
brandptags must be use to really display a line-break.In addition, HTML reduces spaces. A string like
"<b>Hello </b> world"is displayed as "Hello world".Additional Notes
Checklist