@@ -54,7 +54,10 @@ List of items:
54
54
55
55
``` bash
56
56
npm install @synstack/text
57
+ # or
57
58
yarn add @synstack/text
59
+ # or
60
+ pnpm add @synstack/text
58
61
```
59
62
60
63
## Features
@@ -151,7 +154,7 @@ This is a list of items:
151
154
- You can infer the value type of the extra object by using a type assertion from ` Text.ExtraObject.Infer `
152
155
153
156
``` ts
154
- import { t , tParse , type Text } from " @pairprog /text" ;
157
+ import { t , tParse , type Text } from " @synstack /text" ;
155
158
156
159
// @ts-expect-error - The non-matching extra object will be rejected
157
160
const textFail: Text .String <{ type: " extra" ; value: string }> =
@@ -164,3 +167,46 @@ const text: string & { __extra: { type: "extra"; value: string } } =
164
167
console .log (tParse (text ));
165
168
// ["Hello ", { type: "extra", value: "Hello" }, " World"]
166
169
```
170
+
171
+ ### Configuration Options
172
+
173
+ You can configure text processing behavior using ` Text.options() ` :
174
+
175
+ ``` ts
176
+ import { Text } from " @synstack/text" ;
177
+
178
+ // Custom join string for arrays
179
+ const customText = Text .options ({ joinString: " | " });
180
+ const result = customText .t ` Items: ${[" A" , " B" , " C" ]} ` ;
181
+ // "Items: A | B | C"
182
+
183
+ // Chain options
184
+ const text = Text .options ()
185
+ .options ({ joinString: " , " })
186
+ .t ` List: ${[" item1" , " item2" ]} ` ;
187
+ // "List: item1, item2"
188
+ ```
189
+
190
+
191
+ ## API Reference
192
+
193
+ ### Core Functions
194
+
195
+ - ** ` t ` ** - Main templating function for creating formatted text
196
+ - ** ` tParse ` ** - Parse text with extra objects back into components
197
+
198
+ ### Classes & Types
199
+
200
+ - ** ` Text ` ** - Main text processing class with configurable options
201
+ - ** ` Text.Options ` ** - Configuration options interface
202
+ - ** ` Text.String<T> ` ** - String type with extra object information
203
+ - ** ` Text.ExtraObject.Base ` ** - Base type for extra objects
204
+ - ** ` TextParseExtraItemException ` ** - Exception thrown during parsing errors
205
+
206
+ ### Configuration
207
+
208
+ ``` ts
209
+ type Text .Options = {
210
+ joinString? : string ; // Default: "\n"
211
+ }
212
+ ` ` `
0 commit comments