soderlind / ps-hyphenate
WordPress plugin that improves wrapping of long compound words with native hyphenation and optional render-time soft hyphen exceptions.
Package info
github.com/soderlind/ps-hyphenate
Type:wordpress-plugin
pkg:composer/soderlind/ps-hyphenate
Requires
- php: >=8.3
- ext-mbstring: *
- org_heigl/hyphenator: ^3.1
- soderlind/wordpress-github-updater: ^2.0
Requires (Dev)
- brain/monkey: ^2.7
- pestphp/pest: ^4.0
README
WordPress plugin that improves text wrapping for long compound words in languages like German, Norwegian, Swedish, and Dutch.
Features
- CSS hyphenation — Enables native browser hyphenation on frontend content.
- Soft hyphen exceptions — Insert explicit break points via an exception dictionary at render time.
- TeX pattern fallback — Automatic hyphenation using
org_heigl/hyphenatordictionaries for 30+ locales (German, Norwegian (Bokmål/Nynorsk), Danish, Dutch, Swedish, Icelandic, English, Spanish, French, Italian, Portuguese, Polish, Czech, Slovak, Slovenian, Hungarian, and many more). - Locale-aware — Prefix exceptions with a locale (e.g.
nb_NO:digitaliserings-organisasjon). - Case-preserving — Matches exceptions case-insensitively but renders with original casing.
- Non-destructive — Processes at render time; saved post content is never modified.
- Block-aware — Filters Gutenberg blocks and classic
the_contentoutput.
Requirements
- PHP 8.3+
- WordPress 6.8+
Installation
- Download
ps-hyphenate.zip - Upload via
Plugins → Add New → Upload Plugin - Activate via
WordPress Admin → Plugins - Configure exceptions via
Settings → PS Hyphenate
Plugin updates are handled automatically via GitHub. No need to manually download and install updates.
Composer:
composer require soderlind/ps-hyphenate
Exception Dictionary
Add entries in Settings → PS Hyphenate → Exception dictionary.
| Format | Example |
|---|---|
| Explicit | Donaudampfschifffahrtsgesellschaft=Donau-dampf-schiff-fahrts-gesellschaft |
| Shorthand | digitaliserings-organisasjon |
| Locale-prefixed | nb_NO:menneske-rettighets-organisasjon |
Hyphens in the replacement mark soft hyphen positions.
Automatic Updates
This plugin supports automatic updates from GitHub releases via soderlind/wordpress-github-updater.
When a new release is published on GitHub, WordPress will detect and offer the update through the standard plugin update mechanism.
Development
composer install
composer test
Tests use Pest with Brain Monkey for WordPress function mocks.
License
GPL-2.0-or-later