The text editor often replaces the line breaks with empty paragraphs <p>nbsp;<p>
. Paragraphs with a margin can weaken the look of your website. This module provides a text filter that replaces empty paragraphs, for example <p></p>
or <p> </p>
with <br />
tags.
Remove empty paragraphs
This module also allows you to remove empty paragraphs if you want to delete them completely. This is not recommended because sometimes the editor needs to add an extra space between the text.
Configuration
- Go to 'Text formats and editors' on the page '/admin/config/content/formats'
- Add a new text format or edit an existing one
- In the chosen text format, select the 'Improve line breaks' option
- Change its order on the list
- If you want to completely delete empty paragraphs set checkbox 'Remove empty paragraphs' on the 'Improve line breaks' tab in the 'Filter settings'
- Click on the 'Save configuration' button
Notice: The Improve line breaks filter should be triggered after the 'Convert line breaks into HTML' and 'Correct faulty and chopped off HTML' if these are selected.
This module skip ignore tags (script
, style
, code
, pre
, object
, iframe
) when it replaces or removes unnecessary paragraphs.
Project information
- Module categories: Content Editing Experience, Content Display
- 437 sites report using this module
- Created by Krzysztof Domański on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
Development version: 8.x-1.x-dev updated 13 Dec 2022 at 17:23 UTC