Skip to content

Commit 4b57338

Browse files
committed
Updated README
1 parent 9b2e86c commit 4b57338

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
Rendering strings provided by users can result in unexpected typographic results. For instance, in most latin languages (such as french) it is recommended to add a non-breakable space in front of, amongst others, exclamation or question marks (`!` and `?`). Most users will probably just type a regular space, which could result in an unwanted line break just before these punctuation marks.
44

5-
This simple package provides a `typography` macro to Laravel's `Str` facade and `Stringable` instances (created using `Str::of()` or `str()`) that will take care of these typographic details.
5+
This simple package provides a `typography` macro for Laravel's `Str` facade and `Stringable` instances (created using `Str::of()` or `str()`) that will take care of these typographic details.
66

7-
It is also possible to enhance the package by adding your own typographic rules.
7+
It is also possible to enhance this package by adding your own typographic rules.
88

99
```php
1010
$content = 'Mama mia !';
@@ -23,25 +23,29 @@ composer require whitecube/laravel-string-typography
2323

2424
## Getting started
2525

26-
The package's ServiceProvider and therefore its `typography` macro will automatically be registered upon installation so you can start using it right away:
26+
The package's ServiceProvider and therefore its `typography` macro will automatically be registered upon installation. You can start using it right away:
2727

2828
```blade
29-
<!-- Using the Str facade -->
29+
{{-- Using the "Str" facade --}}
3030
<h1>{!! Str::typography($title) !!}</h1>
31-
<!-- Using the str() helper method -->
31+
32+
{{-- Using the "str()" helper --}}
3233
<p>{!! str($paragraph)->typography() !!}</p>
3334
```
3435

35-
Using `Stringable` instances, you can chain the `typography` method with other helpers:
36+
Using `Stringable` instances, you can chain `typography` with other helper methods:
3637

3738
```blade
3839
<div>{!! str($text)->markdown()->typography() !!}</div>
3940
```
4041

42+
> [!NOTE]
43+
> Since the transformed strings contain HTML entities (such as `&nbsp;`), don't forget to render them using `{!! !!}` instead of `{{ }}` in your Blade templates.
44+
4145
## Default typographic rules
4246

4347
| Key | Usage | Description |
44-
| ------------------------- | --------------------------------------------------- | --------------------------------------------------------------------------------------------- |
48+
|:------------------------- |:--------------------------------------------------- |:--------------------------------------------------------------------------------------------- |
4549
| `unbreakable-punctuation` | Remove unwanted line breaks in front of punctuation | Replaces ` !`, ` ?`, ` :`, ` ;` with `&nbsp;!`, `&nbsp;?`, `&nbsp;:`, `&nbsp;;` respectively. |
4650
| `hellip` | Use the correct "horizontal ellipsis" HTML entity | Replaces `&#8230;`, `&#x2026;`, `...`, `` with `&hellip;`. |
4751

0 commit comments

Comments
 (0)