liquidpl/blade-no-single-letter-words

Adds a tag to Blade which pushes one character words in paragraphs to the next line.

1.0.0 2020-02-12 11:42 UTC

This package is auto-updated.

Last update: 2025-06-12 20:12:29 UTC


README

A common typography practice in countries such as Poland is to push 1-2 character words that are situated at the end of the line to the next one.

This package adds @nosingleletterwords and @endnosingleletterwords to Blade. Adding them to your template alters the text inside them so that   is appended after said 1-2 character words, so that they'll be always pushed to the next line if they happen to be at the end of a line.

Supported Laravel versions

This package officially supports the currently supported Laravel version, which at the time of this commit are 5.8 and above. However, it should work on the previous versions too.

Installation

# composer require liquidpl/blade-no-single-letter-words

On Laravel 5.4 and below, you need to add the service provider to your configuration files. In your config/app.php file, in the providers array key:

    'providers' => array( // or [
        // ...

        'LiquidPL\BladeNoSingleLetterWords\BladeNoSingleLetterWordsProvider',
    );

Usage

@nosingleletterwords
<p>
    Some text that might look a bit bad from a typographical standpoint.
<p>
@endnosingleletterwords

Results in:

<p>
    Some text that might look a&nbsp;bit bad from a&nbsp;typographical standpoint.
</p>