Post list preview: trim trailing newline in generated excerpt#25349
Merged
jkmassel merged 3 commits intowordpress-mobile:testing-25349from Apr 8, 2026
Merged
Conversation
jkmassel
requested changes
Mar 6, 2026
Contributor
jkmassel
left a comment
There was a problem hiding this comment.
Thanks for taking a look at this! The implementation looks good, I just left a note about improving one test.
I appreciate the contribution, and I'm excited to get it merged!
Contributor
Author
|
Great call — updated ✅ I changed the test to assert the explicit expected output instead of mirroring implementation details:
Commit: |
jkmassel
approved these changes
Mar 12, 2026
Contributor
jkmassel
left a comment
There was a problem hiding this comment.
Thanks for the contribution!
ead6a8e to
1398920
Compare
|
jkmassel
added a commit
that referenced
this pull request
Apr 8, 2026
The test exercises the excerpt path where leading/trailing newlines survive after collapsing. It will fail until the trimmedForPreview() change from #25349 lands.
e5fa570 to
53f0ea7
Compare
github-merge-queue Bot
pushed a commit
that referenced
this pull request
Apr 8, 2026
* Add failing test and release note for post list preview newline fix * Post list preview: trim trailing newline in generated excerpt (#25349) * Fix post preview to trim leading/trailing newlines * test: assert explicit preview content for newline trim case --------- Co-authored-by: YuF-9468 <150006551+YuF-9468@users.noreply.github.com> Co-authored-by: YuF-9468 <2060563720+YuF-9468@users.noreply.github.com> Co-authored-by: Jeremy Massel <1123407+jkmassel@users.noreply.github.com> --------- Co-authored-by: YuF-9468 <corgiking@163.com> Co-authored-by: YuF-9468 <150006551+YuF-9468@users.noreply.github.com> Co-authored-by: YuF-9468 <2060563720+YuF-9468@users.noreply.github.com>
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
Fixes #12673.
This updates post preview generation to trim leading/trailing whitespace and newlines after extracting/collapsing preview text. It prevents preview labels from rendering a trailing blank line in the post list when content contains paragraph separators.
Testing instructions
Automated verification
testThatContentPreviewForDisplayTrimsLeadingAndTrailingNewlinesinPostTests.