Skip to content

Inconsistent handling of line breaks in excerpts #15117

@dtweney

Description

@dtweney

Line breaks are handled differently in Gutenberg blocks vs classic blocks
When generating excerpts, Wordpress 5.x strips out the <br> tags in Gutenberg blocks, but it replaces them with a normal space (” “) in Classic blocks.

To reproduce

  1. Create a post in WordPress using the Gutenberg editor.
  2. Type some text in the first block and insert line breaks using Shift-Enter (or
    in the code editor)
  3. Save the post as a draft.
  4. Create a post with the same text using the Classic editor.
  5. Save the post as a draft.
  6. Compare the excerpts using the expanded view in the Wordpress list of all posts. This behavior can also be seen in other places where excerpts are used.

Expected behavior
Line breaks (with <br>) should always be replaced with a normal space (" ") in excerpts.

Screenshots
Compare "This is just to say 1" (classic block) with "This is just to say 2" (Gutenberg "paragraph" block).

Screen Shot 2019-04-22 at 3 43 04 PM

Desktop (please complete the following information):
n/a

Smartphone (please complete the following information):
n/a

Additional context

  • WordPress 5.1
  • Please add the version of Gutenberg you are using in the description.
  • To report a security issue, please visit the WordPress HackerOne program: https://hackerone.com/wordpress.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Backwards CompatibilityIssues or PRs that impact backwards compatability[Feature] Document SettingsDocument settings experience[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions