Drupal is a registered trademark of Dries Buytaert
drupal 11.3.8 Update released for Drupal core (11.3.8)! drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! linkit 7.0.14 Minor update available for module linkit (7.0.14). masquerade 8.x-2.2 Minor update available for module masquerade (8.x-2.2). video_embed_field 3.1.0 Minor update available for module video_embed_field (3.1.0). bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). editoria11y 3.0.1 Minor update available for module editoria11y (3.0.1). geofield_map 11.1.9 Minor update available for module geofield_map (11.1.9). domain 3.0.0 Major update available for module domain (3.0.0). ai 1.2.15 Minor update available for module ai (1.2.15). ai 1.3.4 Minor update available for module ai (1.3.4). leaflet 10.4.7 Minor update available for module leaflet (10.4.7).

ai_text_cleaner

1 sites No security coverage
View on drupal.org

AI Text Cleaner

AI Text Cleaner is a small Drupal module that provides a text filter and a Drush command to clean formatting quirks from ChatGPT or other LLM outputs.
It removes hidden or problematic characters, converts non-breaking spaces, normalizes dashes and quotes, converts ellipses, and strips Markdown-style headings and stray asterisks.

Features

  • Text filter plugin that can be enabled on input formats to clean content on save.
  • Options supported:
    • Remove hidden/control characters
    • Convert non-breaking spaces to regular spaces
    • Normalize dashes (hyphen/en dash/em dash) to a standard hyphen
    • Normalize quotes (curly “smart” quotes → straight quotes)
    • Convert ellipses (…) to three periods (...)
    • Remove trailing whitespace
    • Remove stray asterisks and stray list artifacts
    • Strip Markdown-style headings (leading # characters)
  • Drush command ai:text-clean (alias ai-text-clean) to run the cleaner across nodes in bulk.
  • Per-option statistics exported for reporting or CSV-like table output.
  • Analysis mode (dry run) that reports what would change without saving.
  • Ability to limit by content type (bundle), language, and maximum node count.

Dependencies

  • Drupal core (module developed for Drupal 11)
  • PHP 8.1 or newer
  • Optional: Drush (to use the ai:text-clean command)
  • Filter system: integrates with Drupal's core filter subsystem (ensure input formats are configured).

Installation

  1. Place the module in web/modules/custom/ai_text_cleaner.
  2. Enable the module (example using Drush):
drush en ai_text_cleaner -y

To automatically apply the filter, go to Configuration → Text formats and editors, edit the target input format, and enable the "AI Text Cleaner" filter at the desired weight.

Plain-text field cleaning (since v1.1)

A new configuration option allows the module to clean simple text fields (fields without an assigned Text Format) when content is saved. To enable and configure this:

  1. Go to Administration → Configuration → Content → AI Text Cleaner settings (or visit /admin/config/content/ai-text-cleaner).
  2. Enable "Clean plain text fields" and choose which cleaning options to apply to plain text fields.

When enabled, the same cleaning rules that the filter uses for formatted text (remove hidden characters, normalize dashes/quotes/guillemets, convert ellipses, etc.) will be applied to fields that don't have a text format set.

Usage with Drush

Analyze (dry run) all nodes of type article:

drush ai:text-clean --types=article --analysis=TRUE

Apply cleaning and save changes for up to 50 nodes across all languages:

drush ai:text-clean --limit=50 --analysis=FALSE

You can supply multiple content types or languages as comma-separated lists, for example --types=article,page or --languages=en,de.

Activity

Total releases
4
First release
Mar 2026
Latest release
4 weeks ago
Release cadence
7 days
Stability
75% stable

Release Timeline

Releases

Version Type Release date
1.1.0 Stable Apr 4, 2026
1.1.0-rc1 Pre-release Apr 2, 2026
1.0.1 Stable Mar 14, 2026
1.0.0 Stable Mar 14, 2026