punctilio 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -85,7 +85,7 @@ Setting aside the benchmark, `punctilio`’s test suite includes 600+ tests at 1
|
|
|
85
85
|
|
|
86
86
|
Other typography libraries either transform plain strings or operate on AST nodes individually (`retext-smartypants` [can’t map changes back to HTML](https://github.com/rehypejs/rehype-retext)). But real HTML has text spanning multiple elements—if you concatenate text from `<em>Wait</em>...`, transform it, then try to split it back, youve lost track of where `</em>` belonged.
|
|
87
87
|
|
|
88
|
-
`punctilio` introduces _separation boundaries_. First, insert a “separator” character (default: `U+E000`) at each element boundary before transforming (like at the start and end of an `<em>`). Every regex allows this character mid-pattern without breaking matches. For example,
|
|
88
|
+
`punctilio` introduces _separation boundaries_. First, insert a “separator” character (default: `U+E000`) at each element boundary before transforming (like at the start and end of an `<em>`). Every regex allows this character mid-pattern without breaking matches. For example, “`.[SEP]..`” still becomes “`…[SEP]`”. `punctilio` validates the output by ensuring the separator count remains the same.
|
|
89
89
|
|
|
90
90
|
```typescript
|
|
91
91
|
import { transform, DEFAULT_SEPARATOR } from 'punctilio'
|
|
@@ -112,7 +112,7 @@ For manual DOM walking or custom transforms, use `transformElement` from `puncti
|
|
|
112
112
|
|
|
113
113
|
## Options
|
|
114
114
|
|
|
115
|
-
`punctilio` doesn't enable all transformations by default. Fractions and degrees tend to match too aggressively (perfectly applying the degree transformation requires semantic meaning). Superscript letters and punctuation ligatures have spotty font support
|
|
115
|
+
`punctilio` doesn't enable all transformations by default. Fractions and degrees tend to match too aggressively (perfectly applying the degree transformation requires semantic meaning). Superscript letters and punctuation ligatures have spotty font support. Furthermore, `ligatures = true` can change the meaning of text by collapsing question and exclamation marks. Non-breaking spaces are also opt-in since they alter whitespace throughout the text.
|
|
116
116
|
|
|
117
117
|
```typescript
|
|
118
118
|
transform(text, {
|