Skip to content

Post list preview: trim trailing newline in generated excerpt#25349

Open
YuF-9468 wants to merge 1 commit intowordpress-mobile:trunkfrom
YuF-9468:fix-12673-trim-preview-newlines
Open

Post list preview: trim trailing newline in generated excerpt#25349
YuF-9468 wants to merge 1 commit intowordpress-mobile:trunkfrom
YuF-9468:fix-12673-trim-preview-newlines

Conversation

@YuF-9468
Copy link

@YuF-9468 YuF-9468 commented Mar 5, 2026

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

  1. Create or edit a post with multiple paragraph blocks.
  2. Return to the post list.
  3. Verify the preview no longer shows an extra blank trailing line/empty space under the first visible line.

Automated verification

  • Added testThatContentPreviewForDisplayTrimsLeadingAndTrailingNewlines in PostTests.
  • CI should run the updated test suite for this PR.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 5, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gutenberg paragraph shows up as an empty space in Post List

2 participants