Overview
Text filter to automatically improve typography of your content. It relies on the JoliTypo PHP library.
How to use
As a filter in editor
- Go to your text filters configuration page (
admin/config/content/formats); - Edit or create a filter, check the "Improve typography" filter;
- Enable necessary filter types and save the configuration.
As a service
To process HTML content:
// Parameters: only $content is required, other parameters have default values.
$content = '<div>Some <p>text</p></div>';
$rules = ['CurlyQuote', 'Dash'];
$locale = 'en';
$protected_tags = '<p>';
// Process.
$result = \Drupal::service('typography_filter.manager')->fix($content, $rules, $locale, $protected_tags);To process non-HTML content:
// Parameters: only $content is required, $rules parameter has default value.
$content = 'Some text';
$rules = ['CurlyQuote', 'Dash'];
// Process.
$result = \Drupal::service('typography_filter.manager')->fixString($content, $rules);Supporting organizations:
paid contribution time (up to version 8.x-1.0)
Project information
- Project categories: Content editing experience
23 sites report using this module
- Created by duaelfr on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.


