Drupal is a registered trademark of Dries Buytaert

strippfilter

78 sites Security covered
View on drupal.org

Strip paragraph tags from a text format that otherwise requires them.

Features

This module provides an input filter that strips opening and closing paragraph tags (<p> and </p>) so that you can designate a text format for producing inline WYSIWYG-edited output.

For instance, you can make a three-part caption that will be rigidly formatted as a bold title followed by a caption that allows interior bold or italics but no paragraph breaks flowing into a credit that is always italicized and muted. The content editor can edit each part with CKEditor 5, but rather than being stuck with the paragraph tags for each section

Installation

Works with Drupal 8, 9, 10, and 11.

composer require 'drupal/strippfilter:^1'

Post-Installation

Go to Administration » Configuration » Content authoring » Text formats and editors (/admin/config/content/formats) and create or edit the format you want to make always-inline by enabling the Strip paragraph tags filter. Make certain this filter runs last.

Then for fields that should use this format, set allowed formats only to this format and in form display set the textarea to be only one or two lines.

Additional Requirements

No non-core requirements. Makes most sense with core CKEditor (CKEditor5), as the main use case is working around their stubborn insistence on forcing paragraph tags. (See github.com/ckeditor/ckeditor5/issues/762 for the stalled progress and alternate approaches.)

Pairs well with Textarea widget for text fields.

Similar projects

Probably plenty and they probably have more functionality.

Whether it is a bug or not Strip HTML tags filter cannot do this because the content between the tags gets removed too. So if you set it to strip p tags you get blank text, empty strings, back.

Supporting this Module

You can support Agaric's overall contributions to Drupal and a bit beyond by supporting Drutopia at opencollective.com/drutopia. Thanks!!

Community Documentation

Contributions welcome, the issue queue is always a good place to start.

Activity

Total releases
2
First release
May 2025
Latest release
9 months ago
Release cadence
0 days
Stability
100% stable

Releases

Version Type Release date
1.1.0 Stable May 8, 2025
1.0.1 Stable May 8, 2025