punctilio 0.4.17 → 0.4.19

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.
Files changed (2) hide show
  1. package/README.md +5 -6
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -23,15 +23,14 @@ As far as I can tell, `punctilio` is the most reliable and feature-complete. I b
23
23
 
24
24
  [^wrote]: While Claude is the number one contributor to this repository, that’s just because Claude has helped me port my existing code and add minor features. The core regular expressions (e.g. dashes, quotes, multiplication signs) are human-written.
25
25
 
26
- I tested `punctilio` 0.4 against [`smartypants`](https://www.npmjs.com/package/smartypants) 0.2.2, [`tipograph`](https://www.npmjs.com/package/tipograph) 0.7.4, and [`smartquotes`](https://www.npmjs.com/package/smartquotes) 2.3.2.[^python] These other packages have spotty feature coverage and inconsistent impact on text. For example, `smartypants` ignores leading apostrophes:
26
+ I tested `punctilio` 0.4 against [`smartypants`](https://www.npmjs.com/package/smartypants) 0.2.2, [`tipograph`](https://www.npmjs.com/package/tipograph) 0.7.4, and [`smartquotes`](https://www.npmjs.com/package/smartquotes) 2.3.2.[^python] These other packages have spotty feature coverage and inconsistent impact on text. For example, `smartypants` mishandles quotes after em dashes (though quite hard to see in GitHub's font) and lacks multiplication sign support.
27
27
 
28
- [^python]: The Python libraries I found were closely related to the JavaScript packages, so I don’t include Python tests.
28
+ [^python]: The Python libraries I found were closely related to the JavaScript packages, so I don’t include Python tests.
29
29
 
30
30
  | Input | `smartypants` | `punctilio` |
31
31
  |:-----:|:-----------------:|:-------:|
32
- | 'Twas the night | ‘Twas the night ✗ | ’Twas the night ✓ |
33
- | the '99 season | the ‘99 season ✗ | the ’99 season ✓ |
34
- | rock 'n' roll | rock ‘n’ roll ✗ | rock ’n’ roll ✓ |
32
+ | She said—"Hi!" | She said—”Hi!” () | She said—“Hi!” () |
33
+ | 5x5 | 5x5 () | 5×5 () |
35
34
 
36
35
  By running [`benchmark.mjs`](./benchmark.mjs), I basically graded all libraries on a subset of [my unit tests](./src/tests/), selected to represent a wide range of features.
37
36
 
@@ -66,7 +65,7 @@ As far as I can tell, `punctilio`’s only missing feature is non-English quote
66
65
 
67
66
  ## Works with HTML DOMs via separation boundaries
68
67
 
69
- 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, you've lost track of where `</em>` belonged.
68
+ Other typography libraries either transform plain strings or operate on AST nodes individually (`retext-smartypants` [cant 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, you've lost track of where `</em>` belonged.
70
69
 
71
70
  `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.
72
71
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "punctilio",
3
- "version": "0.4.17",
3
+ "version": "0.4.19",
4
4
  "description": "Smart typography transformations: curly quotes, em-dashes, en-dashes, and more",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",