Drupal is a registered trademark of Dries Buytaert

nbsp_title

No security coverage
View on drupal.org

The Non-Breaking Space Title module automatically applies language-specific typography rules to your content using client-side JavaScript. It ensures proper spacing around punctuation marks, quotes, and units without modifying your database content, keeping your data clean and portable across different contexts (APIs, exports, search).

Features

  • Multi-language support: Configure different typography rules for each active language on your site
  • Client-side processing: Rules are applied via JavaScript, keeping your database content clean and portable
  • Configurable selectors: Choose which CSS selectors to target (titles, headings, content areas, etc.)
  • Per-language rules: Define regex patterns and replacements tailored to each language's typography conventions
  • Pre-configured rules: Includes default rules for English (em dashes) and French (non-breaking spaces before punctuation, French quotes, units)
  • Dynamic content support: Uses MutationObserver to automatically process content loaded after page load
  • Permission-based access: Dedicated permission for managing typography rules

Use cases:

  • Multi-language sites requiring different typography rules per language
  • Publications that need to maintain clean, portable content in the database
  • Sites that want to enforce typography standards without manual editing

Post-Installation

  1. Enable the module: Install and enable via Drush (drush en nbsp_title) or the Extend page
  2. Clear cache: Run drush cr to register the new permission
  3. Set permissions: Go to /admin/people/permissions and assign the "Administer Non breaking space title" permission to appropriate roles
  4. Configure rules: Navigate to Configuration → User interface → Non breaking space title (/admin/config/regional/nbsp-title)
  5. Configure selectors: Add CSS selectors (one per line) for elements where rules should apply. Default selectors include .node__title, .page-title, h1, h2, h3h4
  6. Add language rules: For each active language, add typography rules with:
    • Description: Explanation of what the rule does
    • Pattern: JavaScript regular expression (e.g., \s+([:\;!\?]))
    • Replacement: Replacement string (e.g.,  $1 - will be converted to Unicode non-breaking space)

The module automatically applies rules based on the current language context

Additional Requirements

  • Drupal: Core 10, or 11
  • No additional libraries required: Uses vanilla JavaScript and Drupal core APIs

This module works standalone but complements:

  • Language modules: Works seamlessly with Drupal's core language and translation systems
  • Content translation: Automatically applies appropriate rules based on content language

Supporting this Module

This module is maintained as part of ongoing Drupal development work. Contributions, bug reports, and feature requests are welcome on the project issue queue.

Community Documentation

  • Issue queue: Report bugs and request features on Drupal.org
  • Examples: See the module's configuration page for pre-configured typography rules for French and English

Activity

Total releases
1
First release
Feb 2026
Latest release
5 days ago
Release cadence
Stability
0% stable

Releases

Version Type Release date
1.0.0-alpha1 Pre-release Feb 27, 2026