|
1 | 1 | # Typography Rules for Laravel |
2 | 2 |
|
3 | | -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. |
| 3 | +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-breaking 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. |
4 | 4 |
|
5 | 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. |
6 | 6 |
|
@@ -46,7 +46,7 @@ Using `Stringable` instances, you can chain `typography` with other helper metho |
46 | 46 |
|
47 | 47 | | Key | Usage | Description | |
48 | 48 | |:------------------------- |:--------------------------------------------------- |:--------------------------------------------------------------------------------------------- | |
49 | | -| `unbreakable-punctuation` | Remove unwanted line breaks in front of punctuation | Replaces ` !`, ` ?`, ` :`, ` ;` with ` !`, ` ?`, ` :`, ` ;` respectively. | |
| 49 | +| `non-breaking-punctuation` | Remove unwanted line breaks in front of punctuation | Replaces ` !`, ` ?`, ` :`, ` ;` with ` !`, ` ?`, ` :`, ` ;` respectively. | |
50 | 50 | | `hellip` | Use the correct "horizontal ellipsis" HTML entity | Replaces `…`, `…`, `...`, `…` with `…`. | |
51 | 51 |
|
52 | 52 | ## Registering & removing typographic rules |
@@ -75,14 +75,14 @@ Call a single or a few specific rules: |
75 | 75 |
|
76 | 76 | ```blade |
77 | 77 | <div>{!! str($text)->typography(only: 'hellip') !!}</div> |
78 | | -<div>{!! str($text)->typography(only: ['hellip', 'unbreakable-punctuation']) !!}</div> |
| 78 | +<div>{!! str($text)->typography(only: ['hellip', 'non-breaking-punctuation']) !!}</div> |
79 | 79 | ``` |
80 | 80 |
|
81 | 81 | Call all rules except a single or a few specific unwanted rules: |
82 | 82 |
|
83 | 83 | ```blade |
84 | 84 | <div>{!! str($text)->typography(except: 'hellip') !!}</div> |
85 | | -<div>{!! str($text)->typography(except: ['hellip', 'unbreakable-punctuation']) !!}</div> |
| 85 | +<div>{!! str($text)->typography(except: ['hellip', 'non-breaking-punctuation']) !!}</div> |
86 | 86 | ``` |
87 | 87 |
|
88 | 88 | --- |
|
0 commit comments